[PATCHv5 02/23] qemu: use consistent error when qemu binary is too old

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

 



Most of our errors complaining about an inability to support a
particular action due to qemu limitations used CONFIG_UNSUPPORTED,
but we had a few outliers.  Reported by Jiri Denemark.

* src/qemu/qemu_command.c (qemuBuildDriveDevStr): Prefer
CONFIG_UNSUPPORTED.
* src/qemu/qemu_driver.c (qemuDomainReboot)
(qemuDomainBlockJobImpl): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainAttachPciControllerDevice):
Likewise.
* src/qemu/qemu_monitor.c (qemuMonitorTransaction)
(qemuMonitorBlockJob, qemuMonitorSystemWakeup): Likewise.
---

v5: new patch, factored out from comments on other patches

 src/qemu/qemu_command.c |    2 +-
 src/qemu/qemu_driver.c  |   13 ++++++++-----
 src/qemu/qemu_hotplug.c |    2 +-
 src/qemu/qemu_monitor.c |    6 +++---
 4 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c82f5bc..b66ce18 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1527,7 +1527,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
             }
         } else {
             if (info->addr.pci.function != 0) {
-                qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                 _("Only PCI device addresses with function=0 "
                                   "are supported with this QEMU binary"));
                 return -1;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 436ef37..c3555ca 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1633,12 +1633,15 @@ cleanup:
     return ret;
 }

-static int qemuDomainShutdown(virDomainPtr dom) {
+static int qemuDomainShutdown(virDomainPtr dom)
+{
     return qemuDomainShutdownFlags(dom, 0);
 }


-static int qemuDomainReboot(virDomainPtr dom, unsigned int flags) {
+static int
+qemuDomainReboot(virDomainPtr dom, unsigned int flags)
+{
     struct qemud_driver *driver = dom->conn->privateData;
     virDomainObjPtr vm;
     int ret = -1;
@@ -1682,7 +1685,7 @@ static int qemuDomainReboot(virDomainPtr dom, unsigned int flags) {
 #if HAVE_YAJL
         if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON)) {
             if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) {
-                qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                 _("Reboot is not supported with this QEMU binary"));
                 goto cleanup;
             }
@@ -11643,11 +11646,11 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base,
     if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_ASYNC)) {
         async = true;
     } else if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_SYNC)) {
-        qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
+        qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                         _("block jobs not supported with this QEMU binary"));
         goto cleanup;
     } else if (base) {
-        qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
+        qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                         _("partial block pull not supported with this "
                           "QEMU binary"));
         goto cleanup;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 857b980..7cf7b90 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -335,7 +335,7 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
         if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
             controller->model == -1 &&
             !qemuCapsGet(priv->qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) {
-            qemuReportError(VIR_ERR_OPERATION_FAILED,
+            qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                             _("USB controller hotplug unsupported in this QEMU binary"));
             goto cleanup;
         }
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 36f3832..2f66c46 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2696,7 +2696,7 @@ qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr actions)
     if (mon->json)
         ret = qemuMonitorJSONTransaction(mon, actions);
     else
-        qemuReportError(VIR_ERR_INVALID_ARG, "%s",
+        qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                         _("transaction requires JSON monitor"));
     return ret;
 }
@@ -2786,7 +2786,7 @@ int qemuMonitorBlockJob(qemuMonitorPtr mon,
         ret = qemuMonitorJSONBlockJob(mon, device, base, bandwidth, info, mode,
                                       async);
     else
-        qemuReportError(VIR_ERR_INVALID_ARG, "%s",
+        qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                         _("block jobs require JSON monitor"));
     return ret;
 }
@@ -2918,7 +2918,7 @@ int qemuMonitorSystemWakeup(qemuMonitorPtr mon)
     }

     if (!mon->json) {
-        qemuReportError(VIR_ERR_NO_SUPPORT, "%s",
+        qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                         _("JSON monitor is required"));
         return -1;
     }
-- 
1.7.7.6

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