Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
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