aboutsummaryrefslogtreecommitdiff
path: root/libvirt-blkstat
diff options
context:
space:
mode:
authorGuido G√ľnther <agx@sigxcpu.org>2008-10-30 16:50:57 +0100
committerGuido Guenther <agx@sigxcpu.org>2008-10-30 16:50:57 +0100
commit7858c461651c341537c158ffee1475251c880b0e (patch)
treebdfef8467347aee119e8a6c6cd82691b42cec354 /libvirt-blkstat
parentefc301ac547ed23808537c710f35acbfa2f109d9 (diff)
handle lookupById failures
xend seems to report wrong numbers, so ignore errors resolving ids to domains
Diffstat (limited to 'libvirt-blkstat')
-rw-r--r--libvirt-blkstat16
1 files changed, 12 insertions, 4 deletions
diff --git a/libvirt-blkstat b/libvirt-blkstat
index a3e3b4c..42ec1b4 100644
--- a/libvirt-blkstat
+++ b/libvirt-blkstat
@@ -30,8 +30,12 @@ graph_info This graph shows the block device I/O of the virtual machines"""
conn = libvirt.openReadOnly(uri)
ids = conn.listDomainsID()
for id in ids:
- dom = conn.lookupByID(id)
- name = dom.name()
+ try:
+ dom = conn.lookupByID(id)
+ name = dom.name()
+ except libvirt.libvirtError, err:
+ print >>sys.stderr, "Id: %s: %s" % (id, err)
+ continue
if name == "Domain-0":
continue
print "%s_read.label %s" % (canon(name), name)
@@ -77,8 +81,12 @@ def fetch_values(uri):
for id in ids:
rd = 0
wr = 0
- dom = conn.lookupByID(id)
- name = dom.name()
+ try:
+ dom = conn.lookupByID(id)
+ name = dom.name()
+ except libvirt.libvirtError, err:
+ print >>sys.stderr, "Id: %s: %s" % (id, err)
+ continue
if name == "Domain-0":
continue
disks = get_disks(dom)