From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joanna Rutkowska Subject: XenAPI: vm_metrics sometimes does not return valid data Date: Thu, 20 May 2010 13:08:06 +0200 Message-ID: <4BF51816.3080509@invisiblethingslab.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1133130980==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --===============1133130980== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig4DD9DFB4039D60966F2F72F3" This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig4DD9DFB4039D60966F2F72F3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello, In order to get per-VM CPU utilization I use a code similar to this one [1] (simplified version): uuids =3D xend_session.session.xenapi.VM.get_by_name_label (name) session_uuid =3D uuids[0] session_metrics =3D session.xenapi.VM.get_metrics(session_uuid) cpus_util =3D session.xenapi.VM_metrics.get_VCPUs_utilisation (session_metrics) 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 =3D {'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 =3D session.xenapi.host.get_all() session_cpus =3D session.xenapi.host.get_host_CPUs(session_hosts[0]) for cpu in self.session_cpus: cpu_total_load +=3D session.xenapi.host_cpu.get_utilisation(cpu) cpu_total_load /=3D len(session_cpus) In that case I always keep getting the following values (Dom0 uses 2 CPUs= ): 0.361701816398 0.299435554096 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. joanna. [1] The actual code is here, in case you're interested: http://qubes-os.org/gitweb/?p=3Dmainstream/core.git;a=3Dblob;f=3Ddom0/qvm= -core/qubes.py;h=3D6e5a686b4a43b3b1b3c2cfba04b63232a6ef6edf;hb=3DHEAD#l32= 6 [2] http://qubes-os.org/gitweb/?p=3Dmainstream/core.git;a=3Dblob;f=3Ddom0/qvm= -core/qubes.py;h=3D6e5a686b4a43b3b1b3c2cfba04b63232a6ef6edf;hb=3DHEAD#l86= 7 --------------enig4DD9DFB4039D60966F2F72F3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iEYEARECAAYFAkv1GBYACgkQORdkotfEW85T7ACg0m2Kn+yELyFS+lzqEAQtd05D oaUAn0mPrSCyFQ6t10PVWFZumkJCKkmE =aGmF -----END PGP SIGNATURE----- --------------enig4DD9DFB4039D60966F2F72F3-- --===============1133130980== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1133130980==--