diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 77ccb2def6..c867fb8a47 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3011,6 +3011,11 @@
bus
and "pci" or "ccw" address
types.
Since 1.2.8 (QEMU 2.1)
+
+ For virtio disks,
+ Virtio-specific options can also be
+ set. (Since 3.5.0)
+
backenddomain
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 7cea0c5e8e..d106550542 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1770,6 +1770,7 @@
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 58ba1da8a5..a03ed097cf 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1745,6 +1745,7 @@ virDomainDiskDefFree(virDomainDiskDefPtr def)
VIR_FREE(def->product);
VIR_FREE(def->domain_name);
VIR_FREE(def->blkdeviotune.group_name);
+ VIR_FREE(def->virtio);
virDomainDeviceInfoClear(&def->info);
virObjectUnref(def->privateData);
@@ -4467,6 +4468,10 @@ virDomainDeviceDefPostParseInternal(virDomainDeviceDefPtr dev,
}
}
+ if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO &&
+ virDomainCheckVirtioOptions(disk->virtio) < 0)
+ return -1;
+
if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
virDomainDiskDefAssignAddress(xmlopt, disk, def) < 0)
return -1;
@@ -8447,6 +8452,9 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
}
}
+ if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0)
+ goto error;
+
/* Disk volume types will have authentication information handled in
* virStorageTranslateDiskSourcePool
*/
@@ -19172,6 +19180,10 @@ virDomainDiskDefCheckABIStability(virDomainDiskDefPtr src,
return false;
}
+ if (src->virtio && dst->virtio &&
+ !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
+ return false;
+
if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
return false;
@@ -21360,6 +21372,9 @@ virDomainDiskDefFormat(virBufferPtr buf,
virBufferAsprintf(&driverBuf, " iothread='%u'", def->iothread);
if (def->detect_zeroes)
virBufferAsprintf(&driverBuf, " detect_zeroes='%s'", detect_zeroes);
+
+ virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
+
if (virBufferUse(&driverBuf)) {
virBufferAddLit(buf, " 0 specific thread # */
int detect_zeroes; /* enum virDomainDiskDetectZeroes */
char *domain_name; /* backend domain name */
+ virDomainVirtioOptionsPtr virtio;
};
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
index b16a9847fe..6dd82de648 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
@@ -15,7 +15,7 @@
/usr/bin/qemu-system-x86_64
-
+