We want this helper to work more like other similar ones, where
error reporting is performed by the caller. This introduces a
small amount of code duplication but makes for a cleaner API.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/qemu/qemu_domain.c | 9 +++++----
src/qemu/qemu_hotplug.c | 3 +++
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 01f4ed6917..22e6b9fd3e 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4125,9 +4125,6 @@ qemuDomainDefaultSCSIControllerModel(const virDomainDef *def,
if (qemuDomainHasBuiltinESP(def))
return VIR_DOMAIN_CONTROLLER_MODEL_SCSI_NCR53C90;
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to determine model for SCSI controller
idx=%1$d"),
- cont->idx);
return -1;
}
@@ -5616,8 +5613,12 @@ qemuDomainControllerDefPostParse(virDomainControllerDef *cont,
/* Set the default SCSI controller model if not already set */
cont->model = qemuDomainDefaultSCSIControllerModel(def, cont, qemuCaps);
- if (cont->model < 0)
+ if (cont->model < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to determine model for SCSI controller
idx=%1$d"),
+ cont->idx);
return -1;
+ }
break;
case VIR_DOMAIN_CONTROLLER_TYPE_USB:
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index a2498e793a..a9dbc37915 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -883,6 +883,9 @@ qemuDomainFindOrCreateSCSIDiskController(virDomainObj *vm,
cont->model = model;
if (cont->model < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to determine model for SCSI controller
idx=%1$d"),
+ cont->idx);
VIR_FREE(cont);
return NULL;
}
--
2.43.0