]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Make libvirt import optional (OS X)
authorJohn Spray <john.spray@inktank.com>
Fri, 31 Jan 2014 20:53:45 +0000 (20:53 +0000)
committerJohn Spray <john.spray@inktank.com>
Fri, 31 Jan 2014 20:53:45 +0000 (20:53 +0000)
teuthology/orchestra/remote.py

index 512ee3d1f0ea0ae1fc109a68d930eefb0b541d37..e74c2e373b7a1de635110586f3a778cb494e7df9 100644 (file)
@@ -1,6 +1,18 @@
 from . import run
 from teuthology import misc
 import time
+import pexpect
+import re
+import logging
+from teuthology import lockstatus as ls
+
+try:
+    import libvirt
+except ImportError:
+    libvirt = None
+
+log = logging.getLogger(__name__)
+
 
 class Remote(object):
     """
@@ -48,13 +60,6 @@ class Remote(object):
         r.remote = self
         return r
 
-import pexpect
-import re
-import logging
-import libvirt
-from teuthology import lockstatus as ls
-
-log = logging.getLogger(__name__)
 
 def getShortName(name):
     hn = name.split('@')[-1]
@@ -212,6 +217,9 @@ class PhysicalConsole():
 class VirtualConsole():
 
     def __init__(self, name, ipmiuser, ipmipass, ipmidomain, logfile=None, timeout=20):
+        if libvirt is None:
+            raise RuntimeError("libvirt not found")
+
         self.shortname = getShortName(name)
         status_info = ls.get_status('', self.shortname)
         try: