[virt-tools-list] [PATCH] virtinst: add KVM feature kvm_hint_dedicated

Menno Lageman menno.lageman at oracle.com
Tue Aug 13 06:57:13 UTC 2019


QEMU version 2.12.1 introduced a performance feature under commit
be7773268d98 ("target-i386: add KVM_HINTS_DEDICATED performance hint").
Support for this performance hint was added in libvirt 5.7.0 by commit
cb12c59dac04 ("qemu: support for kvm-hint-dedicated performance hint").

This patch extends virt-install's existing --features option to insert the
appropriate XML into the guest definition if this feature is specified
on the command line.

    E.g. --features='kvm_hint_dedicated=on' would result
    in the following XML:

      <features>
        ...
        <kvm>
          <hint-dedicated state='on'/>
        </kvm>
        ...
      </features>

Signed-off-by: Menno Lageman <menno.lageman at oracle.com>
---
 tests/cli-test-xml/compare/virt-install-singleton-config-1.xml | 3 +++
 tests/clitest.py                                               | 2 +-
 virtinst/cli.py                                                | 2 ++
 virtinst/domain/features.py                                    | 1 +
 4 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/cli-test-xml/compare/virt-install-singleton-config-1.xml b/tests/cli-test-xml/compare/virt-install-singleton-config-1.xml
index 2e0bfa2eae5d..2cb85fee5a45 100644
--- a/tests/cli-test-xml/compare/virt-install-singleton-config-1.xml
+++ b/tests/cli-test-xml/compare/virt-install-singleton-config-1.xml
@@ -31,6 +31,9 @@
   </os>
   <features>
     <acpi/>
+    <kvm>
+      <hint-dedicated state="on"/>
+    </kvm>
     <vmport state="off"/>
   </features>
   <cpu mode="custom" match="exact">
diff --git a/tests/clitest.py b/tests/clitest.py
index e5665630346e..e7da300fe07b 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -468,7 +468,7 @@ c.add_compare("""
 --security type=none,model=dac
 --numatune 1,2,3,5-7,^6
 --memorybacking hugepages=on
---features apic=off
+--features apic=off,kvm_hint_dedicated=on
 --clock offset=localtime
 --resource /virtualmachines/production
 --events on_crash=restart
diff --git a/virtinst/cli.py b/virtinst/cli.py
index d9b4d083661d..8f36c6ec283e 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -2422,6 +2422,7 @@ class ParserFeatures(VirtCLIParser):
         "pmu.state": "pmu",
         "vmport.state": "vmport",
         "kvm.hidden.state": "kvm_hidden",
+        "kvm.dedicated.state": "kvm_hint_dedicated",
         "gic.version": "gic_version",
         "smm.state": "smm",
         "vmcoreinfo.state": "vmcoreinfo",
@@ -2455,6 +2456,7 @@ class ParserFeatures(VirtCLIParser):
 
         cls.add_arg("vmport.state", "vmport", is_onoff=True)
         cls.add_arg("kvm.hidden.state", "kvm_hidden", is_onoff=True)
+        cls.add_arg("kvm.dedicated.state", "kvm_hint_dedicated", is_onoff=True)
         cls.add_arg("pvspinlock.state", "pvspinlock", is_onoff=True)
 
         cls.add_arg("gic.version", "gic_version")
diff --git a/virtinst/domain/features.py b/virtinst/domain/features.py
index d5590ab0ddeb..246839f20730 100644
--- a/virtinst/domain/features.py
+++ b/virtinst/domain/features.py
@@ -36,6 +36,7 @@ class DomainFeatures(XMLBuilder):
 
     vmport = XMLProperty("./vmport/@state", is_onoff=True)
     kvm_hidden = XMLProperty("./kvm/hidden/@state", is_onoff=True)
+    kvm_hint_dedicated = XMLProperty("./kvm/hint-dedicated/@state", is_onoff=True)
     pvspinlock = XMLProperty("./pvspinlock/@state", is_onoff=True)
 
     smm = XMLProperty("./smm/@state", is_onoff=True)
-- 
2.21.0




More information about the virt-tools-list mailing list