You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sa...@apache.org on 2013/07/16 19:04:50 UTC
git commit: updated refs/heads/4.2 to 25b0f58
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 <sa...@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 <sa...@apache.org>
Authored: Tue Jul 16 21:30:03 2013 +0530
Committer: Sateesh Chodapuneedi <sa...@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 {