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

CheckNFS actor should respect nfsd filesystem #888

Merged
merged 1 commit into from
May 26, 2022
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
13 changes: 8 additions & 5 deletions repos/system_upgrade/common/actors/checknfs/actor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from leapp import reporting
from leapp.actors import Actor
from leapp.models import StorageInfo
from leapp.reporting import Report, create_report
from leapp import reporting
from leapp.reporting import create_report, Report
from leapp.tags import ChecksPhaseTag, IPUWorkflowTag


Expand All @@ -22,24 +22,27 @@ def process(self):
"We have found NFS usage at the following locations:\n"
nfs_found = False

def _is_nfs(a_type):
return a_type.startswith('nfs') and a_type != 'nfsd'

for storage in self.consume(StorageInfo):
# Check fstab
for fstab in storage.fstab:
if fstab.fs_vfstype.startswith("nfs"):
if _is_nfs(fstab.fs_vfstype):
nfs_found = True
details += "- One or more NFS entries in /etc/fstab\n"
break

# Check mount
for mount in storage.mount:
if mount.tp.startswith("nfs"):
if _is_nfs(mount.tp):
nfs_found = True
details += "- Currently mounted NFS shares\n"
break

# Check systemd-mount
for systemdmount in storage.systemdmount:
if systemdmount.fs_type.startswith("nfs"):
if _is_nfs(systemdmount.fs_type):
nfs_found = True
details += "- One or more configured NFS mounts in systemd-mount\n"
break
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pytest

from leapp.snactor.fixture import current_actor_context
from leapp.models import StorageInfo, SystemdMountEntry, FstabEntry, MountEntry
from leapp.models import FstabEntry, MountEntry, StorageInfo, SystemdMountEntry
from leapp.reporting import Report
from leapp.snactor.fixture import current_actor_context


@pytest.mark.parametrize('nfs_fstype', ('nfs', 'nfs4'))
Expand Down Expand Up @@ -50,6 +50,13 @@ def test_actor_without_fstab_entry(current_actor_context):
assert not current_actor_context.consume(Report)


def test_actor_with_nfsd(current_actor_context):
with_nfsd = [MountEntry(name="nfsd", mount="/proc/fs/nfsd", tp="nfsd", options="rw,relatime")]
current_actor_context.feed(StorageInfo(mount=with_nfsd))
current_actor_context.run()
assert not current_actor_context.consume(Report)


@pytest.mark.parametrize('nfs_fstype', ('nfs', 'nfs4'))
def test_actor_with_mount_share(current_actor_context, nfs_fstype):
with_mount_share = [MountEntry(name="nfs", mount="/mnt/data", tp=nfs_fstype,
Expand Down