Skip to content

Instantly share code, notes, and snippets.

@smoser
Created August 17, 2012 21:01
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save smoser/3382629 to your computer and use it in GitHub Desktop.
boot cloud images with libvirt
$ disk_dist_imgz=/archive/mirrors/uec/releases/precise/release-20120728/ubuntu-12.04-server-cloudimg-amd64-disk1.img
$ disk_dist_img=disk.img.dist
$ disk=disk.img
$ qemu-img convert "${disk_dist_imgz}" "${disk_dist_img}"
$ qemu-img create -f qcow2 -b "${disk_dist_img}" "$disk"
$ cat my-user-data
#cloud-config
password: passw0rd
chpasswd: { expire: False }
ssh_pwauth: True
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAA...w== smoser@brickies
# update the above user-data with the output of 'ssh-add -L'
# create a seed disk with 'make-seed-disk' for cloud-init (LP: #1036312)
$ make-seed-disk --disk-format=qcow2 seed.img my-user-data
# write-libvirt-xml from http://paste.ubuntu.com/1153294/
$ ./write-libvirt-xml "$disk,seed.img" my-dom > libvirt.xml
$ virsh define libvirt.xml
$ virsh start my-dom
# serial output should go to 'my-dom-serial.log' including ip address for ssh
$ virsh vncdisplay my-dom
@mdanetzky
Copy link

http://paste.ubuntu.com/1153294/ doesn't exist anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment