Developer

Version 6 (Vangelis Koukis, 11/21/2011 04:44 pm) → Version 7/10 (Vangelis Koukis, 11/21/2011 04:44 pm)

h1. Developers

h2. Checking out

To check out the source code use @git@:
<pre>
$ git clone https://code.grnet.gr/git/snf-image
</pre>

h2. Configure and install @snf-image-host@

Once you have checkout the source code, it's time to configure. For the simplest default configuration run:
<pre>
$ cd snf-image-host
$ ./autogen.sh
$ ./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc
</pre>

Other configuration options you may find useful:
* @--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.
* @--with-helper-dir=/path/to/helper/dir@ : specify the path where the helper data are going to be stored
* @--with-helper-img=/path/to/img/file@ : specify the path to the helper VM image
* @--with-helper-kernel=/path/to/kernel@ : specify the path to the helper VM kernel
* @--with-helper-initrd=/path/to/initrd@ : specify the path to the helper VM initrd
* @--with-os-dir=/path/to/os/dir@ : specify the top-level OS Provider's directory under which to install itself

After configuring install the package by running:

<pre>
$ make && make install
</pre>

h2. Preparing @snf-image-helper@

h3. Using @snf-image-update-helper@

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.

h3. Manually

If you want to create your own helper VM manually and then install @snf-image-helper@ inside (the hard way), do the following:
# Customize a helper VM image of your choice
# Once you have customized your helper VM image, mount it on a tmp directory.
# Checkout the source code as described in the first section.
# Run:
<pre>
$ cd snf-image-helper
$ ./autogen.sh
$ ./configure
$ make
$ make DESTDIR=/path/to/mounted/tmpdir install
</pre>
# @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:
<pre>
$ cat > "/path/to/mounted/tmpdir/etc/rc.local" <<EOF
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

if ! grep -q snf_image_activate_helper /proc/cmdline; then
echo "WARNING: NOT calling snf-image-helper, add snf_image_activate_helper"
echo "to the kernel command line if you want to do so."
else
/usr/bin/snf-image-helper --force
fi

exit 0
EOF

$ chmod +x "/path/to/mounted/tmpdir/etc/rc.local"
</pre>
# @snf-image-helper@ requires the @--force@ argument to run. This stands to avert possible halt of the system by mistake.
# Once snf-image-helper is installed correctly inside your helper VM image, umount the image and store it under $HELPER_DIR

h2. Building debian packages

If you want to build debian packages from the latest source, after checking out the source, do the following:

<pre>
$ git checkout debian
$ cd snf-image-host
$ mkdir .git;git-buildpackage --git-upstream-branch=master --git-debian-branch=debian;rmdir .git
</pre>

Copy or move the @.deb@ package and associated files (@.orig.tar.gz@, @.build@, @.changes@, @.debian.tar.gz@, @.dsc@) @.dsc) out of the git tree, then:

<pre>
$ cd ..
$ git clean -df
$ cd snf-image-helper
$ mkdir .git;git-buildpackage --git-upstream-branch=master --git-debian-branch=debian;rmdir .git
$ cd ..
</pre>

Again move the generated files somewhere else and optionally, you may clean any leftover files and directories when you're done:
<pre>
$ git clean -df
</pre>