On Fri, Mar 06, 2015 at 15:22:50 +0100, Francesco Romani wrote: > Management applications, like oVirt, may need to setup cpu quota > limits to enforce QoS for domains. > > For this purpose, management applications also need to check how > domains are behaving with respect to CPU quota. This data is available > using the virDomainGetSchedulerParameters API. > > This patch adds a new group to bulk stats API to obtain the same > information. > > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1191428 > --- > include/libvirt/libvirt-domain.h | 1 + > src/libvirt-domain.c | 16 ++++++++ > src/qemu/qemu_driver.c | 84 ++++++++++++++++++++++++++++++++++++++++ > tools/virsh-domain-monitor.c | 7 ++++ > tools/virsh.pod | 10 ++++- > 5 files changed, 117 insertions(+), 1 deletion(-) > > diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h > index a9d3efd..a283f93 100644 > --- a/include/libvirt/libvirt-domain.h > +++ b/include/libvirt/libvirt-domain.h > @@ -1723,6 +1723,7 @@ typedef enum { > VIR_DOMAIN_STATS_VCPU = (1 << 3), /* return domain virtual CPU info */ > VIR_DOMAIN_STATS_INTERFACE = (1 << 4), /* return domain interfaces info */ > VIR_DOMAIN_STATS_BLOCK = (1 << 5), /* return domain block info */ > + VIR_DOMAIN_STATS_TUNE_CPU = (1 << 6), /* return domain CPU tuning info */ > } virDomainStatsTypes; > > typedef enum { > diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c > index 89d1eab..b451299 100644 > --- a/src/libvirt-domain.c > +++ b/src/libvirt-domain.c > @@ -11004,6 +11004,22 @@ virConnectGetDomainCapabilities(virConnectPtr conn, > * "block.<num>.physical" - physical size in bytes of the container of the > * backing image as unsigned long long. > * > + * VIR_DOMAIN_STATS_TUNE_CPU: Return CPU tuning statistics > + * and usage information. > + * The typed parameter keys are in this format: > + * "tune.vcpu.quota" - max allowed bandwidth, in microseconds, as > + * long long integer. -1 means 'infinite'. > + * "tune.vcpu.period" - timeframe on which the virtual cpu quota is > + * enforced, in microseconds, as unsigned long long. > + * "tune.emu.quota" - max allowed bandwidth for emulator threads, > + * in microseconds, as long long integer. > + * -1 means 'infinite'. > + * "tune.emu.period" - timeframe on which the emulator quota is > + * enforced, in microseconds, as unsigned long long. > + * "tune.cpu.shares" - weight of this domain. This value is meaningful > + * only if compared with the other values of > + * the running domains. Expressed as unsigned long long. > + * These options above represent configuration and not any statistic value, so they won't change unless libvirt is instructed to change them. I don't think they belong to the stats API. Additionally libvirt recently added an event to track change of the tunables. See virConnectDomainEventTunableCallback. http://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEventTunableCallback http://libvirt.org/html/libvirt-libvirt-domain.html#VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES http://libvirt.org/html/libvirt-libvirt-domain.html#VIR_DOMAIN_TUNABLE_CPU_EMULATORPIN and so on ... I think you want to use that event and leave this api for statistics only. NACK Peter
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list