cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject git commit: updated refs/heads/master to bf83efc
Date Fri, 06 Sep 2013 21:48:50 GMT
Updated Branches:
  refs/heads/master 0e695ec7e -> bf83efcf4


CLOUDSTACK-4190:[Object_store_refactor] volume should be deleted from
staging storage after successfule volume migration, specially handle
DeleteVolume command for Vmware volume structure in secondary storage.


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

Branch: refs/heads/master
Commit: bf83efcf4bd2c8ac5aacaf948826331ebb96b993
Parents: 0e695ec
Author: Min Chen <min.chen@citrix.com>
Authored: Fri Sep 6 14:33:34 2013 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Fri Sep 6 14:39:03 2013 -0700

----------------------------------------------------------------------
 .../storage/resource/NfsSecondaryStorageResource.java | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf83efcf/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
----------------------------------------------------------------------
diff --git a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
index cf4369c..3e19b64 100755
--- a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
+++ b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
@@ -1775,7 +1775,15 @@ public class NfsSecondaryStorageResource extends ServerResourceBase
implements S
                 parent += File.separator;
             }
             String absoluteVolumePath = parent + relativeVolumePath;
-            File tmpltParent = new File(absoluteVolumePath).getParentFile();
+            File volPath = new File(absoluteVolumePath);
+            File tmpltParent = null;
+            if (volPath.exists() && volPath.isDirectory()) {
+                // for vmware, absoluteVolumePath represents a directory where volume files
are located.
+                tmpltParent = volPath;
+            } else{
+                // for other hypervisors, the volume .vhd or .qcow2 file path is passed
+                tmpltParent = new File(absoluteVolumePath).getParentFile();
+            }
             String details = null;
             if (!tmpltParent.exists()) {
                 details = "volume parent directory " + tmpltParent.getName() + " doesn't
exist";
@@ -1806,7 +1814,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase
implements S
 
                     if (!f.delete()) {
                         return new Answer(cmd, false, "Unable to delete file " + f.getName()
+ " under Volume path "
-                                + relativeVolumePath);
+                                + tmpltParent.getPath());
                     }
                 }
                 if (!found) {
@@ -1816,7 +1824,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase
implements S
             }
             if (!tmpltParent.delete()) {
                 details = "Unable to delete directory " + tmpltParent.getName() + " under
Volume path "
-                        + relativeVolumePath;
+                        + tmpltParent.getPath();
                 s_logger.debug(details);
                 return new Answer(cmd, false, details);
             }


Mime
View raw message