mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 13:47:13 +03:00
qemu: move ZPCI uid validation into device validation
The ZPCI device validation is specific to qemu. So, let us move the ZPCI uid validation out of domain xml parsing into qemu domain device validation. Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com> Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
076591009a
commit
5f9dd9d866
@ -77,9 +77,6 @@ virZPCIDeviceAddressParseXML(xmlNodePtr node,
|
||||
def.fid.isSet = true;
|
||||
}
|
||||
|
||||
if (!virZPCIDeviceAddressIsValid(&def))
|
||||
return -1;
|
||||
|
||||
addr->zpci = def;
|
||||
|
||||
return 0;
|
||||
|
@ -2841,7 +2841,6 @@ virPCIStubDriverTypeFromString;
|
||||
virPCIStubDriverTypeToString;
|
||||
virZPCIDeviceAddressIsIncomplete;
|
||||
virZPCIDeviceAddressIsPresent;
|
||||
virZPCIDeviceAddressIsValid;
|
||||
|
||||
|
||||
# util/virperf.h
|
||||
|
@ -1018,7 +1018,9 @@ static int
|
||||
qemuValidateDomainDeviceDefZPCIAddress(virDomainDeviceInfoPtr info,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
if (virZPCIDeviceAddressIsPresent(&info->addr.pci.zpci) &&
|
||||
virZPCIDeviceAddressPtr zpci = &info->addr.pci.zpci;
|
||||
|
||||
if (virZPCIDeviceAddressIsPresent(zpci) &&
|
||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_ZPCI)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s",
|
||||
@ -1026,6 +1028,20 @@ qemuValidateDomainDeviceDefZPCIAddress(virDomainDeviceInfoPtr info,
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* We don't need to check fid because fid covers
|
||||
* all range of uint32 type.
|
||||
*/
|
||||
if (zpci->uid.isSet &&
|
||||
(zpci->uid.value > VIR_DOMAIN_DEVICE_ZPCI_MAX_UID ||
|
||||
zpci->uid.value == 0)) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("Invalid PCI address uid='0x%.4x', "
|
||||
"must be > 0x0000 and <= 0x%.4x"),
|
||||
zpci->uid.value,
|
||||
VIR_DOMAIN_DEVICE_ZPCI_MAX_UID);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2167,26 +2167,6 @@ virPCIDeviceAddressParse(char *address,
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
virZPCIDeviceAddressIsValid(virZPCIDeviceAddressPtr zpci)
|
||||
{
|
||||
/* We don't need to check fid because fid covers
|
||||
* all range of uint32 type.
|
||||
*/
|
||||
if (zpci->uid.isSet &&
|
||||
(zpci->uid.value > VIR_DOMAIN_DEVICE_ZPCI_MAX_UID ||
|
||||
zpci->uid.value == 0)) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("Invalid PCI address uid='0x%.4x', "
|
||||
"must be > 0x0000 and <= 0x%.4x"),
|
||||
zpci->uid.value,
|
||||
VIR_DOMAIN_DEVICE_ZPCI_MAX_UID);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
virZPCIDeviceAddressIsIncomplete(const virZPCIDeviceAddress *addr)
|
||||
{
|
||||
|
@ -254,7 +254,6 @@ int virPCIDeviceAddressParse(char *address, virPCIDeviceAddressPtr bdf);
|
||||
|
||||
bool virZPCIDeviceAddressIsIncomplete(const virZPCIDeviceAddress *addr);
|
||||
bool virZPCIDeviceAddressIsPresent(const virZPCIDeviceAddress *addr);
|
||||
bool virZPCIDeviceAddressIsValid(virZPCIDeviceAddressPtr zpci);
|
||||
|
||||
int virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path,
|
||||
int pfNetDevIdx,
|
||||
|
Loading…
x
Reference in New Issue
Block a user