Repository: cloudstack
Updated Branches:
  refs/heads/4.4-forward 953167808 -> 54c0df56d


CLOUDSTACK-6488 Fixed an issue where the "path" field was not being set 
properly in the DB when the volume had a snapshot taken of it


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

Branch: refs/heads/4.4-forward
Commit: 54c0df56dc03d20ef1d9804d8695c3f6584470f8
Parents: 9531678
Author: Mike Tutkowski <[email protected]>
Authored: Wed Apr 23 10:32:55 2014 -0600
Committer: Mike Tutkowski <[email protected]>
Committed: Wed Apr 23 18:29:22 2014 -0600

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54c0df56/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 e37bf38..fbba322 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
@@ -1169,21 +1169,28 @@ public class VmwareStorageManagerImpl implements 
VmwareStorageManager {
         if (input == null) {
             return null;
         }
+
         String result = input;
-        if (result.endsWith(".vmdk")) { // get rid of vmdk file extension
-            result = result.substring(0, result.length() - (".vmdk").length());
+
+        final String fileType = ".vmdk";
+
+        if (result.endsWith(fileType)) {
+            // get rid of fileType
+            result = result.substring(0, result.length() - 
(fileType).length());
         }
-        if (result.split("-").length == 1) {
+
+        String[] str = result.split("-");
+        int length = str.length;
+
+        if (length == 1 || length == 2) {
             return result;
         }
-        if (result.split("-").length > 2) {
-            return result.split("-")[0] + "-" + result.split("-")[1];
-        }
-        if (result.split("-").length == 2) {
-            return result.split("-")[0];
-        } else {
-            return result;
+
+        if (length > 2) {
+            return str[0] + "-" + str[1];
         }
+
+        return result;
     }
 
     @Override

Reply via email to