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:
ext4:
btrfs:
xfs:
Capabilities:
persistence: true
block: false

View File

@ -3,7 +3,7 @@ FROM python:3.9-slim-buster
WORKDIR /app/
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/*
ENV PIP_NO_CACHE_DIR 1

View File

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

View File

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