[PATCH v2] Update xml schemas according to libvirt source

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

 



capability.rng: Guest features can be in any order.
nodedev.rng: Added <driver> element, <capability> phys_function and
virt_functions for PCI devices.
storagepool.rng: Owner or group ID can be -1.

schema tests: New capabilities and nodedev files; changed owner and
group to -1 in pool-dir.xml.
storage_conf: Print uid_t and gid_t as signed to storage pool XML.
---
v2: New tests and signed uid_t and gid_t printing. This feels slightly
less wrong than testing for 4294967295.
---
 docs/schemas/capability.rng                        |   76 ++++++------
 docs/schemas/nodedev.rng                           |   37 ++++++
 docs/schemas/storagepool.rng                       |   10 ++-
 src/conf/storage_conf.c                            |    8 +-
 tests/capabilityschemadata/caps-test2.xml          |  122 ++++++++++++++++++++
 .../pci_82579LM_network_adapter.xml                |   17 +++
 tests/storagepoolxml2xmlin/pool-dir.xml            |    4 +-
 tests/storagepoolxml2xmlout/pool-dir.xml           |    4 +-
 8 files changed, 231 insertions(+), 47 deletions(-)
 create mode 100644 tests/capabilityschemadata/caps-test2.xml
 create mode 100644 tests/nodedevschemadata/pci_82579LM_network_adapter.xml

diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng
index 06ff685..c392e44 100644
--- a/docs/schemas/capability.rng
+++ b/docs/schemas/capability.rng
@@ -296,43 +296,45 @@
 
   <define name='features'>
     <element name='features'>
-      <optional>
-        <element name='pae'>
-          <empty/>
-        </element>
-      </optional>
-      <optional>
-        <element name='nonpae'>
-          <empty/>
-        </element>
-      </optional>
-      <optional>
-        <element name='ia64_be'>
-          <empty/>
-        </element>
-      </optional>
-      <optional>
-        <element name='acpi'>
-          <ref name='featuretoggle'/>
-          <empty/>
-        </element>
-      </optional>
-      <optional>
-        <element name='apic'>
-          <ref name='featuretoggle'/>
-          <empty/>
-        </element>
-      </optional>
-      <optional>
-        <element name='cpuselection'>
-          <empty/>
-        </element>
-      </optional>
-      <optional>
-        <element name='deviceboot'>
-          <empty/>
-        </element>
-      </optional>
+      <interleave>
+        <optional>
+          <element name='pae'>
+            <empty/>
+          </element>
+        </optional>
+        <optional>
+          <element name='nonpae'>
+            <empty/>
+          </element>
+        </optional>
+        <optional>
+          <element name='ia64_be'>
+            <empty/>
+          </element>
+        </optional>
+        <optional>
+          <element name='acpi'>
+            <ref name='featuretoggle'/>
+            <empty/>
+          </element>
+        </optional>
+        <optional>
+          <element name='apic'>
+            <ref name='featuretoggle'/>
+            <empty/>
+          </element>
+        </optional>
+        <optional>
+          <element name='cpuselection'>
+            <empty/>
+          </element>
+        </optional>
+        <optional>
+          <element name='deviceboot'>
+            <empty/>
+          </element>
+        </optional>
+      </interleave>
     </element>
   </define>
 
diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng
index a73c2e5..c07a97d 100644
--- a/docs/schemas/nodedev.rng
+++ b/docs/schemas/nodedev.rng
@@ -15,6 +15,12 @@
         <element name="parent"><text/></element>
       </optional>
 
+      <optional>
+        <element name="driver">
+          <element name="name"><text/></element>
+        </element>
+      </optional>
+
       <zeroOrMore>
         <ref name="capability"/>
       </zeroOrMore>
@@ -115,6 +121,28 @@
       </choice>
     </element>
 
+    <optional>
+      <element name='capability'>
+        <attribute name='type'>
+          <value>phys_function</value>
+        </attribute>
+        <optional>
+          <ref name='address'/>
+        </optional>
+      </element>
+    </optional>
+
+    <optional>
+      <element name='capability'>
+        <attribute name='type'>
+          <value>virt_functions</value>
+        </attribute>
+        <optional>
+          <ref name='address'/>
+        </optional>
+      </element>
+    </optional>
+
   </define>
 
   <define name='capusbdev'>
@@ -369,6 +397,15 @@
     </element>
   </define>
 
+  <define name='address'>
+    <element name='address'>
+      <attribute name='domain'><ref name='hexuint'/></attribute>
+      <attribute name='bus'><ref name='hexuint'/></attribute>
+      <attribute name='slot'><ref name='hexuint'/></attribute>
+      <attribute name='function'><ref name='hexuint'/></attribute>
+    </element>
+  </define>
+
   <define name='hexuint'>
     <data type='string'>
       <param name="pattern">(0x)?[0-9a-f]+</param>
diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng
index 039798a..983f664 100644
--- a/docs/schemas/storagepool.rng
+++ b/docs/schemas/storagepool.rng
@@ -178,10 +178,16 @@
           <ref name='unsignedInt'/>
         </element>
         <element name='owner'>
-          <ref name='unsignedInt'/>
+          <choice>
+            <ref name='unsignedInt'/>
+            <value>-1</value>
+          </choice>
         </element>
         <element name='group'>
-          <ref name='unsignedInt'/>
+          <choice>
+            <ref name='unsignedInt'/>
+            <value>-1</value>
+          </choice>
         </element>
         <optional>
           <element name='label'>
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 7944555..b07a7aa 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1036,10 +1036,10 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def) {
         virBufferAddLit(&buf,"    <permissions>\n");
         virBufferAsprintf(&buf,"      <mode>0%o</mode>\n",
                           def->target.perms.mode);
-        virBufferAsprintf(&buf,"      <owner>%u</owner>\n",
-                          (unsigned int) def->target.perms.uid);
-        virBufferAsprintf(&buf,"      <group>%u</group>\n",
-                          (unsigned int) def->target.perms.gid);
+        virBufferAsprintf(&buf,"      <owner>%d</owner>\n",
+                          (int) def->target.perms.uid);
+        virBufferAsprintf(&buf,"      <group>%d</group>\n",
+                          (int) def->target.perms.gid);
 
         if (def->target.perms.label)
             virBufferAsprintf(&buf,"      <label>%s</label>\n",
diff --git a/tests/capabilityschemadata/caps-test2.xml b/tests/capabilityschemadata/caps-test2.xml
new file mode 100644
index 0000000..a99c1b8
--- /dev/null
+++ b/tests/capabilityschemadata/caps-test2.xml
@@ -0,0 +1,122 @@
+<capabilities>
+
+  <host>
+    <cpu>
+      <arch>x86_64</arch>
+      <model>SandyBridge</model>
+      <vendor>Intel</vendor>
+      <topology sockets='1' cores='2' threads='2'/>
+      <feature name='osxsave'/>
+      <feature name='pdcm'/>
+      <feature name='xtpr'/>
+      <feature name='tm2'/>
+      <feature name='est'/>
+      <feature name='smx'/>
+      <feature name='vmx'/>
+      <feature name='ds_cpl'/>
+      <feature name='monitor'/>
+      <feature name='dtes64'/>
+      <feature name='pbe'/>
+      <feature name='tm'/>
+      <feature name='ht'/>
+      <feature name='ss'/>
+      <feature name='acpi'/>
+      <feature name='ds'/>
+      <feature name='vme'/>
+    </cpu>
+    <power_management>
+      <suspend_mem/>
+    </power_management>
+    <migration_features>
+      <live/>
+      <uri_transports>
+        <uri_transport>tcp</uri_transport>
+      </uri_transports>
+    </migration_features>
+  </host>
+
+  <guest>
+    <os_type>hvm</os_type>
+    <arch name='i686'>
+      <wordsize>32</wordsize>
+      <emulator>/usr/bin/qemu-system-x86_64</emulator>
+      <machine>pc-1.2</machine>
+      <machine canonical='pc-1.2'>pc</machine>
+      <machine>pc-1.1</machine>
+      <machine>pc-1.0</machine>
+      <machine>pc-0.15</machine>
+      <machine>pc-0.14</machine>
+      <machine>pc-0.13</machine>
+      <machine>pc-0.12</machine>
+      <machine>pc-0.11</machine>
+      <machine>pc-0.10</machine>
+      <machine>isapc</machine>
+      <domain type='qemu'>
+      </domain>
+      <domain type='kvm'>
+        <emulator>/usr/libexec/qemu-kvm</emulator>
+        <machine>pc-1.2</machine>
+        <machine canonical='pc-1.2'>pc</machine>
+        <machine>pc-1.1</machine>
+        <machine>pc-1.0</machine>
+        <machine>pc-0.15</machine>
+        <machine>pc-0.14</machine>
+        <machine>pc-0.13</machine>
+        <machine>pc-0.12</machine>
+        <machine>pc-0.11</machine>
+        <machine>pc-0.10</machine>
+        <machine>isapc</machine>
+      </domain>
+    </arch>
+    <features>
+      <cpuselection/>
+      <deviceboot/>
+      <pae/>
+      <nonpae/>
+      <acpi default='on' toggle='yes'/>
+      <apic default='on' toggle='no'/>
+    </features>
+  </guest>
+
+  <guest>
+    <os_type>hvm</os_type>
+    <arch name='x86_64'>
+      <wordsize>64</wordsize>
+      <emulator>/usr/bin/qemu-system-x86_64</emulator>
+      <machine>pc-1.2</machine>
+      <machine canonical='pc-1.2'>pc</machine>
+      <machine>pc-1.1</machine>
+      <machine>pc-1.0</machine>
+      <machine>pc-0.15</machine>
+      <machine>pc-0.14</machine>
+      <machine>pc-0.13</machine>
+      <machine>pc-0.12</machine>
+      <machine>pc-0.11</machine>
+      <machine>pc-0.10</machine>
+      <machine>isapc</machine>
+      <domain type='qemu'>
+      </domain>
+      <domain type='kvm'>
+        <emulator>/usr/libexec/qemu-kvm</emulator>
+        <machine>pc-1.2</machine>
+        <machine canonical='pc-1.2'>pc</machine>
+        <machine>pc-1.1</machine>
+        <machine>pc-1.0</machine>
+        <machine>pc-0.15</machine>
+        <machine>pc-0.14</machine>
+        <machine>pc-0.13</machine>
+        <machine>pc-0.12</machine>
+        <machine>pc-0.11</machine>
+        <machine>pc-0.10</machine>
+        <machine>isapc</machine>
+      </domain>
+    </arch>
+    <features>
+      <cpuselection/>
+      <deviceboot/>
+      <acpi default='on' toggle='yes'/>
+      <apic default='on' toggle='no'/>
+    </features>
+  </guest>
+
+</capabilities>
diff --git a/tests/nodedevschemadata/pci_82579LM_network_adapter.xml b/tests/nodedevschemadata/pci_82579LM_network_adapter.xml
new file mode 100644
index 0000000..6e154d6
--- /dev/null
+++ b/tests/nodedevschemadata/pci_82579LM_network_adapter.xml
@@ -0,0 +1,17 @@
+<device>
+  <name>pci_0000_00_19_0</name>
+  <parent>computer</parent>
+  <driver>
+    <name>e1000e</name>
+  </driver>
+  <capability type='pci'>
+    <domain>0</domain>
+    <bus>0</bus>
+    <slot>25</slot>
+    <function>0</function>
+    <product id='0x1502'>82579LM Gigabit Network Connection</product>
+    <vendor id='0x8086'>Intel Corporation</vendor>
+    <capability type='virt_functions'>
+    </capability>
+  </capability>
+</device>
diff --git a/tests/storagepoolxml2xmlin/pool-dir.xml b/tests/storagepoolxml2xmlin/pool-dir.xml
index d86cc2a..e10ccb7 100644
--- a/tests/storagepoolxml2xmlin/pool-dir.xml
+++ b/tests/storagepoolxml2xmlin/pool-dir.xml
@@ -10,8 +10,8 @@
     <path>///var/////lib/libvirt/images//</path>
     <permissions>
       <mode>0700</mode>
-      <owner>0</owner>
-      <group>0</group>
+      <owner>-1</owner>
+      <group>-1</group>
       <label>some_label_t</label>
     </permissions>
   </target>
diff --git a/tests/storagepoolxml2xmlout/pool-dir.xml b/tests/storagepoolxml2xmlout/pool-dir.xml
index 85b9d8d..f81bc1d 100644
--- a/tests/storagepoolxml2xmlout/pool-dir.xml
+++ b/tests/storagepoolxml2xmlout/pool-dir.xml
@@ -10,8 +10,8 @@
     <path>/var/lib/libvirt/images</path>
     <permissions>
       <mode>0700</mode>
-      <owner>0</owner>
-      <group>0</group>
+      <owner>-1</owner>
+      <group>-1</group>
       <label>some_label_t</label>
     </permissions>
   </target>
-- 
1.7.8.6

--
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]