qemu_snapshot: check only once if snapshot is external

There will be more external snapshot checks introduced by following
patch so group them together.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Pavel Hrdina 2023-03-06 12:21:16 +01:00
parent 32cf4ed5cd
commit daf48171f1

View File

@ -3728,19 +3728,19 @@ qemuSnapshotDeleteValidate(virDomainObj *vm,
}
}
if (virDomainSnapshotIsExternal(snap) &&
qemuDomainHasBlockjob(vm, false)) {
if (virDomainSnapshotIsExternal(snap)) {
if (qemuDomainHasBlockjob(vm, false)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("cannot delete external snapshots when there is another active block job"));
return -1;
}
if (virDomainSnapshotIsExternal(snap) &&
(flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN)) {
if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("deletion of external disk snapshots with children not supported"));
return -1;
}
}
return 0;
}