virDomain{Get,Set}PerfEvents: support --config --live --current

Now that we have @flags we can support changing perf events just
in active or inactive configuration regardless of the other.
Previously, calling virDomainSetPerfEvents set events in both
active and inactive configuration at once. Even though we allow
users to set perf events that are to be enabled once domain is
started up. The virDomainGetPerfEvents API was flawed too. It
returned just runtime info.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik committed 2016-03-31 10:42:46 +02:00
1 parent 30cd5983b7
commit ed504ba392
4 files changed
+71 -30

No files matched your search

+14
View File
@@ -8560,6 +8560,9 @@ static const vshCmdOptDef opts_perf[] = {
.type = VSH_OT_STRING,
.help = N_("perf events which will be disabled")
},
VIRSH_COMMON_OPT_DOMAIN_CONFIG,
VIRSH_COMMON_OPT_DOMAIN_LIVE,
VIRSH_COMMON_OPT_DOMAIN_CURRENT,
{.name = NULL}
};
@@ -8601,6 +8604,17 @@ cmdPerf(vshControl *ctl, const vshCmd *cmd)
bool ret = false;
const char *enable = NULL, *disable = NULL;
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
bool current = vshCommandOptBool(cmd, "current");
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
if (config)
flags |= VIR_DOMAIN_AFFECT_CONFIG;
if (live)
flags |= VIR_DOMAIN_AFFECT_LIVE;
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
return false;
+8
View File
@@ -2146,6 +2146,7 @@ Specifying -1 as a value for these limits is interpreted as unlimited.
=item B<perf> I<domain> [I<--enable> B<eventSpec>]
[I<--disable> B<eventSpec>]
[[I<--config>] [I<--live>] | [I<--current>]]
Get the current perf events setting or enable/disable specific perf
events for a guest domain.
@@ -2165,6 +2166,13 @@ separated by commas. However, just "cmt" event is supported presently. CMT is a
PQos (Platform Qos) feature to monitor the usage of cache by applications
running on the platform.
If I<--live> is specified, affect a running guest.
If I<--config> is specified, affect the next boot of a persistent guest.
If I<--current> is specified, affect the current guest state.
Both I<--live> and I<--config> flags may be given, but I<--current> is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
=item B<blkiotune> I<domain> [I<--weight> B<weight>]
[I<--device-weights> B<device-weights>]
[I<--device-read-iops-sec> B<device-read-iops-sec>]