[lnst] lnst-ctl: add deconfigure action
by Jiří Pírko
commit cd51db3d17e24c887d53198bb8413f04e38b77cc
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Fri Feb 28 15:58:16 2014 +0100
lnst-ctl: add deconfigure action
The deconfigure action calls just the deconfiguration of slaves as
defined in the /tmp/.lnst_machine_conf file created by a previous
config_only run.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst-ctl | 7 +++++--
lnst/Controller/NetTestController.py | 5 +++--
2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/lnst-ctl b/lnst-ctl
index 80b1308..4ce280e 100755
--- a/lnst-ctl
+++ b/lnst-ctl
@@ -33,7 +33,7 @@ def usage(retval=0):
"""
print "Usage: %s [OPTIONS...] ACTION [RECIPES...]" % sys.argv[0]
print ""
- print "ACTION = [ run | config_only | match_setup ]"
+ print "ACTION = [ run | config_only | deconfigure | match_setup ]"
print ""
print "OPTIONS"
print " -a, --define-alias name=value define top-level alias"
@@ -200,9 +200,12 @@ def main():
action = args[0]
recipes = args[1:]
- if not action in ['run', 'config_only', 'match_setup']:
+ if not action in ['run', 'config_only', 'deconfigure', 'match_setup']:
logging.error("Action '%s' not recognised" % action)
usage(RETVAL_ERR)
+ if action == 'deconfigure':
+ NetTestController.remove_saved_machine_config()
+ return 0
summary = []
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index b2694c4..2a18b1b 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -56,7 +56,7 @@ class NetTestController:
self._recipe_path = recipe_path
self._msg_dispatcher = MessageDispatcher(log_ctl)
- self._remove_saved_machine_config()
+ self.remove_saved_machine_config()
sp = SlavePool(lnst_config.get_option('environment', 'pool_dirs'),
check_process_running("libvirtd"), pool_checks)
@@ -446,7 +446,8 @@ class NetTestController:
with open("/tmp/.lnst_machine_conf", "wb") as f:
pickled_data = cPickle.dump(config_data, f)
- def _remove_saved_machine_config(self):
+ @classmethod
+ def remove_saved_machine_config(cls):
#removes previously saved configuration
cfg = None
try:
9 years, 7 months
[lnst] NetTestController: always save config_only configuration
by Jiří Pírko
commit 8cadf4b8d938107832eebfbb70957f672c5de146
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Fri Feb 28 15:58:15 2014 +0100
NetTestController: always save config_only configuration
Until now we only saved config_only configuration if the run was
virtualized, this was so that we could nicely deconfigure dynamically
created network devices. This commit makes it so that the configuration
is stored for every config_only run, even if virtualization wasn't used.
This is not required for functionality since slaves will automatically
deconfigure themselves when needed, but it can be used to call
deconfiguration without running a different config_only run or run an
entire recipe.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/NetTestController.py | 40 +++++++++++++++++----------------
1 files changed, 21 insertions(+), 19 deletions(-)
---
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index c5e3fec..b2694c4 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -56,7 +56,7 @@ class NetTestController:
self._recipe_path = recipe_path
self._msg_dispatcher = MessageDispatcher(log_ctl)
- self._remove_virt_config()
+ self._remove_saved_machine_config()
sp = SlavePool(lnst_config.get_option('environment', 'pool_dirs'),
check_process_running("libvirtd"), pool_checks)
@@ -422,14 +422,15 @@ class NetTestController:
for bridge in self._network_bridges.itervalues():
bridge.cleanup()
- def _save_virt_config(self):
+ def _save_machine_config(self):
#saves current virtual configuration to a file, after pickling it
config_data = dict()
machines = config_data["machines"] = {}
for m in self._machines.itervalues():
machine = machines[m.get_hostname()] = dict()
- machine["libvirt_dom"] = m.get_libvirt_domain()
+ if m.get_libvirt_domain() != None:
+ machine["libvirt_dom"] = m.get_libvirt_domain()
machine["interfaces"] = []
for i in m._interfaces:
@@ -442,21 +443,22 @@ class NetTestController:
for bridge in self._network_bridges.itervalues():
bridges.append(bridge.get_name())
- with open("/tmp/.lnst_virt_conf", "wb") as f:
+ with open("/tmp/.lnst_machine_conf", "wb") as f:
pickled_data = cPickle.dump(config_data, f)
- def _remove_virt_config(self):
- #removes previously saved virtual configuration
+ def _remove_saved_machine_config(self):
+ #removes previously saved configuration
cfg = None
try:
- with open("/tmp/.lnst_virt_conf", "rb") as f:
+ with open("/tmp/.lnst_machine_conf", "rb") as f:
cfg = cPickle.load(f)
except:
+ logging.info("No previous configuration found.")
return
if cfg:
logging.info("Cleaning up leftover configuration from previous "\
- "virtualized config_only run.")
+ "config_only run.")
for hostname, machine in cfg["machines"].iteritems():
port = lnst_config.get_option("environment", "rpcport")
if test_tcp_connection(hostname, port):
@@ -474,14 +476,15 @@ class NetTestController:
break
rpc_con.close()
- libvirt_dom = machine["libvirt_dom"]
- domain_ctl = VirtDomainCtl(libvirt_dom)
- logging.info("Detaching dynamically created interfaces.")
- for i in machine["interfaces"]:
- try:
- domain_ctl.detach_interface(i)
- except:
- pass
+ if "libvirt_dom" in "machine":
+ libvirt_dom = machine["libvirt_dom"]
+ domain_ctl = VirtDomainCtl(libvirt_dom)
+ logging.info("Detaching dynamically created interfaces.")
+ for i in machine["interfaces"]:
+ try:
+ domain_ctl.detach_interface(i)
+ except:
+ pass
logging.info("Removing dynamically created bridges.")
for br in cfg["bridges"]:
@@ -491,7 +494,7 @@ class NetTestController:
except:
pass
- os.remove("/tmp/.lnst_virt_conf")
+ os.remove("/tmp/.lnst_machine_conf")
def match_setup(self):
self._prepare_provisioning()
@@ -509,8 +512,7 @@ class NetTestController:
raise
sp = self._slave_pool
- if sp.is_setup_virtual():
- self._save_virt_config()
+ self._save_machine_config()
self._cleanup_slaves(deconfigure=False)
return {"passed": True}
9 years, 7 months
[PATCH 2/2] lnst-ctl: add deconfigure action
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
The deconfigure action calls just the deconfiguration of slaves as
defined in the /tmp/.lnst_machine_conf file created by a previous
config_only run.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst-ctl | 7 +++++--
lnst/Controller/NetTestController.py | 5 +++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/lnst-ctl b/lnst-ctl
index 80b1308..4ce280e 100755
--- a/lnst-ctl
+++ b/lnst-ctl
@@ -33,7 +33,7 @@ def usage(retval=0):
"""
print "Usage: %s [OPTIONS...] ACTION [RECIPES...]" % sys.argv[0]
print ""
- print "ACTION = [ run | config_only | match_setup ]"
+ print "ACTION = [ run | config_only | deconfigure | match_setup ]"
print ""
print "OPTIONS"
print " -a, --define-alias name=value define top-level alias"
@@ -200,9 +200,12 @@ def main():
action = args[0]
recipes = args[1:]
- if not action in ['run', 'config_only', 'match_setup']:
+ if not action in ['run', 'config_only', 'deconfigure', 'match_setup']:
logging.error("Action '%s' not recognised" % action)
usage(RETVAL_ERR)
+ if action == 'deconfigure':
+ NetTestController.remove_saved_machine_config()
+ return 0
summary = []
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index b2694c4..2a18b1b 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -56,7 +56,7 @@ class NetTestController:
self._recipe_path = recipe_path
self._msg_dispatcher = MessageDispatcher(log_ctl)
- self._remove_saved_machine_config()
+ self.remove_saved_machine_config()
sp = SlavePool(lnst_config.get_option('environment', 'pool_dirs'),
check_process_running("libvirtd"), pool_checks)
@@ -446,7 +446,8 @@ class NetTestController:
with open("/tmp/.lnst_machine_conf", "wb") as f:
pickled_data = cPickle.dump(config_data, f)
- def _remove_saved_machine_config(self):
+ @classmethod
+ def remove_saved_machine_config(cls):
#removes previously saved configuration
cfg = None
try:
--
1.8.5.3
9 years, 7 months
[PATCH 1/2] NetTestController: always save config_only configuration
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
Until now we only saved config_only configuration if the run was
virtualized, this was so that we could nicely deconfigure dynamically
created network devices. This commit makes it so that the configuration
is stored for every config_only run, even if virtualization wasn't used.
This is not required for functionality since slaves will automatically
deconfigure themselves when needed, but it can be used to call
deconfiguration without running a different config_only run or run an
entire recipe.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/NetTestController.py | 40 +++++++++++++++++++-----------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index c5e3fec..b2694c4 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -56,7 +56,7 @@ class NetTestController:
self._recipe_path = recipe_path
self._msg_dispatcher = MessageDispatcher(log_ctl)
- self._remove_virt_config()
+ self._remove_saved_machine_config()
sp = SlavePool(lnst_config.get_option('environment', 'pool_dirs'),
check_process_running("libvirtd"), pool_checks)
@@ -422,14 +422,15 @@ class NetTestController:
for bridge in self._network_bridges.itervalues():
bridge.cleanup()
- def _save_virt_config(self):
+ def _save_machine_config(self):
#saves current virtual configuration to a file, after pickling it
config_data = dict()
machines = config_data["machines"] = {}
for m in self._machines.itervalues():
machine = machines[m.get_hostname()] = dict()
- machine["libvirt_dom"] = m.get_libvirt_domain()
+ if m.get_libvirt_domain() != None:
+ machine["libvirt_dom"] = m.get_libvirt_domain()
machine["interfaces"] = []
for i in m._interfaces:
@@ -442,21 +443,22 @@ class NetTestController:
for bridge in self._network_bridges.itervalues():
bridges.append(bridge.get_name())
- with open("/tmp/.lnst_virt_conf", "wb") as f:
+ with open("/tmp/.lnst_machine_conf", "wb") as f:
pickled_data = cPickle.dump(config_data, f)
- def _remove_virt_config(self):
- #removes previously saved virtual configuration
+ def _remove_saved_machine_config(self):
+ #removes previously saved configuration
cfg = None
try:
- with open("/tmp/.lnst_virt_conf", "rb") as f:
+ with open("/tmp/.lnst_machine_conf", "rb") as f:
cfg = cPickle.load(f)
except:
+ logging.info("No previous configuration found.")
return
if cfg:
logging.info("Cleaning up leftover configuration from previous "\
- "virtualized config_only run.")
+ "config_only run.")
for hostname, machine in cfg["machines"].iteritems():
port = lnst_config.get_option("environment", "rpcport")
if test_tcp_connection(hostname, port):
@@ -474,14 +476,15 @@ class NetTestController:
break
rpc_con.close()
- libvirt_dom = machine["libvirt_dom"]
- domain_ctl = VirtDomainCtl(libvirt_dom)
- logging.info("Detaching dynamically created interfaces.")
- for i in machine["interfaces"]:
- try:
- domain_ctl.detach_interface(i)
- except:
- pass
+ if "libvirt_dom" in "machine":
+ libvirt_dom = machine["libvirt_dom"]
+ domain_ctl = VirtDomainCtl(libvirt_dom)
+ logging.info("Detaching dynamically created interfaces.")
+ for i in machine["interfaces"]:
+ try:
+ domain_ctl.detach_interface(i)
+ except:
+ pass
logging.info("Removing dynamically created bridges.")
for br in cfg["bridges"]:
@@ -491,7 +494,7 @@ class NetTestController:
except:
pass
- os.remove("/tmp/.lnst_virt_conf")
+ os.remove("/tmp/.lnst_machine_conf")
def match_setup(self):
self._prepare_provisioning()
@@ -509,8 +512,7 @@ class NetTestController:
raise
sp = self._slave_pool
- if sp.is_setup_virtual():
- self._save_virt_config()
+ self._save_machine_config()
self._cleanup_slaves(deconfigure=False)
return {"passed": True}
--
1.8.5.3
9 years, 7 months
[lnst] NetConfigDevice: fix bridge configuration
by Jiří Pírko
commit 6dcee83689760210cf6cf39f993ce6542effc72a
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Wed Feb 19 11:51:34 2014 +0100
NetConfigDevice: fix bridge configuration
Just typos that raised exceptions...
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Slave/NetConfigDevice.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/lnst/Slave/NetConfigDevice.py b/lnst/Slave/NetConfigDevice.py
index ee93ec8..e279d66 100644
--- a/lnst/Slave/NetConfigDevice.py
+++ b/lnst/Slave/NetConfigDevice.py
@@ -131,15 +131,15 @@ class NetConfigDeviceBridge(NetConfigDeviceGeneric):
_modulename = "bridge"
def _add_rm_bridge(self, prefix):
- exec_cmd("brctl %sbr %s " % (prefix, self._dev_conf["name"]))
+ exec_cmd("brctl %sbr %s " % (prefix, self._dev_config["name"]))
- def _add_rm_port(self, prefix, slave_if_index):
+ def _add_rm_port(self, prefix, slave_id):
port_name = self._if_manager.get_mapped_device(slave_id).get_name()
- exec_cmd("brctl %sif %s %s" % (prefix, self._dev_conf["name"],
+ exec_cmd("brctl %sif %s %s" % (prefix, self._dev_config["name"],
port_name))
def _add_rm_ports(self, prefix):
- for slave_id in get_slaves(self._dev_conf):
+ for slave_id in get_slaves(self._dev_config):
self._add_rm_port(prefix, slave_id)
def configure(self):
9 years, 7 months
[lnst] InterfaceManager: call master deconfiguration just once
by Jiří Pírko
commit d569cadd4c977b0a0aa44a45cdda81b355182d56
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Wed Feb 19 11:51:33 2014 +0100
InterfaceManager: call master deconfiguration just once
When the deconfigure_all method of the InterfaceManager is called we do
not listen to netlink updates between device deconfigurations. This
results in the master being deconfigured by each associated slave and
raising an exception. This commit fixes that.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Slave/InterfaceManager.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index 94153ed..c120555 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -227,7 +227,8 @@ class Device(object):
def clear_configuration(self):
if self._master != None:
master_dev = self._if_manager.get_device(self._master)
- master_dev.clear_configuration()
+ if master_dev != None:
+ master_dev.clear_configuration()
if self._conf != None:
self.down()
@@ -243,7 +244,8 @@ class Device(object):
def deconfigure(self):
if self._master != None:
master_dev = self._if_manager.get_device(self._master)
- master_dev.deconfigure()
+ if master_dev != None:
+ master_dev.deconfigure()
if self._conf != None and self._configured:
self._conf.deconfigure()
9 years, 7 months
[lnst] NetConfigDevice: cleanup unused functions
by Jiří Pírko
commit cc4e88a7d81d7ece9b8c265a05e3081037f4ffd1
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Wed Feb 19 11:51:32 2014 +0100
NetConfigDevice: cleanup unused functions
This commit removes the functions NetConfigDeviceType and
NetConfigDeviceAllCleanup that are no longer used.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Slave/NetConfigDevice.py | 19 -------------------
1 files changed, 0 insertions(+), 19 deletions(-)
---
diff --git a/lnst/Slave/NetConfigDevice.py b/lnst/Slave/NetConfigDevice.py
index 997f22d..ee93ec8 100644
--- a/lnst/Slave/NetConfigDevice.py
+++ b/lnst/Slave/NetConfigDevice.py
@@ -311,22 +311,3 @@ def NetConfigDevice(dev_config, if_manager):
return nm_type_class_mapping[dev_config["type"]](dev_config, if_manager)
else:
return type_class_mapping[dev_config["type"]](dev_config, if_manager)
-
-def NetConfigDeviceType(netdev, config):
- '''
- Class dispatcher for classmethods
- '''
- if is_nm_managed(netdev, config):
- return nm_type_class_mapping[netdev["type"]]
- else:
- return type_class_mapping[netdev["type"]]
-
-def NetConfigDeviceAllCleanup():
- logging.debug("Performing interface type cleanup.")
- if check_process_running("NetworkManager") and \
- lnst_config.get_option("environment", "use_nm"):
- for dev_type in nm_type_class_mapping:
- nm_type_class_mapping[dev_type].type_cleanup()
- else:
- for dev_type in type_class_mapping:
- type_class_mapping[dev_type].type_cleanup()
9 years, 7 months
[lnst] remove NetConfig.py and NetConfigDevNames
by Jiří Pírko
commit c8b819663f10b98fe7d00237550ffb64dc2cfd4a
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Wed Feb 19 11:51:31 2014 +0100
remove NetConfig.py and NetConfigDevNames
Cleanup of deprecated modules. These modules are no longer needed as
their functionality is now handled by the InterfaceManager module.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Slave/NetConfig.py | 169 ---------------------------------------
lnst/Slave/NetConfigDevNames.py | 87 --------------------
lnst/Slave/NetTestSlave.py | 1 -
3 files changed, 0 insertions(+), 257 deletions(-)
---
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index 50ccf13..28c595e 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -30,7 +30,6 @@ from lnst.Common.ExecCmd import exec_cmd
from lnst.Common.ResourceCache import ResourceCache
from lnst.Common.NetTestCommand import NetTestCommandContext
from lnst.Common.NetTestCommand import CommandException, NetTestCommand
-from lnst.Slave.NetConfig import NetConfig
from lnst.Slave.NmConfigDevice import is_nm_managed_by_name
from lnst.Common.Utils import check_process_running
from lnst.Common.ConnectionHandler import recv_data, send_data
9 years, 7 months
[lnst] VirtUtils: move to lnst/Controller
by Jiří Pírko
commit 030c99e3f1bde8542c6cc83a054ef46dcd8be67d
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Thu Feb 20 13:21:51 2014 +0100
VirtUtils: move to lnst/Controller
VirtUtils are only used by the controller and there is no use case in
which we would want to use it on slaves. Therefore it makes more sense
to move it to the lnst/Controller directory.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/Machine.py | 2 +-
lnst/Controller/NetTestController.py | 2 +-
lnst/{Common => Controller}/VirtUtils.py | 0
3 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index 25749e0..d73aedd 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -31,7 +31,7 @@ from lnst.Common.ConnectionHandler import ConnectionHandler
# conditional support for libvirt
if check_process_running("libvirtd"):
- from lnst.Common.VirtUtils import VirtNetCtl, VirtDomainCtl
+ from lnst.Controller.VirtUtils import VirtNetCtl, VirtDomainCtl
DEFAULT_TIMEOUT = 60
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index 39bc83a..c5e3fec 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -38,7 +38,7 @@ import lnst.Controller.Task as Task
# conditional support for libvirt
if check_process_running("libvirtd"):
- from lnst.Common.VirtUtils import VirtNetCtl, VirtDomainCtl
+ from lnst.Controller.VirtUtils import VirtNetCtl, VirtDomainCtl
class NetTestError(Exception):
pass
diff --git a/lnst/Common/VirtUtils.py b/lnst/Controller/VirtUtils.py
similarity index 100%
rename from lnst/Common/VirtUtils.py
rename to lnst/Controller/VirtUtils.py
9 years, 7 months
[lnst] Controller: conditional VirtUtils import
by Jiří Pírko
commit 3843690c884f8c19db069207158a97a0014285f7
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Thu Feb 20 13:21:50 2014 +0100
Controller: conditional VirtUtils import
Since running the lnst controller doesn't necessarily depend on having
libvirt running or installed this commit adds a condition to the import
of the VirtUtils module. This will fix lnst-ctl crashing on machines
that don't have libvirt running.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/Machine.py | 6 +++++-
lnst/Controller/NetTestController.py | 5 ++++-
2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index 75c0d8a..25749e0 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -24,11 +24,15 @@ from pprint import pprint, pformat
from lnst.Common.Config import lnst_config
from lnst.Common.Logs import log_exc_traceback
from lnst.Common.NetUtils import MacPool, normalize_hwaddr
-from lnst.Common.VirtUtils import VirtNetCtl, VirtDomainCtl
from lnst.Common.Utils import wait_for, md5sum, dir_md5sum, create_tar_archive
+from lnst.Common.Utils import check_process_running
from lnst.Common.ConnectionHandler import send_data, recv_data
from lnst.Common.ConnectionHandler import ConnectionHandler
+# conditional support for libvirt
+if check_process_running("libvirtd"):
+ from lnst.Common.VirtUtils import VirtNetCtl, VirtDomainCtl
+
DEFAULT_TIMEOUT = 60
class MachineError(Exception):
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index 1831a71..39bc83a 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -21,7 +21,6 @@ import imp
from time import sleep
from xmlrpclib import Binary
from lnst.Common.NetUtils import MacPool
-from lnst.Common.VirtUtils import VirtNetCtl, VirtDomainCtl
from lnst.Common.Utils import wait_for, md5sum, dir_md5sum, create_tar_archive
from lnst.Common.Utils import check_process_running, bool_it
from lnst.Common.NetTestCommand import NetTestCommandContext, NetTestCommand
@@ -37,6 +36,10 @@ from lnst.Common.Colours import decorate_with_preset
from lnst.Common.NetUtils import test_tcp_connection
import lnst.Controller.Task as Task
+# conditional support for libvirt
+if check_process_running("libvirtd"):
+ from lnst.Common.VirtUtils import VirtNetCtl, VirtDomainCtl
+
class NetTestError(Exception):
pass
9 years, 7 months