Debian Codegraph @

doc/sources/ovf/README

raw
1 This directory contains documentation and a demo of the OVF
2 functionality that is present in cloud-init.
3
4 The example/ directory contains the following files:
5 example/ovf-env.xml
6 This is an example ovf environment file
7 to make an iso that qualifies for the ISO transport, do:
8 mkdir my-iso
9 cp environment.xml my-iso/ovf-env.xml
10 genisoimage -o transport.iso -r my-iso
11 Then, boot with that ISO attached as a CDrom
12 - example/ubuntu-server.ovf
13 Example generated by virtualbox "export" of a simple VM.
14 It contains a functional ProductSection also. Given answers
15 to each of the Properties there, a suitable OVF environment file
16 (ovf-env.xml) could be created.
17
18 == Demo ==
19 In order to easily demonstrate this functionality, simple demo is
20 contained here. To boot a local virtual machine in either kvm or virtual
21 box, follow the steps below.
22
23 - download a suitable Ubuntu image
24 Visit http://cloud-images.ubuntu.com/releases and download a disk image
25 of Natty, Oneiric or a newer release.
26
27 $ burl="http://cloud-images.ubuntu.com/releases/"
28 $ disk="ubuntu-11.10-server-cloudimg-i386-disk1"
29 $ wcurl "$burl/11.10/release/$disk.img" -O "$disk.img"
30
31 - If you're going to use virtual box, you will need to convert the image
32 from qcow2 format into a virtual-box friendly VHD format.
33 $ qemu-img convert -O vdi "$disk.img" "ubuntu.vdi"
34
35 - If you're using kvm, you should create a qcow delta image to store
36 the changes so you keep the original pristine.
37 $ qemu-img create -f qcow2 -b "$disk.img" "ubuntu.qcow2"
38
39 Optionally, you could decompress the image, which will make it boot faster
40 but will take up more local disk space.
41 $ qemu-img convert -O qcow2 "$disk.img" "$disk.qcow2"
42 $ qemu-img create -f qcow2 -b "$disk.qcow2" ubuntu.qcow2
43
44 - Create an ISO file that will provide user-data to the image.
45 This will put the contents of 'user-data' into an ovf-env.xml file
46 and create an ISO file that can then be attached at boot to provide
47 the user data to cloud-init.
48
49 $ ./make-iso ovf-env.xml.tmpl user-data --output ovftransport.iso
50
51 - Boot your virtual machine
52 The cloud-images boot with kernel and boot progress to ttyS0.
53 You can change that at the grub prompt if you'd like by editing the
54 kernel entry. Otherwise, to see progress you'll need to switch
55 to the serial console. In kvm graphic mode, you do that by clicking
56 in the window and then pressing 'ctrl-alt-3'. For information
57 on how to do that in virtualbox or kvm curses, see the relevant
58 documentation.
59
60 KVM:
61 $ kvm -drive file=ubuntu.qcow2,if=virtio -cdrom ovftransport.iso \
62 -m 256 -net nic -net user,hostfwd=tcp::2222-:22
63
64 VirtualBox:
65 - Launch the GUI and create a new vm with $disk.vdi and ovftransport.iso
66 attached.
67 - If you use 'NAT' networking, then forward a port (2222) to the
68 guests' port 22 to be able to ssh.
69
70 Upon successful boot you will be able to log in as the 'ubuntu' user
71 with the password 'passw0rd' (which was set in the 'user-data' file).
72
73 You will also be able to ssh to the instance with the provided:
74 $ chmod 600 ovfdemo.pem
75 $ ssh -i ovfdemo.pem -p 2222 ubuntu@localhost
76
77 - Notes:
78 * The 'instance-id' that is set in the ovf-env.xml image needs to
79 be unique. If you want to run the first-boot code of cloud-init
80 again you will either have to remove /var/lib/cloud ('rm -Rf' is fine)
81 or create a new cdrom with a different instance-id. To do the
82 ladder, simply add the '--instance-id=' flag to the 'make-iso'
83 command above and start your vm with the new ISO attached.