summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 """