aboutsummaryrefslogtreecommitdiff
path: root/rumba
diff options
context:
space:
mode:
authorVincenzo Maffione <v.maffione@gmail.com>2017-06-01 15:51:19 +0000
committerVincenzo Maffione <v.maffione@gmail.com>2017-06-01 15:51:19 +0000
commit430f1a369f9dbc1328abb3ea750cfcc0c4db0c3e (patch)
tree684e1fca97b1414843ef61a7840dceeeaa8c826b /rumba
parent7d816ccc891934d34465fc30cc8de1b4d55381f6 (diff)
parent15687f1938dd5faa68eccfdcacc45fb4b0644b45 (diff)
downloadrumba-430f1a369f9dbc1328abb3ea750cfcc0c4db0c3e.tar.gz
rumba-430f1a369f9dbc1328abb3ea750cfcc0c4db0c3e.zip
Merge branch 'download' into 'master'
QEMU plugin: download buildroot images if not provided by the user See merge request !51
Diffstat (limited to 'rumba')
-rw-r--r--rumba/model.py8
-rw-r--r--rumba/prototypes/irati.py3
-rw-r--r--rumba/prototypes/ouroboros.py3
-rw-r--r--rumba/prototypes/rlite.py3
-rw-r--r--rumba/testbeds/qemu.py24
5 files changed, 36 insertions, 5 deletions
diff --git a/rumba/model.py b/rumba/model.py
index 7f65098..ccd60df 100644
--- a/rumba/model.py
+++ b/rumba/model.py
@@ -520,11 +520,15 @@ class Experiment:
@abc.abstractmethod
def install_prototype(self):
- raise Exception('run_prototype() method not implemented')
+ raise Exception('install_prototype() method not implemented')
@abc.abstractmethod
def bootstrap_prototype(self):
- raise Exception('run_prototype() method not implemented')
+ raise Exception('bootstrap_prototype() method not implemented')
+
+ @abc.abstractmethod
+ def prototype_name(self):
+ raise Exception('prototype_name() method not implemented')
def swap_in(self):
# Realize the experiment testbed (testbed-specific)
diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py
index eaca03a..3669320 100644
--- a/rumba/prototypes/irati.py
+++ b/rumba/prototypes/irati.py
@@ -38,6 +38,9 @@ logger = log.get_logger(__name__)
# An experiment over the IRATI implementation
class Experiment(mod.Experiment):
+ def prototype_name(self):
+ return 'irati'
+
@staticmethod
def real_sudo(s):
return 'sudo ' + s
diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py
index 01b8b72..9ac1425 100644
--- a/rumba/prototypes/ouroboros.py
+++ b/rumba/prototypes/ouroboros.py
@@ -32,6 +32,9 @@ class Experiment(mod.Experiment):
def __init__(self, testbed, nodes=None):
mod.Experiment.__init__(self, testbed, nodes)
+ def prototype_name(self):
+ return 'ouroboros'
+
def setup_ouroboros(self):
for node in self.nodes:
ssh.execute_command(self.testbed, node.ssh_config,
diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py
index de2ba52..cc38255 100644
--- a/rumba/prototypes/rlite.py
+++ b/rumba/prototypes/rlite.py
@@ -34,6 +34,9 @@ class Experiment(mod.Experiment):
def __init__(self, testbed, nodes=None):
mod.Experiment.__init__(self, testbed, nodes)
+ def prototype_name(self):
+ return 'rlite'
+
def execute_commands(self, node, cmds):
ssh.execute_commands(self.testbed, node.ssh_config,
cmds, time_out=None)
diff --git a/rumba/testbeds/qemu.py b/rumba/testbeds/qemu.py
index a916525..b7ebef9 100644
--- a/rumba/testbeds/qemu.py
+++ b/rumba/testbeds/qemu.py
@@ -26,24 +26,25 @@ import os
import rumba.model as mod
import rumba.log as log
import rumba.ssh_support as ssh_support
+import wget
logger = log.get_logger(__name__)
class Testbed(mod.Testbed):
- def __init__(self, exp_name, bzimage, initramfs, proj_name="ARCFIRE",
+ def __init__(self, exp_name, bzimage=None, initramfs=None, proj_name="ARCFIRE",
password="root", username="root",
use_vhost=True, qemu_logs_dir=None):
mod.Testbed.__init__(self, exp_name, username, password, proj_name)
self.vms = {}
self.shims = []
- self.bzimage = bzimage
- self.initramfs = initramfs
self.vhost = use_vhost
self.qemu_logs_dir = os.getcwd() if qemu_logs_dir is None \
else qemu_logs_dir
self.boot_processes = []
+ self.bzimage = bzimage
+ self.initramfs = initramfs
@staticmethod
def _run_command_chain(commands, results_queue,
@@ -114,6 +115,23 @@ class Testbed(mod.Testbed):
raise Exception('Not authenticated')
logger.info("swapping in")
+
+ # Download the proper buildroot images, if the user did not specify
+ # local images
+ url_prefix = "https://bitbucket.org/vmaffione/rina-images/downloads/"
+ if not self.bzimage:
+ self.bzimage = '%s.bzImage' % (experiment.prototype_name())
+ if not os.path.exists(self.bzimage):
+ logger.info("Downloading %s" % (url_prefix + self.bzimage))
+ wget.download(url_prefix + self.bzimage)
+ print("\n")
+ if not self.initramfs:
+ self.initramfs = '%s.rootfs.cpio' % (experiment.prototype_name())
+ if not os.path.exists(self.initramfs):
+ logger.info("Downloading %s" % (url_prefix + self.initramfs))
+ wget.download(url_prefix + self.initramfs)
+ print("\n")
+
logger.info('Setting up interfaces.')
# Building bridges and taps