mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: Introduce qemuDomainDeviceDefValidateControllerAttributes
Move the checks that various attributes are not set on any controller other than SCSI controller using virtio-scsi model into the common controller validate checks.
This commit is contained in:
parent
958e0431a9
commit
d92f2efbed
@ -2725,30 +2725,6 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(def->type == VIR_DOMAIN_CONTROLLER_TYPE_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"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (def->cmd_per_lun) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
||||||
_("'cmd_per_lun' is only supported by virtio-scsi controller"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (def->max_sectors) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
||||||
_("'max_sectors' is only supported by virtio-scsi controller"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (def->ioeventfd) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
||||||
_("'ioeventfd' is only supported by virtio-scsi controller"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ((virDomainControllerType) def->type) {
|
switch ((virDomainControllerType) def->type) {
|
||||||
case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
|
case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
|
||||||
switch (def->model) {
|
switch (def->model) {
|
||||||
|
@ -3922,6 +3922,37 @@ qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
qemuDomainDeviceDefValidateControllerAttributes(const virDomainControllerDef *controller)
|
||||||
|
{
|
||||||
|
if (!(controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI &&
|
||||||
|
controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI)) {
|
||||||
|
if (controller->queues) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("'queues' is only supported by virtio-scsi controller"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (controller->cmd_per_lun) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("'cmd_per_lun' is only supported by virtio-scsi controller"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (controller->max_sectors) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("'max_sectors' is only supported by virtio-scsi controller"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (controller->ioeventfd) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("'ioeventfd' is only supported by virtio-scsi controller"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemuDomainDeviceDefValidateControllerIDE(const virDomainControllerDef *controller,
|
qemuDomainDeviceDefValidateControllerIDE(const virDomainControllerDef *controller,
|
||||||
const virDomainDef *def)
|
const virDomainDef *def)
|
||||||
@ -3959,6 +3990,9 @@ qemuDomainDeviceDefValidateController(const virDomainControllerDef *controller,
|
|||||||
"controller"))
|
"controller"))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (qemuDomainDeviceDefValidateControllerAttributes(controller) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
switch ((virDomainControllerType) controller->type) {
|
switch ((virDomainControllerType) controller->type) {
|
||||||
case VIR_DOMAIN_CONTROLLER_TYPE_IDE:
|
case VIR_DOMAIN_CONTROLLER_TYPE_IDE:
|
||||||
ret = qemuDomainDeviceDefValidateControllerIDE(controller, def);
|
ret = qemuDomainDeviceDefValidateControllerIDE(controller, def);
|
||||||
|
Loading…
Reference in New Issue
Block a user