cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Tutkowski <>
Subject VMware snapshot question
Date Mon, 06 Jan 2014 23:10:58 GMT

I was wondering about the following code in VmwareStorageManagerImpl. It is
in the CreateVMSnapshotAnswer execute(VmwareHostService hostService,
CreateVMSnapshotCommand cmd) method.

The part I wonder about is in populating the mapNewDisk map. For disks like
the following:

i-2-9-VM/fksjfaklsjdgflajs.vmdk, the key for the map ends up being i-2.

When we call this:

String baseName = extractSnapshotBaseFileName(volumeTO.getPath());

It uses a path such as the following:


There is no i-2-9-VM/ preceding the name, so the key we search on ends up
being the following:


This leads to a newPath being equal to null.

As it turns out, I believe null is actually correct, but - if that's the
case - why do we have all this logic if - in the end - we are just going to
assign null to newPath in every case when creating a VM snapshot for
VMware? As it turns out, null is later interpreted to mean, "don't replace
the path field of this volume in the volumes table," which is, I think,
what we want.


                VirtualDisk[] vdisks = vmMo.getAllDiskDevice();

                for (int i = 0; i < vdisks.length; i ++){

                    List<Pair<String, ManagedObjectReference>> vmdkFiles =
vmMo.getDiskDatastorePathChain(vdisks[i], false);

                    for(Pair<String, ManagedObjectReference> fileItem :
vmdkFiles) {

                        String vmdkName = fileItem.first().split(" ")[1];

                        if (vmdkName.endsWith(".vmdk")){

                            vmdkName = vmdkName.substring(0,
vmdkName.length() - (".vmdk").length());


                        String baseName =

                        mapNewDisk.put(baseName, vmdkName);



                for (VolumeObjectTO volumeTO : volumeTOs) {

                    String baseName =

                    String newPath = mapNewDisk.get(baseName);

                    // get volume's chain size for this VM snapshot,
exclude current volume vdisk

                    DataStoreTO store = volumeTO.getDataStore();

                    long size =
getVMSnapshotChainSize(context,hyperHost,baseName + "*.vmdk",

                            store.getUuid(), newPath);

                    if(volumeTO.getVolumeType()== Volume.Type.ROOT){

                        // add memory snapshot size

                        size = size +





*Mike Tutkowski*
*Senior CloudStack Developer, SolidFire Inc.*
o: 303.746.7302
Advancing the way the world uses the

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message