mirror of https://gitee.com/openkylin/libvirt.git
qemu_command.c: move DISK_BUS_SATA validation to qemu_validate.c
A few tweaks were made during the move: - the error messages were changed to mention 'sata controller' instead of 'ide controller'; - a check for address type 'drive' was added like it is done with other bus types. The error message of qemuxml2argdata was updated to reflect that now, instead of erroring it out from the common code in virDomainDiskDefValidate(), we're failing earlier with a different error message. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
cd97692000
commit
da1748cab1
|
@ -1634,17 +1634,6 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
|||
break;
|
||||
|
||||
case VIR_DOMAIN_DISK_BUS_SATA:
|
||||
if (disk->info.addr.drive.bus != 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("bus must be 0 for ide controller"));
|
||||
return NULL;
|
||||
}
|
||||
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
|
||||
|
|
|
@ -2243,6 +2243,25 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDomainDiskDef *disk,
|
|||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DISK_BUS_SATA:
|
||||
if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("unexpected address type for sata disk"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (disk->info.addr.drive.bus != 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("bus must be 0 for sata controller"));
|
||||
return -1;
|
||||
}
|
||||
if (disk->info.addr.drive.target != 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("target must be 0 for sata controller"));
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DISK_BUS_VIRTIO:
|
||||
case VIR_DOMAIN_DISK_BUS_XEN:
|
||||
case VIR_DOMAIN_DISK_BUS_SD:
|
||||
|
|
|
@ -1 +1 @@
|
|||
unsupported configuration: Invalid address type 'pci' for the disk 'sda' with the bus type 'sata'
|
||||
internal error: unexpected address type for sata disk
|
||||
|
|
Loading…
Reference in New Issue