cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #03853
[Merge] ~rjschwei/cloud-init:btrfsResize into cloud-init:master
Robert Schweikert has proposed merging ~rjschwei/cloud-init:btrfsResize into cloud-init:master.
Requested reviews:
cloud-init commiters (cloud-init-dev)
For more details, see:
https://code.launchpad.net/~rjschwei/cloud-init/+git/cloud-init/+merge/334338
Resize of btrfs fails if "/" is mounted ro. However, it should be allowed to resize the file system. Use a subvolume that is rw as the mountpoint to trick the tools into letting the filesystem be resized as desired
--
Your team cloud-init commiters is requested to review the proposed merge of ~rjschwei/cloud-init:btrfsResize into cloud-init:master.
diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py
index 0d282e6..01ed681 100644
--- a/cloudinit/config/cc_resizefs.py
+++ b/cloudinit/config/cc_resizefs.py
@@ -59,7 +59,14 @@ __doc__ = get_schema_doc(schema) # Supplement python help()
def _resize_btrfs(mount_point, devpth):
- return ('btrfs', 'filesystem', 'resize', 'max', mount_point)
+ # If "/" is ro resize will fail. However it should be allowed since resize
+ # makes everything bigger and subvolumes that are no ro will benefit.
+ # Use a subvolume thta is not ro to trick te resize operation to do the
+ # "right" thing.
+ if mount_point == '/' and os.path.isdir("/.snapshots"):
+ return ('btrfs', 'filesystem', 'resize', 'max', '/.snapshots')
+ else:
+ return ('btrfs', 'filesystem', 'resize', 'max', mount_point)
def _resize_ext(mount_point, devpth):
Follow ups