def get_session(self, host=None): """Returns a connection to the LXD hypervisor This method should be used to create a connection to the LXD hypervisor via the pylxd API call. :param host: host is the LXD daemon to connect to :return: pylxd object """ try: if host: return api.API(host=host) else: return api.API() except Exception as ex: # notify the compute host that the connection failed # via an rpc call LOG.exception(_LE('Connection to LXD failed')) payload = dict(ip=CONF.host, method='_connect', reason=ex) rpc.get_notifier('compute').error(nova_context.get_admin_context, 'compute.nova_lxd.error', payload) raise exception.HypervisorUnavailable(host=CONF.host)
def setUp(self): super(LXDAPITestBase, self).setUp() self.lxd = api.API()
def setUp(self): super().setUp() self.lxd = api.API()
def __init__(self): self.lxd = api.API()