[PATCH 4/8] Add virtio revision attribute to controllers

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

 



<controller type='scsi' index='0' model='virtio-scsi'>
    <virtio revision='0'/>
</controller>

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

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 6ddd7ef..703dd26 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3116,6 +3116,14 @@
       additional attributes that control specific features, such as:
     </p>
 
+    <p>
+      For virtio controllers, 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>
+
       <dl>
         <dt><code>virtio-serial</code></dt>
         <dd>The <code>virtio-serial</code> controller has two additional
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 41a00a2..c24a060 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1926,6 +1926,9 @@
             </optional>
           </element>
         </optional>
+        <optional>
+          <ref name="virtioRevision"/>
+        </optional>
       </interleave>
     </element>
   </define>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3a64c35..844cd4b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8285,6 +8285,9 @@ virDomainControllerDefParseXML(xmlNodePtr node,
         cur = cur->next;
     }
 
+    if (virDomainVirtioRevisionParseXML(ctxt, &def->virtio_rev) < 0)
+        goto error;
+
     /* node is parsed differently from target attributes because
      * someone thought it should be a subelement instead...
      */
@@ -20210,6 +20213,7 @@ virDomainControllerDefFormat(virBufferPtr buf,
             virBufferAsprintf(buf, "<pcihole64 unit='KiB'>%lu</"
                               "pcihole64>\n", def->opts.pciopts.pcihole64size);
         }
+        virDomainVirtioRevisionFormatXML(buf, def->virtio_rev);
 
         virBufferAdjustIndent(buf, -2);
         virBufferAddLit(buf, "</controller>\n");
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 0dbd3fd..18b5bbd 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -761,6 +761,7 @@ struct _virDomainControllerDef {
         virDomainUSBControllerOpts usbopts;
     } opts;
     virDomainDeviceInfo info;
+    virDomainVirtioRevision virtio_rev;
 };
 
 
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
index 691fd5b..b8fa986 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
@@ -28,12 +28,22 @@
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
       <virtio revision='1'/>
     </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source file='/var/lib/libvirt/images/img3'/>
+      <target dev='sda' bus='scsi'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
     <controller type='usb' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
     </controller>
     <controller type='ide' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
     </controller>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
+      <virtio revision='0'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <controller type='virtio-serial' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
index 691fd5b..b8fa986 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
@@ -28,12 +28,22 @@
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
       <virtio revision='1'/>
     </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source file='/var/lib/libvirt/images/img3'/>
+      <target dev='sda' bus='scsi'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
     <controller type='usb' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
     </controller>
     <controller type='ide' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
     </controller>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
+      <virtio revision='0'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <controller type='virtio-serial' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
-- 
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]