6 |
6 |
file. This definition also allows for manual creation of an instance by simply
|
7 |
7 |
setting only the disks up and allowing you to boot via the install cd manually.
|
8 |
8 |
The goal of this instance is to allow fast and flexible installation of
|
9 |
|
instances without the need for external tools such as deboostrap.
|
|
9 |
instances without the need for external tools such as debootstrap.
|
10 |
10 |
|
11 |
11 |
Installation
|
12 |
12 |
------------
|
... | ... | |
74 |
74 |
Creation of Deployment Images
|
75 |
75 |
-----------------------------
|
76 |
76 |
|
77 |
|
There are two types that are supported for deploying images.
|
|
77 |
There are three types that are supported for deploying images.
|
|
78 |
|
|
79 |
* tarball
|
|
80 |
* qemu image
|
|
81 |
* dump
|
78 |
82 |
|
79 |
83 |
Tarball
|
80 |
84 |
~~~~~~~
|
... | ... | |
89 |
93 |
Qemu Images
|
90 |
94 |
~~~~~~~~~~~
|
91 |
95 |
|
92 |
|
To create a new qemu based disk image, you will need to able the 'CDINSTALL'
|
|
96 |
To create a new qemu based disk image, you will need to able the ``CDINSTALL``
|
93 |
97 |
option and install the VM using the distro's provided installation medium. It is
|
94 |
98 |
not recommended to build images on systems outside of ganeti (such as libvirt)
|
95 |
99 |
as we have encountered issues with systems segfaulting.
|
96 |
100 |
|
97 |
101 |
Once the instance has been created, boot the instance and point it to the
|
98 |
|
install medium:
|
|
102 |
install medium::
|
99 |
103 |
|
100 |
|
gnt-instance start -H cdrom_image_path=path/to/iso/ubuntu-9.10.iso, \
|
|
104 |
gnt-instance start -H cdrom_image_path=path/to/iso/ubuntu-9.10.iso, \
|
101 |
105 |
boot_order=cdrom instance-name
|
102 |
106 |
|
103 |
107 |
Once the base image has been installed, ensure you have the acpid package
|
104 |
108 |
installed so that ganeti can shutdown the VM properly. Once you are happy with
|
105 |
109 |
your base image, shutdown the VM, activate the disks, and create the disk
|
106 |
110 |
image using qemu-img. Its recommended you use qcow2 with compression to reduce
|
107 |
|
the amount of disk space used.
|
|
111 |
the amount of disk space used::
|
108 |
112 |
|
109 |
113 |
# activate disks
|
110 |
114 |
gnt-instance activate-disks instance-name
|
... | ... | |
112 |
116 |
qemu-img convert -c -f host_device /dev/drbd1 \
|
113 |
117 |
-O qcow2 $IMAGE_DIR/ubuntu-9.10-x86_64.img
|
114 |
118 |
|
115 |
|
Note: Older versions of qemu-img may not support the 'host_device' format so use
|
116 |
|
'raw' instead which should work in theory.
|
|
119 |
Note: Older versions of qemu-img may not support the ``host_device`` format so
|
|
120 |
use ``raw`` instead which should work in theory.
|
|
121 |
|
|
122 |
Dump
|
|
123 |
~~~~
|
|
124 |
|
|
125 |
The last, and most efficient type of disk image is creating filesystem dumps
|
|
126 |
using the dump command. The advantage with using dumps is that its much faster
|
|
127 |
to deploy using it, and it also has built-in compression. The disadvantage is
|
|
128 |
that you need to install grub manually which might be an issue on some operating
|
|
129 |
systems. We currently support grub 1, but anything using grub 2 will have issues
|
|
130 |
that I haven't found a solution for yet.
|
|
131 |
|
|
132 |
You will need to create images for both the boot and root partition (if you
|
|
133 |
include a boot partition).
|
|
134 |
|
|
135 |
Create a base image for an instance just like its described in Qemu Images. Make
|
|
136 |
sure the instance is shutdown and then issue the following commands (assuming
|
|
137 |
the activated disk is drbd1)::
|
|
138 |
|
|
139 |
dump -0 -q -z9 -f ${IMAGE_DIR}/${IMAGE_NAME}-${ARCH}-boot.dump \
|
|
140 |
/dev/mapper/drbdq-1
|
|
141 |
|
|
142 |
dump -0 -q -z9 -f ${IMAGE_DIR}/${IMAGE_NAME}-${ARCH}-root.dump \
|
|
143 |
/dev/mapper/drbdq-3
|
117 |
144 |
|
118 |
145 |
Partition Layout
|
119 |
146 |
~~~~~~~~~~~~~~~~
|
... | ... | |
123 |
150 |
future, however you *must* use the following layout otherwise ganeti will not
|
124 |
151 |
install the VM correctly. Currently the following partition layout is assumed:
|
125 |
152 |
|
126 |
|
With swap:
|
|
153 |
With swap::
|
127 |
154 |
/dev/$disk1 /boot
|
128 |
155 |
/dev/$disk2 swap
|
129 |
156 |
/dev/$disk3 /
|
130 |
157 |
|
131 |
|
Without swap:
|
|
158 |
Without swap::
|
132 |
159 |
/dev/$disk1 /boot
|
133 |
160 |
/dev/$disk2 /
|
134 |
161 |
|
|
162 |
NOTE: If you have kernel_path set, /boot will not be created and all partition
|
|
163 |
numbers will go up by one. For example:
|
|
164 |
|
|
165 |
With swap::
|
|
166 |
/dev/$disk1 swap
|
|
167 |
/dev/$disk2 /
|
|
168 |
|
|
169 |
Without swap::
|
|
170 |
/dev/$disk1 /
|
|
171 |
|
135 |
172 |
Image Naming
|
136 |
173 |
~~~~~~~~~~~~
|
137 |
174 |
|
... | ... | |
139 |
176 |
|
140 |
177 |
tarball: $IMAGE_NAME-$ARCH.tar.gz
|
141 |
178 |
qemu-img: $IMAGE_NAME-$ARCH.img
|
|
179 |
dump: $IMAGE_NAME-$ARCH-boot.dump
|
|
180 |
$IMAGE_NAME-$ARCH-root.dump
|
|
181 |
|
|
182 |
Useful Scripts
|
|
183 |
~~~~~~~~~~~~~~
|
|
184 |
|
|
185 |
There are a set of useful scripts located in /usr/share/ganeti/os/image/tools
|
|
186 |
that you are welcome to use. These scripts are all intended to be run on the
|
|
187 |
master node::
|
|
188 |
|
|
189 |
mount-disks $instance_name
|
|
190 |
umount-disks $instance_name
|
|
191 |
|
|
192 |
This will mount or umount an instance to /tmp/${instance_name}_root
|
|
193 |
|
|
194 |
``make-dump $instance_name [ $IMAGE_DIR ]``
|
|
195 |
|
|
196 |
Create dump images for the given OS variant. You can override the default
|
|
197 |
$IMAGE_DIR setting by giving it as a second argument.
|
|
198 |
|
|
199 |
``make-qemu-img $instance_name [ $IMAGE_DIR ]``
|
|
200 |
|
|
201 |
Create an qemu image for the given OS variant.
|
142 |
202 |
|
143 |
203 |
Customization of the instance
|
144 |
204 |
-----------------------------
|
... | ... | |
157 |
217 |
ROOT_DEV: device in which the root (/) filesystem resides (the one mounted in
|
158 |
218 |
TARGET)
|
159 |
219 |
BOOT_DEV: device in which the boot (/boot) filesystem resides
|
|
220 |
IMAGE_TYPE: type of image being used (tarball, qemu, dump)
|
160 |
221 |
|
161 |
222 |
The scripts in CUSTOMIZE_DIR can exit with an error code to signal an error in
|
162 |
223 |
the instance creation, should they fail.
|
... | ... | |
166 |
227 |
able to umount the filesystem from the directory, and hand the instance back to
|
167 |
228 |
Ganeti.
|
168 |
229 |
|
|
230 |
Included Custom Scripts
|
|
231 |
-----------------------
|
|
232 |
|
|
233 |
This OS definition includes three optional customization scripts that are
|
|
234 |
disabled by default. They are not required but are useful.
|
|
235 |
|
|
236 |
Grub
|
|
237 |
~~~~
|
|
238 |
|
|
239 |
When enabled, this can setup two things:
|
|
240 |
|
|
241 |
- Install grub into the MBR
|
|
242 |
- Setup serial access to grub
|
|
243 |
|
|
244 |
In general, the MBR will only be installed if you're not using a qemu image
|
|
245 |
type, or the ``kernel_path`` parameter is empty or initiating an import. There
|
|
246 |
is currently no support for install a grub2 MBR (which Ubuntu Karmic requires).
|
|
247 |
Its recommended that you only use the qemu image type for Ubuntu Karmic until we
|
|
248 |
fix this.
|
|
249 |
|
|
250 |
If ``serial_console`` is ``True`` then this script will try to enable serial
|
|
251 |
support for grub.
|
|
252 |
|
|
253 |
Interfaces
|
|
254 |
~~~~~~~~~~
|
|
255 |
|
|
256 |
When enabled, it would try to setup networking for eth0 and enable DHCP. It
|
|
257 |
assumes you already have a DHCP client installed on the guest OS. This currently
|
|
258 |
supports the following operating systems:
|
|
259 |
|
|
260 |
- Redhat (CentOS/Fedora)
|
|
261 |
- Debian/Ubuntu
|
|
262 |
- Gentoo
|
|
263 |
- OpenSUSE
|
|
264 |
|
|
265 |
SSH
|
|
266 |
~~~
|
|
267 |
|
|
268 |
When enabled, it will clear out any generated ssh keys that the image may have
|
|
269 |
so that each instance have *unique* host keys. Currently its disabled for
|
|
270 |
Debian/Ubuntu since the keys won't be regenerated via the init script. We plan
|
|
271 |
to fix this manually at some point in the future.
|
|
272 |
|
169 |
273 |
# vi: set tw=80 ft=rst :
|