instance-debootstrap.git
3 years agoVersion bump and NEWS file update for 0.16 release master v0.16
Iustin Pop [Mon, 30 May 2016 20:53:35 +0000 (22:53 +0200)]
Version bump and NEWS file update for 0.16 release

Update NEWS file with a list of changes.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Viktor Bachraty <vbachraty@google.com>

3 years agoAdd NEWS entry for current 0.15 release
Iustin Pop [Mon, 30 May 2016 20:53:34 +0000 (22:53 +0200)]
Add NEWS entry for current 0.15 release

It seems this was forgotten when the release was made.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Viktor Bachraty <vbachraty@google.com>

3 years agoAdd a test for exercising the scripts
Iustin Pop [Sun, 29 May 2016 00:38:26 +0000 (02:38 +0200)]
Add a test for exercising the scripts

To allow _some_ testing of this code without Ganeti, let's add a
simple test that exercises the create/export/import scripts.

There are a number of downsides to this script:

- it needs real root (due to losetup/kpartx/chroot), so the script
  checks for this and exits if the requirement is not met; this means
  that during normal development this will not add usefulness
- it does an actual install, so it needs network access
- although I tried to be careful by disabling cache generation and
  cleanup, it might still touch the filesystem of the host machine,
  hence it's best to run it in a throwaway VM
- it's not interactive: there's a single test, and it runs for a few
  minutes without any feedback; with automake's new test driver at
  least, there are (growing) log files in test/ which can be tail'ed

However, when plugged in and tied to (e.g.) Debian's autopkgtest
suite, it means that breakage such as
https://bugs.launchpad.net/bugs/1577346 would have been detected
automatically and much earlier.

Additionally, I had to bump the minimum automake version, since 1.9 is
no longer present in modern distributions; even wheezy (oldstable) has
1.11 as default. Tested with 1.11 and 1.15.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Brian Foley <bpfoley@google.com>

3 years agoSwitch default suite to jessie and bump min disk size
Iustin Pop [Sun, 29 May 2016 00:38:25 +0000 (02:38 +0200)]
Switch default suite to jessie and bump min disk size

wheezy is oldstable now, so let's bump the default. Sadly, this needs
a bump in the min disk size, since on a fresh debootstrap call:

$ du -sh wheezy jessie
229M    wheezy
283M    jessie

So we're over the current 256MB limit during debootstrap run itself,
before we get a chance to cleanup deb packages, etc. I've doubled the
size since 512MB is still small, even for test instances.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Brian Foley <bpfoley@google.com>

3 years agoCheck for required programs at configure time
Iustin Pop [Sun, 29 May 2016 00:38:24 +0000 (02:38 +0200)]
Check for required programs at configure time

This is not terribly helpful, especially when instance-deboostrap is
installed from packages and not from source, however it helps preventing
"obvious" missing dependencies for from-source installs.

Only tools that come from extra packages are checked, not the ones that
are installed in minimal installs  (not sure about losetup, so I've
included it as well).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Brian Foley <bpfoley@google.com>

3 years agoDon't mark common.sh as executable
Iustin Pop [Sun, 29 May 2016 00:38:23 +0000 (02:38 +0200)]
Don't mark common.sh as executable

This is not needed, and is an artifact from the time when we autogenerated the
`create' script (commit 6c4bbf6); the migration to common.sh (commit eb23d04)
forgot to remove this.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Brian Foley <bpfoley@google.com>

3 years agoFix sfdisk invocation for util-linux 2.26+
Iustin Pop [Thu, 26 May 2016 10:26:28 +0000 (12:26 +0200)]
Fix sfdisk invocation for util-linux 2.26+

sfdisk changed in 2.26; it stopped supporting the geometry options (-C, -H,
-S), deprecated -L and -u. However, we can't just drop these options, as
pre-2.26 needs them for devices that don't report geometry (e.g. plain files).

This patch changes the invocation of sfdisk based on what the `--help' output
contains, as parsing the version number seems a bit more involved. Tested
manually (not from Ganeti) with both 2.20, 2.25 and 2.28. The resulting
partitioned disks have similarly-sized partitions, but the geometry information
is different (as expected).

This was reported in, and will fix, Ubuntu Launchpad bug LP#1577346.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Brian Foley <bpfoley@google.com>

3 years agoUse OSP_FILESYSTEM for fstab and mk2efs in import
Brian Foley [Tue, 3 May 2016 12:37:30 +0000 (13:37 +0100)]
Use OSP_FILESYSTEM for fstab and mk2efs in import

These were missed previously when adding OSP_FILESYSTEM support, and
may cause problems if OSP_FILESYSTEM is not compatible with the default
filesystem chosen by mke2fs.

Thanks to hostingnuggets for reporting and suggesting the fix in #1175.

Signed-off-by: Brian Foley <bpfoley@google.com>
Reviewed-by: Viktor Bachraty <vbachraty@google.com>

3 years agoVersion bump for 0.15 v0.15
Klaus Aehlig [Fri, 23 Oct 2015 13:32:38 +0000 (15:32 +0200)]
Version bump for 0.15

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>

3 years agoFix matching of UUIDs to '-1'
Helga Velroyen [Thu, 27 Aug 2015 08:07:36 +0000 (10:07 +0200)]
Fix matching of UUIDs to '-1'

The UUID string can contain "-1" but we only want
to match on the first part ($UUID.diskX-1 : ...)

Signed-off-by: Simon Deziel <simon.deziel@gmail.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

4 years agoAdd udevadm settle invocation to prevent errors
Petr Pudlak [Mon, 20 Apr 2015 12:25:28 +0000 (14:25 +0200)]
Add udevadm settle invocation to prevent errors

Similarly to issue #1037, a loopback device was reported busy at the
time the 'create' scripts attempted to remove it. To prevent that,
an invocation of 'udevadm settle' is added to the list of cleanup
commands, to be executed just before 'losetup -d'.

Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>

5 years agoUse sync kpartx mode when creating devices
Apollon Oikonomopoulos [Mon, 24 Mar 2014 20:28:15 +0000 (22:28 +0200)]
Use sync kpartx mode when creating devices

Pass the -s (sync) flag to kpartx in map_disk0(). Without the -s flag,
kpartx will return directly after signaling the device mapper to create
the partition devices, however it is not guaranteed that the devices
will have appeared in userspace by the time map_disk0 will look for
them. With -s, kpartx will wait until the devices have been created.

Signed-off-by: Apollon Oikonomopoulos <apoikos@gmail.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

5 years agoReplace 'losetup' flag '-s' with '--show'
Jose A. Lopes [Fri, 24 Jan 2014 09:23:01 +0000 (10:23 +0100)]
Replace 'losetup' flag '-s' with '--show'

This fixes issue 690.

Signed-off-by: Jose A. Lopes <jabolopes@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

5 years agoVersion bump for 0.14 v0.14
Michele Tartara [Tue, 8 Oct 2013 11:38:16 +0000 (11:38 +0000)]
Version bump for 0.14

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

5 years agoUpgrade NEWS file for 0.14
Michele Tartara [Tue, 8 Oct 2013 11:34:11 +0000 (11:34 +0000)]
Upgrade NEWS file for 0.14

Properly set up a new NEWS file section for the next release. A few items had
already been added erroneously to the section about version 0.13, that has
already been released.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

5 years agoUpdate NEWS file
Michele Tartara [Tue, 8 Oct 2013 10:53:04 +0000 (12:53 +0200)]
Update NEWS file

Update the NEWS file in preparation for the 0.13 release.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

6 years agoFix hardcoded ext3 reference
Thomas Thrainer [Fri, 23 Aug 2013 09:34:47 +0000 (11:34 +0200)]
Fix hardcoded ext3 reference

Write the correct filesystem to fstab in the create script.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

6 years agoAdd an example about how to run hooks
Michele Tartara [Thu, 11 Jul 2013 10:58:32 +0000 (10:58 +0000)]
Add an example about how to run hooks

The example has the second aim of documenting how to automatically set the
user passwords at instance creation.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

6 years agoUpdate documentation
Michele Tartara [Thu, 11 Jul 2013 10:20:53 +0000 (12:20 +0200)]
Update documentation

The documentation was still stating that debian Lenny is the default
distribution installed by debootstrap. Actually, it is Wheezy now.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

6 years agoClear the root password
Michele Tartara [Thu, 11 Jul 2013 10:18:20 +0000 (12:18 +0200)]
Clear the root password

Debootstrap used to leave the instances without a root password set, making the
first login quite hard.

This commits changes the situation, by setting an empty root password (as
already stated by the documentation).

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

6 years agoBump version for 0.13 release v0.13
Thomas Thrainer [Thu, 23 May 2013 09:25:20 +0000 (11:25 +0200)]
Bump version for 0.13 release

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

6 years agoReport error when exporting non-ext partition
Thomas Thrainer [Thu, 23 May 2013 11:17:29 +0000 (13:17 +0200)]
Report error when exporting non-ext partition

Report an error if it's exporting an instance fails because of the
wrong filesystem type.

This fixes issue 303.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

6 years agoMake filesystem of root partition configurable
Thomas Thrainer [Thu, 23 May 2013 15:23:31 +0000 (17:23 +0200)]
Make filesystem of root partition configurable

A new parameter, filesystem, is introduced which can be used to specify
the filesystem type of the root partition from instances. It defaults
to 'ext4'.

This also required to update the API version of the OS definition, as
instance parameters are only supported from version 20 on.

This fixes issue 464.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

6 years agoChange default Debian version to Wheezy
Thomas Thrainer [Thu, 23 May 2013 09:35:09 +0000 (11:35 +0200)]
Change default Debian version to Wheezy

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

6 years agoDocument instance variant creation
Thomas Thrainer [Thu, 23 May 2013 09:11:30 +0000 (11:11 +0200)]
Document instance variant creation

Add a section in README which describes how to define new instance
variants and an example how to do that for Ubuntu 12.04.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

6 years agoAdd example for Ubuntu instance
Thomas Thrainer [Tue, 21 May 2013 10:12:03 +0000 (12:12 +0200)]
Add example for Ubuntu instance

Add an example which outlines how to used ganeti-instance-deboostrap to
install Ubuntu 12.04 (precise).

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

6 years agoAdd check for minimum disk size v0.12
Iustin Pop [Tue, 30 Oct 2012 10:14:28 +0000 (11:14 +0100)]
Add check for minimum disk size

This fixes issue 164, and changes:

  Failure: command execution error:
  Could not add os for instance instance2 on node node4:
  OS create script failed (exited with exit code 1), last lines in the log file:
  tar: ./bin/df: Cannot open: No such file or directory
  tar: ./bin/ip: Cannot open: No such file or directory
  tar: ./bin/grep: Cannot open: No such file or directory
  tar: ./opt: Cannot mkdir: No space left on device
  tar: ./selinux: Cannot mkdir: No space left on device
  tar: Exiting with failure status due to previous errors

Into:

  Failure: command execution error:
  Could not add os for instance instance2 on node node4:
  OS create script failed (exited with exit code 1), last lines in the log file:
  Device size is too small (128 MB)
  Required size is at least 256MB

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

6 years agoAdd a copy of ganeti's devel/release
Iustin Pop [Mon, 29 Oct 2012 16:15:02 +0000 (17:15 +0100)]
Add a copy of ganeti's devel/release

This has just the names changes, plus using standard distcheck/dist,
instead of the ganeti-specific `-release' variants.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

6 years agoAdd support for components override
Iustin Pop [Mon, 29 Oct 2012 16:12:47 +0000 (17:12 +0100)]
Add support for components override

This fixes issue 254. I've took a slightly different approach (never
pass --components if the variable is empty, to not override builtin
debootstrap default).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

6 years agoUpdate NEWS file and bump version for 0.12 release
Iustin Pop [Mon, 29 Oct 2012 13:31:45 +0000 (14:31 +0100)]
Update NEWS file and bump version for 0.12 release

Time for a new release, since we have a few accumulated fixes.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

6 years agoFix console of xen-pvm
Iustin Pop [Mon, 29 Oct 2012 13:27:15 +0000 (14:27 +0100)]
Fix console of xen-pvm

This fixes issue 284: the current serial console code only activates
is when HV_SERIAL_CONSOLE is set, but that's a parameter that applies
only to kvm; for xen-pvm, we always want to activate the console,
albeit on a different device.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

6 years agoShip and install all hooks and their data
Iustin Pop [Mon, 29 Oct 2012 11:49:38 +0000 (12:49 +0100)]
Ship and install all hooks and their data

Currently, we have just a few hooks shipped, but none are
installed. This patch adds automake rules for installing all hooks and
their config data in the right directories (but they will still need
to be activated by the admin).

This fixes issue 283.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

7 years agoFix uninstall rules for variants/defaults files
Iustin Pop [Thu, 19 Jul 2012 12:35:28 +0000 (14:35 +0200)]
Fix uninstall rules for variants/defaults files

This makes "make distcheck" happy again.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

7 years agoInstall the defaults file automatically
Iustin Pop [Thu, 19 Jul 2012 12:33:00 +0000 (14:33 +0200)]
Install the defaults file automatically

This fixes issue 51, and is a good thing to do (even if packages are
already installing it).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

7 years agoUpdate NEWS file and bump version for 0.11 release v0.11
Iustin Pop [Wed, 9 May 2012 04:01:49 +0000 (06:01 +0200)]
Update NEWS file and bump version for 0.11 release

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

7 years agoAlso export the proxy for https usage
Iustin Pop [Wed, 9 May 2012 07:01:27 +0000 (09:01 +0200)]
Also export the proxy for https usage

And clarify the documentation about it.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

7 years agoFix a few issues with the grub hook
Iustin Pop [Wed, 9 May 2012 03:45:41 +0000 (05:45 +0200)]
Fix a few issues with the grub hook

This patch:

- updates the comments (no need for explicit EXTRA_PKGS)
- export the proxy if the instance-debootstrap environment defines it
- sets the debconf frontend to non-interactive (I've seen it go into a
  loop otherwise)

I still can't create a grub install, because grub-probe doesn't want
to use LVM names nicely, but that's another issue.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

7 years agoMake partition alignment configurable
Iustin Pop [Wed, 9 May 2012 02:34:05 +0000 (04:34 +0200)]
Make partition alignment configurable

So that people with special requirements (e.g. SSDs with unusual block
allocations) can customise it for their setup.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

7 years agoUpdate defaults file
Iustin Pop [Wed, 9 May 2012 02:29:52 +0000 (04:29 +0200)]
Update defaults file

Per bugs.debian.org/672114, the distribution names in the defaults
files are very old, plus the package recommendations are wrong for
more modern distros.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

7 years agoAlign partition on 1MiB boundary
Iustin Pop [Thu, 3 May 2012 04:26:54 +0000 (21:26 -0700)]
Align partition on 1MiB boundary

Currently, the partition we create in 'msdos' style partitioning is
not aligned to any particular offset, and instead starts simply after
the MBR on sector 1. This creates problems with grub for example,
which doesn't have space for embedding.

To fix this and make the partitioning more standard, let's align it on
a 1MiB boundary.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

7 years agoBump version and update NEWS for 0.10 release v0.10
Iustin Pop [Sat, 21 Apr 2012 10:07:17 +0000 (12:07 +0200)]
Bump version and update NEWS for 0.10 release

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

7 years agoSwitch from lenny to squeeze as default
Iustin Pop [Sat, 21 Apr 2012 10:01:27 +0000 (12:01 +0200)]
Switch from lenny to squeeze as default

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

7 years agoWhitespace/style cleanups
Iustin Pop [Sat, 21 Apr 2012 09:57:04 +0000 (11:57 +0200)]
Whitespace/style cleanups

The recent hooks additions are not style compliant (gasp!). Fix this.

We might also want to fix missing copyright headers, but not sure
about that.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

7 years agotimezone hook: use host-default if none present
Guido Trotter [Fri, 7 Oct 2011 19:43:50 +0000 (15:43 -0400)]
timezone hook: use host-default if none present

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

7 years agoMention chpasswd -e in defaultpasswords hook
Guido Trotter [Fri, 7 Oct 2011 19:42:33 +0000 (15:42 -0400)]
Mention chpasswd -e in defaultpasswords hook

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

7 years agoAdd ssh-keys example hook
Guido Trotter [Fri, 7 Oct 2011 19:42:07 +0000 (15:42 -0400)]
Add ssh-keys example hook

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

7 years agoSome extra example hooks
Serge van Ginderachter [Fri, 24 Sep 2010 07:45:06 +0000 (09:45 +0200)]
Some extra example hooks

1) Hook to set default passwords in the instance
2) Hook to set a timezone for the instance

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

7 years agoexport: add support for ext4 filesystems
Guido Trotter [Wed, 11 Aug 2010 20:44:46 +0000 (16:44 -0400)]
export: add support for ext4 filesystems

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

9 years agoUpdate NEWS file for serial console fixes v0.9
Guido Trotter [Fri, 12 Mar 2010 10:47:15 +0000 (10:47 +0000)]
Update NEWS file for serial console fixes

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

9 years agoFix serial console
Guido Trotter [Sun, 1 Nov 2009 21:23:41 +0000 (16:23 -0500)]
Fix serial console

- Binding the console on /dev/console makes it impossible to send
  control characters (eg. ctrl+C). Now that we can, on the ganeti side,
  support a better console mode, with a proper escape character, in
  order to have a working console on the instance side we explicitely
  bind getty to ttyS0, but only when the relevant hypervisor parameter
  is set (of course if that's later changed one has to do the relevant
  change inside the instance, or he'll see init error messages on the
  console)

- Ubuntu has changed to yet another style for init config. Support both.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

9 years agoRemove a couple of useless quotes
Guido Trotter [Sun, 1 Nov 2009 21:29:25 +0000 (16:29 -0500)]
Remove a couple of useless quotes

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

9 years agoMake 0.9 release with the recent changes
Iustin Pop [Wed, 3 Mar 2010 09:03:31 +0000 (10:03 +0100)]
Make 0.9 release with the recent changes

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

9 years agoDistribute examples in the archive
Iustin Pop [Wed, 3 Mar 2010 08:58:24 +0000 (09:58 +0100)]
Distribute examples in the archive

The examples were not shipped at all, which makes it hard to package
them.

This patch renames the directory holding them (example → examples), adds
the executable bit on the interfaces hook, and distributes them in the
dist archive.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

9 years agoChange the customization directory
Iustin Pop [Wed, 3 Mar 2010 08:50:12 +0000 (09:50 +0100)]
Change the customization directory

The current customization directory is
“$sysconfdir/ganeti/instance-debootstrap.d”. Recently, the variants
support has added the variants configuration as
“$sysconfdir/ganeti/instance-debootstrap/variants/default.conf”. This
means we have two, very similar (instance-debootstrap.d vs.
instance-debootstrap) directories under ganeti.

This patch changes the customize directory to
$sysconfdir/ganeti/instance-debootstrap/hooks. It is more in line with
Ganeti's own hooks naming, and removes the old “.d” directory, for a
more sane layout.

People upgrading, with the default (commented-out) CUSTOMIZE_DIR will
need to rename their on-disk directory.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

9 years agoMake release 0.8 v0.8
Iustin Pop [Tue, 2 Mar 2010 10:24:51 +0000 (11:24 +0100)]
Make release 0.8

No recent changes, but we need a stable release of instance-debootstrap
for Ganeti 2.1.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

9 years agoSupport blktype as an alternative to vol_id
Guido Trotter [Mon, 19 Oct 2009 23:18:07 +0000 (19:18 -0400)]
Support blktype as an alternative to vol_id

This is needed to run when the node os is debian squeeze or ubuntu
karmik. Since blktype and vol_id need different options, we include the
options in the command variable. Moreover we add a new VOL_TYPE command,
for that usage of vol_id/blktype.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

9 years agoAdd script for creating a new instance with grub
Jun Futagawa [Mon, 5 Oct 2009 17:51:55 +0000 (02:51 +0900)]
Add script for creating a new instance with grub

This example hook installs grub inside a newly created debootstrap
instance.

Signed-off-by: Jun Futagawa <jfut@integ.jp>
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

9 years agoSupport API version 15 (with OS variants)
Guido Trotter [Fri, 2 Oct 2009 15:03:50 +0000 (16:03 +0100)]
Support API version 15 (with OS variants)

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Olivier Tharan <olive@google.com>

9 years agoFix two typos in a variable name
Guido Trotter [Fri, 2 Oct 2009 15:03:36 +0000 (16:03 +0100)]
Fix two typos in a variable name

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Olivier Tharan <olive@google.com>

9 years agoShip variants file with the correct name
Guido Trotter [Fri, 2 Oct 2009 15:02:51 +0000 (16:02 +0100)]
Ship variants file with the correct name

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Olivier Tharan <olive@google.com>

9 years agoInitialize the CLEANUP array and trap in common.sh
Guido Trotter [Wed, 25 Feb 2009 16:05:43 +0000 (16:05 +0000)]
Initialize the CLEANUP array and trap in common.sh

All the scripts have to inizialize this and set the cleanup trap, so
we're doing it for them in common.sh.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Olivier Tharan <olive@google.com>

10 years agoSupport os variants
Guido Trotter [Fri, 7 Aug 2009 13:01:16 +0000 (14:01 +0100)]
Support os variants

This is a Ganeti 2.1 design feature. It's not implemented yet in 2.1,
but its implementation in the debootstrap OS is totally backwards
compatible. If no OS_VARIANT environment variable is passed in,
everything proceeds as before, otherwise a instance-deboostrap tries
to load a config file from a specially configured directory, which can
be used to override any variable in the defaults file (which is sourced
at the beginning as it was before.

By default only the "default" variant is exported, which is shipped as
an empty config file.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

10 years agoMore tweaks to kpartx output parsing v0.7
Guido Trotter [Thu, 19 Feb 2009 13:42:05 +0000 (13:42 +0000)]
More tweaks to kpartx output parsing

Apparently kpartx likes to play with us, and different versions of
kpartx will give the mapped partition different names. Sometimes dashes
in the original name will be doubled, and sometimes a leading directory
in /dev (eg. a volume group name) will be included in the name itself.

In order to avoid that we just look in the output for anything which
includes the string '-1' (which is the first partition, with the
separator '-' which we forced kpartx to use with the -p- option).
Moreover, to be sure we don't pass on wrong information, we check that
our grep had some output, and that the created device actually exists
after running kpartx -a, with the output redirected to /dev/null as
otherwise sometimes it will echo a few lines which will be inserted in
the function result, and thus break the actual result filesystem_dev
variable.

Reviewed-by: iustinp

10 years agoimport: only use swap if swap_uuid is defined
Guido Trotter [Wed, 18 Feb 2009 17:05:24 +0000 (17:05 +0000)]
import: only use swap if swap_uuid is defined

As for create sometimes we'll fail in getting a uuid for the swap
disk. In that case we have to ignore that, while in import we're failing
to do so.

Reviewed-by: iustinp

10 years agoRework the blockdev handling
Iustin Pop [Wed, 18 Feb 2009 11:15:13 +0000 (11:15 +0000)]
Rework the blockdev handling

This (big) patch changes the block device handling to be the same in all
the commands. The create script is no longer generated, but instead
common.sh is.

The patch also comments out the PARTITION_STYLE entry in defaults,
otherwise we'll always use that.

Reviewed-by: ultrotter,imsnah

10 years agoUpdate NEWS file and release 0.7
Guido Trotter [Tue, 17 Feb 2009 13:51:51 +0000 (13:51 +0000)]
Update NEWS file and release 0.7

Reviewed-by: iustinp

10 years ago'msdos' is the default partition style from api10
Guido Trotter [Tue, 17 Feb 2009 13:51:38 +0000 (13:51 +0000)]
'msdos' is the default partition style from api10

But we still keep using 'none' for compatibility with ganeti 1.2 on api5

Reviewed-by: iustinp

10 years agoTo avoid bashisms, convert to /bin/bash! :)
Guido Trotter [Mon, 16 Feb 2009 10:25:44 +0000 (10:25 +0000)]
To avoid bashisms, convert to /bin/bash! :)

Reviewed-by: iustinp

10 years agoFix 1.2 compatibility
Guido Trotter [Mon, 16 Feb 2009 10:25:28 +0000 (10:25 +0000)]
Fix 1.2 compatibility

getopt must be executed outside of the get_api5_arguments function,
because there $@ will be overridden.

vol_id may return an error on old distributions (dapper) in that case we
just... err... well... ignore the error and forget to set up the swap
partition in fstab?? :)

Reviewed-by: iustinp

10 years agoAdd example instance-debootstrap.d file
Guido Trotter [Fri, 13 Feb 2009 11:18:47 +0000 (11:18 +0000)]
Add example instance-debootstrap.d file

This configures the eth0 interface for dhcp.

Reviewed-by: iustinp

10 years agoAdd CUSTOMIZE_DIR to personalize the installation
Guido Trotter [Fri, 13 Feb 2009 11:18:29 +0000 (11:18 +0000)]
Add CUSTOMIZE_DIR to personalize the installation

The scripts in this directory, if defined, will be executed using
run-parts, allowing some customization of the instance after the
debootstrap OS has acted and before handing back the instance to ganeti.

Reviewed-by: iustinp

10 years agoImplement PARTITION_STYLE='msdos'
Guido Trotter [Wed, 28 Jan 2009 12:03:34 +0000 (12:03 +0000)]
Implement PARTITION_STYLE='msdos'

With this partition style the blockdev passed in from ganeti is used as
a whole disk, a partition table is written on it, then a single primary
partition spanning the whole disk, and at last the os is installed in
this partition.

Reviewed-by: iustinp

10 years agoAdd the PARTITION_STYLE configuration variable
Guido Trotter [Wed, 28 Jan 2009 12:03:16 +0000 (12:03 +0000)]
Add the PARTITION_STYLE configuration variable

This variable will be used to decide if and how to partition the
instance block device.

Reviewed-by: iustinp

10 years agoinstance-debootstrap: release 0.6 v0.6
Guido Trotter [Mon, 26 Jan 2009 15:58:39 +0000 (15:58 +0000)]
instance-debootstrap: release 0.6

This commit also updates the NEWS file

Reviewed-by: iustinp

10 years agodevel/upload: add a missing wait
Guido Trotter [Mon, 26 Jan 2009 15:58:26 +0000 (15:58 +0000)]
devel/upload: add a missing wait

Without this the script exits, and removes the temporary directory,
before rsync is done.

Reviewed-by: iustinp

10 years agoUse losetup rather than -o loop
Guido Trotter [Mon, 26 Jan 2009 12:19:31 +0000 (12:19 +0000)]
Use losetup rather than -o loop

If the device we're given is actually a file, rather than just mounting
it with the -o loop option, we'll explicitely losetup it to a device,
and losetup -d (detach) it at the end. This allows us to do more actions
on the target device (for example partition it, if needed).

Reviewed-by: iustinp

10 years agoAbstract cleanups in a CLEANUP array
Guido Trotter [Mon, 26 Jan 2009 12:19:19 +0000 (12:19 +0000)]
Abstract cleanups in a CLEANUP array

Rather than just having two cleanups for the whole script (namely the
umounting and removal of the temp directory) we can change cleanups with
an array structure, which is then executed in reverse order. This will
be used to add more operations that need their own cleanup, in a
structured way.

Reviewed-by: iustinp

10 years agoAdd devel/upload script
Guido Trotter [Mon, 26 Jan 2009 10:34:30 +0000 (10:34 +0000)]
Add devel/upload script

This eases development/debugging of the os script.
It's mostly copied from its ganeti counterpart.

Reviewed-by: iustinp

10 years agodefaults: update EXTRA_PKGS comments
Guido Trotter [Mon, 26 Jan 2009 10:34:18 +0000 (10:34 +0000)]
defaults: update EXTRA_PKGS comments

EXTRA_PKGS comments used to be xen specific, and also a bit outdated.
With this patch we make them hypervisor agnostic, and then we provide
some sane defaults for different hypervisors/distro. Moreover we no
longer state that lenny doesn't have xen support for amd64, as it does.

Reviewed-by: iustinp

10 years agoinstance debootstrap: enable import
Guido Trotter [Wed, 22 Oct 2008 14:09:42 +0000 (14:09 +0000)]
instance debootstrap: enable import

Reviewed-by: iustinp

10 years agoinstance debootstrap: enable export
Guido Trotter [Wed, 22 Oct 2008 14:09:28 +0000 (14:09 +0000)]
instance debootstrap: enable export

Avoid exporting swap devices

Reviewed-by: iustinp

10 years agocommon.sh: output all errors to stderr
Guido Trotter [Wed, 22 Oct 2008 14:09:16 +0000 (14:09 +0000)]
common.sh: output all errors to stderr

Create a log_error function that outputs to stderr and use it to send
error messages. This also clarifies error messages a bit and fixes one
wrong check for new_name rather than old_name.

Reviewed-by: iustinp

10 years agoUse basename when checking the script name
Guido Trotter [Wed, 22 Oct 2008 14:09:04 +0000 (14:09 +0000)]
Use basename when checking the script name

Also save it to the SCRIPT_NAME variable to avoid calling basename every
time or forgetting to call it.

Reviewed-by: iustinp

10 years agosearch for vol_id and use retrocompatible options
Guido Trotter [Wed, 22 Oct 2008 14:08:52 +0000 (14:08 +0000)]
search for vol_id and use retrocompatible options

older versions of udev, for example the one on dapper, install vol_id in
/lib/udev but not in /sbin. They also require shorter options, which
happen to work on newer udev as well.

Reviewed-by: iustinp

10 years agouse proper variable name INSTANCE_NAME
Guido Trotter [Fri, 17 Oct 2008 14:21:41 +0000 (14:21 +0000)]
use proper variable name INSTANCE_NAME

the design doc the api version 10 uses the INSTANCE_NAME variable name
to refer to an instance, but we were incorrectly expecting INSTANCE

Reviwed-by: iustinp

10 years agoShip common.sh with the debootstrap os
Guido Trotter [Fri, 17 Oct 2008 14:21:30 +0000 (14:21 +0000)]
Ship common.sh with the debootstrap os

Reviwed-by: iustinp

10 years agoOLD/NEW swap, fix get_api10_arguments too
Guido Trotter [Thu, 16 Oct 2008 16:38:53 +0000 (16:38 +0000)]
OLD/NEW swap, fix get_api10_arguments too

Reviewed-by: iustinp

10 years agorename: invert old and new instance name
Guido Trotter [Thu, 16 Oct 2008 13:35:31 +0000 (13:35 +0000)]
rename: invert old and new instance name

For compatibility with what ganeti internally does the name passed in
INSTANCE_NAME is the new one, and the old one is passed in
OLD_INSTANCE_NAME.

Reviewed-by: iustinp

10 years agoinstance-debootstrap: Support both api 5 and 10
Guido Trotter [Thu, 16 Oct 2008 09:20:36 +0000 (09:20 +0000)]
instance-debootstrap: Support both api 5 and 10

Reviewed-by: iustinp

10 years agocommon.sh parsing for api10 arguments
Guido Trotter [Thu, 16 Oct 2008 09:20:26 +0000 (09:20 +0000)]
common.sh parsing for api10 arguments

If OS_API_VERSION has value 10 we'll check and parse the arguments using
the version 10 style, as described by the relevant design doc, and save
them to the old names we used before. This makes the create and rename
scripts version 6 compatible (except for bugs, that is), while import
and export will need some more work.

Reviewed-by: iustinp

10 years agoMake $swapdev optional
Guido Trotter [Thu, 16 Oct 2008 09:20:16 +0000 (09:20 +0000)]
Make $swapdev optional

In create and import we'll only use a swap device only if swapdev is
set.  This is for compatibility with the OS API version 10, where no swap
is going to be set up.

Reviewed-by: iustinp

10 years agoParse command line arguments in common.sh
Guido Trotter [Thu, 16 Oct 2008 09:20:04 +0000 (09:20 +0000)]
Parse command line arguments in common.sh

Currently each of the 4 OS API scripts parses its command line
separately. Creating common.sh lets us centralize this behavior.

For the rename script we change the old_name variable to just instance
for more uniformity with what the new version of the API will do.

Reviewed-by: iustinp

11 years agoUse vol_id to calculate volume UUIDs
Guido Trotter [Tue, 26 Aug 2008 13:32:47 +0000 (13:32 +0000)]
Use vol_id to calculate volume UUIDs

This allows the UUID to be calculated in a standard way no matter what
the filesystem in use is. It requires udev to be installed.

Reviewed-by: imsnah

11 years agodebootstrap create: activate serial console
Guido Trotter [Thu, 14 Aug 2008 15:15:12 +0000 (15:15 +0000)]
debootstrap create: activate serial console

If we make sure that the instance os spawns a getty on /dev/console we
cover both the case where console is on tty1 and the serial console one
where it's on ttyS0. In order to do this we modify /etc/inittab on
debian, and /etc/event.d on ubuntu.

Reviewed-by: imsnah

11 years agoUse UUID-based mounts for create and import
Guido Trotter [Thu, 14 Aug 2008 10:24:35 +0000 (10:24 +0000)]
Use UUID-based mounts for create and import

With this change we mount our root and swap filesystems in /etc/fstab
based on their UUID rather than on their device name. This makes the
system resistent to device name changes, and makes sure the operating
system will find its devices whether they're seen as scsi, ide, virtio,
or some other new type/name.

This change makes the OS be able to boot under KVM, but also
xen+paravirt_ops and other possibly other hypervisors.

Reviewed-by: imsnah

11 years agoMake the 0.5 release v0.5
Iustin Pop [Mon, 7 Jul 2008 14:20:08 +0000 (14:20 +0000)]
Make the 0.5 release

This patch updates the NEWS file and changes the version number to 0.5.

Reviewed-by: ultrotter

11 years agoAllow enabling of a proxy for debootstrap
Iustin Pop [Mon, 7 Jul 2008 12:59:18 +0000 (12:59 +0000)]
Allow enabling of a proxy for debootstrap

This is valid only for non-cached installs, of course, but it's still a
useful thing.

Reviewed-by: imsnah

11 years agoFix a wrong dirname
Iustin Pop [Mon, 7 Jul 2008 12:33:33 +0000 (12:33 +0000)]
Fix a wrong dirname

Reviewed-by: ultrotter

11 years agoUpdate the README file
Iustin Pop [Mon, 7 Jul 2008 08:54:09 +0000 (08:54 +0000)]
Update the README file

This patch updates the README file with the changes in the installation
process (due to autotools) and the new settings file.

The readme file is now in restructured text format.

Reviewed-by: imsnah

11 years agoAllow customization of installation directory
Iustin Pop [Mon, 7 Jul 2008 08:54:00 +0000 (08:54 +0000)]
Allow customization of installation directory

Currently the OS definition is installed always under
$datadir/ganeti/os, but this doesn't work if ganeti was configure with a
different OS dir.

This patch allows customization of the os dir at configure time, via a
new '--with-os-dir=...' variable. This allows for example:
  ./configure --with-os-dir=/srv/ganeti/os ...

Reviewed-by: imsnah