From de8fac5f21bc77c48587811343b0fb131349d6ae Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Tue, 30 Jan 2018 16:12:31 -0500 Subject: [PATCH] qemu: Reduce need to call qemuDomainGetSCSIControllerModel Now that post parse processing handles setting the SCSI controller model, there's no need to call qemuDomainGetSCSIControllerModel to get the "default controller" when building the command line controller string or when assigning the spaprvio address since the controller model value will already be filled in. --- src/qemu/qemu_command.c | 11 +++-------- src/qemu/qemu_domain_address.c | 14 +++----------- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 1142f302a8..f82a78155a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2717,22 +2717,17 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, int *nusbcontroller) { virBuffer buf = VIR_BUFFER_INITIALIZER; - int model = def->model; const char *modelName = NULL; *devstr = NULL; if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { - model = qemuDomainGetSCSIControllerModel(domainDef, def, qemuCaps); - if (model < 0) - return -1; - - if (!qemuBuildCheckSCSIControllerModel(qemuCaps, model)) + if (!qemuBuildCheckSCSIControllerModel(qemuCaps, def->model)) return -1; } if (!(def->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI && - model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI)) { + def->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI)) { if (def->queues) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("'queues' is only supported by virtio-scsi controller")); @@ -2757,7 +2752,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, switch ((virDomainControllerType) def->type) { case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: - switch (model) { + switch (def->model) { case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: if (def->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) { virBufferAddLit(&buf, "virtio-scsi-ccw"); diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 75c263015a..aa736131e6 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -225,12 +225,10 @@ qemuDomainAssignSpaprVIOAddress(virDomainDefPtr def, static int -qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def, - virQEMUCapsPtr qemuCaps) +qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def) { size_t i; int ret = -1; - int model; /* Default values match QEMU. See spapr_(llan|vscsi|vty).c */ @@ -249,13 +247,7 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def, for (i = 0; i < def->ncontrollers; i++) { virDomainControllerDefPtr cont = def->controllers[i]; - if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { - model = qemuDomainGetSCSIControllerModel(def, cont, qemuCaps); - if (model < 0) - goto cleanup; - } - - if (model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI && + if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI && cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { cont->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO; } @@ -2864,7 +2856,7 @@ qemuDomainAssignAddresses(virDomainDefPtr def, if (qemuDomainAssignVirtioSerialAddresses(def) < 0) return -1; - if (qemuDomainAssignSpaprVIOAddresses(def, qemuCaps) < 0) + if (qemuDomainAssignSpaprVIOAddresses(def) < 0) return -1; if (qemuDomainAssignS390Addresses(def, qemuCaps) < 0)