There were few things done in the nodedev code but we were lacking tests
for it.  And because of that we missed that the schema was not updated
either.  Fix the schema and add various test files to show the schema
is correct.

Signed-off-by: Martin Kletzander <mklet...@redhat.com>
---
 docs/schemas/nodedev.rng                           |  7 ++++-
 tests/nodedevschemadata/pci_0000_02_10_7_sriov.xml | 23 +++++++++++++++++
 .../pci_0000_02_10_7_sriov_pf_vfs_all.xml          | 29 +++++++++++++++++++++
 ...i_0000_02_10_7_sriov_pf_vfs_all_header_type.xml | 30 ++++++++++++++++++++++
 .../pci_0000_02_10_7_sriov_vfs.xml                 | 26 +++++++++++++++++++
 .../pci_0000_02_10_7_sriov_zero_vfs_max_count.xml  | 21 +++++++++++++++
 6 files changed, 135 insertions(+), 1 deletion(-)
 create mode 100644 tests/nodedevschemadata/pci_0000_02_10_7_sriov.xml
 create mode 100644 
tests/nodedevschemadata/pci_0000_02_10_7_sriov_pf_vfs_all.xml
 create mode 100644 
tests/nodedevschemadata/pci_0000_02_10_7_sriov_pf_vfs_all_header_type.xml
 create mode 100644 tests/nodedevschemadata/pci_0000_02_10_7_sriov_vfs.xml
 create mode 100644 
tests/nodedevschemadata/pci_0000_02_10_7_sriov_zero_vfs_max_count.xml

diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng
index 6b9b54298b21..93a88d883056 100644
--- a/docs/schemas/nodedev.rng
+++ b/docs/schemas/nodedev.rng
@@ -143,8 +143,13 @@
           <value>virt_functions</value>
         </attribute>
         <optional>
-          <ref name='address'/>
+          <attribute name='maxCount'>
+            <ref name='unsignedInt'/>
+          </attribute>
         </optional>
+        <zeroOrMore>
+          <ref name='address'/>
+        </zeroOrMore>
       </element>
     </optional>

diff --git a/tests/nodedevschemadata/pci_0000_02_10_7_sriov.xml 
b/tests/nodedevschemadata/pci_0000_02_10_7_sriov.xml
new file mode 100644
index 000000000000..8f243b4d6119
--- /dev/null
+++ b/tests/nodedevschemadata/pci_0000_02_10_7_sriov.xml
@@ -0,0 +1,23 @@
+<device>
+  <name>pci_0000_02_10_7</name>
+  <parent>pci_0000_00_04_0</parent>
+  <capability type='pci'>
+    <domain>0</domain>
+    <bus>2</bus>
+    <slot>16</slot>
+    <function>7</function>
+    <product id='0x10ca'>82576 Virtual Function</product>
+    <vendor id='0x8086'>Intel Corporation</vendor>
+    <capability type='phys_function'>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x1'/>
+    </capability>
+    <iommuGroup number='31'>
+      <address domain='0x0000' bus='0x02' slot='0x10' function='0x7'/>
+    </iommuGroup>
+    <numa node='0'/>
+    <pci-express>
+      <link validity='cap' port='0' speed='2.5' width='4'/>
+      <link validity='sta' width='0'/>
+    </pci-express>
+  </capability>
+</device>
diff --git a/tests/nodedevschemadata/pci_0000_02_10_7_sriov_pf_vfs_all.xml 
b/tests/nodedevschemadata/pci_0000_02_10_7_sriov_pf_vfs_all.xml
new file mode 100644
index 000000000000..9e8dace020a1
--- /dev/null
+++ b/tests/nodedevschemadata/pci_0000_02_10_7_sriov_pf_vfs_all.xml
@@ -0,0 +1,29 @@
+<device>
+  <name>pci_0000_02_10_7</name>
+  <parent>pci_0000_00_04_0</parent>
+  <capability type='pci'>
+    <domain>0</domain>
+    <bus>2</bus>
+    <slot>16</slot>
+    <function>7</function>
+    <product id='0x10ca'>82576 Virtual Function</product>
+    <vendor id='0x8086'>Intel Corporation</vendor>
+    <capability type='phys_function'>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x1'/>
+    </capability>
+    <capability type='virt_functions' maxCount='7'>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x2'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x3'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x4'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x5'/>
+    </capability>
+    <iommuGroup number='31'>
+      <address domain='0x0000' bus='0x02' slot='0x10' function='0x7'/>
+    </iommuGroup>
+    <numa node='0'/>
+    <pci-express>
+      <link validity='cap' port='0' speed='2.5' width='4'/>
+      <link validity='sta' width='0'/>
+    </pci-express>
+  </capability>
+</device>
diff --git 
a/tests/nodedevschemadata/pci_0000_02_10_7_sriov_pf_vfs_all_header_type.xml 
b/tests/nodedevschemadata/pci_0000_02_10_7_sriov_pf_vfs_all_header_type.xml
new file mode 100644
index 000000000000..4e6323a3ecdd
--- /dev/null
+++ b/tests/nodedevschemadata/pci_0000_02_10_7_sriov_pf_vfs_all_header_type.xml
@@ -0,0 +1,30 @@
+<device>
+  <name>pci_0000_02_10_7</name>
+  <parent>pci_0000_00_04_0</parent>
+  <capability type='pci'>
+    <domain>0</domain>
+    <bus>2</bus>
+    <slot>16</slot>
+    <function>7</function>
+    <product id='0x10ca'>82576 Virtual Function</product>
+    <vendor id='0x8086'>Intel Corporation</vendor>
+    <capability type='phys_function'>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x1'/>
+    </capability>
+    <capability type='virt_functions' maxCount='7'>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x2'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x3'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x4'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x5'/>
+    </capability>
+    <capability type='pci-bridge'/>
+    <iommuGroup number='31'>
+      <address domain='0x0000' bus='0x02' slot='0x10' function='0x7'/>
+    </iommuGroup>
+    <numa node='0'/>
+    <pci-express>
+      <link validity='cap' port='0' speed='2.5' width='4'/>
+      <link validity='sta' width='0'/>
+    </pci-express>
+  </capability>
+</device>
diff --git a/tests/nodedevschemadata/pci_0000_02_10_7_sriov_vfs.xml 
b/tests/nodedevschemadata/pci_0000_02_10_7_sriov_vfs.xml
new file mode 100644
index 000000000000..355eaaad97d4
--- /dev/null
+++ b/tests/nodedevschemadata/pci_0000_02_10_7_sriov_vfs.xml
@@ -0,0 +1,26 @@
+<device>
+  <name>pci_0000_02_10_7</name>
+  <parent>pci_0000_00_04_0</parent>
+  <capability type='pci'>
+    <domain>0</domain>
+    <bus>2</bus>
+    <slot>16</slot>
+    <function>7</function>
+    <product id='0x10ca'>82576 Virtual Function</product>
+    <vendor id='0x8086'>Intel Corporation</vendor>
+    <capability type='virt_functions'>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x2'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x3'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x4'/>
+      <address domain='0x0000' bus='0x02' slot='0x00' function='0x5'/>
+    </capability>
+    <iommuGroup number='31'>
+      <address domain='0x0000' bus='0x02' slot='0x10' function='0x7'/>
+    </iommuGroup>
+    <numa node='0'/>
+    <pci-express>
+      <link validity='cap' port='0' speed='2.5' width='4'/>
+      <link validity='sta' width='0'/>
+    </pci-express>
+  </capability>
+</device>
diff --git 
a/tests/nodedevschemadata/pci_0000_02_10_7_sriov_zero_vfs_max_count.xml 
b/tests/nodedevschemadata/pci_0000_02_10_7_sriov_zero_vfs_max_count.xml
new file mode 100644
index 000000000000..e9eb122bfec9
--- /dev/null
+++ b/tests/nodedevschemadata/pci_0000_02_10_7_sriov_zero_vfs_max_count.xml
@@ -0,0 +1,21 @@
+<device>
+  <name>pci_0000_02_10_7</name>
+  <parent>pci_0000_00_04_0</parent>
+  <capability type='pci'>
+    <domain>0</domain>
+    <bus>2</bus>
+    <slot>16</slot>
+    <function>7</function>
+    <product id='0x10ca'>82576 Virtual Function</product>
+    <vendor id='0x8086'>Intel Corporation</vendor>
+    <capability type='virt_functions' maxCount='3'/>
+    <iommuGroup number='31'>
+      <address domain='0x0000' bus='0x02' slot='0x10' function='0x7'/>
+    </iommuGroup>
+    <numa node='0'/>
+    <pci-express>
+      <link validity='cap' port='0' speed='2.5' width='4'/>
+      <link validity='sta' width='0'/>
+    </pci-express>
+  </capability>
+</device>
-- 
2.8.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to