aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincenzo Maffione <v.maffione@gmail.com>2017-06-01 17:12:28 +0200
committerVincenzo Maffione <v.maffione@gmail.com>2017-06-01 17:12:28 +0200
commit9424b5f36e2ef87d4bd01b9b4e5fc83965ec33b6 (patch)
tree91317ac1120b2cb8b5c1ef1c1c5695b6f3516a4f
parentf3d700174eed69d612650df3c63e8b56cebf2c52 (diff)
downloadrumba-9424b5f36e2ef87d4bd01b9b4e5fc83965ec33b6.tar.gz
rumba-9424b5f36e2ef87d4bd01b9b4e5fc83965ec33b6.zip
qemu plugin: automatic download of buildroot images
-rwxr-xr-xexamples/two-layers.py6
-rw-r--r--rumba/testbeds/qemu.py22
2 files changed, 21 insertions, 7 deletions
diff --git a/examples/two-layers.py b/examples/two-layers.py
index b4e4e64..b3622fd 100755
--- a/examples/two-layers.py
+++ b/examples/two-layers.py
@@ -48,11 +48,9 @@ d = Node("d",
tb = qemu.Testbed(exp_name = "twolayers",
username = "root",
- password = "root",
- bzimage = '/home/vmaffione/git/rlite/demo/buildroot/bzImage',
- initramfs = '/home/vmaffione/git/rlite/demo/buildroot/rootfs.cpio')
+ password = "root")
-exp = rl.Experiment(tb, nodes = [a, b, c, d])
+exp = irati.Experiment(tb, nodes = [a, b, c, d])
print(exp)
diff --git a/rumba/testbeds/qemu.py b/rumba/testbeds/qemu.py
index a916525..894bee5 100644
--- a/rumba/testbeds/qemu.py
+++ b/rumba/testbeds/qemu.py
@@ -26,25 +26,41 @@ 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 = []
+ # Download the proper buildroot image, if not provided explicitely
+ url_prefix = "https://bitbucket.org/vmaffione/rina-images/downloads/"
+ if not bzimage:
+ bzimage = 'irati.bzImage'
+ if not os.path.exists(bzimage):
+ print("Downloading %s" % (url_prefix + bzimage))
+ wget.download(url_prefix + bzimage)
+ print("\n")
+ if not initramfs:
+ initramfs = 'irati.rootfs.cpio'
+ if not os.path.exists(initramfs):
+ print("Downloading %s" % (url_prefix + initramfs))
+ wget.download(url_prefix + initramfs)
+ print("\n")
+ self.bzimage = bzimage
+ self.initramfs = initramfs
+
@staticmethod
def _run_command_chain(commands, results_queue,
error_queue, ignore_errors=False):