[PATCHv5 10/13] Add compatibility attribute to rng devices

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

 



<rng model='virtio'>
  <driver compatibility='modern'/>
  <backend model='random'>/dev/random</backend>
</rng>

https://bugzilla.redhat.com/show_bug.cgi?id=1227354
---
 docs/formatdomain.html.in                                   | 7 +++++++
 docs/schemas/domaincommon.rng                               | 5 +++++
 src/conf/domain_conf.c                                      | 8 ++++++++
 src/conf/domain_conf.h                                      | 1 +
 tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml     | 5 +++++
 tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml | 4 ++++
 6 files changed, 30 insertions(+)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index fa7e2bb..41a9325 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -6532,6 +6532,13 @@ qemu-kvm -net nic,model=? /dev/null
           </dd>
         </dl>
       </dd>
+      <dt><code>driver</code></dt>
+      <dd>
+        The <code>compatibility</code> attribute of the <code>driver</code>
+        element can be used to specify the compatibility of virtio devices.
+        Allowed values are <code>legacy</code>, <code>transitional</code>
+        and <code>modern</code>. <span class="since">Since 2.2.0</span>.
+      </dd>
 
     </dl>
 
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 1b305a2..ed00ace 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4798,6 +4798,11 @@
       <interleave>
         <ref name="rng-backend"/>
         <optional>
+          <element name="driver">
+            <ref name="compatibility"/>
+          </element>
+        </optional>
+        <optional>
           <ref name="rng-rate"/>
         </optional>
         <optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 885430d..166f5fb 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12044,6 +12044,9 @@ virDomainRNGDefParseXML(xmlNodePtr node,
     if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
         goto error;
 
+    if (virDomainDriverCompatibilityParseXML(ctxt, &def->compatibility) < 0)
+        goto error;
+
  cleanup:
     VIR_FREE(model);
     VIR_FREE(backend);
@@ -21749,6 +21752,11 @@ virDomainRNGDefFormat(virBufferPtr buf,
         break;
     }
 
+    if (def->compatibility) {
+        virBufferAsprintf(buf, "<driver compatibility='%s'/>",
+                          virDomainDriverCompatibilityTypeToString(def->compatibility));
+    }
+
     if (virDomainDeviceInfoNeedsFormat(&def->info, flags)) {
         if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
             return -1;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index e7c0ba2..342218e 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1947,6 +1947,7 @@ struct _virDomainRNGDef {
     } source;
 
     virDomainDeviceInfo info;
+    virDomainDriverCompatibility compatibility;
 };
 
 typedef enum {
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
index 02b5598..5b9726a 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
@@ -95,5 +95,10 @@
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
       <driver compatibility='transitional'/>
     </memballoon>
+    <rng model='virtio'>
+      <backend model='random'>/dev/random</backend>
+      <driver compatibility='modern'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/>
+    </rng>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
index 02b5598..ab69bb7 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
@@ -95,5 +95,9 @@
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
       <driver compatibility='transitional'/>
     </memballoon>
+    <rng model='virtio'>
+      <backend model='random'>/dev/random</backend>
+      <driver compatibility='modern'/><address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/>
+    </rng>
   </devices>
 </domain>
-- 
2.7.3

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