It has nothing to do with assigning addresses, so it makes more
sense to have it in qemu_domain.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/qemu/qemu_domain.c | 37 ++++++++++++++++++++++++++++++++++
src/qemu/qemu_domain.h | 3 +++
src/qemu/qemu_domain_address.c | 36 ---------------------------------
src/qemu/qemu_domain_address.h | 4 ----
4 files changed, 40 insertions(+), 40 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 48d721a809..672f1ce59f 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4104,6 +4104,43 @@ qemuDomainDefAddDefaultAudioBackend(virQEMUDriver *driver,
return 0;
}
+
+/**
+ * @def: Domain definition
+ * @cont: Domain controller def
+ * @qemuCaps: qemu capabilities
+ *
+ * If the controller model is already defined, return it immediately;
+ * otherwise, based on the @qemuCaps return a default model value.
+ *
+ * Returns model on success, -1 on failure with error set.
+ */
+int
+qemuDomainGetSCSIControllerModel(const virDomainDef *def,
+ const virDomainControllerDef *cont,
+ virQEMUCaps *qemuCaps)
+{
+ if (cont->model > 0)
+ return cont->model;
+
+ if (qemuDomainIsPSeries(def))
+ return VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI;
+ if (ARCH_IS_S390(def->os.arch))
+ return VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI;
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI))
+ return VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC;
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI))
+ return VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI;
+ 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;
+}
+
+
static int
qemuDomainDefAddDefaultDevices(virQEMUDriver *driver,
virDomainDef *def,
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index b4512cc80e..4dfc0ab5c7 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -836,6 +836,9 @@ bool qemuDomainHasBuiltinESP(const virDomainDef *def);
bool qemuDomainNeedsFDC(const virDomainDef *def);
bool qemuDomainSupportsPCI(const virDomainDef *def);
bool qemuDomainSupportsPCIMultibus(const virDomainDef *def);
+int qemuDomainGetSCSIControllerModel(const virDomainDef *def,
+ const virDomainControllerDef *cont,
+ virQEMUCaps *qemuCaps);
void qemuDomainUpdateCurrentMemorySize(virDomainObj *vm);
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 0a7273dc07..49fd4d454d 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -38,42 +38,6 @@ VIR_LOG_INIT("qemu.qemu_domain_address");
#define VIO_ADDR_TPM 0x4000ul
-/**
- * @def: Domain definition
- * @cont: Domain controller def
- * @qemuCaps: qemu capabilities
- *
- * If the controller model is already defined, return it immediately;
- * otherwise, based on the @qemuCaps return a default model value.
- *
- * Returns model on success, -1 on failure with error set.
- */
-int
-qemuDomainGetSCSIControllerModel(const virDomainDef *def,
- const virDomainControllerDef *cont,
- virQEMUCaps *qemuCaps)
-{
- if (cont->model > 0)
- return cont->model;
-
- if (qemuDomainIsPSeries(def))
- return VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI;
- if (ARCH_IS_S390(def->os.arch))
- return VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI;
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI))
- return VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC;
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI))
- return VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI;
- 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;
-}
-
-
static int
qemuDomainAssignVirtioSerialAddresses(virDomainDef *def)
{
diff --git a/src/qemu/qemu_domain_address.h b/src/qemu/qemu_domain_address.h
index 0ac6285f2e..78fcd74234 100644
--- a/src/qemu/qemu_domain_address.h
+++ b/src/qemu/qemu_domain_address.h
@@ -24,10 +24,6 @@
#include "qemu_conf.h"
#include "qemu_capabilities.h"
-int qemuDomainGetSCSIControllerModel(const virDomainDef *def,
- const virDomainControllerDef *cont,
- virQEMUCaps *qemuCaps);
-
int qemuDomainAssignAddresses(virDomainDef *def,
virQEMUCaps *qemuCaps,
virQEMUDriver *driver,
--
2.43.0