aboutsummaryrefslogtreecommitdiff
path: root/rumba
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-09-18 12:57:57 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2017-09-18 13:05:44 +0200
commita47f94f48fa4e6856ac1ac63e871aa8363035dc7 (patch)
tree894a1992d3aa7cbc0aa5e56e29ffe2ad03ac0ddd /rumba
parent2f160576cf94a5aaadf87c84d5e4153549acffaa (diff)
downloadrumba-a47f94f48fa4e6856ac1ac63e871aa8363035dc7.tar.gz
rumba-a47f94f48fa4e6856ac1ac63e871aa8363035dc7.zip
testbeds: emulab: Continue if experiment is swapped in
This will let rumba continue if the experiment is already swapped in in emulab, since it is not an error. It also adds the posibility to swap the experiment out from Rumba.
Diffstat (limited to 'rumba')
-rw-r--r--rumba/prototypes/ouroboros.py3
-rw-r--r--rumba/ssh_support.py4
-rw-r--r--rumba/testbeds/emulab.py45
3 files changed, 42 insertions, 10 deletions
diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py
index 49323c5..97cd05f 100644
--- a/rumba/prototypes/ouroboros.py
+++ b/rumba/prototypes/ouroboros.py
@@ -50,7 +50,8 @@ class Experiment(mod.Experiment):
cmds = list()
cmds.append("sudo apt-get update")
- cmds.append("sudo apt-get install cmake protobuf-c-compiler git --yes")
+ cmds.append("sudo apt-get install cmake protobuf-c-compiler " +
+ "git libfuse-dev --yes")
cmds.append("sudo rm -r ~/ouroboros/build")
cmds.append("cd ~/ouroboros; sudo ./install_debug.sh /")
diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py
index 64d17e6..8b07c13 100644
--- a/rumba/ssh_support.py
+++ b/rumba/ssh_support.py
@@ -163,9 +163,9 @@ def execute_commands(testbed, ssh_config, commands, time_out=3):
chan.exec_command(command)
except paramiko.ssh_exception.SSHException as e:
raise SSHException('Failed to execute command')
- if (chan.recv_exit_status() != 0):
- raise SSHException('A remote command returned an error')
o = _print_stream(stdout)
+ if (chan.recv_exit_status() != 0):
+ raise SSHException('A remote command returned an error.\n' + o)
ssh_client.close()
return o
diff --git a/rumba/testbeds/emulab.py b/rumba/testbeds/emulab.py
index 66c5b7f..7568815 100644
--- a/rumba/testbeds/emulab.py
+++ b/rumba/testbeds/emulab.py
@@ -102,6 +102,8 @@ class Testbed(mod.Testbed):
Swaps experiment in
@param self: testbed info
+
+ @return: Is the experiment newly swapped in
"""
cmd = '/usr/testbed/bin/sslxmlrpc_client.py swapexp proj=' + \
self.proj_name + \
@@ -109,9 +111,17 @@ class Testbed(mod.Testbed):
self.exp_name + \
' direction=in'
- output = ssh.execute_command(self, self.ops_ssh_config, cmd)
+ try:
+ ssh.execute_command(self, self.ops_ssh_config, cmd)
+ except ssh.SSHException as e:
+ line = re.findall(r'not swapped out', str(e))
+ if line:
+ logger.info("Experiment is already swapped in.")
+ return False
+ else:
+ raise e
- return output
+ return True
def _create_experiment(self, experiment):
"""
@@ -142,9 +152,14 @@ class Testbed(mod.Testbed):
'" exp="' + exp_name + '" noswapin=true ' + \
'nsfilepath="' + dest_file_name + '"'
- ssh.execute_command(self, self.ops_ssh_config, cmd, time_out=None)
- ssh.execute_command(self, self.ops_ssh_config, 'rm ' + dest_file_name)
- logger.info("New experiment succesfully created.")
+ try:
+ ssh.execute_command(self, self.ops_ssh_config, cmd, time_out=None)
+ logger.info("New experiment succesfully created.")
+ except:
+ logger.info("Experiment already exists.")
+ finally:
+ ssh.execute_command(self, self.ops_ssh_config,
+ 'rm ' + dest_file_name)
def generate_ns_script(self, experiment):
"""
@@ -250,6 +265,22 @@ class Testbed(mod.Testbed):
def swap_in(self, experiment):
self._create_experiment(experiment)
- self.swap_exp_in()
- self.wait_until_nodes_up()
+ wait = self.swap_exp_in()
+ if wait:
+ self.wait_until_nodes_up()
self.complete_experiment_graph(experiment)
+
+
+ def swap_out(self, experiment):
+ """
+ Swaps experiment out
+
+ @param self: testbed info
+ """
+ cmd = '/usr/testbed/bin/sslxmlrpc_client.py swapexp proj=' + \
+ self.proj_name + \
+ ' exp=' + \
+ self.exp_name + \
+ ' direction=out'
+
+ ssh.execute_command(self, self.ops_ssh_config, cmd)