Re: [PATCH 04/15] schema: allow pci address attributes to be in decimal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/30/2016 05:05 AM, Michal Privoznik wrote:
On 24.03.2016 20:25, Laine Stump wrote:
This is especially useful for "bus", since the bus of a device's pci
address is matched to the "index" of a controller to determine which
bus it will be connected to, and "index" is always specified in
decimal - being able to specify both in decimal at least makes it
easier to assure a device is being assigned to the correct bus when it
is added. For the other attributes, it is just a convenience.

(MB: the parser already allows for any of these attributes to be given
in decimal, and there are even examples floating around on the
internet that give them in decimal rather than hex (written in the
days before virsh did schema validation on all XML). This only updates
the schema to match the parser.)
---
  docs/schemas/basictypes.rng | 32 ++++++++++++++++++++------------
  1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
index 64babaf..e2936d8 100644
--- a/docs/schemas/basictypes.rng
+++ b/docs/schemas/basictypes.rng
@@ -282,24 +282,32 @@
    </define>
<define name="pciDomain">
-    <data type="string">
-      <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
-    </data>
+    <ref name="uint16"/>
    </define>
    <define name="pciBus">
-    <data type="string">
-      <param name="pattern">(0x)?[0-9a-fA-F]{1,2}</param>
-    </data>
+    <ref name="uint8"/>
    </define>
    <define name="pciSlot">
-    <data type="string">
-      <param name="pattern">(0x)?[0-1]?[0-9a-fA-F]</param>
-    </data>
+    <choice>
+      <data type="string">
+        <param name="pattern">(0x)?[0-1]?[0-9a-fA-F]</param>
+      </data>
+      <data type="int">
+        <param name="minInclusive">0</param>
+        <param name="maxInclusive">31</param>
+      </data>
+    </choice>
    </define>
    <define name="pciFunc">
-    <data type="string">
-      <param name="pattern">(0x)?[0-7]</param>
-    </data>
+    <choice>
+      <data type="string">
+        <param name="pattern">(0x)?[0-7]</param>
+      </data>
+      <data type="int">
+        <param name="minInclusive">0</param>
+        <param name="maxInclusive">7</param>
+      </data>
+    </choice>
    </define>
<define name='wwn'>

Okay, but we can never format them in decimal as '12' in decimal is
something different than in hexadecimal.

Correct. I think we're stuck with formatting the way it is (actually, since it's so common for PCI addresses to be in hex, if we were going to change anything it would be to format the index in hex, but even that would probably confuse some people).

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]