|
|
3e5111 |
From 51a842ccdf1c02ec00ba96217658b0db31a6addb Mon Sep 17 00:00:00 2001
|
|
|
3e5111 |
Message-Id: <51a842ccdf1c02ec00ba96217658b0db31a6addb@dist-git>
|
|
|
3e5111 |
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
|
|
3e5111 |
Date: Fri, 9 Jun 2017 12:49:02 +0200
|
|
|
3e5111 |
Subject: [PATCH] Add virtio-related options to disks
|
|
|
3e5111 |
MIME-Version: 1.0
|
|
|
3e5111 |
Content-Type: text/plain; charset=UTF-8
|
|
|
3e5111 |
Content-Transfer-Encoding: 8bit
|
|
|
3e5111 |
|
|
|
3e5111 |
https://bugzilla.redhat.com/show_bug.cgi?id=1283251
|
|
|
3e5111 |
|
|
|
3e5111 |
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
3e5111 |
(cherry picked from commit 1bc2cb3b3205dca7174147ac970e2b82c8af69da)
|
|
|
3e5111 |
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
|
|
3e5111 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
3e5111 |
---
|
|
|
3e5111 |
docs/formatdomain.html.in | 5 +++++
|
|
|
3e5111 |
docs/schemas/domaincommon.rng | 1 +
|
|
|
3e5111 |
src/conf/domain_conf.c | 15 +++++++++++++++
|
|
|
3e5111 |
src/conf/domain_conf.h | 1 +
|
|
|
3e5111 |
tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml | 2 +-
|
|
|
3e5111 |
5 files changed, 23 insertions(+), 1 deletion(-)
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
|
|
3e5111 |
index 2556f383fc..bb7a85a1a1 100644
|
|
|
3e5111 |
--- a/docs/formatdomain.html.in
|
|
|
3e5111 |
+++ b/docs/formatdomain.html.in
|
|
|
3e5111 |
@@ -3008,6 +3008,11 @@
|
|
|
3e5111 |
bus and "pci" or "ccw" address types.
|
|
|
3e5111 |
Since 1.2.8 (QEMU 2.1)
|
|
|
3e5111 |
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ For virtio disks,
|
|
|
3e5111 |
+ Virtio-specific options can also be
|
|
|
3e5111 |
+ set. (Since 3.5.0)
|
|
|
3e5111 |
+
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
backenddomain
|
|
|
3e5111 |
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
|
|
3e5111 |
index f571af6706..f838dc55fd 100644
|
|
|
3e5111 |
--- a/docs/schemas/domaincommon.rng
|
|
|
3e5111 |
+++ b/docs/schemas/domaincommon.rng
|
|
|
3e5111 |
@@ -1716,6 +1716,7 @@
|
|
|
3e5111 |
<optional>
|
|
|
3e5111 |
<ref name="detect_zeroes"/>
|
|
|
3e5111 |
</optional>
|
|
|
3e5111 |
+ <ref name="virtioOptions"/>
|
|
|
3e5111 |
<empty/>
|
|
|
3e5111 |
</element>
|
|
|
3e5111 |
</define>
|
|
|
3e5111 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
3e5111 |
index 4768d02029..a4b4f70855 100644
|
|
|
3e5111 |
--- a/src/conf/domain_conf.c
|
|
|
3e5111 |
+++ b/src/conf/domain_conf.c
|
|
|
3e5111 |
@@ -1745,6 +1745,7 @@ virDomainDiskDefFree(virDomainDiskDefPtr def)
|
|
|
3e5111 |
VIR_FREE(def->product);
|
|
|
3e5111 |
VIR_FREE(def->domain_name);
|
|
|
3e5111 |
VIR_FREE(def->blkdeviotune.group_name);
|
|
|
3e5111 |
+ VIR_FREE(def->virtio);
|
|
|
3e5111 |
virDomainDeviceInfoClear(&def->info);
|
|
|
3e5111 |
virObjectUnref(def->privateData);
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -4440,6 +4441,10 @@ virDomainDeviceDefPostParseInternal(virDomainDeviceDefPtr dev,
|
|
|
3e5111 |
}
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
+ if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO &&
|
|
|
3e5111 |
+ virDomainCheckVirtioOptions(disk->virtio) < 0)
|
|
|
3e5111 |
+ return -1;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
|
|
|
3e5111 |
virDomainDiskDefAssignAddress(xmlopt, disk, def) < 0)
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
@@ -8420,6 +8425,9 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|
|
3e5111 |
}
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
+ if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0)
|
|
|
3e5111 |
+ goto error;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
/* Disk volume types will have authentication information handled in
|
|
|
3e5111 |
* virStorageTranslateDiskSourcePool
|
|
|
3e5111 |
*/
|
|
|
3e5111 |
@@ -19146,6 +19154,10 @@ virDomainDiskDefCheckABIStability(virDomainDiskDefPtr src,
|
|
|
3e5111 |
return false;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
+ if (src->virtio && dst->virtio &&
|
|
|
3e5111 |
+ !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
|
|
3e5111 |
+ return false;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
|
|
|
3e5111 |
return false;
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -21307,6 +21319,9 @@ virDomainDiskDefFormat(virBufferPtr buf,
|
|
|
3e5111 |
virBufferAsprintf(&driverBuf, " iothread='%u'", def->iothread);
|
|
|
3e5111 |
if (def->detect_zeroes)
|
|
|
3e5111 |
virBufferAsprintf(&driverBuf, " detect_zeroes='%s'", detect_zeroes);
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
|
|
|
3e5111 |
+
|
|
|
3e5111 |
if (virBufferUse(&driverBuf)) {
|
|
|
3e5111 |
virBufferAddLit(buf, "
|
|
|
3e5111 |
virBufferAddBuffer(buf, &driverBuf);
|
|
|
3e5111 |
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
|
|
3e5111 |
index f1f9208b91..eac1919175 100644
|
|
|
3e5111 |
--- a/src/conf/domain_conf.h
|
|
|
3e5111 |
+++ b/src/conf/domain_conf.h
|
|
|
3e5111 |
@@ -668,6 +668,7 @@ struct _virDomainDiskDef {
|
|
|
3e5111 |
unsigned int iothread; /* unused = 0, > 0 specific thread # */
|
|
|
3e5111 |
int detect_zeroes; /* enum virDomainDiskDetectZeroes */
|
|
|
3e5111 |
char *domain_name; /* backend domain name */
|
|
|
3e5111 |
+ virDomainVirtioOptionsPtr virtio;
|
|
|
3e5111 |
};
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
|
|
|
3e5111 |
index b16a9847fe..6dd82de648 100644
|
|
|
3e5111 |
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
|
|
|
3e5111 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
|
|
|
3e5111 |
@@ -15,7 +15,7 @@
|
|
|
3e5111 |
<devices>
|
|
|
3e5111 |
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
|
|
3e5111 |
<disk type='file' device='disk'>
|
|
|
3e5111 |
- <driver name='qemu' type='raw'/>
|
|
|
3e5111 |
+ <driver name='qemu' type='raw' iommu='on' ats='on'/>
|
|
|
3e5111 |
<source file='/var/lib/libvirt/images/img1'/>
|
|
|
3e5111 |
<target dev='vda' bus='virtio'/>
|
|
|
3e5111 |
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
|
|
|
3e5111 |
--
|
|
|
3e5111 |
2.13.1
|
|
|
3e5111 |
|