qemu_command.c: move LUN and IDE checks to qemu_validate.c

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Daniel Henrique Barboza 2020-10-08 13:02:12 -03:00
parent ccb08c3818
commit c9fbb07bab
3 changed files with 23 additions and 18 deletions

View File

@ -1561,12 +1561,6 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
switch ((virDomainDiskBus) disk->bus) {
case VIR_DOMAIN_DISK_BUS_IDE:
if (disk->info.addr.drive.target != 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("target must be 0 for ide controller"));
return NULL;
}
if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
virBufferAddLit(&opt, "ide-cd");
else
@ -1590,15 +1584,6 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
break;
case VIR_DOMAIN_DISK_BUS_SCSI:
if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_BLOCK)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("This QEMU doesn't support scsi-block for "
"lun passthrough"));
return NULL;
}
}
controllerModel = qemuDomainFindSCSIControllerModel(def, &disk->info);
if (controllerModel < 0)
return NULL;

View File

@ -2112,6 +2112,15 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDomainDiskDef *disk,
return -1;
}
if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_BLOCK)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("This QEMU doesn't support scsi-block for "
"lun passthrough"));
return -1;
}
if (disk->copy_on_read == VIR_TRISTATE_SWITCH_ON) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("copy_on_read is not compatible with 'lun' disk '%s'"),
@ -2165,6 +2174,11 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDomainDiskDef *disk,
_("Only 1 IDE controller is supported"));
return -1;
}
if (disk->info.addr.drive.target != 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("target must be 0 for ide controller"));
return -1;
}
break;
case VIR_DOMAIN_DISK_BUS_FDC:

View File

@ -344,7 +344,8 @@ mymain(void)
DO_TEST_CAPS_VER("disk-cache", "2.12.0");
DO_TEST_CAPS_LATEST("disk-cache");
DO_TEST("disk-network-nbd", NONE);
DO_TEST("disk-network-iscsi", QEMU_CAPS_VIRTIO_SCSI);
DO_TEST("disk-network-iscsi", QEMU_CAPS_VIRTIO_SCSI,
QEMU_CAPS_SCSI_BLOCK);
DO_TEST("disk-network-gluster", NONE);
DO_TEST("disk-network-rbd", NONE);
DO_TEST("disk-network-source-auth", NONE);
@ -355,7 +356,9 @@ mymain(void)
DO_TEST("disk-nvme", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_QCOW2_LUKS);
DO_TEST_CAPS_LATEST("disk-scsi");
DO_TEST("disk-virtio-scsi-reservations",
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_PR_MANAGER_HELPER);
QEMU_CAPS_VIRTIO_SCSI,
QEMU_CAPS_PR_MANAGER_HELPER,
QEMU_CAPS_SCSI_BLOCK);
DO_TEST("controller-virtio-scsi", QEMU_CAPS_VIRTIO_SCSI);
DO_TEST("disk-virtio-s390-zpci",
QEMU_CAPS_DEVICE_ZPCI,
@ -660,7 +663,10 @@ mymain(void)
DO_TEST("numad-static-vcpu-no-numatune", NONE);
DO_TEST("disk-scsi-lun-passthrough-sgio",
QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN);
QEMU_CAPS_SCSI_LSI,
QEMU_CAPS_VIRTIO_SCSI,
QEMU_CAPS_SCSI_DISK_WWN,
QEMU_CAPS_SCSI_BLOCK);
DO_TEST("disk-scsi-disk-vpd",
QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN);
DO_TEST("disk-source-pool", NONE);