<controller type='scsi' index='0' model='virtio-scsi'>
<virtio revision='0.9'/>
</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 922098a..6fa0c1a 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3150,6 +3150,14 @@
additional attributes that control specific features, such as:
</p>
+ <p>
+ For virtio controllers, optional <code>virtio</code> elements
+ 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>
+
<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 6b40553..4f4db8c 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1946,6 +1946,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 9ab1f5d..098c853 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8328,6 +8328,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...
*/
@@ -20296,6 +20299,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 4510d73..23f320b 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -763,6 +763,7 @@ struct _virDomainControllerDef {
virDomainUSBControllerOpts usbopts;
} opts;
virDomainDeviceInfo info;
+ virBitmapPtr virtio_rev;
};
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
index 1a8a3de..7972617 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.0'/>
</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.9'/>
+ </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 1a8a3de..7972617 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.0'/>
</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.9'/>
+ </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