summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmando Migliaccio <armando.migliaccio@citrix.com>2010-12-09 10:40:07 +0000
committerArmando Migliaccio <armando.migliaccio@citrix.com>2010-12-09 10:40:07 +0000
commit783f4fa44b835ef6c399e18679774a2e4bc4124a (patch)
tree201ae1bba43d39cdaccf1ba9dbc074c438fe6920
parentfd7931847de7cb24c629380fb71bca7833710edc (diff)
fixed how the XenAPI library is loaded
-rw-r--r--nova/virt/xenapi/vm_utils.py9
-rw-r--r--nova/virt/xenapi/vmops.py2
2 files changed, 11 insertions, 0 deletions
diff --git a/nova/virt/xenapi/vm_utils.py b/nova/virt/xenapi/vm_utils.py
index 2a75f9dbf..2b84601f2 100644
--- a/nova/virt/xenapi/vm_utils.py
+++ b/nova/virt/xenapi/vm_utils.py
@@ -50,6 +50,15 @@ class VMHelper():
The class that wraps the helper methods together.
"""
def __init__(self):
+ return
+
+ @classmethod
+ def late_import(cls):
+ """
+ Load the XenAPI module in for helper class, if required.
+ This is to avoid to install the XenAPI library when other
+ hypervisors are used
+ """
global XenAPI
if XenAPI is None:
XenAPI = __import__('XenAPI')
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py
index 542d4894c..e7c3102a3 100644
--- a/nova/virt/xenapi/vmops.py
+++ b/nova/virt/xenapi/vmops.py
@@ -41,6 +41,8 @@ class VMOps(object):
if XenAPI is None:
XenAPI = __import__('XenAPI')
self._session = session
+ # Load XenAPI module in the helper class
+ VMHelper.late_import()
def list_instances(self):
""" List VM instances """