[PATCHv5 09/13] Add compatibility attribute to interfaces

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

 



<interface type='user'>
  <mac address='52:54:56:5a:5c:5e'/>
  <model type='virtio'/>
  <driver compatibility='modern'/>
</interface>

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

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 81ca852..fa7e2bb 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4739,6 +4739,13 @@ qemu-kvm -net nic,model=? /dev/null
         <span class="since">virtio-net since 1.0.6 (QEMU and KVM only)</span>
         <span class="since">vhost-user since 1.2.17 (QEMU and KVM only)</span>
       </dd>
+      <dt><code>compatibility</code></dt>
+      <dd>
+        The <code>compatibility</code> attribute 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>
     <p>
       Offloading options for the host and guest can be configured using
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index baa9105..1b305a2 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2553,6 +2553,9 @@
               </optional>
             </group>
           </choice>
+          <optional>
+            <ref name="compatibility"/>
+          </optional>
           <interleave>
             <optional>
               <element name='host'>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2f3927a..885430d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9664,6 +9664,9 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
         goto error;
     }
 
+    if (virDomainDriverCompatibilityParseXML(ctxt, &def->compatibility) < 0)
+        goto error;
+
  cleanup:
     ctxt->node = oldnode;
     VIR_FREE(macaddr);
@@ -20832,7 +20835,10 @@ virDomainVirtioNetDriverFormat(char **outstr,
     }
     if (def->driver.virtio.queues)
         virBufferAsprintf(&buf, "queues='%u' ", def->driver.virtio.queues);
-
+    if (def->compatibility) {
+        virBufferAsprintf(&buf, "compatibility='%s'",
+                          virDomainDriverCompatibilityTypeToString(def->compatibility));
+    }
     virBufferTrim(&buf, " ", -1);
 
     if (virBufferCheckError(&buf) < 0)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 0a4017f..e7c0ba2 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -994,6 +994,7 @@ struct _virDomainNetDef {
     virNetDevVlan vlan;
     int trustGuestRxFilters; /* enum virTristateBool */
     int linkstate;
+    virDomainDriverCompatibility compatibility;
 };
 
 /* Used for prefix of ifname of any network name generated dynamically
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
index 98697ef..02b5598 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
@@ -58,6 +58,18 @@
       <target dir='fs2'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </filesystem>
+    <interface type='user'>
+      <mac address='52:54:56:58:5a:5c'/>
+      <model type='virtio'/>
+      <driver compatibility='legacy'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:56:5a:5c:5e'/>
+      <model type='virtio'/>
+      <driver compatibility='modern'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+    </interface>
     <input type='mouse' bus='virtio'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
     </input>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
index 98697ef..02b5598 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
@@ -58,6 +58,18 @@
       <target dir='fs2'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </filesystem>
+    <interface type='user'>
+      <mac address='52:54:56:58:5a:5c'/>
+      <model type='virtio'/>
+      <driver compatibility='legacy'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:56:5a:5c:5e'/>
+      <model type='virtio'/>
+      <driver compatibility='modern'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+    </interface>
     <input type='mouse' bus='virtio'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
     </input>
-- 
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]