diff options
author | Dimitri Staessens <dimitri.staessens@ugent.be> | 2017-10-24 17:00:40 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2017-10-24 17:03:48 +0200 |
commit | c09a71b756ab3208ac02a006f9a4d54792b803b5 (patch) | |
tree | 26e8110a48f1664716db1052cfc887206687da01 | |
parent | 339c971d13b6411d165f8af2914d459e59383b84 (diff) | |
download | rumba-c09a71b756ab3208ac02a006f9a4d54792b803b5.tar.gz rumba-c09a71b756ab3208ac02a006f9a4d54792b803b5.zip |
testbeds: Add support for selecting jfed VMs
Allows setting the attribute machine_type="virtual" for experiment
nodes. If the attribute is set to something else than "virtual" a bare
metal machine will be selected. If the attribute is not set, the
default will be chosen from the jfed testbed. For the wall and
cloudlab, the default is physical machines, for the others, it's
virtual machines. This default can be overriden by setting the jfed
testbed attribute use_physical_machines to True or False.
-rw-r--r-- | rumba/model.py | 3 | ||||
-rw-r--r-- | rumba/testbeds/jfed.py | 36 |
2 files changed, 33 insertions, 6 deletions
diff --git a/rumba/model.py b/rumba/model.py index a223fb4..62125a6 100644 --- a/rumba/model.py +++ b/rumba/model.py @@ -215,7 +215,7 @@ class SSHConfig: # class Node: def __init__(self, name, difs=None, dif_registrations=None, - client=False, policies=None): + client=False, policies=None, machine_type=None): self.name = name if difs is None: difs = list() @@ -225,6 +225,7 @@ class Node: if dif_registrations is None: dif_registrations = dict() self.dif_registrations = dif_registrations + self.machine_type = machine_type self.ssh_config = SSHConfig(name) self.ipcps = [] self.policies = dict() diff --git a/rumba/testbeds/jfed.py b/rumba/testbeds/jfed.py index f40cb06..7182143 100644 --- a/rumba/testbeds/jfed.py +++ b/rumba/testbeds/jfed.py @@ -47,7 +47,8 @@ class Testbed(mod.Testbed): def __init__(self, exp_name, username, cert_file, exp_hours="2", proj_name="ARCFIRE", authority="wall2.ilabt.iminds.be", - image=None, image_custom=False, image_owner=None): + image=None, image_custom=False, image_owner=None, + use_physical_machines=None): passwd = getpass.getpass(prompt="Password for certificate file: ") mod.Testbed.__init__(self, exp_name, @@ -55,7 +56,6 @@ class Testbed(mod.Testbed): passwd, proj_name, http_proxy="https://proxy.atlantis.ugent.be:8080") - self.authority = "urn:publicid:IDN+" + authority + "+authority+cm" self.auth_name = authority self.cert_file = cert_file self.exp_hours = exp_hours @@ -64,6 +64,18 @@ class Testbed(mod.Testbed): self.manifest = os.path.join(mod.tmp_dir, self.exp_name + ".rrspec") self.jfed_jar = os.path.join(mod.cache_dir, 'jfed_cli/experimenter-cli.jar') + + if "exogeni" in authority: + self.authority = "urn:publicid:IDN+" + authority + "+authority+am" + else: + self.authority = "urn:publicid:IDN+" + authority + "+authority+cm" + + if use_physical_machines is None: + if "wall" in authority or "cloudlab" in authority: + self.use_physical_machines=True + else: + self.use_physical_machines=False + if image is not None: if image_owner is None: if not image_custom: @@ -126,12 +138,26 @@ class Testbed(mod.Testbed): el = doc.createElement("node") top_el.appendChild(el) el.setAttribute("client_id", node.name) - el.setAttribute("exclusive", "true") + + if node.machine_type is None: + if (self.use_physical_machines): + el.setAttribute("exclusive", "true") + else: + el.setAttribute("exclusive", "false") + elif node.machine_type == "virtual": + el.setAttribute("exclusive", "false") + else: + el.setAttribute("exclusive", "true") + el.setAttribute("component_manager_id", self.authority) el2 = doc.createElement("sliver_type") el.appendChild(el2) - el2.setAttribute("name", "raw-pc") + + if (el.getAttribute("exclusive") == True): + el2.setAttribute("name", "raw-pc") + else: + el2.setAttribute("name", "default-vm") if self.image is not None: image_el = doc.createElement("disk_image") @@ -153,7 +179,7 @@ class Testbed(mod.Testbed): top_el.appendChild(el) el.setAttribute("client_id", dif.name) - el2 = doc.createElement("component_manager_id") + el2 = doc.createElement("component_manager") el2.setAttribute("name", self.authority) el.appendChild(el2) |