2d1356
From f583c2a22e7ce86586aa30f3ee66b6a830778550 Mon Sep 17 00:00:00 2001
2d1356
Message-Id: <f583c2a22e7ce86586aa30f3ee66b6a830778550@dist-git>
2d1356
From: Martin Kletzander <mkletzan@redhat.com>
2d1356
Date: Mon, 23 May 2016 18:10:05 +0200
2d1356
Subject: [PATCH] nodedev: Fix parsing of generated XMLs
2d1356
2d1356
RHEL-7.2.z: https://bugzilla.redhat.com/show_bug.cgi?id=1331328
2d1356
2d1356
Commit d77ffb6876 added not only reporting of the PCI header type, but
2d1356
also parsing of that information.  However, because there was no parsing
2d1356
done for the other sub-PCI capabilities, if there was any other
2d1356
capability then a valid header type name (like phys_function or
2d1356
virt_functions) the parsing would fail.  This prevented passing node
2d1356
device XMLs that we generated into our own functions when dealing with,
2d1356
e.g. with SRIOV cards.
2d1356
2d1356
Instead of reworking the whole parsing, just fix this one occurence and
2d1356
remove a test for it for the time being.  Future patches will deal with
2d1356
the rest.
2d1356
2d1356
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2d1356
(cherry picked from commit 17a94ba70fc11c21f8ea70ff92131d0868f4cde1)
2d1356
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2d1356
---
2d1356
 src/conf/node_device_conf.c | 12 ------------
2d1356
 tests/nodedevxml2xmltest.c  |  2 --
2d1356
 2 files changed, 14 deletions(-)
2d1356
2d1356
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
2d1356
index feefb9a..fdea79e 100644
2d1356
--- a/src/conf/node_device_conf.c
2d1356
+++ b/src/conf/node_device_conf.c
2d1356
@@ -1328,18 +1328,6 @@ virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt,
2d1356
                                           _("invalid NUMA node ID supplied for '%s'")) < 0)
2d1356
         goto out;
2d1356
 
2d1356
-    if ((tmp = virXPathString("string(./capability[1]/@type)", ctxt))) {
2d1356
-        int hdrType = virPCIHeaderTypeFromString(tmp);
2d1356
-
2d1356
-        if (hdrType <= 0) {
2d1356
-            virReportError(VIR_ERR_INTERNAL_ERROR,
2d1356
-                           _("Unknown PCI header type '%s'"), tmp);
2d1356
-            goto out;
2d1356
-        }
2d1356
-
2d1356
-        data->pci_dev.hdrType = hdrType;
2d1356
-    }
2d1356
-
2d1356
     if ((pciExpress = virXPathNode("./pci-express[1]", ctxt))) {
2d1356
         if (VIR_ALLOC(pci_express) < 0)
2d1356
             goto out;
2d1356
diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c
2d1356
index d2cd444..a37d729 100644
2d1356
--- a/tests/nodedevxml2xmltest.c
2d1356
+++ b/tests/nodedevxml2xmltest.c
2d1356
@@ -91,8 +91,6 @@ mymain(void)
2d1356
     DO_TEST("usb_device_1d6b_1_0000_00_1d_0");
2d1356
     DO_TEST("pci_8086_4238_pcie_wireless");
2d1356
     DO_TEST("pci_8086_0c0c_snd_hda_intel");
2d1356
-    DO_TEST("pci_0000_00_02_0_header_type");
2d1356
-    DO_TEST("pci_0000_00_1c_0_header_type");
2d1356
 
2d1356
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
2d1356
 }
2d1356
-- 
2d1356
2.8.3
2d1356