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

Rewrite the mount resource to fix at least one existing issue #744

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Mar 6, 2024

  1. engine: resources: Rewrite MountRes to rely on systemd units over fstab

    The mount approach was flawed. It relied on editing fstab, then restarting the
    systemd service that is responsible for mounting all defined filesystems. Among
    other issues, this approach made it impossible for mgmt to unmount managed
    filesystems, because after removing them from fstab, they would just be ignored
    by systemd.
    
    The new approach is based on creating a systemd unit for each managed mount,
    through a unit file in /etc/systemd/system. These files are managed by wrapped
    File resources now. Then a wrapped Svc resource manages the lifecycle of the
    mount. This works even after removing the unit definition from systemd, because
    as long as the filesystem is still mounted, systemd will be able to derive a
    transient unit that can be managed.
    
    This also simplifies the logic of the MountRes a lot, because we don't have to
    be so careful anymore about matching existing fstab entries to what is expected
    by a given Mount resource. We just overwrite the unit definition with whatever
    is specified, and rely on systemd to handle the details. Systemd will even
    create mount points if they don't yet exist.
    
    Currently this approach is not yet equipped to handle the case that a mount
    could be defined via fstab already, or through a unit file that is in a
    different location than /etc/systemd/system. As such, this second iteration
    should be considered as a partial (if more rounded than the first one)
    solution.
    
    Fixes purpleidea#525
    ffrank committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    b2f4dfd View commit details
    Browse the repository at this point in the history
  2. test: shell: Add a stub test for mount, and some clean-up

    As the --converged-timeout does not work anymore, we cannot use this current
    approach to test the mount resource. Simple resources like file can sync in
    time before the main loop terminates, but MountRes cannot. Therefor this test
    script is skipping itself for now. We should replace all of these tests with
    a more sophisticated approach.
    
    Still, while we have them, we can reduce some copy/paste work by adding another
    util function for checking sudo.
    ffrank committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    db8c973 View commit details
    Browse the repository at this point in the history