aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Capitani <m.capitani@nextworks.it>2018-03-28 12:37:46 +0200
committerMarco Capitani <m.capitani@nextworks.it>2018-03-28 12:53:38 +0200
commit9d42e50b99993c3fa5b9724c09dd28be4c528add (patch)
tree1dffc47add13cfc465119535c28ed9582755535c
parent45b397567a6700fc1284d45fc04b7c49e8ffa5f4 (diff)
downloadrumba-9d42e50b99993c3fa5b9724c09dd28be4c528add.tar.gz
rumba-9d42e50b99993c3fa5b9724c09dd28be4c528add.zip
qemu: put ~/.ssh/id_rsa.pub into VM's authorized_keys
fixes #17
-rw-r--r--rumba/testbeds/qemu.py12
1 files changed, 11 insertions, 1 deletions
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):