[libvirt] [PATCHv2 10/15] Add virtio-related options to filesystems

Ján Tomko jtomko at redhat.com
Tue Jun 6 11:36:24 UTC 2017


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

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 86e0bf8..ef30079 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3296,6 +3296,11 @@
             or "handle", but no formats. Virtuozzo driver supports
             a type of "ploop" with a format of "ploop".
           </li>
+          <li>
+          For virtio-backed devices,
+          <a href="#elementsVirtio">Virtio-specific options</a> can also be
+          set. (<span class="since">Since 3.5.0</span>)
+          </li>
         </ul>
       </dd>
 
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 01c35ae..3608f84 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2256,6 +2256,7 @@
           <value>immediate</value>
         </attribute>
       </optional>
+      <ref name='virtioOptions'/>
       <empty/>
     </element>
   </define>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a794595..e1b785a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1904,6 +1904,7 @@ void virDomainFSDefFree(virDomainFSDefPtr def)
     virStorageSourceFree(def->src);
     VIR_FREE(def->dst);
     virDomainDeviceInfoClear(&def->info);
+    VIR_FREE(def->virtio);
 
     VIR_FREE(def);
 }
@@ -9431,6 +9432,9 @@ virDomainFSDefParseXML(xmlNodePtr node,
             goto error;
     }
 
+    if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0)
+        goto error;
+
     def->src->path = source;
     source = NULL;
     def->dst = target;
@@ -21674,6 +21678,10 @@ virDomainFSDefFormat(virBufferPtr buf,
 
     }
 
+    virBufferAddLit(&driverBuf, " ");
+    virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
+    virBufferTrim(&driverBuf, " ", -1);
+
     if (virBufferUse(&driverBuf)) {
         virBufferAddLit(buf, "<driver");
         virBufferAddBuffer(buf, &driverBuf);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 0f57d76..b9ca8a0 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -883,6 +883,7 @@ struct _virDomainFSDef {
     unsigned long long space_hard_limit; /* in bytes */
     unsigned long long space_soft_limit; /* in bytes */
     bool symlinksResolved;
+    virDomainVirtioOptionsPtr virtio;
 };
 
 
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
index dd84ecd..4fc17d2 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
@@ -42,12 +42,13 @@
       <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
     </controller>
     <filesystem type='mount' accessmode='passthrough'>
+      <driver iommu_platform='on' ats='on'/>
       <source dir='/export/fs1'/>
       <target dir='fs1'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </filesystem>
     <filesystem type='mount' accessmode='mapped'>
-      <driver type='path' wrpolicy='immediate'/>
+      <driver type='path' wrpolicy='immediate' iommu_platform='on' ats='on'/>
       <source dir='/export/fs2'/>
       <target dir='fs2'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-options.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-options.xml
index dd84ecd..4fc17d2 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-options.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-options.xml
@@ -42,12 +42,13 @@
       <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
     </controller>
     <filesystem type='mount' accessmode='passthrough'>
+      <driver iommu_platform='on' ats='on'/>
       <source dir='/export/fs1'/>
       <target dir='fs1'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </filesystem>
     <filesystem type='mount' accessmode='mapped'>
-      <driver type='path' wrpolicy='immediate'/>
+      <driver type='path' wrpolicy='immediate' iommu_platform='on' ats='on'/>
       <source dir='/export/fs2'/>
       <target dir='fs2'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
-- 
2.10.2




More information about the libvir-list mailing list