summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2012-03-21 16:14:07 -0400
committerScott Moser <smoser@ubuntu.com>2012-03-21 16:14:07 -0400
commita088694a7dd88d0645d540c6b194fe4fd3628b28 (patch)
tree007137f8c12c9f3e08a1aae7ba1979cafff5cc34 /cloudinit
parent6e1547d093f975b18722ad94083dda4dc3753c3f (diff)
downloadvyos-cloud-init-a088694a7dd88d0645d540c6b194fe4fd3628b28.tar.gz
vyos-cloud-init-a088694a7dd88d0645d540c6b194fe4fd3628b28.zip
allow cloud-config to control if resizefs is blocking or not
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/CloudConfig/cc_resizefs.py23
1 files changed, 13 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))