mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 01:32:18 +02:00
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
This commit is contained in:
parent
c24d2b88f6
commit
36cfd76ce1
@ -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());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user