[XEND] Fix xen_version and missing os import
authorAlastair Tse <atse@xensource.com>
Fri, 3 Nov 2006 16:51:28 +0000 (16:51 +0000)
committerAlastair Tse <atse@xensource.com>
Fri, 3 Nov 2006 16:51:28 +0000 (16:51 +0000)
Signed-off-by: Alastair Tse <atse@xensource.com>
tools/python/xen/xend/XendDomainInfo.py
tools/python/xen/xend/XendNode.py

index ec0f8e8c2fd114f44d4b9cbce1c4b23f559a7ade..2a3d2d30b37cdd4f9dd54d23128fe8cfb327d2e5 100644 (file)
@@ -29,6 +29,7 @@ import time
 import threading
 import re
 import copy
+import os
 from types import StringTypes
 
 import xen.lowlevel.xc
index 88f440fe7443fe987289d47a6ea5f9c61359cb5d..d0548a4dee3fdaf21a585aeb9b929e0cbb9d81fb 100644 (file)
@@ -80,9 +80,13 @@ class XendNode:
 
     def xen_version(self):
         info = self.xc.xeninfo()
-        from xen import VERSION
-        return {'Xen': '%(xen_major)d.%(xen_minor)d' % info,
-                'Xend': VERSION}
+        try:
+            from xen import VERSION
+            return {'Xen': '%(xen_major)d.%(xen_minor)d' % info,
+                    'Xend': VERSION}
+        except (ImportError, AttributeError):
+            return {'Xen': '%(xen_major)d.%(xen_minor)d' % info,
+                    'Xend': '3.0.3'}
 
     def get_name(self):
         return self.name