diff options
author | Marco Capitani <m.capitani@nextworks.it> | 2017-04-12 15:56:37 +0200 |
---|---|---|
committer | Marco Capitani <m.capitani@nextworks.it> | 2017-04-12 15:56:37 +0200 |
commit | c83ea6f4b791cd85cd248b039b353c522f2f1f3e (patch) | |
tree | cf3ffb203f0ada7bef09301aa3f3d5400b2d8c7b /rumba/testbeds/qemu.py | |
parent | 46310717c3293054324cc6a0271d855b638df0ff (diff) | |
parent | 6d8d0d30d75b318650034470b376a57a37b57944 (diff) | |
download | rumba-c83ea6f4b791cd85cd248b039b353c522f2f1f3e.tar.gz rumba-c83ea6f4b791cd85cd248b039b353c522f2f1f3e.zip |
Merge branch 'master' into master-marco
Updating with ssh changes (and other)
Diffstat (limited to 'rumba/testbeds/qemu.py')
-rw-r--r-- | rumba/testbeds/qemu.py | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/rumba/testbeds/qemu.py b/rumba/testbeds/qemu.py index 73a4f14..7255b3c 100644 --- a/rumba/testbeds/qemu.py +++ b/rumba/testbeds/qemu.py @@ -180,14 +180,14 @@ class Testbed(mod.Testbed): boot_batch_size = max(1, multiprocessing.cpu_count() // 2) booting_budget = boot_batch_size - boot_backoff = 12 + boot_backoff = 12 # in seconds base_port = 2222 - vm_memory = 164 + vm_memory = 164 # in megabytes vm_frontend = 'virtio-net-pci' vmid = 1 - for node in experiment.nodes: # type: mod.Node + for node in experiment.nodes: name = node.name vm = self.vms.setdefault(name, {'vm': node, 'ports': []}) fwdp = base_port + vmid @@ -195,7 +195,8 @@ class Testbed(mod.Testbed): mac = '00:0a:0a:0a:%02x:%02x' % (vmid, 99) vm['ssh'] = fwdp vm['id'] = vmid - node.full_name = "127.0.0.1:%s" % fwdp + node.ssh_config.hostname = "localhost" + node.ssh_config.port = fwdp vars_dict = {'fwdp': fwdp, 'id': vmid, 'mac': mac, 'bzimage': self.bzimage, @@ -243,8 +244,10 @@ class Testbed(mod.Testbed): booting_budget -= 1 if booting_budget <= 0: - print('Sleeping for %s seconds to give ' - 'the machines time to boot up.' % boot_backoff) + + print('Sleeping %s secs waiting ' + 'for the VMs to boot' % boot_backoff) + time.sleep(boot_backoff) booting_budget = boot_batch_size @@ -256,6 +259,14 @@ class Testbed(mod.Testbed): vmid += 1 + # Wait for the last batch of VMs to start + if booting_budget < boot_backoff: + tsleep = boot_backoff * (boot_batch_size - booting_budget) / \ + boot_batch_size + print('Sleeping %s secs waiting for the last VMs to boot' % tsleep) + time.sleep(tsleep) + + def swap_out(self, experiment): """ :rtype str |