Developer

Version 4 (Constantinos Venetsanopoulos, 10/13/2011 01:52 pm)

1 1 Constantinos Venetsanopoulos
h1. Developers
2 1 Constantinos Venetsanopoulos
3 1 Constantinos Venetsanopoulos
h2. Checking out
4 1 Constantinos Venetsanopoulos
5 1 Constantinos Venetsanopoulos
To check out the source code use @git@:
6 1 Constantinos Venetsanopoulos
<pre>
7 1 Constantinos Venetsanopoulos
$ git clone https://code.grnet.gr/git/snf-image
8 1 Constantinos Venetsanopoulos
</pre>
9 1 Constantinos Venetsanopoulos
10 1 Constantinos Venetsanopoulos
h2. Configure and install @snf-image-host@
11 1 Constantinos Venetsanopoulos
12 1 Constantinos Venetsanopoulos
Once you have checkout the source code, it's time to configure. For the simplest default configuration run:
13 1 Constantinos Venetsanopoulos
<pre>
14 1 Constantinos Venetsanopoulos
 $ cd snf-image-host
15 1 Constantinos Venetsanopoulos
 $ ./autogen.sh
16 1 Constantinos Venetsanopoulos
 $ ./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc
17 1 Constantinos Venetsanopoulos
</pre>
18 1 Constantinos Venetsanopoulos
19 1 Constantinos Venetsanopoulos
Other configuration options you may find useful:
20 1 Constantinos Venetsanopoulos
* @--with-progress-monitor@ : if enabled, it monitors the progress of the dd command while the Image is being copied and produces read/write statistics. To use this option you need to have @snf-ganeti-tools@ installed on your cluster, so that the @snf-progress-monitor@ program is present on your system.
21 1 Constantinos Venetsanopoulos
* @--with-helper-dir=/path/to/helper/dir@ : specify the path where the helper data are going to be stored
22 1 Constantinos Venetsanopoulos
* @--with-helper-img=/path/to/img/file@ : specify the path to the helper VM image
23 1 Constantinos Venetsanopoulos
* @--with-helper-kernel=/path/to/kernel@ : specify the path to the helper VM kernel
24 1 Constantinos Venetsanopoulos
* @--with-helper-initrd=/path/to/initrd@ : specify the path to the helper VM initrd
25 1 Constantinos Venetsanopoulos
* @--with-os-dir=/path/to/os/dir@ : specify the top-level OS Provider's directory under which to install itself
26 1 Constantinos Venetsanopoulos
27 1 Constantinos Venetsanopoulos
After configuring install the package by running:
28 1 Constantinos Venetsanopoulos
29 1 Constantinos Venetsanopoulos
<pre>
30 1 Constantinos Venetsanopoulos
 $ make && make install
31 1 Constantinos Venetsanopoulos
</pre>
32 1 Constantinos Venetsanopoulos
33 1 Constantinos Venetsanopoulos
h2. Preparing @snf-image-helper@
34 1 Constantinos Venetsanopoulos
35 2 Constantinos Venetsanopoulos
h3. Using @snf-image-update-helper@
36 2 Constantinos Venetsanopoulos
37 1 Constantinos Venetsanopoulos
The @snf-image-helper@ must be installed inside the helper VM and NOT the Ganeti node. The smoothest way to accomplish that, is by making a @snf-image-helper@ debian package, store it under @snf-image-host@'s $HELPER_DIR and run @snf-image-update-helper@ (part of @snf-image-host@) to create the helper VM and install the @snf-image-helper@ debian package inside it. See the next section on how to build the debian package.
38 2 Constantinos Venetsanopoulos
39 2 Constantinos Venetsanopoulos
h3. Manually
40 1 Constantinos Venetsanopoulos
41 1 Constantinos Venetsanopoulos
If you want to create your own helper VM manually and then install @snf-image-helper@ inside (the hard way), do the following:
42 1 Constantinos Venetsanopoulos
# Customize a helper VM image of your choice
43 1 Constantinos Venetsanopoulos
# Once you have customized your helper VM image, mount it on a tmp directory.
44 1 Constantinos Venetsanopoulos
# Checkout the source code as described in the first section.
45 1 Constantinos Venetsanopoulos
# Run:
46 4 Constantinos Venetsanopoulos
<pre>
47 4 Constantinos Venetsanopoulos
$ cd snf-image-helper
48 4 Constantinos Venetsanopoulos
$ ./autogen.sh
49 4 Constantinos Venetsanopoulos
$ ./configure
50 4 Constantinos Venetsanopoulos
$ make
51 4 Constantinos Venetsanopoulos
$ make DESTDIR=/path/to/mounted/tmp/dir install 
52 4 Constantinos Venetsanopoulos
</pre> 
53 4 Constantinos Venetsanopoulos
# @snf-image-helper@ should run automatically in the helper VM upon boot, when the @snf_image_activate_helper@ kernel command line argument is present. To do so you can e.g. customize the helper VM's rc.local script:
54 4 Constantinos Venetsanopoulos
<pre>
55 4 Constantinos Venetsanopoulos
$ cat > "/path/to/mounted/tmp/etc/rc.local" <<EOF
56 4 Constantinos Venetsanopoulos
#!/bin/sh -e
57 4 Constantinos Venetsanopoulos
#
58 4 Constantinos Venetsanopoulos
# rc.local
59 4 Constantinos Venetsanopoulos
#
60 4 Constantinos Venetsanopoulos
# This script is executed at the end of each multiuser runlevel.
61 4 Constantinos Venetsanopoulos
# Make sure that the script will "exit 0" on success or any other
62 4 Constantinos Venetsanopoulos
# value on error.
63 4 Constantinos Venetsanopoulos
#
64 4 Constantinos Venetsanopoulos
# In order to enable or disable this script just change the execution
65 4 Constantinos Venetsanopoulos
# bits.
66 4 Constantinos Venetsanopoulos
#
67 4 Constantinos Venetsanopoulos
# By default this script does nothing. 
68 4 Constantinos Venetsanopoulos
69 4 Constantinos Venetsanopoulos
if ! grep -q snf_image_activate_helper /proc/cmdline; then
70 4 Constantinos Venetsanopoulos
    echo "WARNING: NOT calling snf-image-helper, add snf_image_activate_helper"
71 4 Constantinos Venetsanopoulos
    echo "to the kernel command line if you want to do so."
72 4 Constantinos Venetsanopoulos
else
73 4 Constantinos Venetsanopoulos
    /usr/bin/snf-image-helper --force
74 4 Constantinos Venetsanopoulos
fi
75 4 Constantinos Venetsanopoulos
76 4 Constantinos Venetsanopoulos
exit 0
77 4 Constantinos Venetsanopoulos
EOF
78 4 Constantinos Venetsanopoulos
79 4 Constantinos Venetsanopoulos
$ chmod +x "/path/to/mounted/tmp/etc/rc.local"
80 4 Constantinos Venetsanopoulos
</pre> 
81 4 Constantinos Venetsanopoulos
# @snf-image-helper@ requires the @--force@ argument to run. This stands to avert possible halt of the system by mistake.
82 4 Constantinos Venetsanopoulos
# Once snf-image-helper is installed correctly inside your helper VM image, umount the image and store it under $HELPER_DIR
83 1 Constantinos Venetsanopoulos
84 1 Constantinos Venetsanopoulos
h2. Building debian packages
85 1 Constantinos Venetsanopoulos
86 1 Constantinos Venetsanopoulos
If you want to build debian packages from the latest source, after checking out the source, do the following:
87 1 Constantinos Venetsanopoulos
88 1 Constantinos Venetsanopoulos
<pre>
89 1 Constantinos Venetsanopoulos
 $ git checkout debian
90 1 Constantinos Venetsanopoulos
 $ cd snf-image-host
91 1 Constantinos Venetsanopoulos
 $ dpkg-buildpackage -us -uc -b
92 1 Constantinos Venetsanopoulos
 $ cd ../snf-image-helper
93 1 Constantinos Venetsanopoulos
 $ dpkg-buildpackage -us -uc -b
94 1 Constantinos Venetsanopoulos
 $ cd ..
95 1 Constantinos Venetsanopoulos
</pre>
96 1 Constantinos Venetsanopoulos
97 1 Constantinos Venetsanopoulos
Optionally, you may clean any leftover files and directories when you're done:
98 1 Constantinos Venetsanopoulos
<pre>
99 1 Constantinos Venetsanopoulos
 $ git clean -df
100 1 Constantinos Venetsanopoulos
</pre>