From 7858c461651c341537c158ffee1475251c880b0e Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Thu, 30 Oct 2008 16:50:57 +0100 Subject: handle lookupById failures xend seems to report wrong numbers, so ignore errors resolving ids to domains --- libvirt-ifstat | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'libvirt-ifstat') diff --git a/libvirt-ifstat b/libvirt-ifstat index 696dd79..4fd2f93 100644 --- a/libvirt-ifstat +++ b/libvirt-ifstat @@ -30,8 +30,12 @@ graph_info This graph shows the network 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_rx.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 ifaces = get_ifaces(dom) -- cgit v1.2.3