From: Chen Hanxiao <chenhanxiao@xxxxxxxxx> Some services, such as Nova, check whether device was not found by errror messages "not found". [1] This patch unify logs of qemuDomainDetachDeviceLive, which will be helpful. [1] https://github.com/openstack/nova/blob/master/nova/virt/libvirt/guest.py#L406 Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxx> --- src/qemu/qemu_hotplug.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index d97aa6051..925574b92 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -5093,7 +5093,7 @@ qemuDomainDetachShmemDevice(virQEMUDriverPtr driver, if ((idx = virDomainShmemDefFind(vm->def, dev)) < 0) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("device not present in domain configuration")); + _("device not found in domain configuration")); return -1; } @@ -5150,7 +5150,7 @@ qemuDomainDetachWatchdog(virQEMUDriverPtr driver, watchdog->action == dev->action && virDomainDeviceInfoAddressIsEqual(&dev->info, &watchdog->info))) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("watchdog device not present in domain configuration")); + _("watchdog device not found in domain configuration")); return -1; } @@ -5233,8 +5233,11 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver, virDomainNetDefPtr detach = NULL; qemuDomainObjPrivatePtr priv = vm->privateData; - if ((detachidx = virDomainNetFindIdx(vm->def, dev->data.net)) < 0) + if ((detachidx = virDomainNetFindIdx(vm->def, dev->data.net)) < 0) { + virReportError(VIR_ERR_OPERATION_FAILED, + _("netdev %s not found"), dev->data.net->mac.addr); goto cleanup; + } detach = vm->def->nets[detachidx]; @@ -5420,8 +5423,9 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver, char *devstr = NULL; if (!(tmpChr = virDomainChrFind(vmdef, chr))) { - virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("device not present in domain configuration")); + virReportError(VIR_ERR_OPERATION_INVALID, + _("device %s not found in domain configuration"), + chr->target.name); goto cleanup; } @@ -5468,7 +5472,7 @@ qemuDomainDetachRNGDevice(virQEMUDriverPtr driver, if ((idx = virDomainRNGFind(vm->def, rng)) < 0) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("device not present in domain configuration")); + _("device not found in domain configuration")); return -1; } @@ -5511,7 +5515,7 @@ qemuDomainDetachMemoryDevice(virQEMUDriverPtr driver, if ((idx = virDomainMemoryFindByDef(vm->def, memdef)) < 0) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("device not present in domain configuration")); + _("device not found in domain configuration")); return -1; } -- 2.14.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list