mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
xml: nodedev: make pci capability class element optional
Commit 3bd4ed46
introduced this element as required which
breaks backcompat for test driver. Let's make the element optional.
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
This commit is contained in:
parent
01e11ebcb6
commit
1193d9737b
@ -71,7 +71,7 @@
|
|||||||
include:
|
include:
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>class</code></dt>
|
<dt><code>class</code></dt>
|
||||||
<dd>Combined class, subclass and
|
<dd>Optional element for combined class, subclass and
|
||||||
programming interface codes as 6-digit hexadecimal number.
|
programming interface codes as 6-digit hexadecimal number.
|
||||||
<span class="since">Since 5.2.0</span></dd>
|
<span class="since">Since 5.2.0</span></dd>
|
||||||
<dt><code>domain</code></dt>
|
<dt><code>domain</code></dt>
|
||||||
|
@ -133,11 +133,13 @@
|
|||||||
<value>pci</value>
|
<value>pci</value>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
|
||||||
<element name='class'>
|
<optional>
|
||||||
<data type="string">
|
<element name='class'>
|
||||||
<param name="pattern">0x[0-9a-fA-F]{6}</param>
|
<data type="string">
|
||||||
</data>
|
<param name="pattern">0x[0-9a-fA-F]{6}</param>
|
||||||
</element>
|
</data>
|
||||||
|
</element>
|
||||||
|
</optional>
|
||||||
<element name='domain'>
|
<element name='domain'>
|
||||||
<ref name='unsignedLong'/>
|
<ref name='unsignedLong'/>
|
||||||
</element>
|
</element>
|
||||||
|
@ -208,7 +208,8 @@ virNodeDeviceCapPCIDefFormat(virBufferPtr buf,
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
virBufferAsprintf(buf, "<class>0x%.6x</class>\n", data->pci_dev.klass);
|
if (data->pci_dev.klass >= 0)
|
||||||
|
virBufferAsprintf(buf, "<class>0x%.6x</class>\n", data->pci_dev.klass);
|
||||||
virBufferAsprintf(buf, "<domain>%d</domain>\n",
|
virBufferAsprintf(buf, "<domain>%d</domain>\n",
|
||||||
data->pci_dev.domain);
|
data->pci_dev.domain);
|
||||||
virBufferAsprintf(buf, "<bus>%d</bus>\n", data->pci_dev.bus);
|
virBufferAsprintf(buf, "<bus>%d</bus>\n", data->pci_dev.bus);
|
||||||
@ -1645,16 +1646,16 @@ virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt,
|
|||||||
orignode = ctxt->node;
|
orignode = ctxt->node;
|
||||||
ctxt->node = node;
|
ctxt->node = node;
|
||||||
|
|
||||||
if (virNodeDevCapsDefParseHexId("string(./class[1])", ctxt,
|
if ((tmp = virXPathString("string(./class[1])", ctxt))) {
|
||||||
&pci_dev->klass, def,
|
if (virStrToLong_i(tmp, NULL, 16, &pci_dev->klass) < 0 ||
|
||||||
_("no PCI class supplied for '%s'"),
|
pci_dev->klass > 0xffffff) {
|
||||||
_("invalid PCI class supplied for '%s'")) < 0)
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
goto out;
|
_("invalid PCI class supplied for '%s'"), def->name);
|
||||||
|
goto out;
|
||||||
if (pci_dev->klass > 0xffffff) {
|
}
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
VIR_FREE(tmp);
|
||||||
_("invalid PCI class supplied for '%s'"), def->name);
|
} else {
|
||||||
goto out;
|
pci_dev->klass = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virNodeDevCapsDefParseULong("number(./domain[1])", ctxt,
|
if (virNodeDevCapsDefParseULong("number(./domain[1])", ctxt,
|
||||||
|
@ -153,7 +153,7 @@ struct _virNodeDevCapPCIDev {
|
|||||||
unsigned int function;
|
unsigned int function;
|
||||||
unsigned int product;
|
unsigned int product;
|
||||||
unsigned int vendor;
|
unsigned int vendor;
|
||||||
unsigned int klass;
|
int klass;
|
||||||
char *product_name;
|
char *product_name;
|
||||||
char *vendor_name;
|
char *vendor_name;
|
||||||
virPCIDeviceAddressPtr physical_function;
|
virPCIDeviceAddressPtr physical_function;
|
||||||
|
@ -402,7 +402,8 @@ udevProcessPCI(struct udev_device *device,
|
|||||||
privileged = driver->privileged;
|
privileged = driver->privileged;
|
||||||
nodeDeviceUnlock();
|
nodeDeviceUnlock();
|
||||||
|
|
||||||
if (udevGetUintProperty(device, "PCI_CLASS", &pci_dev->klass, 16) < 0)
|
pci_dev->klass = -1;
|
||||||
|
if (udevGetIntProperty(device, "PCI_CLASS", &pci_dev->klass, 16) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ((p = strrchr(def->sysfs_path, '/')) == NULL ||
|
if ((p = strrchr(def->sysfs_path, '/')) == NULL ||
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
<name>pci_0000_02_10_7</name>
|
<name>pci_0000_02_10_7</name>
|
||||||
<parent>pci_0000_00_04_0</parent>
|
<parent>pci_0000_00_04_0</parent>
|
||||||
<capability type='pci'>
|
<capability type='pci'>
|
||||||
<class>0xffffff</class>
|
|
||||||
<domain>0</domain>
|
<domain>0</domain>
|
||||||
<bus>2</bus>
|
<bus>2</bus>
|
||||||
<slot>16</slot>
|
<slot>16</slot>
|
||||||
|
Loading…
Reference in New Issue
Block a user