aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Capitani <m.capitani@nextworks.it>2018-02-21 11:43:49 +0100
committerMarco Capitani <m.capitani@nextworks.it>2018-02-27 16:51:26 +0100
commit0158b68b1736ca8a5fb68de5a56cae234030774c (patch)
tree77d317940d9abcc0db9140fc494266c9a04effb2
parent5e6f1b8dd525bf4c0f8a03463bdb1f4696f27dee (diff)
downloadrumba-0158b68b1736ca8a5fb68de5a56cae234030774c.tar.gz
rumba-0158b68b1736ca8a5fb68de5a56cae234030774c.zip
model & more: add prototype/system log fields
This commit adds the fields necessary to specify the paths and folders related to system logs and prototype logs and fetching them. Defaults are introduced and specific paths for rlite & qemu
-rw-r--r--rumba/model.py33
-rw-r--r--rumba/prototypes/irati.py2
-rw-r--r--rumba/prototypes/rlite.py5
-rw-r--r--rumba/testbeds/qemu.py4
4 files changed, 38 insertions, 6 deletions
diff --git a/rumba/model.py b/rumba/model.py
index b877209..5647b1e 100644
--- a/rumba/model.py
+++ b/rumba/model.py
@@ -28,6 +28,7 @@ import abc
import os
import stat
import time
+import shutil
import rumba.log as log
from rumba import ssh_support
@@ -70,13 +71,20 @@ class Testbed(object):
username,
password,
proj_name,
- http_proxy=None):
+ http_proxy=None,
+ system_logs=None):
self.username = username
self.password = password
self.proj_name = proj_name
self.exp_name = exp_name
self.http_proxy = http_proxy
self.flags = {'no_vlan_offload': False}
+ if system_logs is None:
+ self.system_logs = ['/var/log/syslog']
+ elif isinstance(system_logs, str):
+ self.system_logs = [system_logs]
+ else:
+ self.system_logs = system_logs
@abc.abstractmethod
def swap_in(self, experiment):
@@ -526,7 +534,12 @@ class Policy(object):
class Experiment(object):
__metaclass__ = abc.ABCMeta
- def __init__(self, testbed, nodes=None, git_repo=None, git_branch=None):
+ def __init__(self, testbed,
+ nodes=None,
+ git_repo=None,
+ git_branch=None,
+ log_dir=None,
+ prototype_logs=None):
if nodes is None:
nodes = list()
self.nodes = nodes
@@ -544,6 +557,22 @@ class Experiment(object):
self.dt_flows = [] # a list of per-DIF lists of data transfer flows
self.mgmt_flows = [] # a list of per-DIF lists of management flows
+ # Determine log directory
+ if log_dir is None:
+ # If it is None, use /tmp/rumba/{project}
+ # Wipe it and make it again
+ exp_name = self.testbed.exp_name.replace('/', '_') # Just in case
+ log_dir = '/tmp/rumba/' + exp_name + '/'
+ shutil.rmtree(log_dir, ignore_errors=True)
+ os.mkdir(log_dir)
+ self.log_dir = log_dir
+ if not os.path.isdir(self.log_dir):
+ raise Exception('Destination "%s" is not a directory. '
+ 'Cannot fetch logs.'
+ % self.log_dir)
+ self.prototype_logs = prototype_logs \
+ if prototype_logs is not None else []
+
# Generate missing information
self.generate()
diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py
index 50b8d89..41de9bb 100644
--- a/rumba/prototypes/irati.py
+++ b/rumba/prototypes/irati.py
@@ -188,7 +188,7 @@ class Experiment(mod.Experiment):
self.sudo('modprobe shim-eth-vlan'),
self.sudo('modprobe normal-ipcp'),
self.sudo('ipcm -a \"%(ipcmcomps)s\" '
- '-c /etc/%(name)s.ipcm.conf -l %(verb)s &> log &'
+ '-c /etc/%(name)s.ipcm.conf -l %(verb)s &> ipcmstart.log &'
% format_args)]
logger.info('Sending setup commands to node %s.', node.name)
diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py
index 3268ef5..dca693b 100644
--- a/rumba/prototypes/rlite.py
+++ b/rumba/prototypes/rlite.py
@@ -41,7 +41,8 @@ class Experiment(mod.Experiment):
def __init__(self, testbed, nodes=None,
git_repo='https://github.com/vmaffione/rlite',
git_branch='master'):
- mod.Experiment.__init__(self, testbed, nodes, git_repo, git_branch)
+ mod.Experiment.__init__(self, testbed, nodes, git_repo, git_branch,
+ prototype_logs=['/tmp/uipcp.log'])
@staticmethod
def make_executor(node, packages, testbed):
@@ -74,7 +75,7 @@ class Experiment(mod.Experiment):
"modprobe rlite-shim-eth",
"modprobe rlite-shim-udp4",
"modprobe rlite-shim-loopback",
- "rlite-uipcps -v DBG >uipcp.log 2>&1 &"]
+ "rlite-uipcps -v DBG > /tmp/uipcp.log 2>&1 &"]
self.may_sudo(cmds)
for node in self.nodes:
diff --git a/rumba/testbeds/qemu.py b/rumba/testbeds/qemu.py
index a74fae0..4321fc8 100644
--- a/rumba/testbeds/qemu.py
+++ b/rumba/testbeds/qemu.py
@@ -48,7 +48,9 @@ class Testbed(mod.Testbed):
def __init__(self, exp_name, bzimage_path=None, initramfs_path=None,
proj_name="ARCFIRE", password="root", username="root",
use_vhost=True):
- mod.Testbed.__init__(self, exp_name, username, password, proj_name)
+ mod.Testbed.__init__(self, exp_name,
+ username, password,
+ proj_name, system_logs=['/var/log/messages'])
self.vms = {}
self.shims = []
self.vhost = use_vhost