mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
Merge pull request #150 from timbot/debian-backports-growroot
Enable auto rootdisk growth on gce-backports
This commit is contained in:
commit
880e13f0d8
4 changed files with 40 additions and 1 deletions
|
@ -61,4 +61,4 @@ class AdjustExpandRootScript(Task):
|
|||
script = os.path.join(info.root, 'etc/init.d/expand-root')
|
||||
root_idx = info.volume.partition_map.root.get_index()
|
||||
device_path = 'device_path="/dev/xvda{idx}"'.format(idx=root_idx)
|
||||
sed_i(script, '^device_path="/dev/xvda$', device_path)
|
||||
sed_i(script, '^device_path="/dev/xvda"$', device_path)
|
||||
|
|
|
@ -3,6 +3,7 @@ import tasks.apt
|
|||
import tasks.boot
|
||||
import tasks.configuration
|
||||
import tasks.image
|
||||
import tasks.initd
|
||||
import tasks.host
|
||||
import tasks.packages
|
||||
from bootstrapvz.common.tasks import apt
|
||||
|
@ -31,6 +32,7 @@ def resolve_tasks(taskset, manifest):
|
|||
tasks.apt.SetPackageRepositories,
|
||||
tasks.apt.ImportGoogleKey,
|
||||
tasks.packages.DefaultPackages,
|
||||
tasks.packages.ReleasePackages,
|
||||
tasks.packages.GooglePackages,
|
||||
|
||||
tasks.configuration.GatherReleaseInformation,
|
||||
|
@ -38,6 +40,8 @@ def resolve_tasks(taskset, manifest):
|
|||
tasks.host.DisableIPv6,
|
||||
tasks.host.InstallHostnameHook,
|
||||
tasks.boot.ConfigureGrub,
|
||||
initd.AddExpandRoot,
|
||||
tasks.initd.AdjustExpandRootDev,
|
||||
initd.InstallInitScripts,
|
||||
ssh.AddSSHKeyGeneration,
|
||||
ssh.DisableSSHPasswordAuthentication,
|
||||
|
@ -48,6 +52,9 @@ def resolve_tasks(taskset, manifest):
|
|||
volume.Delete,
|
||||
])
|
||||
|
||||
if manifest.volume['partitions']['type'] != 'none':
|
||||
taskset.add(initd.AdjustExpandRootScript)
|
||||
|
||||
if 'gcs_destination' in manifest.image:
|
||||
taskset.add(tasks.image.UploadImage)
|
||||
if 'gce_project' in manifest.image:
|
||||
|
|
16
bootstrapvz/providers/gce/tasks/initd.py
Normal file
16
bootstrapvz/providers/gce/tasks/initd.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
from bootstrapvz.base import Task
|
||||
from bootstrapvz.common import phases
|
||||
from bootstrapvz.common.tasks import initd
|
||||
|
||||
|
||||
class AdjustExpandRootDev(Task):
|
||||
description = 'Adjusting the expand-root device'
|
||||
phase = phases.system_modification
|
||||
predecessors = [initd.AddExpandRoot, initd.AdjustExpandRootScript]
|
||||
|
||||
@classmethod
|
||||
def run(cls, info):
|
||||
import os.path
|
||||
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')
|
|
@ -1,6 +1,7 @@
|
|||
from bootstrapvz.base import Task
|
||||
from bootstrapvz.common import phases
|
||||
from bootstrapvz.common.tasks import apt
|
||||
import logging
|
||||
import os
|
||||
|
||||
|
||||
|
@ -28,6 +29,21 @@ class DefaultPackages(Task):
|
|||
info.packages.add(kernel_package)
|
||||
|
||||
|
||||
class ReleasePackages(Task):
|
||||
description = 'Adding release-specific packages required for GCE'
|
||||
phase = phases.preparation
|
||||
predecessors = [apt.AddDefaultSources, apt.AddBackports, DefaultPackages]
|
||||
|
||||
@classmethod
|
||||
def run(cls, info):
|
||||
# Add release-specific packages, if available.
|
||||
if info.source_lists.target_exists('wheezy-backports'):
|
||||
info.packages.add('cloud-initramfs-growroot')
|
||||
else:
|
||||
msg = ('No release-specific packages found for {system.release}').format(**info.manifest_vars)
|
||||
logging.getLogger(__name__).warning(msg)
|
||||
|
||||
|
||||
class GooglePackages(Task):
|
||||
description = 'Adding image packages required for GCE from Google repositories'
|
||||
phase = phases.preparation
|
||||
|
|
Loading…
Add table
Reference in a new issue