[PATCH 10/18] add virtio-related options to memballoon

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

 



https://bugzilla.redhat.com/show_bug.cgi?id=1283251
---
 docs/formatdomain.html.in                           |  7 +++++++
 docs/schemas/domaincommon.rng                       |  5 +++++
 src/conf/domain_conf.c                              | 21 +++++++++++++++++++++
 src/conf/domain_conf.h                              |  1 +
 .../qemuxml2argv-virtio-options.xml                 |  1 +
 .../qemuxml2xmlout-virtio-options.xml               |  1 +
 6 files changed, 36 insertions(+)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index dcc2e5e..c286f50 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -6916,6 +6916,7 @@ qemu-kvm -net nic,model=? /dev/null
     <memballoon model='virtio'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
       <stats period='10'/>
+      <driver iommu_platform='on' ats='on'/>
     </memballoon>
   </devices>
 &lt;/domain&gt;</pre>
@@ -6960,6 +6961,12 @@ qemu-kvm -net nic,model=? /dev/null
           <span class='since'>Since 1.1.1, requires QEMU 1.5</span>
         </p>
       </dd>
+      <dt><code>driver</code></dt>
+      <dd>
+        For model <code>virtio</code> memballoon,
+        <a href="#elementsVirtio">Virtio-specific options</a> can also be
+        set. (<span class="since">Since 3.5.0</span>)
+      </dd>
     </dl>
     <h4><a name="elementsRng">Random number generator device</a></h4>
 
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index d7f3b02..5b424c7 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3784,6 +3784,11 @@
             </attribute>
           </element>
         </optional>
+        <optional>
+          <element name="driver">
+            <ref name="virtioOptions"/>
+          </element>
+        </optional>
       </interleave>
     </element>
   </define>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a83f7dc..ae7cb14 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2284,6 +2284,7 @@ void virDomainMemballoonDefFree(virDomainMemballoonDefPtr def)
         return;
 
     virDomainDeviceInfoClear(&def->info);
+    VIR_FREE(def->virtio);
 
     VIR_FREE(def);
 }
@@ -12947,6 +12948,9 @@ virDomainMemballoonDefParseXML(xmlNodePtr node,
     else if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
         goto error;
 
+    if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0)
+        goto error;
+
  cleanup:
     VIR_FREE(model);
     VIR_FREE(deflate);
@@ -22896,6 +22900,23 @@ virDomainMemballoonDefFormat(virBufferPtr buf,
         return -1;
     }
 
+    if (def->virtio) {
+        virBuffer driverBuf = VIR_BUFFER_INITIALIZER;
+
+        virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
+        virBufferTrim(&driverBuf, " ", -1);
+
+        if (virBufferCheckError(&driverBuf) < 0) {
+            virBufferFreeAndReset(&childrenBuf);
+            return -1;
+        }
+        if (virBufferUse(&driverBuf)) {
+            virBufferAddLit(&childrenBuf, "<driver ");
+            virBufferAddBuffer(&childrenBuf, &driverBuf);
+            virBufferAddLit(&childrenBuf, "/>\n");
+        }
+    }
+
     if (!virBufferUse(&childrenBuf)) {
         virBufferAddLit(buf, "/>\n");
     } else {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 68f8d0c..3a95c64 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1616,6 +1616,7 @@ struct _virDomainMemballoonDef {
     virDomainDeviceInfo info;
     int period; /* seconds between collections */
     int autodeflate; /* enum virTristateSwitch */
+    virDomainVirtioOptionsPtr virtio;
 };
 
 struct _virDomainNVRAMDef {
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
index a2bbbee..96ec700 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
@@ -85,6 +85,7 @@
     </video>
     <memballoon model='virtio'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
+      <driver iommu_platform='on' ats='on'/>
     </memballoon>
     <rng model='virtio'>
       <backend model='random'>/dev/random</backend>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-options.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-options.xml
index a2bbbee..96ec700 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-options.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-options.xml
@@ -85,6 +85,7 @@
     </video>
     <memballoon model='virtio'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
+      <driver iommu_platform='on' ats='on'/>
     </memballoon>
     <rng model='virtio'>
       <backend model='random'>/dev/random</backend>
-- 
2.10.2

--
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]
  Powered by Linux