mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
qemu: Handle MODEL_SCSI_{AUTO,DEFAULT} appropriately
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@redhat.com> Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
parent
0d095c6d47
commit
518e70158b
@ -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"),
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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"),
|
||||
|
Loading…
Reference in New Issue
Block a user