#!/usr/bin/python3
-from nitsi.machine import machine
-
-from nitsi.network import network
-
-import os
import configparser
import libvirt
import logging
+import os
+
+from . import machine
+from . import network
logger = logging.getLogger("nitsi.virtual_environ")
self.path = os.path.abspath(path)
except BaseException as e:
self.log.error("Could not get absolute path")
+ raise e
self.log.debug(self.path)
self.con = libvirt.open(self.uri)
except BaseException as error:
self.log.error("Could not connect to: {}".format(self.uri))
+ raise error
self.log.debug("Connected to: {}".format(self.uri))
networks = {}
for _network in self.networks:
self.log.debug(_network)
- networks.setdefault(_network, network(self.con, os.path.normpath(self.path + "/" + self.config[_network]["xml_file"])))
+ networks.setdefault(_network, network.network(self.con, os.path.normpath(self.path + "/" + self.config[_network]["xml_file"])))
return networks
def get_machines(self):
machines = {}
for _machine in self.machines:
self.log.debug(_machine)
- machines.setdefault(_machine, machine(
+ machines.setdefault(_machine, machine.machine(
self.con,
os.path.normpath(self.path + "/" + self.config[_machine]["xml_file"]),
os.path.normpath(self.path + "/" + self.config[_machine]["snapshot_xml_file"]),
if len(_machine) > self._longest_machine_name:
self._longest_machine_name = len(_machine)
- return self._longest_machine_name
\ No newline at end of file
+ return self._longest_machine_name