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/master to e8ea6b1
Date Sun, 30 Jun 2013 03:30:49 GMT
Updated Branches:
  refs/heads/master 15a684478 -> e8ea6b1ab


CLOUDSTACK-3260
Fixing NPE.


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

Branch: refs/heads/master
Commit: e8ea6b1abdb78e8f789571d562cd2d37f03f336a
Parents: 15a6844
Author: Sateesh Chodapuneedi <sateesh@apache.org>
Authored: Sun Jun 30 08:59:41 2013 +0530
Committer: Sateesh Chodapuneedi <sateesh@apache.org>
Committed: Sun Jun 30 08:59:41 2013 +0530

----------------------------------------------------------------------
 .../hypervisor/vmware/manager/VmwareStorageManagerImpl.java      | 4 ++++
 .../src/com/cloud/hypervisor/vmware/resource/VmwareResource.java | 4 +++-
 vmware-base/src/com/cloud/hypervisor/vmware/mo/DatastoreMO.java  | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e8ea6b1a/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 7b01d06..fee3e0a 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
@@ -74,6 +74,7 @@ import com.cloud.utils.Pair;
 import com.cloud.utils.StringUtils;
 import com.cloud.utils.Ternary;
 import com.cloud.utils.script.Script;
+import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.snapshot.VMSnapshot;
 import com.vmware.vim25.ManagedObjectReference;
@@ -1090,6 +1091,9 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager
{
     private String getVolumePathInDatastore(DatastoreMO dsMo, String volumeFileName) throws
Exception {
         String datastoreVolumePath = dsMo.searchFileInSubFolders(volumeFileName, true);
         assert (datastoreVolumePath != null) : "Virtual disk file missing from datastore.";
+        if (datastoreVolumePath == null) {
+            throw new CloudRuntimeException("Unable to find file " + volumeFileName + " in
datastore " + dsMo.getName());
+        }
         return datastoreVolumePath;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e8ea6b1a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 52f4190..968e095 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -3984,7 +3984,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
             DatastoreMO dsMo = new DatastoreMO(getServiceContext(), morDs);
             String datastoreVolumePath = dsMo.searchFileInSubFolders(cmd.getVolumePath()
+ ".vmdk", true);
             assert (datastoreVolumePath != null) : "Virtual disk file must exist in specified
datastore for attach/detach operations.";
-
+            if (datastoreVolumePath == null) {
+                throw new CloudRuntimeException("Unable to find file " + cmd.getVolumePath()
+ ".vmdk in datastore " + dsMo.getName());
+            }
             AttachVolumeAnswer answer = new AttachVolumeAnswer(cmd, cmd.getDeviceId(), datastoreVolumePath);
             if (cmd.getAttach()) {
                 vmMo.attachDisk(new String[] { datastoreVolumePath }, morDs);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e8ea6b1a/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..a1f2506 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatastoreMO.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatastoreMO.java
@@ -335,7 +335,7 @@ public class DatastoreMO extends BaseMO {
 
         HostDatastoreBrowserMO browserMo = getHostDatastoreBrowserMO();
         ArrayList<HostDatastoreBrowserSearchResults> results = browserMo.searchDatastoreSubFolders("["
+ getName() + "]", fileName, caseInsensitive);
-        if (results.size() > 1) {
+        if (results != null && results.size() > 1) {
             s_logger.warn("Multiple files with name " + fileName + " exists in datastore
" + datastorePath + ". Trying to choose first file found in search attempt.");
         }
         for (HostDatastoreBrowserSearchResults result : results) {


Mime
View raw message