You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2022/11/03 15:43:36 UTC

[GitHub] [cloudstack] DaanHoogland commented on a diff in pull request #6868: Set root volume as destroyed when destroying a VM

DaanHoogland commented on code in PR #6868:
URL: https://github.com/apache/cloudstack/pull/6868#discussion_r1013061381


##########
engine/schema/src/main/java/com/cloud/storage/dao/VolumeDaoImpl.java:
##########
@@ -759,4 +759,11 @@ public void updateDiskOffering(long volumeId, long diskOfferingId) {
             throw new CloudRuntimeException(e);
         }
     }
+    @Override
+    public VolumeVO getInstanceRootVolume(long instanceId, String instanceUuid) {

Review Comment:
   why add the uuid parameter?



##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -2335,6 +2337,15 @@ public UserVm recoverVirtualMachine(RecoverVMCmd cmd) throws ResourceAllocationE
         return _vmDao.findById(vmId);
     }
 
+    protected void recoverRootVolume(VolumeVO volume, Long vmId) {
+        if (Volume.State.Destroy.equals(volume.getState())) {
+            _volumeService.recoverVolume(volume.getId());
+            _volsDao.attachVolume(volume.getId(), vmId, ROOT_DEVICE_ID);
+        } else {
+            _volumeService.publishVolumeCreationUsageEvent(volume);
+        }

Review Comment:
   doesn´t this mean a volume creation event gets published when the volume is in a state of Expunging/Expunged?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org