Merge pull request #301 from zmarano/master

Fix expand-root so it works correctly on GCE and other providers
This commit is contained in:
Anders Ingemann 2016-03-03 19:33:40 +01:00
commit 41597d2700
4 changed files with 12 additions and 17 deletions

View file

@ -58,7 +58,6 @@ class AdjustExpandRootScript(Task):
@classmethod
def run(cls, info):
from ..tools import sed_i
from bootstrapvz.common.releases import jessie
script = os.path.join(info.root, 'etc/init.d/expand-root')
root_idx = info.volume.partition_map.root.get_index()
@ -68,5 +67,14 @@ class AdjustExpandRootScript(Task):
root_device_path = 'root_device_path="{device}"'.format(device=info.volume.device_path)
sed_i(script, '^root_device_path="/dev/xvda"$', root_device_path)
if info.manifest.release >= jessie:
class AdjustGrowpartWorkaround(Task):
description = 'Adjusting expand-root for growpart-workaround'
phase = phases.system_modification
predecessors = [AdjustExpandRootScript]
@classmethod
def run(cls, info):
from ..tools import sed_i
script = os.path.join(info.root, 'etc/init.d/expand-root')
sed_i(script, '^growpart="growpart"$', 'growpart-workaround')

View file

@ -83,6 +83,7 @@ def resolve_tasks(taskset, manifest):
if manifest.release >= jessie:
taskset.add(tasks.packages.AddWorkaroundGrowpart)
taskset.add(initd.AdjustGrowpartWorkaround)
if manifest.provider.get('install_init_scripts', True):
taskset.add(tasks.initd.AddEC2InitScripts)

View file

@ -40,7 +40,6 @@ def resolve_tasks(taskset, manifest):
tasks.host.InstallHostnameHook,
tasks.boot.ConfigureGrub,
initd.AddExpandRoot,
tasks.initd.AdjustExpandRootDev,
initd.InstallInitScripts,
boot.BlackListModules,
boot.UpdateInitramfs,

View file

@ -1,23 +1,10 @@
from bootstrapvz.base import Task
from bootstrapvz.common import phases
from bootstrapvz.common.tasks import initd
from bootstrapvz.common.tasks import kernel
from . import assets
import os.path
class AdjustExpandRootDev(Task):
description = 'Adjusting the expand-root device'
phase = phases.system_modification
predecessors = [initd.AddExpandRoot, initd.AdjustExpandRootScript]
@classmethod
def run(cls, info):
from bootstrapvz.common.tools import sed_i
script = os.path.join(info.root, 'etc/init.d/expand-root')
sed_i(script, '/dev/xvda', '/dev/sda')
class AddGrowRootDisable(Task):
description = 'Add script to selectively disable growroot'
phase = phases.system_modification