提交 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,
}
} 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;
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册