rhtyd commented on a change in pull request #3276: [DO NOT MERGE WIP] Add more 
states for attaching disk in allocated state
URL: https://github.com/apache/cloudstack/pull/3276#discussion_r276171842
 
 

 ##########
 File path: server/src/com/cloud/storage/VolumeApiServiceImpl.java
 ##########
 @@ -1920,12 +1920,13 @@ private Volume orchestrateDetachVolumeFromVM(long 
vmId, long volumeId) {
             // Mark the volume as detached
             _volsDao.detachVolume(volume.getId());
 
-            // volume.getPoolId() should be null if the VM we are detaching 
the disk from has never been started before
-            DataStore dataStore = volume.getPoolId() != null ? 
dataStoreMgr.getDataStore(volume.getPoolId(), DataStoreRole.Primary) : null;
-
-            volService.revokeAccess(volFactory.getVolume(volume.getId()), 
host, dataStore);
-
-            handleTargetsForVMware(hostId, volumePool.getHostAddress(), 
volumePool.getPort(), volume.get_iScsiName());
+            // volumePool() should be null if the VM we are detaching the disk 
from has never been started before
+            // only revoke access on volumes that are actually on a datastore
+            if (volumePool != null) {
 
 Review comment:
   Should the original logic be retained? What happens if volumePool is null?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to