提交 54f325e9 编写于 作者: A Andrea Bolognani

conf: nodedev: Set PCI_PHYSICAL_FUNCTION flag more carefully

Instead of setting the flag before parsing the PCI address, set
it afterwards. This ensure we can never end up in a situation
where the flag has been set but pci_dev.physical_function has
not been filled in.
上级 fc9ba9d5
...@@ -1293,8 +1293,6 @@ virNodeDevPCICapabilityParseXML(xmlXPathContextPtr ctxt, ...@@ -1293,8 +1293,6 @@ virNodeDevPCICapabilityParseXML(xmlXPathContextPtr ctxt,
if (VIR_ALLOC(data->pci_dev.physical_function) < 0) if (VIR_ALLOC(data->pci_dev.physical_function) < 0)
goto out; goto out;
data->pci_dev.flags |= VIR_NODE_DEV_CAP_FLAG_PCI_PHYSICAL_FUNCTION;
if (!address) { if (!address) {
virReportError(VIR_ERR_XML_ERROR, "%s", virReportError(VIR_ERR_XML_ERROR, "%s",
_("Missing address in 'phys_function' capability")); _("Missing address in 'phys_function' capability"));
...@@ -1304,6 +1302,8 @@ virNodeDevPCICapabilityParseXML(xmlXPathContextPtr ctxt, ...@@ -1304,6 +1302,8 @@ virNodeDevPCICapabilityParseXML(xmlXPathContextPtr ctxt,
if (virPCIDeviceAddressParseXML(address, if (virPCIDeviceAddressParseXML(address,
data->pci_dev.physical_function) < 0) data->pci_dev.physical_function) < 0)
goto out; goto out;
data->pci_dev.flags |= VIR_NODE_DEV_CAP_FLAG_PCI_PHYSICAL_FUNCTION;
} else if (STREQ(type, "virt_functions")) { } else if (STREQ(type, "virt_functions")) {
int naddresses; int naddresses;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册