提交 6fb8a64d 编写于 作者: E Eric Blake

qemu: use consistent error when qemu binary is too old

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.
上级 4f06777e
...@@ -1527,7 +1527,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf, ...@@ -1527,7 +1527,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
} }
} else { } else {
if (info->addr.pci.function != 0) { 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 " _("Only PCI device addresses with function=0 "
"are supported with this QEMU binary")); "are supported with this QEMU binary"));
return -1; return -1;
......
...@@ -1633,12 +1633,15 @@ cleanup: ...@@ -1633,12 +1633,15 @@ cleanup:
return ret; return ret;
} }
static int qemuDomainShutdown(virDomainPtr dom) { static int qemuDomainShutdown(virDomainPtr dom)
{
return qemuDomainShutdownFlags(dom, 0); 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; struct qemud_driver *driver = dom->conn->privateData;
virDomainObjPtr vm; virDomainObjPtr vm;
int ret = -1; int ret = -1;
...@@ -1682,7 +1685,7 @@ static int qemuDomainReboot(virDomainPtr dom, unsigned int flags) { ...@@ -1682,7 +1685,7 @@ static int qemuDomainReboot(virDomainPtr dom, unsigned int flags) {
#if HAVE_YAJL #if HAVE_YAJL
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON)) { if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON)) {
if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) { 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")); _("Reboot is not supported with this QEMU binary"));
goto cleanup; goto cleanup;
} }
...@@ -11643,11 +11646,11 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base, ...@@ -11643,11 +11646,11 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base,
if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_ASYNC)) { if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_ASYNC)) {
async = true; async = true;
} else if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_SYNC)) { } 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")); _("block jobs not supported with this QEMU binary"));
goto cleanup; goto cleanup;
} else if (base) { } else if (base) {
qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("partial block pull not supported with this " _("partial block pull not supported with this "
"QEMU binary")); "QEMU binary"));
goto cleanup; goto cleanup;
......
...@@ -335,7 +335,7 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver, ...@@ -335,7 +335,7 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
controller->model == -1 && controller->model == -1 &&
!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) { !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")); _("USB controller hotplug unsupported in this QEMU binary"));
goto cleanup; goto cleanup;
} }
......
...@@ -2696,7 +2696,7 @@ qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr actions) ...@@ -2696,7 +2696,7 @@ qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr actions)
if (mon->json) if (mon->json)
ret = qemuMonitorJSONTransaction(mon, actions); ret = qemuMonitorJSONTransaction(mon, actions);
else else
qemuReportError(VIR_ERR_INVALID_ARG, "%s", qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("transaction requires JSON monitor")); _("transaction requires JSON monitor"));
return ret; return ret;
} }
...@@ -2786,7 +2786,7 @@ int qemuMonitorBlockJob(qemuMonitorPtr mon, ...@@ -2786,7 +2786,7 @@ int qemuMonitorBlockJob(qemuMonitorPtr mon,
ret = qemuMonitorJSONBlockJob(mon, device, base, bandwidth, info, mode, ret = qemuMonitorJSONBlockJob(mon, device, base, bandwidth, info, mode,
async); async);
else else
qemuReportError(VIR_ERR_INVALID_ARG, "%s", qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("block jobs require JSON monitor")); _("block jobs require JSON monitor"));
return ret; return ret;
} }
...@@ -2918,7 +2918,7 @@ int qemuMonitorSystemWakeup(qemuMonitorPtr mon) ...@@ -2918,7 +2918,7 @@ int qemuMonitorSystemWakeup(qemuMonitorPtr mon)
} }
if (!mon->json) { if (!mon->json) {
qemuReportError(VIR_ERR_NO_SUPPORT, "%s", qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("JSON monitor is required")); _("JSON monitor is required"));
return -1; return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册