* Add multipath-tools (specifically, kpartx) to nova-compute's $PATH

so that it can inject SSH keys into disk images.
* Use the injected key if available.

svn path=/nixos/trunk/; revision=26724
This commit is contained in:
Eelco Dolstra 2011-04-06 15:53:03 +00:00
parent 2e2282bd5e
commit 4c2a0dc531
2 changed files with 16 additions and 12 deletions

View File

@ -18,6 +18,9 @@
echo "setting host name..." echo "setting host name..."
${pkgs.nettools}/bin/hostname $(${pkgs.curl}/bin/curl http://169.254.169.254/1.0/meta-data/hostname) ${pkgs.nettools}/bin/hostname $(${pkgs.curl}/bin/curl http://169.254.169.254/1.0/meta-data/hostname)
# Don't download the SSH key if it has already been injected
# into the image (a Nova feature).
if ! [ -e /root/.ssh/authorized_keys ]; then
echo "obtaining SSH key..." echo "obtaining SSH key..."
mkdir -p /root/.ssh mkdir -p /root/.ssh
${pkgs.curl}/bin/curl --retry 3 --retry-delay 0 --fail \ ${pkgs.curl}/bin/curl --retry 3 --retry-delay 0 --fail \
@ -31,6 +34,7 @@
chmod 600 /root/.ssh/authorized_keys chmod 600 /root/.ssh/authorized_keys
rm -f /root/key.pub rm -f /root/key.pub
fi fi
fi
# Print the host public key on the console so that the user # Print the host public key on the console so that the user
# can obtain it securely by parsing the output of # can obtain it securely by parsing the output of

View File

@ -104,7 +104,7 @@ in
path = path =
[ pkgs.sudo pkgs.vlan pkgs.nettools pkgs.iptables pkgs.qemu_kvm [ pkgs.sudo pkgs.vlan pkgs.nettools pkgs.iptables pkgs.qemu_kvm
pkgs.e2fsprogs pkgs.utillinux pkgs.e2fsprogs pkgs.utillinux pkgs.multipath_tools
]; ];
exec = "${nova}/bin/nova-compute --nodaemon --verbose"; exec = "${nova}/bin/nova-compute --nodaemon --verbose";