Skip to content

Instantly share code, notes, and snippets.

@smoser

smoser/README.txt

Created Aug 17, 2012
Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@mdanetzky mdanetzky commented Aug 26, 2017

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