summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_growpart.py
diff options
context:
space:
mode:
authorSteve Langasek <steve.langasek@canonical.com>2017-03-28 21:47:50 -0700
committerScott Moser <smoser@brickies.net>2017-03-29 16:45:32 -0400
commit0e2030ca7fe783ead06100c748f4714895461799 (patch)
treefc90d18e34fbc990c81b2226db7e47e9c27a366c /cloudinit/config/cc_growpart.py
parente80dbb80987ba44be2899e34fbbbf7d48389b6b5 (diff)
downloadvyos-cloud-init-0e2030ca7fe783ead06100c748f4714895461799.tar.gz
vyos-cloud-init-0e2030ca7fe783ead06100c748f4714895461799.zip
support resizing partition and rootfs on system booted without initramfs.
When booted without an initramfs, the root device will be /dev/root, not a named device. There is partial support for this when resizing filesystems, but not for growing partitions, without which it doesn't do much good. Move the /dev/root resolution code to util.py and use it from cc_growpart.py. Also, booting without an initramfs only works with a root= argument that's either a kernel device name (which is unstable) or a partition UUID. Handle the case of root=PARTUUID=value, not just LABEL and UUID. LP: #1677376
Diffstat (limited to 'cloudinit/config/cc_growpart.py')
-rw-r--r--cloudinit/config/cc_growpart.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/cloudinit/config/cc_growpart.py b/cloudinit/config/cc_growpart.py
index 832bb3fd..089693e8 100644
--- a/cloudinit/config/cc_growpart.py
+++ b/cloudinit/config/cc_growpart.py
@@ -247,7 +247,16 @@ def devent2dev(devent):
result = util.get_mount_info(devent)
if not result:
raise ValueError("Could not determine device of '%s' % dev_ent")
- return result[0]
+ dev = result[0]
+
+ container = util.is_container()
+
+ # Ensure the path is a block device.
+ if (dev == "/dev/root" and not os.path.exists(dev) and not container):
+ dev = util.rootdev_from_cmdline(util.get_cmdline())
+ if dev is None:
+ raise ValueError("Unable to find device '/dev/root'")
+ return dev
def resize_devices(resizer, devices):