[libvirt PATCH 18/20] qemu_snapshot: check only once if snapshot is external

Pavel Hrdina posted 20 patches 1 year, 4 months ago
There is a newer version of this series
[libvirt PATCH 18/20] qemu_snapshot: check only once if snapshot is external
Posted by Pavel Hrdina 1 year, 4 months ago
There will be more external snapshot checks introduced by following
patch so group them together.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 src/qemu/qemu_snapshot.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 95297cfe6a..05386b11fe 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -3426,18 +3426,18 @@ qemuSnapshotDeleteValidate(virDomainObj *vm,
         }
     }
 
-    if (virDomainSnapshotIsExternal(snap) &&
-        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)) {
+        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)) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("deletion of external disk snapshots with children not supported"));
-        return -1;
+        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;
-- 
2.39.2
Re: [libvirt PATCH 18/20] qemu_snapshot: check only once if snapshot is external
Posted by Peter Krempa 1 year, 3 months ago
On Mon, Mar 13, 2023 at 16:42:19 +0100, Pavel Hrdina wrote:
> There will be more external snapshot checks introduced by following
> patch so group them together.
> 
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> ---
>  src/qemu/qemu_snapshot.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>