From: John Spray Date: Fri, 31 Jan 2014 20:53:45 +0000 (+0000) Subject: Make libvirt import optional (OS X) X-Git-Tag: v0.94.10~27^2^2~364^2~382^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b80e510257333407aec3407c01de3963d6ce99e9;p=ceph.git Make libvirt import optional (OS X) --- diff --git a/teuthology/orchestra/remote.py b/teuthology/orchestra/remote.py index 512ee3d1f0ea0..e74c2e373b7a1 100644 --- a/teuthology/orchestra/remote.py +++ b/teuthology/orchestra/remote.py @@ -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: