cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject git commit: updated refs/heads/4.2 to 8b6eeed
Date Mon, 19 Aug 2013 07:30:07 GMT
Updated Branches:
  refs/heads/4.2 b73c44991 -> 8b6eeedaa


fix CLOUDSTACK-3234 modify the logics of retrieving Vmsnapshot volume path


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8b6eeeda
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8b6eeeda
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8b6eeeda

Branch: refs/heads/4.2
Commit: 8b6eeedaaee9106dabcc364132d7422fd7ed1418
Parents: b73c449
Author: Mice Xia <mice_xia@tcloudcomputing.com>
Authored: Mon Aug 19 15:28:51 2013 +0800
Committer: Mice Xia <mice_xia@tcloudcomputing.com>
Committed: Mon Aug 19 15:29:09 2013 +0800

----------------------------------------------------------------------
 .../manager/VmwareStorageManagerImpl.java       | 26 ++++++++++++--------
 1 file changed, 16 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b6eeeda/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
index d2408b3..985b30e 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
@@ -1267,10 +1267,12 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager
{
         if (result.endsWith(".vmdk")){ // get rid of vmdk file extension
             result = result.substring(0, result.length() - (".vmdk").length());
         }
+        if(result.contains("/"))
+            result = result.substring(result.indexOf ("/") + 1,result.length()); // remove
VM name path
+        if(result.contains("ROOT") && result.split("-").length > 1)
+            return "ROOT";
         if(result.split("-").length == 1) // e.g 4da6dcbd412c47b59f96c7ff6dbd7216.vmdk
             return result;
-        if(result.split("-").length > 2) // e.g ROOT-5-4.vmdk, ROOT-5-4-000001.vmdk
-            return result.split("-")[0] + "-" + result.split("-")[1];
         if(result.split("-").length == 2) // e.g 4da6dcbd412c47b59f96c7ff6dbd7216-000001.vmdk
             return result.split("-")[0];
         else
@@ -1324,6 +1326,8 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager
{
                         if (vmdkName.endsWith(".vmdk")){
                             vmdkName = vmdkName.substring(0, vmdkName.length() - (".vmdk").length());
                         }
+                        if(vmdkName.contains("/"))
+                            vmdkName = vmdkName.substring(vmdkName.indexOf ("/") + 1,vmdkName.length());

                         String baseName = extractSnapshotBaseFileName(vmdkName);
                         mapNewDisk.put(baseName, vmdkName);
                     }
@@ -1372,7 +1376,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager
{
             if(vmMo == null)
                 vmMo = hyperHost.findVmOnPeerHyperHost(vmName);
             if (vmMo == null) {
-                String msg = "Unable to find VM for RevertToVMSnapshotCommand";
+                String msg = "Unable to find VM for DeleteVMSnapshotCommand";
                 s_logger.debug(msg);
                 return new DeleteVMSnapshotAnswer(cmd, false, msg);
             } else {
@@ -1396,6 +1400,8 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager
{
                         if (vmdkName.endsWith(".vmdk")) {
                             vmdkName = vmdkName.substring(0, vmdkName.length() - (".vmdk").length());
                         }
+                        if(vmdkName.contains("/"))
+                            vmdkName = vmdkName.substring(vmdkName.indexOf ("/") + 1,vmdkName.length());
                         String baseName = extractSnapshotBaseFileName(vmdkName);
                         mapNewDisk.put(baseName, vmdkName);
                     }
@@ -1474,16 +1480,16 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager
{
                             if (vmdkName.endsWith(".vmdk")) {
                                 vmdkName = vmdkName.substring(0, vmdkName.length() - (".vmdk").length());
                             }
-                            String[] s = vmdkName.split("-");
-                            mapNewDisk.put(s[0], vmdkName);
+                            if(vmdkName.contains("/"))
+                                vmdkName = vmdkName.substring(vmdkName.indexOf ("/") + 1,vmdkName.length());
                           
+                            String baseName = extractSnapshotBaseFileName(vmdkName);
+                            mapNewDisk.put(baseName, vmdkName);
                         }
                     }
-                    String key = null;
                     for (VolumeTO volumeTo : listVolumeTo) {
-                        String parentUUID = volumeTo.getPath();
-                        String[] s = parentUUID.split("-");
-                        key = s[0];
-                        volumeTo.setPath(mapNewDisk.get(key));
+                        String baseName = extractSnapshotBaseFileName(volumeTo.getPath());
+                        String newPath = mapNewDisk.get(baseName);
+                        volumeTo.setPath(newPath);
                     }
                     if (!snapshotMemory) {
                         vmState = VirtualMachine.State.Stopped;


Mime
View raw message