This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] XenAPI: vm_metrics sometimes does not return valid data

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] XenAPI: vm_metrics sometimes does not return valid data
From: Joanna Rutkowska <joanna@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 20 May 2010 13:08:06 +0200
Delivery-date: Thu, 20 May 2010 04:06:06 -0700
Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:date:from:mime-version:to:subject:content-type; s=smtpout; bh=j9faW5vtyvUqKIzkpLLJ1AQQGZg=; b=WImVrmwJECjxHFy8bCkEEN6w2u8F+ILNaH0qnimu5T4wCL7QaTaSTInERpy+JcrVY1Yeaoy98LF/O85HKXtwZlVVY9WIQ7yl/VbxxVQu7VljezJ3fex45MXb++ORngNVO+VDeSaNv3KksAGcgvJWeVu4NpLU1tU3Z0QOuRgYlUE=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100330 Fedora/3.0.4-1.fc12 Lightning/1.0b2pre Thunderbird/3.0.4

In order to get per-VM CPU utilization I use a code similar to this one
[1] (simplified version):

uuids = xend_session.session.xenapi.VM.get_by_name_label (name)
session_uuid = uuids[0]
session_metrics = session.xenapi.VM.get_metrics(session_uuid)
cpus_util = session.xenapi.VM_metrics.get_VCPUs_utilisation

Now, this works well, except for when it doesn't... Namely, very rarely,
XenAPI seems to break down and starts to return 0.0s for CPU load for
all the VMs for all the VCPUs.

I have verified that all the other objects are not "None", i.e. that
XenAPI keeps returning valid uuids, and session_metrics objects, but the
cpus_util list is always this:

cpus_util =  {'0': 0.0}

(For the case with 1 VCPU assigned to a VM).

I keep getting this for all the VMs in the system, despite the fact that
those VMs actually do some work (e.g. xentop correctly reports some load
on their VCPUs).

The above doesn't apply to Dom0 CPUs utilization, which I obtain using
the following code [2]:

session_hosts = session.xenapi.host.get_all()
session_cpus = session.xenapi.host.get_host_CPUs(session_hosts[0])

for cpu in self.session_cpus:
    cpu_total_load += session.xenapi.host_cpu.get_utilisation(cpu)

cpu_total_load /= len(session_cpus)

In that case I always keep getting the following values (Dom0 uses 2 CPUs):


Once I reboot the system the problems vanish.

Have no idea how to reproduce it -- occurs very rarely, but still
annoying. Anybody run into a similar problem?

I'm running Xen 3.4.3-rc3, but I don't think saw any commit that would
be dealing with such a problem in the more recent rc's.


[1] The actual code is here, in case you're interested:


Attachment: signature.asc
Description: OpenPGP digital signature

Xen-devel mailing list
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] XenAPI: vm_metrics sometimes does not return valid data, Joanna Rutkowska <=