From: Chen Hanxiao <chenhanxiao(a)gmail.com>
Modify OPERATION_FAILED error codes to use DEVICE_MISSING instead.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
src/qemu/qemu_driver.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a203c9297..10eebd61c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8172,7 +8172,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
case VIR_DOMAIN_DEVICE_HOSTDEV: {
hostdev = dev->data.hostdev;
if ((idx = virDomainHostdevFind(vmdef, hostdev, &det_hostdev)) < 0) {
- virReportError(VIR_ERR_INVALID_ARG, "%s",
+ virReportError(VIR_ERR_DEVICE_MISSING, "%s",
_("device not present in domain configuration"));
return -1;
}
@@ -8184,7 +8184,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
case VIR_DOMAIN_DEVICE_LEASE:
lease = dev->data.lease;
if (!(det_lease = virDomainLeaseRemove(vmdef, lease))) {
- virReportError(VIR_ERR_INVALID_ARG,
+ virReportError(VIR_ERR_DEVICE_MISSING,
_("Lease %s in lockspace %s does not exist"),
lease->key, NULLSTR(lease->lockspace));
return -1;
@@ -8196,7 +8196,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
cont = dev->data.controller;
if ((idx = virDomainControllerFind(vmdef, cont->type,
cont->idx)) < 0) {
- virReportError(VIR_ERR_INVALID_ARG, "%s",
+ virReportError(VIR_ERR_DEVICE_MISSING, "%s",
_("device not present in domain configuration"));
return -1;
}
@@ -8218,7 +8218,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
fs = dev->data.fs;
idx = virDomainFSIndexByName(vmdef, fs->dst);
if (idx < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ virReportError(VIR_ERR_DEVICE_MISSING, "%s",
_("no matching filesystem device was found"));
return -1;
}
@@ -8229,7 +8229,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
case VIR_DOMAIN_DEVICE_RNG:
if ((idx = virDomainRNGFind(vmdef, dev->data.rng)) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ virReportError(VIR_ERR_DEVICE_MISSING, "%s",
_("no matching RNG device was found"));
return -1;
}
@@ -8240,7 +8240,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
case VIR_DOMAIN_DEVICE_MEMORY:
if ((idx = virDomainMemoryFindInactiveByDef(vmdef,
dev->data.memory)) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ virReportError(VIR_ERR_DEVICE_MISSING, "%s",
_("matching memory device was not found"));
return -1;
}
@@ -8252,7 +8252,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
case VIR_DOMAIN_DEVICE_REDIRDEV:
if ((idx = virDomainRedirdevDefFind(vmdef,
dev->data.redirdev)) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ virReportError(VIR_ERR_DEVICE_MISSING, "%s",
_("no matching redirdev was not found"));
return -1;
}
@@ -8262,7 +8262,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
case VIR_DOMAIN_DEVICE_SHMEM:
if ((idx = virDomainShmemDefFind(vmdef, dev->data.shmem)) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ virReportError(VIR_ERR_DEVICE_MISSING, "%s",
_("matching shmem device was not found"));
return -1;
}
@@ -8273,7 +8273,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
case VIR_DOMAIN_DEVICE_WATCHDOG:
if (!vmdef->watchdog) {
- virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ virReportError(VIR_ERR_DEVICE_MISSING, "%s",
_("domain has no watchdog"));
return -1;
}
@@ -8283,7 +8283,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
case VIR_DOMAIN_DEVICE_INPUT:
if ((idx = virDomainInputDefFind(vmdef, dev->data.input)) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ virReportError(VIR_ERR_DEVICE_MISSING, "%s",
_("matching input device not found"));
return -1;
}
--
2.14.3