Image Format

Version 38 (Nikos Skalkotos, 06/26/2013 10:58 am)

1 1 Nikos Skalkotos
h1. Image Format
2 1 Nikos Skalkotos
3 9 Constantinos Venetsanopoulos
The image format (@img_format@) is a required OS Provider parameter and snf-image will complain if not found
4 38 Nikos Skalkotos
Right now we support 3 different types of image formats:
5 8 Constantinos Venetsanopoulos
* @extdump@
6 8 Constantinos Venetsanopoulos
* @ntfsdump@
7 1 Nikos Skalkotos
* @diskdump@
8 1 Nikos Skalkotos
9 13 Nikos Skalkotos
h2. extdump & ntfsdump image formats
10 4 Nikos Skalkotos
11 38 Nikos Skalkotos
Those two formats are dumps (raw copies using dd) of partitions hosting Linux systems on ext{2,3,4} and Windows systems on ntfs filesystems respectively.
12 4 Nikos Skalkotos
13 5 Nikos Skalkotos
Partitions hosting a Windows or Linux system that are suitable for dumping should have the following properties:
14 1 Nikos Skalkotos
* Be the first partition in the filesystem
15 5 Nikos Skalkotos
* The OS they host should not depend on any other partitions
16 1 Nikos Skalkotos
* Start at sector 2048
17 13 Nikos Skalkotos
* Have a bootloader installed in the boot sector of the partition (not MBR)
18 5 Nikos Skalkotos
* Have the root device in /etc/fstab specified in a persistent way, using UUID or LABEL (for extdump only)
19 3 Nikos Skalkotos
20 4 Nikos Skalkotos
h3. Known Issues
21 1 Nikos Skalkotos
22 1 Nikos Skalkotos
* For linux systems, having grub installed in the partition is fragile and things can go wrong when resizing the partitions, especially when shrinking.
23 3 Nikos Skalkotos
* Swap space is not supported.
24 3 Nikos Skalkotos
* More complicated partition schemes are not supported.
25 3 Nikos Skalkotos
26 13 Nikos Skalkotos
h2. diskdump image format
27 1 Nikos Skalkotos
28 38 Nikos Skalkotos
Diskdump is a newer format that overcomes most of the aforementioned issues. This format is a dump (raw copy using dd) of a whole disk.
29 1 Nikos Skalkotos
30 7 Nikos Skalkotos
This design decision has the following benefits:
31 5 Nikos Skalkotos
* Swap partitions are supported
32 5 Nikos Skalkotos
* The system may use multiple partitions:
33 5 Nikos Skalkotos
** dedicated partitions for /boot, /home etc in linux
34 5 Nikos Skalkotos
** system and boot partition in Windows
35 7 Nikos Skalkotos
* There are no restrictions on starting sectors of partitions
36 5 Nikos Skalkotos
37 8 Constantinos Venetsanopoulos
Although diskdump is a lot more flexible than the older formats, there are still some rules to follow:
38 5 Nikos Skalkotos
* All devices in fstab should be specified by persistent names (UUID or LABEL)
39 1 Nikos Skalkotos
* LVMs and extended partitions should be avoided.
40 6 Nikos Skalkotos
** The support for extended partitions is partial. snf-image does not support resizing logical partitions.
41 1 Nikos Skalkotos
** Logical volumes are not supported at all
42 1 Nikos Skalkotos
* In Linux disks only ext{2,3,4} filesystems are supported
43 13 Nikos Skalkotos
44 13 Nikos Skalkotos
h2. Image Properties
45 13 Nikos Skalkotos
46 34 Nikos Skalkotos
In order for snf-image to be able to properly configure an image, it may make use of a set of image properties. Those image properties are passed to snf-image by Ganeti through the @img_poroperties@ OS parameter (see [[:#Ganeti-OS-Interface|Ganeti OS Interface]]). The name of all image properties is *case-insensitive*. For the @diskdump@ format some properties are *mandatory*. For {ext,ntfs}dump formats all image properties are optional.
47 1 Nikos Skalkotos
48 10 Nikos Skalkotos
A list of mandatory and optional properties follows:
49 16 Nikos Skalkotos
* Mandatory properties (@diskdump@ only)
50 1 Nikos Skalkotos
** *OSFAMILY={linux,windows}*
51 1 Nikos Skalkotos
This specifies whether the image is a Linux or a Windows Image. {ext,ntfs}dump formats are self descriptive regarding this property.
52 1 Nikos Skalkotos
** *ROOT_PARTITION={1,2,3,4}*
53 13 Nikos Skalkotos
This specifies the partition number of the root partition. As mentioned earlier, for now, only primary partitions are supported. This property is trivial for {ext,ntfs}dump formats (they only host one partition).
54 10 Nikos Skalkotos
* Optional properties
55 10 Nikos Skalkotos
** *USERS="username1 username2...."*
56 30 Nikos Skalkotos
This is a space-seperated list of users, whose password will be reset by snf-image. The use of this property is optional, but highly recommended. For now, if this property is missing, the users are chosen according to a set of rules, but those rules may change or even be dropped in the future. The rules we currently use are listed below:
57 13 Nikos Skalkotos
*** For Windows images, the @Administrator@'s password is reset.
58 37 Nikos Skalkotos
*** For Linux images, the root password is reset for all distribution.
59 21 Nikos Skalkotos
** *EXCLUDE_ALL_TASKS*
60 28 Nikos Skalkotos
If this property is defined with a value other than _null_, then during the deployment, the image will not be configured at all. This is really handy because it gives the ability to deploy images hosting operating systems whose configuration is not supported by @snf-image@.
61 33 Nikos Skalkotos
** *EXCLUDE_TASK_<task_name>*
62 33 Nikos Skalkotos
This family of properties gives the ability to exclude individual configuration tasks from running. Hence, if the property @EXCLUDE_TASK_DeleteSSHKeys@ with a value other than _null_ is passed to @snf-image@, the aforementioned configuration step will not be executed, and the SSH Keys found in the image will not be removed during the deployment. Task exclusion provides great flexibility, but it needs to be used with great care. Tasks depend on each other and although those dependencies are well documented, automatic task dependency resolution isn't yet supported in @snf-image@. If you exclude task A but not task B which depends on A, you will probably end up with an unsuccessful deployment because B will fail and exit in an abnormal way. You can read more about configuration tasks [[Configuration Tasks|here]].
63 8 Constantinos Venetsanopoulos
64 29 Nikos Skalkotos
h3. OS parameter (img_properties)
65 29 Nikos Skalkotos
66 29 Nikos Skalkotos
Image properties are passed to snf_image through the @img_properties@ OS parameter as a simple json string like the one below:
67 29 Nikos Skalkotos
<pre>
68 29 Nikos Skalkotos
{
69 29 Nikos Skalkotos
     "PROPERTY1": "VALUE1",
70 29 Nikos Skalkotos
     "PROPERTY2": "VALUE2",
71 29 Nikos Skalkotos
     "PROPERTY3": "VALUE3",
72 29 Nikos Skalkotos
     ...
73 29 Nikos Skalkotos
     ...
74 29 Nikos Skalkotos
     ...
75 31 Nikos Skalkotos
     "PROPERTYn": "VALUEn"
76 29 Nikos Skalkotos
 }
77 29 Nikos Skalkotos
</pre>
78 29 Nikos Skalkotos
79 29 Nikos Skalkotos
A real life example for creating a new ganeti instance and passing image properties to @snf-image@ would probably look more like this:
80 29 Nikos Skalkotos
<pre>
81 32 Nikos Skalkotos
gnt-instance add -O img_properties='{"OSFAMILY":"linux"\,"ROOT_PARTITION":"2"\,"USERS":"root guest"}',img_format=diskdump...
82 29 Nikos Skalkotos
</pre>