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-6-17-stable to 75f98ee
Date Fri, 28 Jun 2013 19:59:55 GMT
Updated Branches:
  refs/heads/master-6-17-stable e43dd6e0c -> 75f98eea4


CLOUDSTACK-3260 [Automation] Volume attach and detach failed with null pointer exception in
vmware

Log files shows multiple Exceptions where some of the NPE are observed when file is non-existant
file in datastore.
Fixing NullPointerExceptions seen while searching for file in datastore.


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

Branch: refs/heads/master-6-17-stable
Commit: 75f98eea4e89c6cbbf0762ee13bac77229e86e3c
Parents: e43dd6e
Author: Sateesh Chodapuneedi <sateesh@apache.org>
Authored: Sat Jun 29 01:25:20 2013 +0530
Committer: Sateesh Chodapuneedi <sateesh@apache.org>
Committed: Sat Jun 29 01:25:20 2013 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/75f98eea/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..35fbfc5 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
@@ -73,6 +73,7 @@ import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
 import com.cloud.utils.StringUtils;
 import com.cloud.utils.Ternary;
+import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.script.Script;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.snapshot.VMSnapshot;
@@ -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/75f98eea/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 03dec9c..2dcc72c 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
@@ -3872,6 +3872,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());
             if (cmd.getAttach()) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/75f98eea/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..49b9861 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