commit 433ccc155c12f4f6c4ace049ad591f065098d6d5
Author: Radek Novacek <rnovacek(a)redhat.com>
Date: Thu May 22 10:55:00 2014 +0200
libvirt domain instance might not have state method
virt.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/virt.py b/virt.py
index f7bb3a8..0fc1920 100644
--- a/virt.py
+++ b/virt.py
@@ -34,7 +34,11 @@ class Domain(dict):
}
if domain.isActive():
self['attributes']['active'] = 1
- self['state'] = domain.state(0)[0]
+ try:
+ self['state'] = domain.state(0)[0]
+ except AttributeError:
+ # Some versions of libvirt doesn't have domain.state() method
+ pass
class Virt:
""" Class for interacting with libvirt. """
Show replies by date