mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
qemu_command.c: move wwn validation 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:
parent
4bd0633211
commit
ccb08c3818
@ -1567,14 +1567,6 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disk->wwn &&
|
|
||||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_IDE_DRIVE_WWN)) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
||||||
_("Setting wwn for ide disk is not supported "
|
|
||||||
"by this QEMU"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
|
if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
|
||||||
virBufferAddLit(&opt, "ide-cd");
|
virBufferAddLit(&opt, "ide-cd");
|
||||||
else
|
else
|
||||||
@ -1607,25 +1599,6 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disk->wwn &&
|
|
||||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_WWN)) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
||||||
_("Setting wwn for scsi disk is not supported "
|
|
||||||
"by this QEMU"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Properties wwn, vendor and product were introduced in the
|
|
||||||
* same QEMU release (1.2.0).
|
|
||||||
*/
|
|
||||||
if ((disk->vendor || disk->product) &&
|
|
||||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_WWN)) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
||||||
_("Setting vendor or product for scsi disk is not "
|
|
||||||
"supported by this QEMU"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
controllerModel = qemuDomainFindSCSIControllerModel(def, &disk->info);
|
controllerModel = qemuDomainFindSCSIControllerModel(def, &disk->info);
|
||||||
if (controllerModel < 0)
|
if (controllerModel < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2066,13 +2066,40 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDomainDiskDef *disk,
|
|||||||
_("Only ide and scsi disk support wwn"));
|
_("Only ide and scsi disk support wwn"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (disk->bus == VIR_DOMAIN_DISK_BUS_IDE &&
|
||||||
|
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_IDE_DRIVE_WWN)) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("Setting wwn for ide disk is not supported "
|
||||||
|
"by this QEMU"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (disk->bus != VIR_DOMAIN_DISK_BUS_SCSI &&
|
||||||
|
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_WWN)) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("Setting wwn for scsi disk is not supported "
|
||||||
|
"by this QEMU"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((disk->vendor || disk->product) &&
|
if (disk->vendor || disk->product) {
|
||||||
disk->bus != VIR_DOMAIN_DISK_BUS_SCSI) {
|
if (disk->bus != VIR_DOMAIN_DISK_BUS_SCSI) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("Only scsi disk supports vendor and product"));
|
_("Only scsi disk supports vendor and product"));
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Properties wwn, vendor and product were introduced in the
|
||||||
|
* same QEMU release (1.2.0).
|
||||||
|
*/
|
||||||
|
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_WWN)) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("Setting vendor or product for scsi disk is not "
|
||||||
|
"supported by this QEMU"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
|
if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
|
||||||
|
@ -2252,7 +2252,9 @@ mymain(void)
|
|||||||
DO_TEST_PARSE_ERROR("mach-virt-serial-invalid-machine", NONE);
|
DO_TEST_PARSE_ERROR("mach-virt-serial-invalid-machine", NONE);
|
||||||
|
|
||||||
DO_TEST("disk-ide-split", NONE);
|
DO_TEST("disk-ide-split", NONE);
|
||||||
DO_TEST("disk-ide-wwn", QEMU_CAPS_IDE_DRIVE_WWN);
|
DO_TEST("disk-ide-wwn",
|
||||||
|
QEMU_CAPS_IDE_DRIVE_WWN,
|
||||||
|
QEMU_CAPS_SCSI_DISK_WWN);
|
||||||
|
|
||||||
DO_TEST("disk-geometry", NONE);
|
DO_TEST("disk-geometry", NONE);
|
||||||
DO_TEST("disk-blockio", QEMU_CAPS_BLOCKIO);
|
DO_TEST("disk-blockio", QEMU_CAPS_BLOCKIO);
|
||||||
|
Loading…
Reference in New Issue
Block a user