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/04 16:34:28 UTC

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

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


##########
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:
   This is current behavior, I just added the case where the root volume is destroyed. If you look at the current code, no verification is made. An event is always published. 



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