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

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

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index ba9e643..9998447 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4048,6 +4048,12 @@
       attribute <code>type='pci'</code>
       as <a href="#elementsAddress">documented above</a>.
     </p>
+    <p>
+      An optional <code>virtio</code> element can be used to enforce a 
particular
+      virtio revision in QEMU. The valid values for the <code>revision</code>
+      are <code>0.9</code> and <code>1.0</code>.
+      <span class='since'>Since 2.2.0</span>
+    </p>
 
     <h5><a name="elementsNICSVirtual">Virtual network</a></h5>
 
@@ -6445,7 +6451,7 @@ qemu-kvm -net nic,model=? /dev/null
       <dt><code>virtio</code></dt>
       <dd>
         <p>
-          An optional <code>virtio</code> can be used to enforce a particular
+          An optional <code>virtio</code> element can be used to enforce a 
particular
           virtio revision in QEMU. The valid values for the 
<code>revision</code>
           are <code>0.9</code> and <code>1.0</code>.
           <span class='since'>Since 2.2.0</span>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 58fc6e3..c106cc1 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2414,6 +2414,9 @@
           <ref name="virYesNo"/>
         </attribute>
       </optional>
+      <optional>
+        <ref name="virtioRevision"/>
+      </optional>
     </element>
   </define>
   <!--
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3ab2644..3400833 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9709,6 +9709,9 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
         goto error;
     }
 
+    if (virDomainVirtioRevisionParseXML(ctxt, &def->virtio_rev) < 0)
+        goto error;
+
  cleanup:
     ctxt->node = oldnode;
     VIR_FREE(macaddr);
@@ -21159,6 +21162,8 @@ virDomainNetDefFormat(virBufferPtr buf,
                                   | VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM) < 0)
         return -1;
 
+    virDomainVirtioRevisionFormatXML(buf, def->virtio_rev);
+
     virBufferAdjustIndent(buf, -2);
     virBufferAddLit(buf, "</interface>\n");
     return 0;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 0bdd6d6..0f116b7 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -993,6 +993,7 @@ struct _virDomainNetDef {
     virNetDevVlan vlan;
     int trustGuestRxFilters; /* enum virTristateBool */
     int linkstate;
+    virBitmapPtr virtio_rev;
 };
 
 /* 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 ad846e1..1f9f26f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
@@ -61,6 +61,18 @@
       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' 
function='0x0'/>
       <virtio revision='1.0'/>
     </filesystem>
+    <interface type='user'>
+      <mac address='52:54:56:58:5a:5c'/>
+      <model type='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' 
function='0x0'/>
+      <virtio revision='0.9'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:56:5a:5c:5e'/>
+      <model type='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' 
function='0x0'/>
+      <virtio revision='1.0'/>
+    </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 ad846e1..1f9f26f 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
@@ -61,6 +61,18 @@
       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' 
function='0x0'/>
       <virtio revision='1.0'/>
     </filesystem>
+    <interface type='user'>
+      <mac address='52:54:56:58:5a:5c'/>
+      <model type='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' 
function='0x0'/>
+      <virtio revision='0.9'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:56:5a:5c:5e'/>
+      <model type='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' 
function='0x0'/>
+      <virtio revision='1.0'/>
+    </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@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to