From 9d42e50b99993c3fa5b9724c09dd28be4c528add Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Wed, 28 Mar 2018 12:37:46 +0200 Subject: qemu: put ~/.ssh/id_rsa.pub into VM's authorized_keys fixes #17 --- rumba/testbeds/qemu.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/rumba/testbeds/qemu.py b/rumba/testbeds/qemu.py index 5f76684..5636e75 100644 --- a/rumba/testbeds/qemu.py +++ b/rumba/testbeds/qemu.py @@ -60,7 +60,7 @@ class Testbed(mod.Testbed): self.initramfs_path = initramfs_path self.multiproc_manager = None - self.executor = SSHExecutor(self); + self.executor = SSHExecutor(self) # Prepend sudo to all commands if the user is not 'root' def may_sudo(self, cmds): @@ -337,6 +337,16 @@ class Testbed(mod.Testbed): self.recover_if_names(experiment) + for node in experiment.nodes: + pub_key = os.path.join(os.path.expanduser("~"), + '.ssh', + 'id_rsa.pub') + node.copy_file(pub_key, '/root/.ssh') + node.execute_command('cd /root/.ssh; ' + 'mv authorized_keys old.authorized_keys; ' + 'cat old.authorized_keys id_rsa.pub ' + '> authorized_keys') + logger.info('Experiment has been successfully swapped in.') def swap_out(self, experiment): -- cgit v1.2.3