[PATCH v2 4/7] use new macro helpers to check flag requirements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/libvirt-domain-snapshot.c | 11 +++--------
 src/qemu/qemu_driver.c        |  9 +++------
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/src/libvirt-domain-snapshot.c b/src/libvirt-domain-snapshot.c
index 0d5c5e8..9d43f54 100644
--- a/src/libvirt-domain-snapshot.c
+++ b/src/libvirt-domain-snapshot.c
@@ -220,14 +220,9 @@ virDomainSnapshotCreateXML(virDomainPtr domain,
     virCheckNonNullArgGoto(xmlDesc, error);
     virCheckReadOnlyGoto(conn->flags, error);
 
-    if ((flags & VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT) &&
-        !(flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE)) {
-        virReportInvalidArg(flags,
-                            _("use of 'current' flag in %s requires "
-                              "'redefine' flag"),
-                            __FUNCTION__);
-        goto error;
-    }
+    VIR_REQUIRE_FLAG_GOTO(VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT,
+                          VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE,
+                          error);
 
     VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE,
                              VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f7d77e7..a5ee99d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14541,12 +14541,9 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
                   VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC |
                   VIR_DOMAIN_SNAPSHOT_CREATE_LIVE, NULL);
 
-    if ((flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) &&
-        !(flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY)) {
-        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
-                       _("quiesce requires disk-only"));
-        return NULL;
-    }
+    VIR_REQUIRE_FLAG_RET(VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE,
+                         VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY,
+                         NULL);
 
     if ((redefine && !(flags & VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT)) ||
         (flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA))
-- 
2.0.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]