[PATCH 6/8] Add virtio revision attribute to intefaces

[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'/>
  <virtio revision='1'/>
</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 fa8124d..6c8ea15 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4012,6 +4012,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</code> and <code>1</code>.
+      <span class='since'>Since 2.2.0</span>
+    </p>
 
     <h5><a name="elementsNICSVirtual">Virtual network</a></h5>
 
@@ -6409,7 +6415,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</code> and <code>1</code>.
           <span class='since'>Since 2.2.0</span>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 24616a9..05351a0 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2372,6 +2372,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 7fa50d3..bb91b0c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9666,6 +9666,9 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
         goto error;
     }
 
+    if (virDomainVirtioRevisionParseXML(ctxt, &def->virtio_rev) < 0)
+        goto error;
+
  cleanup:
     ctxt->node = oldnode;
     VIR_FREE(macaddr);
@@ -21073,6 +21076,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 af46c64..880930f 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -991,6 +991,7 @@ struct _virDomainNetDef {
     virNetDevVlan vlan;
     int trustGuestRxFilters; /* enum virTristateBool */
     int linkstate;
+    virDomainVirtioRevision 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 2ee3533..2e13808 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'/>
     </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'/>
+    </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'/>
+    </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 2ee3533..2e13808 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'/>
     </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'/>
+    </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'/>
+    </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]