[PATCH 3/3] lib: Check conditions for VIR_DOMAIN_BLOCK_REBASE_RELATIVE right away

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

 



VIR_DOMAIN_BLOCK_REBASE_RELATIVE works only when @base is specified.
Check it right in libvirt.c as it's not expected to change across
hypervisors.
---
 src/libvirt.c          | 7 +++++++
 src/qemu/qemu_driver.c | 7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index 6bf260a..edf2f8b 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -19817,6 +19817,13 @@ virDomainBlockRebase(virDomainPtr dom, const char *disk,
         goto error;
     }

+    if (flags & VIR_DOMAIN_BLOCK_REBASE_RELATIVE && !base) {
+        virReportInvalidArg(base, "%s",
+                            _("flag VIR_DOMAIN_BLOCK_REBASE_RELATIVE is valid "
+                              "only with non-null base"));
+        goto error;
+    }
+
     if (conn->driver->domainBlockRebase) {
         int ret;
         ret = conn->driver->domainBlockRebase(dom, disk, base, bandwidth,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fd68324..b077950 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15055,13 +15055,6 @@ qemuDomainBlockJobImpl(virDomainObjPtr vm,
         goto cleanup;
     }

-    if (flags & VIR_DOMAIN_BLOCK_REBASE_RELATIVE && !base) {
-        virReportError(VIR_ERR_INVALID_ARG, "%s",
-                       _("flag VIR_DOMAIN_BLOCK_REBASE_RELATIVE is valid only "
-                         "with non-null base"));
-        goto cleanup;
-    }
-
     priv = vm->privateData;
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_ASYNC)) {
         async = true;
-- 
2.0.0

--
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]