Repository: cloudstack
Updated Branches:
  refs/heads/4.4-forward b8a296158 -> 92fea032d


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/92fea032
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/92fea032
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/92fea032

Branch: refs/heads/4.4-forward
Commit: 92fea032da08938749cde73e312370f1b9da1567
Parents: b8a2961
Author: Alena Prokharchyk <[email protected]>
Authored: Wed Jun 18 09:59:23 2014 -0700
Committer: Alena Prokharchyk <[email protected]>
Committed: Wed Jun 18 12:40:02 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/92fea032/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 358b3bd..76281c6 100644
--- 
a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++ 
b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -866,9 +866,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