From 024ecc1f758d36cc0aa5ebce65704eed6bd66d45 Mon Sep 17 00:00:00 2001 From: Chad Smith Date: Thu, 14 Sep 2017 14:05:13 -0600 Subject: resizefs: Drop check for read-only device file, do not warn on overlayroot. As root user, os.access(, os.W_OK) will always return True so that path will never get executed. Also avoid a warning if the root is overlayroot, which is the common case on a MAAS booted 'ephemeral' system. --- cloudinit/config/cc_resizefs.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'cloudinit') diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py index f42b6a63..f774baa3 100644 --- a/cloudinit/config/cc_resizefs.py +++ b/cloudinit/config/cc_resizefs.py @@ -192,6 +192,10 @@ def is_device_path_writable_block(devpath, info, log): return False log.debug("Converted /dev/root to '%s' per kernel cmdline", devpath) + if devpath == 'overlayroot': + log.debug("Not attempting to resize devpath '%s': %s", devpath, info) + return False + try: statret = os.stat(devpath) except OSError as exc: @@ -205,14 +209,6 @@ def is_device_path_writable_block(devpath, info, log): raise exc return False - if not os.access(devpath, os.W_OK): - if container: - log.debug("'%s' not writable in container. cannot resize: %s", - devpath, info) - else: - log.warn("'%s' not writable. cannot resize: %s", devpath, info) - return - if not stat.S_ISBLK(statret.st_mode) and not stat.S_ISCHR(statret.st_mode): if container: log.debug("device '%s' not a block device in container." -- cgit v1.2.3