From e704a8d122722db16550cfd412e390fa0e7ef247 Mon Sep 17 00:00:00 2001 From: Thomas Thrainer Date: Thu, 23 May 2013 17:23:31 +0200 Subject: [PATCH] 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 Reviewed-by: Guido Trotter --- Makefile.am | 4 ++-- NEWS | 4 ++++ README | 11 +++++++++++ common.sh.in | 4 +++- create | 2 +- ganeti_api_version | 5 +++-- parameters.list | 1 + verify | 32 ++++++++++++++++++++++++++++++++ 8 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 parameters.list create mode 100755 verify diff --git a/Makefile.am b/Makefile.am index 1a8c763..98d2a05 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,8 +4,8 @@ osdir=$(OS_DIR)/$(osname) variantsdir=$(DESTDIR)$(sysconfdir)/ganeti/instance-debootstrap/variants defaultsdir=$(DESTDIR)$(sysconfdir)/default -dist_os_SCRIPTS = create import export rename -dist_os_DATA = ganeti_api_version variants.list +dist_os_SCRIPTS = create import export rename verify +dist_os_DATA = ganeti_api_version variants.list parameters.list os_DATA = common.sh dist_doc_DATA = COPYING NEWS README diff --git a/NEWS b/NEWS index f120390..7c48341 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,10 @@ Version 0.13 The Debian version installed by default is now Wheezy. +The filesystem type for the root partition of instances is now +configurable through the new OS parameter ``filesystem``. It +defaults to 'ext4'. + Improve documentation with regard to instance variants. diff --git a/README b/README index ed73c80..258dbbc 100644 --- a/README +++ b/README @@ -127,6 +127,17 @@ For this to work, make sure that you have the appropriate debootstrap script for precise (or just create a symlink called ``precise`` to ``gutsy`` in ``/usr/share/debootstrap/scripts``). +Instance creation parameters +---------------------------- + +Some aspects of the created instance can be conrolled via parameters at +instance creation time with the ``-O`` parameter of ``gnt-instance``. + +The supported parameters are: + +- filesystem: the filesystem type to use for the root partition. This has to + be a filesystem type supported by ``mke2fs``. The default is 'ext4'. + Customization of the instance ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/common.sh.in b/common.sh.in index 4ec0ca3..a35eadd 100644 --- a/common.sh.in +++ b/common.sh.in @@ -157,6 +157,7 @@ else DEFAULT_PARTITION_STYLE="msdos" fi : ${PARTITION_STYLE:=$DEFAULT_PARTITION_STYLE} # disk partition style +: ${OSP_FILESYSTEM:="ext4"} CACHE_DIR="@localstatedir@/cache/ganeti-instance-debootstrap" @@ -184,7 +185,8 @@ if [ -z "$OS_API_VERSION" -o "$OS_API_VERSION" = "5" ]; then GETOPT_RESULT=`getopt -o o:n:i:b:s: -n '$0' -- "$@"` if [ $? != 0 ] ; then log_error "Terminating..."; exit 1 ; fi get_api5_arguments $GETOPT_RESULT -elif [ "$OS_API_VERSION" = "10" -o "$OS_API_VERSION" = "15" ]; then +elif [ "$OS_API_VERSION" = "10" -o "$OS_API_VERSION" = "15" -o \ + "$OS_API_VERSION" = "20" ]; then get_api10_arguments else log_error "Unknown OS API VERSION $OS_API_VERSION" diff --git a/create b/create index 827dad8..0105022 100755 --- a/create +++ b/create @@ -59,7 +59,7 @@ else exit 1 fi -mke2fs -Fjq $filesystem_dev +mke2fs -Fjqt $OSP_FILESYSTEM $filesystem_dev root_uuid=$($VOL_ID $filesystem_dev ) if [ -n "$swapdev" ]; then diff --git a/ganeti_api_version b/ganeti_api_version index 43484f9..00c5455 100644 --- a/ganeti_api_version +++ b/ganeti_api_version @@ -1,3 +1,4 @@ -5 -10 +20 15 +10 +5 diff --git a/parameters.list b/parameters.list new file mode 100644 index 0000000..a7c9e5c --- /dev/null +++ b/parameters.list @@ -0,0 +1 @@ +filesystem The filesystem type to use for the root partition. This has to be a filesystem type supported by ``mke2fs``. The default is 'ext4'. diff --git a/verify b/verify new file mode 100755 index 0000000..2d3af20 --- /dev/null +++ b/verify @@ -0,0 +1,32 @@ +#!/bin/bash + +# Copyright (C) 2007, 2008, 2009 Google Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +set -e + +case $OSP_FILESYSTEM in + ""|"ext2"|"ext3"|"ext4") + ;; + *) + echo "Invalid value '$OSP_FILESYSTEM' for the filesystem parameter" 1>&2 + exit 1 + ;; +esac + +exit 0 + -- 1.7.2.5