diff options
-rwxr-xr-x | examples/two-layers.py | 6 | ||||
-rw-r--r-- | rumba/testbeds/qemu.py | 22 |
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): |