Pearl1594 commented on a change in pull request #4294:
URL: https://github.com/apache/cloudstack/pull/4294#discussion_r478865532



##########
File path: 
plugins/hypervisors/vmware/src/main/java/com/cloud/storage/resource/VmwareStorageProcessor.java
##########
@@ -1234,6 +1245,15 @@ public Answer createTemplateFromVolume(CopyCommand cmd) {
 
             details = "create template from volume exception: " + 
VmwareHelper.getExceptionMessage(e);
             return new CopyCmdAnswer(details);
+        } finally {
+            try {
+                if (volume.getVmName() == null && vmMo != null) {
+                    vmMo.detachAllDisks();
+                    vmMo.destroy();

Review comment:
       there's a check that volume is in fact detached  with this : 
```volume.getVmName()``` hence, vmMo under such a scenario will only point to 
the worker VM. To be safer, will destroy workerVMMo instead. Thanks!




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


Reply via email to