mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-08 22:15:21 +00:00
qemu: Introduce qemuDomainDeviceDefValidateControllerSCSI
Move SCSI validation from qemu_command into qemu_domain. Rename/reorder the args in qemuCheckSCSIControllerIOThreads to match the caller as well as fixing up the comments to remove the previously removed qemuCaps arg.
This commit is contained in:
parent
cd8df1e6de
commit
2d32fc81da
@ -2580,44 +2580,6 @@ qemuBuildUSBControllerDevStr(virDomainControllerDefPtr def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* qemuCheckSCSIControllerIOThreads:
|
|
||||||
* @domainDef: Pointer to domain def
|
|
||||||
* @def: Pointer to controller def
|
|
||||||
* @qemuCaps: Capabilities
|
|
||||||
*
|
|
||||||
* If this controller definition has iothreads set, let's make sure the
|
|
||||||
* configuration is right before adding to the command line
|
|
||||||
*
|
|
||||||
* Returns true if either supported or there are no iothreads for controller;
|
|
||||||
* otherwise, returns false if configuration is not quite right.
|
|
||||||
*/
|
|
||||||
static bool
|
|
||||||
qemuCheckSCSIControllerIOThreads(const virDomainDef *domainDef,
|
|
||||||
virDomainControllerDefPtr def)
|
|
||||||
{
|
|
||||||
if (!def->iothread)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
|
|
||||||
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
||||||
_("IOThreads only available for virtio pci and "
|
|
||||||
"virtio ccw controllers"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Can we find the controller iothread in the iothreadid list? */
|
|
||||||
if (!virDomainIOThreadIDFind(domainDef, def->iothread)) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
||||||
_("controller iothread '%u' not defined in iothreadid"),
|
|
||||||
def->iothread);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qemuBuildControllerDevStr:
|
* qemuBuildControllerDevStr:
|
||||||
* @domainDef: domain definition
|
* @domainDef: domain definition
|
||||||
@ -2656,12 +2618,9 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
|
|||||||
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI:
|
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI:
|
||||||
if (def->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
|
if (def->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
|
||||||
virBufferAddLit(&buf, "virtio-scsi-ccw");
|
virBufferAddLit(&buf, "virtio-scsi-ccw");
|
||||||
if (def->iothread) {
|
if (def->iothread)
|
||||||
if (!qemuCheckSCSIControllerIOThreads(domainDef, def))
|
|
||||||
goto error;
|
|
||||||
virBufferAsprintf(&buf, ",iothread=iothread%u",
|
virBufferAsprintf(&buf, ",iothread=iothread%u",
|
||||||
def->iothread);
|
def->iothread);
|
||||||
}
|
|
||||||
} else if (def->info.type ==
|
} else if (def->info.type ==
|
||||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) {
|
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) {
|
||||||
virBufferAddLit(&buf, "virtio-scsi-s390");
|
virBufferAddLit(&buf, "virtio-scsi-s390");
|
||||||
@ -2670,12 +2629,9 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
|
|||||||
virBufferAddLit(&buf, "virtio-scsi-device");
|
virBufferAddLit(&buf, "virtio-scsi-device");
|
||||||
} else {
|
} else {
|
||||||
virBufferAddLit(&buf, "virtio-scsi-pci");
|
virBufferAddLit(&buf, "virtio-scsi-pci");
|
||||||
if (def->iothread) {
|
if (def->iothread)
|
||||||
if (!qemuCheckSCSIControllerIOThreads(domainDef, def))
|
|
||||||
goto error;
|
|
||||||
virBufferAsprintf(&buf, ",iothread=iothread%u",
|
virBufferAsprintf(&buf, ",iothread=iothread%u",
|
||||||
def->iothread);
|
def->iothread);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (qemuBuildVirtioOptionsStr(&buf, def->virtio, qemuCaps) < 0)
|
if (qemuBuildVirtioOptionsStr(&buf, def->virtio, qemuCaps) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -4046,6 +4046,68 @@ qemuDomainDeviceDefValidateControllerIDE(const virDomainControllerDef *controlle
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* qemuDomainCheckSCSIControllerIOThreads:
|
||||||
|
* @controller: Pointer to controller def
|
||||||
|
* @def: Pointer to domain def
|
||||||
|
*
|
||||||
|
* If this controller definition has iothreads set, let's make sure the
|
||||||
|
* configuration is right before adding to the command line
|
||||||
|
*
|
||||||
|
* Returns true if either supported or there are no iothreads for controller;
|
||||||
|
* otherwise, returns false if configuration is not quite right.
|
||||||
|
*/
|
||||||
|
static bool
|
||||||
|
qemuDomainCheckSCSIControllerIOThreads(const virDomainControllerDef *controller,
|
||||||
|
const virDomainDef *def)
|
||||||
|
{
|
||||||
|
if (!controller->iothread)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (controller->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
|
||||||
|
controller->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("IOThreads only available for virtio pci and "
|
||||||
|
"virtio ccw controllers"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Can we find the controller iothread in the iothreadid list? */
|
||||||
|
if (!virDomainIOThreadIDFind(def, controller->iothread)) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("controller iothread '%u' not defined in iothreadid"),
|
||||||
|
controller->iothread);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
qemuDomainDeviceDefValidateControllerSCSI(const virDomainControllerDef *controller,
|
||||||
|
const virDomainDef *def)
|
||||||
|
{
|
||||||
|
switch ((virDomainControllerModelSCSI) controller->model) {
|
||||||
|
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI:
|
||||||
|
if (!qemuDomainCheckSCSIControllerIOThreads(controller, def))
|
||||||
|
return -1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
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:
|
||||||
|
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI:
|
||||||
|
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI:
|
||||||
|
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078:
|
||||||
|
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemuDomainDeviceDefValidateController(const virDomainControllerDef *controller,
|
qemuDomainDeviceDefValidateController(const virDomainControllerDef *controller,
|
||||||
const virDomainDef *def,
|
const virDomainDef *def,
|
||||||
@ -4069,8 +4131,11 @@ qemuDomainDeviceDefValidateController(const virDomainControllerDef *controller,
|
|||||||
ret = qemuDomainDeviceDefValidateControllerIDE(controller, def);
|
ret = qemuDomainDeviceDefValidateControllerIDE(controller, def);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CONTROLLER_TYPE_FDC:
|
|
||||||
case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
|
case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
|
||||||
|
ret = qemuDomainDeviceDefValidateControllerSCSI(controller, def);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_CONTROLLER_TYPE_FDC:
|
||||||
case VIR_DOMAIN_CONTROLLER_TYPE_SATA:
|
case VIR_DOMAIN_CONTROLLER_TYPE_SATA:
|
||||||
case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL:
|
case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL:
|
||||||
case VIR_DOMAIN_CONTROLLER_TYPE_CCID:
|
case VIR_DOMAIN_CONTROLLER_TYPE_CCID:
|
||||||
|
Loading…
Reference in New Issue
Block a user