]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: use consistent error when qemu binary is too old
authorEric Blake <eblake@redhat.com>
Tue, 17 Apr 2012 04:16:04 +0000 (22:16 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 17 Apr 2012 17:09:44 +0000 (11:09 -0600)
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.

src/qemu/qemu_command.c
src/qemu/qemu_driver.c
src/qemu/qemu_hotplug.c
src/qemu/qemu_monitor.c

index 26f691f8497b323fcc0ed1541ad1977cb3d09e1d..8dedd80806192c4c2b9e27e2b4835f86a64cca25 100644 (file)
@@ -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;
index 436ef376869d61f1191280f6dcba95dc8ee3ab17..c3555ca2ca684ad0ca63520c9cd6bc3f50b62ab9 100644 (file)
@@ -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;
index 857b98089b6ba0844478e0ca77bed5271322646b..7cf7b90518db130ff97d8f600a4c5c770f5b20e7 100644 (file)
@@ -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;
         }
index 36f3832e1848b0e562e7608bfb040c0108968cd4..2f66c46a253b81eba67794b658bb54fe05f12c9f 100644 (file)
@@ -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;
     }