mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-6934: don't try to detach volume from host when volume was never allocated to a primary storage
This commit is contained in:
parent
dbbc6d42fd
commit
3312394154
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue