This is an automated email from the ASF dual-hosted git repository.

weizhou pushed a commit to branch 4.20
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.20 by this push:
     new 36cfd76ce19 KVM: fix delete vm snapshot if it does not exist with a 
Stopped vm (#11687)
36cfd76ce19 is described below

commit 36cfd76ce199ce159f496b27f9ed080488b96427
Author: Wei Zhou <[email protected]>
AuthorDate: Wed Sep 24 13:53:27 2025 +0200

    KVM: fix delete vm snapshot if it does not exist with a Stopped vm (#11687)
    
    * KVM: fix delete vm snapshot if it does not exist with a Stopped vm
    
    * update 11687
---
 .../kvm/resource/wrapper/LibvirtDeleteVMSnapshotCommandWrapper.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtDeleteVMSnapshotCommandWrapper.java
 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtDeleteVMSnapshotCommandWrapper.java
index 58a74d6e0f6..9f1b264ff71 100644
--- 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtDeleteVMSnapshotCommandWrapper.java
+++ 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtDeleteVMSnapshotCommandWrapper.java
@@ -40,6 +40,7 @@ import com.cloud.resource.CommandWrapper;
 import com.cloud.resource.ResourceWrapper;
 import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.storage.Volume;
+import com.cloud.utils.StringUtils;
 import com.cloud.utils.script.Script;
 
 @ResourceWrapper(handles =  DeleteVMSnapshotCommand.class)
@@ -104,7 +105,7 @@ public final class LibvirtDeleteVMSnapshotCommandWrapper 
extends CommandWrapper<
                     commands.add(new 
String[]{Script.getExecutableAbsolutePath("awk"), "-F", " ", "{print $2}"});
                     commands.add(new 
String[]{Script.getExecutableAbsolutePath("grep"), "^" + 
sanitizeBashCommandArgument(cmd.getTarget().getSnapshotName()) + "$"});
                     String qemu_img_snapshot = 
Script.executePipedCommands(commands, 0).second();
-                    if (qemu_img_snapshot == null) {
+                    if (StringUtils.isEmpty(qemu_img_snapshot)) {
                         logger.info("Cannot find snapshot " + 
cmd.getTarget().getSnapshotName() + " in file " + rootDisk.getPath() + ", 
return true");
                         return new DeleteVMSnapshotAnswer(cmd, 
cmd.getVolumeTOs());
                     }

Reply via email to