mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 13:17:58 +03:00
conf: disk: Move validation of disk bus vs disk type
This commit is contained in:
parent
d9cab30a9c
commit
2d3557b251
@ -6925,6 +6925,22 @@ virDomainDiskDefValidate(const virDomainDiskDef *def)
|
||||
}
|
||||
}
|
||||
|
||||
if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
|
||||
def->bus != VIR_DOMAIN_DISK_BUS_FDC) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Invalid bus type '%s' for floppy disk"),
|
||||
virDomainDiskBusTypeToString(def->bus));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
|
||||
def->bus == VIR_DOMAIN_DISK_BUS_FDC) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Invalid bus type '%s' for disk"),
|
||||
virDomainDiskBusTypeToString(def->bus));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -7415,19 +7431,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
}
|
||||
}
|
||||
|
||||
if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
|
||||
def->bus != VIR_DOMAIN_DISK_BUS_FDC) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Invalid bus type '%s' for floppy disk"), bus);
|
||||
goto error;
|
||||
}
|
||||
if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
|
||||
def->bus == VIR_DOMAIN_DISK_BUS_FDC) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Invalid bus type '%s' for disk"), bus);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (devaddr) {
|
||||
if (virDomainParseLegacyDeviceAddress(devaddr,
|
||||
&def->info.addr.pci) < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user