Support xfs filesystem

This commit is contained in:
Mehran Kholdi 2020-08-17 01:23:11 +04:30
parent 7c7e8eb4ce
commit 4d6d83c24a
4 changed files with 10 additions and 3 deletions

View File

@ -7,6 +7,7 @@ DriverInfo:
SupportedFsType: SupportedFsType:
ext4: ext4:
btrfs: btrfs:
xfs:
Capabilities: Capabilities:
persistence: true persistence: true
block: false block: false

View File

@ -3,7 +3,7 @@ FROM python:3.9-slim-buster
WORKDIR /app/ WORKDIR /app/
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y e2fsprogs btrfs-progs && \ apt-get install -y e2fsprogs btrfs-progs xfsprogs && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
ENV PIP_NO_CACHE_DIR 1 ENV PIP_NO_CACHE_DIR 1

View File

@ -40,8 +40,8 @@ Features
- [x] `Filesystem` mode - [x] `Filesystem` mode
- [ ] `Block` mode - [ ] `Block` mode
- [x] Volume metrics - [x] Volume metrics
- [x] Supports fsTypes: `ext4`, `btrfs` - [x] Supports fsTypes: `ext4`, `btrfs`, `xfs`
- [x] Online expansion: If fs supports it (e.g. ext4, btrfs) - [x] Online expansion: If fs supports it (e.g. ext4, btrfs, xfs)
- [ ] Online shrinking: If fs supports it (e.g. btrfs) - [ ] Online shrinking: If fs supports it (e.g. btrfs)
- [ ] Offline expansion/shrinking - [ ] Offline expansion/shrinking
- [ ] Ephemeral inline volume - [ ] Ephemeral inline volume

View File

@ -46,6 +46,8 @@ def be_mounted(dev, mountpoint):
run(f"mount {dev} {mountpoint}") run(f"mount {dev} {mountpoint}")
elif fs == "btrfs": elif fs == "btrfs":
run(f"mount -o flushoncommit {dev} {mountpoint}") run(f"mount -o flushoncommit {dev} {mountpoint}")
elif fs == "xfs":
run(f"mount {dev} {mountpoint}")
else: else:
raise Exception(f"Unsupported fs type: {fs}") raise Exception(f"Unsupported fs type: {fs}")
@ -84,6 +86,8 @@ def be_formatted(dev, fs):
rmdir {tmp_mnt} rmdir {tmp_mnt}
""" """
) )
elif fs == "xfs":
run(f"mkfs.xfs {device}")
else: else:
raise Exception(f"Unsupported fs type: {fs}") raise Exception(f"Unsupported fs type: {fs}")
@ -104,5 +108,7 @@ def be_fs_expanded(dev, path):
run(f"resize2fs {dev}") run(f"resize2fs {dev}")
elif fs == "btrfs": elif fs == "btrfs":
run(f"btrfs filesystem resize max {path}") run(f"btrfs filesystem resize max {path}")
elif fs == "xfs":
run(f"xfs_growfs -d {dev}")
else: else:
raise Exception(f"Unsupported fsType: {fs}") raise Exception(f"Unsupported fsType: {fs}")