[PATCH 2/2] blockjob: make PIVOT and ASYNC flags mutually exclusive

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

 



https://bugzilla.redhat.com/show_bug.cgi?id=977678
---
 src/qemu/qemu_driver.c | 7 +++++++
 tools/virsh-domain.c   | 9 ++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6a83fda..aa7affe 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14153,6 +14153,13 @@ qemuDomainBlockJobAbort(virDomainPtr dom, const char *path, unsigned int flags)
     virCheckFlags(VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC |
                   VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT, -1);
 
+    if ((flags & VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC) &&
+        (flags & VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT)) {
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
+                       _("asynchronnous pivot not supported"));
+        return -1;
+    }
+
     if (!(vm = qemuDomObjFromDomain(dom)))
         return -1;
 
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 5257416..2653388 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -1919,11 +1919,14 @@ cmdBlockJob(vshControl *ctl, const vshCmd *cmd)
     virDomainBlockJobInfo info;
     const char *type;
     int ret;
-    bool abortMode = (vshCommandOptBool(cmd, "abort") ||
-                      vshCommandOptBool(cmd, "async") ||
-                      vshCommandOptBool(cmd, "pivot"));
+    bool abort = vshCommandOptBool(cmd, "abort");
+    bool async = vshCommandOptBool(cmd, "async");
+    bool pivot = vshCommandOptBool(cmd, "pivot");
     bool infoMode = vshCommandOptBool(cmd, "info");
     bool bandwidth = vshCommandOptBool(cmd, "bandwidth");
+    bool abortMode = abort || async || pivot;
+
+    VSH_EXCLUSIVE_OPTIONS_VAR(async, pivot);
 
     if (abortMode + infoMode + bandwidth > 1) {
         vshError(ctl, "%s",
-- 
1.8.1.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]