Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xfsinfoscanner: Do not use systemd-mount data #678

Merged
merged 1 commit into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@ def scan_xfs_mount(data):
return mountpoints


def scan_xfs_systemdmount(data):
mountpoints = set()
for entry in data:
if entry.fs_type == "xfs":
mountpoints.add(entry.path)

return mountpoints


def is_xfs_without_ftype(mp):
for l in run(['/usr/sbin/xfs_info', '{}'.format(mp)], split=True)['stdout']:
if 'ftype=0' in l:
Expand All @@ -46,13 +37,11 @@ def scan_xfs():

fstab_data = set()
mount_data = set()
systemdmount_data = set()
if storage_info:
fstab_data = scan_xfs_fstab(storage_info.fstab)
mount_data = scan_xfs_mount(storage_info.mount)
systemdmount_data = scan_xfs_systemdmount(storage_info.systemdmount)

mountpoints = fstab_data | mount_data | systemdmount_data
mountpoints = fstab_data | mount_data
mountpoints_ftype0 = list(filter(is_xfs_without_ftype, mountpoints))

# By now, we only have XFS mountpoints and check whether or not it has ftype = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,32 +85,6 @@ def test_scan_xfs_mount(monkeypatch):
assert mountpoints == {"/boot"}


def test_scan_xfs_systemdmount(monkeypatch):
systemdmount_data_no_xfs = {
"node": "/dev/sda1",
"path": "pci-0000:00:17.0-ata-2",
"model": "TOSHIBA_THNSNJ512GDNU_A",
"wwn": "0x500080d9108e8753",
"fs_type": "ext4",
"label": "n/a",
"uuid": "5675d309-eff7-4eb1-9c27-58bc5880ec72"}

mountpoints = xfsinfoscanner.scan_xfs_systemdmount([SystemdMountEntry(**systemdmount_data_no_xfs)])
assert not mountpoints

systemdmount_data_xfs = {
"node": "/dev/sda1",
"path": "/var",
"model": "n/a",
"wwn": "n/a",
"fs_type": "xfs",
"label": "n/a",
"uuid": "n/a"}

mountpoints = xfsinfoscanner.scan_xfs_systemdmount([SystemdMountEntry(**systemdmount_data_xfs)])
assert mountpoints == {"/var"}


def test_is_xfs_without_ftype(monkeypatch):
monkeypatch.setattr(xfsinfoscanner, "run", run_mocked())

Expand Down