diff --git a/src/virt.c b/src/virt.c
index 6118c0fdabddc541214294e9390f7d7112516e49..dff8f71dcb9119c812ad9645f72ea2d5f010b824 100644 (file)
--- a/src/virt.c
+++ b/src/virt.c
continue;
}
continue;
}
+ if (info.state != VIR_DOMAIN_RUNNING)
+ {
+ /* only gather stats for running domains */
+ continue;
+ }
+
cpu_submit (info.cpuTime, domains[i], "virt_cpu_total");
memory_submit ((gauge_t) info.memory * 1024, domains[i]);
cpu_submit (info.cpuTime, domains[i], "virt_cpu_total");
memory_submit ((gauge_t) info.memory * 1024, domains[i]);
}
for (j = 0; j < status; j++) {
}
for (j = 0; j < status; j++) {
- memory_stats_submit ((gauge_t) minfo[j].val, domains[i], minfo[j].tag);
+ memory_stats_submit ((gauge_t) minfo[j].val * 1024, domains[i], minfo[j].tag);
}
sfree (minfo);
}
sfree (minfo);
@@ -920,6 +926,9 @@ add_interface_device (virDomainPtr dom, const char *path, const char *address, u
int new_size = sizeof (interface_devices[0]) * (nr_interface_devices+1);
char *path_copy, *address_copy, number_string[15];
int new_size = sizeof (interface_devices[0]) * (nr_interface_devices+1);
char *path_copy, *address_copy, number_string[15];
+ if ((path == NULL) || (address == NULL))
+ return EINVAL;
+
path_copy = strdup (path);
if (!path_copy) return -1;
path_copy = strdup (path);
if (!path_copy) return -1;
@@ -955,6 +964,9 @@ ignore_device_match (ignorelist_t *il, const char *domname, const char *devpath)
char *name;
int n, r;
char *name;
int n, r;
+ if ((domname == NULL) || (devpath == NULL))
+ return 0;
+
n = sizeof (char) * (strlen (domname) + strlen (devpath) + 2);
name = malloc (n);
if (name == NULL) {
n = sizeof (char) * (strlen (domname) + strlen (devpath) + 2);
name = malloc (n);
if (name == NULL) {