summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c44f866)
raw | patch | inline | side by side (parent: c44f866)
author | Igor Pavlikevich <ipavlikevich@gmail.com> | |
Thu, 9 Feb 2017 13:07:13 +0000 (16:07 +0300) | ||
committer | Igor Pavlikevich <ipavlikevich@gmail.com> | |
Wed, 22 Feb 2017 14:20:17 +0000 (17:20 +0300) |
Remove inactive domains from domains list, not only in CPU/Memory/VCPU usage accounting
Signed-off-by: Igor Pavlikevich <ipavlikevich@gmail.com>
Signed-off-by: Igor Pavlikevich <ipavlikevich@gmail.com>
src/virt.c | patch | blob | history |
diff --git a/src/virt.c b/src/virt.c
index 51682993d476ac1a04c678ffa1a9f2a59270d459..692088c46fcdcb0f449519a016a31c8699e503b2 100644 (file)
--- a/src/virt.c
+++ b/src/virt.c
continue;
}
- if (info.di.state != VIR_DOMAIN_RUNNING) {
- /* only gather stats for running domains */
- continue;
- }
-
pcpu_submit(state->domains[i], &info);
cpu_submit(info.di.cpuTime, state->domains[i], "virt_cpu_total");
memory_submit((gauge_t)info.di.memory * 1024, state->domains[i]);
xmlXPathContextPtr xpath_ctx = NULL;
xmlXPathObjectPtr xpath_obj = NULL;
char tag[PARTITION_TAG_MAX_LEN] = {'\0'};
+ virDomainInfo info;
+ int status;
dom = virDomainLookupByID(conn, domids[i]);
if (dom == NULL) {
goto cont;
}
+ status = virDomainGetInfo(dom, &info);
+ if (status != 0) {
+ ERROR(PLUGIN_NAME " plugin: virDomainGetInfo failed with status %i.",
+ status);
+ continue;
+ }
+
+ if (info.state != VIR_DOMAIN_RUNNING) {
+ DEBUG(PLUGIN_NAME " plugin: skipping inactive domain %s", name);
+ continue;
+ }
+
if (il_domains && ignorelist_match(il_domains, name) != 0)
goto cont;