summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f9451f7)
raw | patch | inline | side by side (parent: f9451f7)
author | Florian Forster <octo@huhu.verplant.org> | |
Sat, 19 Mar 2011 14:43:41 +0000 (15:43 +0100) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Sat, 19 Mar 2011 14:43:41 +0000 (15:43 +0100) |
The status code is less than zero on failure and the number of vCPUs
otherwise. Thanks to "JLPC" for pointing this problem out.
otherwise. Thanks to "JLPC" for pointing this problem out.
src/libvirt.c | patch | blob | history |
diff --git a/src/libvirt.c b/src/libvirt.c
index bcbf0e6ad51a5527df6b9a74a6a7322bd916881c..91fda7a5e6c9bcba145da37211356a6acdeef4de 100644 (file)
--- a/src/libvirt.c
+++ b/src/libvirt.c
for (i = 0; i < nr_domains; ++i) {
virDomainInfo info;
virVcpuInfoPtr vinfo = NULL;
+ int status;
int j;
- if (virDomainGetInfo (domains[i], &info) != 0)
+ status = virDomainGetInfo (domains[i], &info);
+ if (status != 0)
+ {
+ ERROR ("libvirt plugin: virDomainGetInfo failed with status %i.",
+ status);
continue;
+ }
cpu_submit (info.cpuTime, t, domains[i], "virt_cpu_total");
- vinfo = malloc (info.nrVirtCpu * sizeof vinfo[0]);
+ vinfo = malloc (info.nrVirtCpu * sizeof (vinfo[0]));
if (vinfo == NULL) {
ERROR ("libvirt plugin: malloc failed.");
continue;
}
- if (virDomainGetVcpus (domains[i], vinfo, info.nrVirtCpu,
- NULL, 0) != 0) {
+ status = virDomainGetVcpus (domains[i], vinfo, info.nrVirtCpu,
+ /* cpu map = */ NULL, /* cpu map length = */ 0);
+ if (status < 0)
+ {
+ ERROR ("libvirt plugin: virDomainGetVcpus failed with status %i.",
+ status);
free (vinfo);
continue;
}