cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sate...@apache.org
Subject git commit: updated refs/heads/4.2 to 25b0f58
Date Tue, 16 Jul 2013 17:04:50 GMT
Updated Branches:
  refs/heads/4.2 93621bb5f -> 25b0f58a6


CLOUDSTACK-3529 Unable to test file existence due to exception java.lang.RuntimeException

See if file being deleted is directory or file.

Signed-off-by: Sateesh Chodapuneedi <sateesh@apache.org>


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

Branch: refs/heads/4.2
Commit: 25b0f58a69c04df00599aec6a71bbf38fcf04f26
Parents: 93621bb
Author: Sateesh Chodapuneedi <sateesh@apache.org>
Authored: Tue Jul 16 21:30:03 2013 +0530
Committer: Sateesh Chodapuneedi <sateesh@apache.org>
Committed: Tue Jul 16 22:33:52 2013 +0530

----------------------------------------------------------------------
 .../com/cloud/hypervisor/vmware/mo/DatastoreMO.java  | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25b0f58a/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatastoreMO.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatastoreMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatastoreMO.java
index 75553ae..3e9f370 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatastoreMO.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatastoreMO.java
@@ -21,8 +21,6 @@ import java.util.List;
 
 import org.apache.log4j.Logger;
 
-import com.cloud.hypervisor.vmware.util.VmwareContext;
-import com.cloud.utils.Pair;
 import com.vmware.vim25.DatastoreSummary;
 import com.vmware.vim25.FileInfo;
 import com.vmware.vim25.HostDatastoreBrowserSearchResults;
@@ -34,6 +32,9 @@ import com.vmware.vim25.PropertySpec;
 import com.vmware.vim25.SelectionSpec;
 import com.vmware.vim25.TraversalSpec;
 
+import com.cloud.hypervisor.vmware.util.VmwareContext;
+import com.cloud.utils.Pair;
+
 public class DatastoreMO extends BaseMO {
 	private static final Logger s_logger = Logger.getLogger(DatastoreMO.class);
 
@@ -48,7 +49,8 @@ public class DatastoreMO extends BaseMO {
 		super(context, morType, morValue);
 	}
 
-	public String getName() throws Exception {
+	@Override
+    public String getName() throws Exception {
 		if(_name == null)
 			_name = (String)_context.getVimClient().getDynamicProperty(_mor, "name");
 
@@ -131,10 +133,15 @@ public class DatastoreMO extends BaseMO {
 		String fullPath = path;
 		if(!DatastoreFile.isFullDatastorePath(fullPath))
 			fullPath = String.format("[%s] %s", datastoreName, path);
+        DatastoreFile file = new DatastoreFile(fullPath);
+        // Test if file specified is null or empty. We don't need to attempt to delete and
return success.
+        if (file.getFileName() == null || file.getFileName().isEmpty()) {
+            return true;
+        }
 
 		try {
 			if(testExistence && !fileExists(fullPath)) {
-                String searchResult = searchFileInSubFolders(fullPath.split(" ")[1], true);
+                String searchResult = searchFileInSubFolders(file.getFileName(), true);
                 if (searchResult == null) {
                     return true;
                 } else {


Mime
View raw message