summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cloudinit/CloudConfig/cc_resizefs.py23
-rw-r--r--doc/examples/cloud-config.txt2
2 files changed, 15 insertions, 10 deletions
diff --git a/cloudinit/CloudConfig/cc_resizefs.py b/cloudinit/CloudConfig/cc_resizefs.py
index e829f362..73e4e7bf 100644
--- a/cloudinit/CloudConfig/cc_resizefs.py
+++ b/cloudinit/CloudConfig/cc_resizefs.py
@@ -36,9 +36,9 @@ def handle(_name, cfg, _cloud, log, args):
if str(args[0]).lower() in ['true', '1', 'on', 'yes']:
resize_root = True
else:
- resize_root = util.get_cfg_option_bool(cfg, "resize_rootfs", True)
+ resize_root = util.get_cfg_option_str(cfg, "resize_rootfs", True)
- if not resize_root:
+ if str(resize_root).lower() in ['false', '0']:
return
# we use mktemp rather than mkstemp because early in boot nothing
@@ -75,14 +75,17 @@ def handle(_name, cfg, _cloud, log, args):
log.debug("not resizing unknown filesystem %s" % fstype)
return
- fid = os.fork()
- if fid == 0:
- try:
- do_resize(resize_cmd, devpth, log)
- os._exit(0) # pylint: disable=W0212
- except Exception as exc:
- sys.stderr.write("Failed: %s" % exc)
- os._exit(1) # pylint: disable=W0212
+ if resize_root == "noblock":
+ fid = os.fork()
+ if fid == 0:
+ try:
+ do_resize(resize_cmd, devpth, log)
+ os._exit(0) # pylint: disable=W0212
+ except Exception as exc:
+ sys.stderr.write("Failed: %s" % exc)
+ os._exit(1) # pylint: disable=W0212
+ else:
+ do_resize(resize_cmd, devpth, log)
log.debug("resizing root filesystem (type=%s, maj=%i, min=%i). pid=%s" %
(str(fstype).rstrip("\n"), os.major(st_dev), os.minor(st_dev), fid))
diff --git a/doc/examples/cloud-config.txt b/doc/examples/cloud-config.txt
index 171802cc..82055d09 100644
--- a/doc/examples/cloud-config.txt
+++ b/doc/examples/cloud-config.txt
@@ -351,6 +351,8 @@ rsyslog:
# this allows you to launch an instance with a larger disk / partition
# and have the instance automatically grow / to accomoddate it
# set to 'False' to disable
+# by default, the resizefs is done early in boot, and blocks
+# if resize_rootfs is set to 'noblock', then it will be run in parallel
resize_rootfs: True
## hostname and /etc/hosts management