[PATCH 1/2] docs, schema, conf: Add support for PMU feature

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

 



Just a new feature that can be turned on/off.

https://bugzilla.redhat.com/show_bug.cgi?id=1178853

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 docs/formatdomain.html.in                          |  6 ++++++
 docs/schemas/domaincommon.rng                      | 11 ++++++++++
 src/conf/domain_conf.c                             |  8 +++++--
 src/conf/domain_conf.h                             |  3 ++-
 .../qemuxml2argv-pmu-feature-off.xml               | 25 ++++++++++++++++++++++
 .../qemuxml2argvdata/qemuxml2argv-pmu-feature.xml  | 25 ++++++++++++++++++++++
 .../qemuxml2xmlout-pmu-feature.xml                 | 25 ++++++++++++++++++++++
 tests/qemuxml2xmltest.c                            |  3 +++
 8 files changed, 103 insertions(+), 3 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pmu-feature-off.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pmu-feature.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pmu-feature.xml

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 21a557e..4efefa4 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1444,6 +1444,12 @@
         </tr>
       </table>
       </dd>
+      <dt><code>pmu</code></dt>
+      <dd>Depending on the <code>state</code> attribute (values <code>on</code>,
+        <code>off</code>, default <code>on</code>) enable or disable the
+        performance monitoring unit for the guest.
+        <span class="since">Since 1.2.12</span>
+      </dd>
     </dl>

     <h3><a name="elementsTime">Time keeping</a></h3>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 85b3709..d250e6f 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4079,6 +4079,9 @@
           <optional>
             <ref name="capabilities"/>
           </optional>
+          <optional>
+            <ref name="pmu"/>
+          </optional>
         </interleave>
       </element>
     </optional>
@@ -4904,6 +4907,14 @@
     </element>
   </define>

+  <define name="pmu">
+    <element name="pmu">
+      <optional>
+        <ref name="featurestate"/>
+      </optional>
+    </element>
+  </define>
+
   <define name="featurestate">
     <attribute name="state">
       <ref name="virOnOff"/>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 57e99e6..96d80a9 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1,7 +1,7 @@
 /*
  * domain_conf.c: domain XML processing
  *
- * Copyright (C) 2006-2014 Red Hat, Inc.
+ * Copyright (C) 2006-2015 Red Hat, Inc.
  * Copyright (C) 2006-2008 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -162,7 +162,8 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST,
               "hyperv",
               "kvm",
               "pvspinlock",
-              "capabilities")
+              "capabilities",
+              "pmu")

 VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, VIR_DOMAIN_CAPABILITIES_POLICY_LAST,
               "default",
@@ -13305,6 +13306,8 @@ virDomainDefParseXML(xmlDocPtr xml,
             }
             ctxt->node = node;
             break;
+
+        case VIR_DOMAIN_FEATURE_PMU:
         case VIR_DOMAIN_FEATURE_PVSPINLOCK:
             node = ctxt->node;
             ctxt->node = nodes[i];
@@ -19761,6 +19764,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,

                 break;

+            case VIR_DOMAIN_FEATURE_PMU:
             case VIR_DOMAIN_FEATURE_PVSPINLOCK:
                 switch ((virTristateSwitch) def->features[i]) {
                 case VIR_TRISTATE_SWITCH_LAST:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ac1f4f8..5cc42d1 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1,7 +1,7 @@
 /*
  * domain_conf.h: domain XML processing
  *
- * Copyright (C) 2006-2014 Red Hat, Inc.
+ * Copyright (C) 2006-2015 Red Hat, Inc.
  * Copyright (C) 2006-2008 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -1611,6 +1611,7 @@ typedef enum {
     VIR_DOMAIN_FEATURE_KVM,
     VIR_DOMAIN_FEATURE_PVSPINLOCK,
     VIR_DOMAIN_FEATURE_CAPABILITIES,
+    VIR_DOMAIN_FEATURE_PMU,

     VIR_DOMAIN_FEATURE_LAST
 } virDomainFeature;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pmu-feature-off.xml b/tests/qemuxml2argvdata/qemuxml2argv-pmu-feature-off.xml
new file mode 100644
index 0000000..2f16023
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pmu-feature-off.xml
@@ -0,0 +1,25 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+    <pmu state='off'/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pmu-feature.xml b/tests/qemuxml2argvdata/qemuxml2argv-pmu-feature.xml
new file mode 100644
index 0000000..8a84703
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pmu-feature.xml
@@ -0,0 +1,25 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+    <pmu/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pmu-feature.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pmu-feature.xml
new file mode 100644
index 0000000..7f23253
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pmu-feature.xml
@@ -0,0 +1,25 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>6</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <features>
+    <acpi/>
+    <pmu state='on'/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 1166534..0551ac3 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -202,6 +202,9 @@ mymain(void)
     DO_TEST("kvm-features");
     DO_TEST("kvm-features-off");

+    DO_TEST_DIFFERENT("pmu-feature");
+    DO_TEST("pmu-feature-off");
+
     DO_TEST("hugepages");
     DO_TEST("hugepages-pages");
     DO_TEST("hugepages-pages2");
-- 
2.2.1

--
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]