The qemuDomainGetSCSIControllerModel() function, which is responsible for choosing a model for a SCSI controller that didn't have one provided by the user, considers values >0 to mean "model has been set". Since MODEL_SCSI_AUTO == 0, this means that such a value is considered the same as MODEL_SCSI_DEFAULT (-1). This makes sense, as not specifying a model name or explicitly asking for one to be automatically chosen intuitively should result in the same behavior. Specifically, there is no case in which a value of MODEL_SCSI_AUTO or MODEL_SCSI_DEFAULT is encountered after the initial controller creation: it is either replaced with an actual model, or an error is raised. Despite this, there are a few places in the QEMU driver where we incorrectly treat these values as if they were actual model names. To reduce confusion, make sure that no longer happens. Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- src/qemu/qemu_command.c | 4 ++-- src/qemu/qemu_domain_address.c | 4 ++-- src/qemu/qemu_validate.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 31d42495f4..aa77821331 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -505,7 +505,6 @@ qemuBuildDeviceAddresDriveProps(virJSONValue *props, break; - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI: @@ -527,6 +526,7 @@ qemuBuildDeviceAddresDriveProps(virJSONValue *props, break; case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DEFAULT: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, _("Unexpected SCSI controller model %1$d"), @@ -2685,7 +2685,6 @@ qemuBuildControllerSCSIDevProps(virDomainControllerDef *def, case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DC390: driver = "dc-390"; break; - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_NCR53C90: /* It is built-in dev */ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -2693,6 +2692,7 @@ qemuBuildControllerSCSIDevProps(virDomainControllerDef *def, virDomainControllerModelSCSITypeToString(def->model)); return NULL; case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DEFAULT: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, _("Unexpected SCSI controller model %1$d"), diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 49fd4d454d..af486aea97 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -567,7 +567,6 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDef *dev, case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: switch ((virDomainControllerModelSCSI) cont->model) { - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DEFAULT: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_NCR53C90: return 0; @@ -577,7 +576,6 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDef *dev, /* Transitional devices only work in conventional PCI slots */ case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL: - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068: @@ -588,6 +586,8 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDef *dev, case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AM53C974: return pciFlags; + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DEFAULT: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST: return 0; } diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index d3bea65139..73afd094a9 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3364,7 +3364,6 @@ qemuValidateCheckSCSIControllerModel(virQEMUCaps *qemuCaps, return false; } break; - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported controller model: %1$s"), @@ -3389,6 +3388,7 @@ qemuValidateCheckSCSIControllerModel(virQEMUCaps *qemuCaps, } return true; case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DEFAULT: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, _("Unexpected SCSI controller model %1$d"), -- 2.43.0 _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx