Repository: cloudstack
Updated Branches:
  refs/heads/master dbbc6d42f -> 331239415


CLOUDSTACK-6934: don't try to detach volume from host when volume was never 
allocated to a primary storage


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

Branch: refs/heads/master
Commit: 3312394154c1ee42b3ff014eadc277a0c39b97cf
Parents: dbbc6d4
Author: Alena Prokharchyk <[email protected]>
Authored: Wed Jun 18 09:59:23 2014 -0700
Committer: Alena Prokharchyk <[email protected]>
Committed: Wed Jun 18 12:39:36 2014 -0700

----------------------------------------------------------------------
 .../cloudstack/engine/orchestration/VolumeOrchestrator.java  | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/33123941/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
----------------------------------------------------------------------
diff --git 
a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
 
b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
index eea931e..050143c 100644
--- 
a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++ 
b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -894,9 +894,11 @@ public class VolumeOrchestrator extends ManagerBase 
implements VolumeOrchestrati
         if (volumesForVm != null) {
             for (VolumeVO volumeForVm : volumesForVm) {
                 VolumeInfo volumeInfo = 
volFactory.getVolume(volumeForVm.getId());
-                DataStore dataStore = 
dataStoreMgr.getDataStore(volumeForVm.getPoolId(), DataStoreRole.Primary);
-
-                volService.disconnectVolumeFromHost(volumeInfo, host, 
dataStore);
+                // pool id can be null for the VM's volumes in Allocated state
+                if (volumeForVm.getPoolId() != null) {
+                    DataStore dataStore = 
dataStoreMgr.getDataStore(volumeForVm.getPoolId(), DataStoreRole.Primary);
+                    volService.disconnectVolumeFromHost(volumeInfo, host, 
dataStore);
+                }
             }
         }
     }

Reply via email to