Bug 2184779

Summary: Filesystem: create systemd unit files for filesystems that are considered network filesystems by systemd
Product: Red Hat Enterprise Linux 9 Reporter: Shane Bradley <sbradley>
Component: resource-agentsAssignee: Oyvind Albrigtsen <oalbrigt>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 9.0CC: agk, cluster-maint, fdinitto, mjuricek, nwahl, phagara
Target Milestone: rcKeywords: Triaged
Target Release: 9.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: resource-agents-4.10.0-38.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-07 08:23:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Shane Bradley 2023-04-05 17:34:02 UTC
Description of problem:

A customer was seeing his gfs2 filesystem managed by pacemaker shutting down before pacemaker started the shutdown process when doing a "shutdown -h now". This should not occur if the filesystem is managed by pacemaker. 

We should create systemd unit files for filesystems that are considered network filesystems by systemd for our `Filesystem` resource-agent. 

Any filesystem that is supported by the `Filesystem` resource-agent that is considered a `network` filesystem by systemd [1] should be include a unit file system to make sure that those filesystem are not shutdown before pacemaker. 


Version-Release number of selected component (if applicable):
resource-agents-4.9.0-16.el8.x86_64

How reproducible:
Every time

Steps to Reproduce:
1. Configure a gfs2 filesystem that is managed by pacemaker.
2. Do: shutdown -h now

Actual results:
The gfs2 filesystems managed by pacemaker are shutdown before pacemaker starts the shutdown process.

Expected results:
The gfs2 filesystem should NOT be shutdown by systemd and unmounted. They should only be unmounted when pacemaker begins
its shutdown.

Additional info:

We should add a check on Filesystem type for the 'Filesystem' resource-agent then create a unit file similar to what we do with "LVM-activate" resource. We should do this for any type that "Filesystem" resource-agent supports and which is considered a network filesystem by systemd. 

Create the following file:
  # touch /etc/systemd/system/resource-agents-deps.target.d/gfs2.conf

Then add the following to the file /etc/systemd/system/resource-agents-deps.target.d/gfs2.conf:
  [Unit]
  After=remote-fs.target

Then reload systemd
  # systemctl daemon-reload

Comment 1 Reid Wahl 2023-04-05 17:41:11 UTC
The systemd_drop_in() function can do this. See lvm_start() in LVM-activate.

This would be something like
```
            # if this is a remote filesystem (https://github.com/systemd/systemd/blob/v253/src/basic/filesystems.c#L115-L132)
            systemd_drop_in "99-Filesystem-remote" "After" \
                    "remote-fs.target"
```

We should think about whether Wants= or Requires= is also necessary. I think After= is sufficient.

Comment 2 Oyvind Albrigtsen 2023-05-17 10:35:07 UTC
https://github.com/ClusterLabs/resource-agents/pull/1869

Comment 10 errata-xmlrpc 2023-11-07 08:23:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (resource-agents bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:6312