From: Chen Hanxiao <chenhanxiao(a)gmail.com>
More proper/detail error messages updated.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
v3:
subject changed.
some description of logs changed.
src/libvirt_private.syms | 2 ++
src/qemu/qemu_hotplug.c | 35 +++++++++++++++++++++++------------
2 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index bc8cc1fba..70a91e5fd 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -203,6 +203,7 @@ virDomainChrConsoleTargetTypeToString;
virDomainChrDefForeach;
virDomainChrDefFree;
virDomainChrDefNew;
+virDomainChrDeviceTypeToString;
virDomainChrEquals;
virDomainChrFind;
virDomainChrGetDomainPtrs;
@@ -427,6 +428,7 @@ virDomainMemoryDefFree;
virDomainMemoryFindByDef;
virDomainMemoryFindInactiveByDef;
virDomainMemoryInsert;
+virDomainMemoryModelTypeToString;
virDomainMemoryRemove;
virDomainMemorySourceTypeFromString;
virDomainMemorySourceTypeToString;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 6b245bd6a..1f67ab74a 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3514,8 +3514,9 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
int ret = -1;
if (!olddev) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot find existing graphics device to modify"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot find existing graphics device to modify of "
+ "type '%s'"), type);
goto cleanup;
}
@@ -5101,8 +5102,10 @@ qemuDomainDetachShmemDevice(virQEMUDriverPtr driver,
qemuDomainObjPrivatePtr priv = vm->privateData;
if ((idx = virDomainShmemDefFind(vm->def, dev)) < 0) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("device not present in domain configuration"));
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("model '%s' shmem device not present "
+ "in domain configuration"),
+ virDomainShmemModelTypeToString(dev->model));
return -1;
}
@@ -5158,8 +5161,10 @@ qemuDomainDetachWatchdog(virQEMUDriverPtr driver,
watchdog->model == dev->model &&
watchdog->action == dev->action &&
virDomainDeviceInfoAddressIsEqual(&dev->info, &watchdog->info)))
{
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("watchdog device not present in domain
configuration"));
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("model '%s' watchdog device not present "
+ "in domain configuration"),
+ virDomainWatchdogModelTypeToString(watchdog->model));
return -1;
}
@@ -5429,8 +5434,10 @@ 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,
+ _("chr type '%s' device not present "
+ "in domain configuration"),
+ virDomainChrDeviceTypeToString(chr->deviceType));
goto cleanup;
}
@@ -5476,8 +5483,10 @@ qemuDomainDetachRNGDevice(virQEMUDriverPtr driver,
int ret = -1;
if ((idx = virDomainRNGFind(vm->def, rng)) < 0) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("device not present in domain configuration"));
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("model '%s' RNG device not present "
+ "in domain configuration"),
+ virDomainRNGBackendTypeToString(rng->model));
return -1;
}
@@ -5519,8 +5528,10 @@ qemuDomainDetachMemoryDevice(virQEMUDriverPtr driver,
qemuDomainMemoryDeviceAlignSize(vm->def, memdef);
if ((idx = virDomainMemoryFindByDef(vm->def, memdef)) < 0) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("device not present in domain configuration"));
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("model '%s' memory device not present "
+ "in the domain configuration"),
+ virDomainMemoryModelTypeToString(memdef->model));
return -1;
}
--
2.14.3