Hi,
Thank you, it sounds good. Can you please let me know how Openstack
Ceilometer will access that wait counter (vcpu.NNN.wait)? To my
understanding Openstack uses libvirt python library to access domain data.
Regards,
- Avi Weit
"Daniel P. Berrange" <berrange(a)redhat.com> wrote on 03/12/2015 01:01:16
PM:
From: "Daniel P. Berrange" <berrange(a)redhat.com>
To: Avi Weit/Haifa/IBM@IBMIL
Cc: libvir-list(a)redhat.com, gord(a)live.ca
Date: 03/12/2015 01:01 PM
Subject: Re: [libvirt] libvirt to report cpuWait of a guest.
On Thu, Dec 03, 2015 at 11:24:08AM +0200, Avi Weit wrote:
> Hi,
> We are working on fixing CPU utilization calculation of
guests (VMs)
in
> Ceilometer metering service of OpenStack.
> Per that fix, we retrieve, at the host level,
se.statistics.wait_sum
(or
> se.wait_sum in old versions) Linux kernel schedstat counter of
the
> KVM/QEMU threads ? that represent the VM. That counter denotes the
time in
> milliseconds the thread 'wants' to run (but not actually
running
because
> of a contention).
> However, as Daniel Berrange mentioned in the fix review,
it would be
> better to retrieve that information from libvirt instead and he asked
me
> to raise this in this mailing list.
> I could not notice that libvirt exposes such a counter.
> It would be very good if virDomainInfo (
>
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainInfo)
can be
> added with cpuWait in addition to cpuTime it currently has so
that
cpuWait
> will denote the total *time* the VM *wants* to run.
> Adding cpuWait to any other location of domain is fine
as well.
We can't modify the virDomainInfo struct becase that would be an ABI
incompatible change. Fortunately we have a better API that is extensible
that we can use - virDomainListGetStats() with the flag
VIR_DOMAIN_STATS_VCPU currently returns per-VCPU information - the
state (running or not) and the CPU time:
# virsh domstats --vcpu demo
Domain: 'demo'
vcpu.current=3
vcpu.maximum=3
vcpu.0.state=1
vcpu.0.time=107130000000
vcpu.1.state=1
vcpu.1.time=0
vcpu.2.state=1
vcpu.2.time=0
We could easily extend this to add vcpu.NNN.wait=XXXXX data of the kind
you request
Regards,
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
http://virt-manager.org :|
http://search.cpan.org/~danberr/ :|
http://live.gnome.org/gtk-vnc :|