saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.09k stars 5.47k forks source link

[BUG] Forced remount because options changed when no options changed #65865

Open CodingMinds opened 7 months ago

CodingMinds commented 7 months ago

Description A highstate forces a remount because of changed options even if no remount is necessary.

In our case it's because of the option noauto.

Setup We use Salt-SSH to manage our Linode Ubuntu VMs.

Steps to Reproduce the behavior Apply a highstate when the mount is already done

mount -l | grep redacted:

/dev/mapper/redacted on /mnt/storage type ext4 (rw,noatime,errors=remount-ro)

cat /proc/self/mountinfo | grep redacted:

440 30 253:0 / /mnt/storage rw,noatime shared:216 - ext4 /dev/mapper/redacted rw,errors=remount-ro

State to be applied:

redacted-mount:
  mount.mounted:
    - name: /mnt/storage
    - device: /dev/mapper/redacted
    - fstype: ext4
    - opts: errors=remount-ro,noauto,noatime
    - persist: False
    - mount: True
    - dump: 0
    - pass_num: 0

Expected behavior Nothing should happen because no option has changed

Screenshots salt-ssh redacted state.highstate test=True:

----------
          ID: redacted-mount
    Function: mount.mounted
        Name: /mnt/storage
      Result: None
     Comment: Remount would be forced because options (noauto) changed
     Started: 11:43:58.422813
    Duration: 7.405 ms
     Changes:   
----------

salt-ssh redacted state.highstate:

----------
          ID: redacted-mount
    Function: mount.mounted
        Name: /mnt/storage
      Result: True
     Comment: Target was already mounted
     Started: 11:50:45.518528
    Duration: 13.03 ms
     Changes:   
              ----------
              umount:
                  Forced remount because options (noauto) changed
----------

Versions Report

salt --versions-report master: ```yaml Salt Version: Salt: 3006.1 Python Version: Python: 3.10.11 (main, May 5 2023, 02:37:04) [Clang 14.0.0 (clang-1400.0.29.202)] Dependency Versions: cffi: 1.14.6 cherrypy: unknown dateutil: 2.8.0 docker-py: Not Installed gitdb: 4.0.5 gitpython: 3.1.30 Jinja2: 3.1.2 libgit2: Not Installed looseversion: 1.0.2 M2Crypto: Not Installed Mako: Not Installed msgpack: 1.0.2 msgpack-pure: Not Installed mysql-python: Not Installed packaging: 22.0 pycparser: 2.21 pycrypto: Not Installed pycryptodome: 3.9.8 pygit2: Not Installed python-gnupg: 0.4.8 PyYAML: 5.4.1 PyZMQ: 23.2.0 relenv: 0.12.3 smmap: 3.0.2 timelib: 0.2.4 Tornado: 4.5.3 ZMQ: 4.3.4 System Versions: dist: darwin 22.6.0 locale: utf-8 machine: x86_64 release: 22.6.0 system: Darwin version: 13.6.3 x86_64 ``` Minion: ``` $ uname -a Linux redacted 5.15.0-83-generic #92-Ubuntu SMP Mon Aug 14 09:30:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux ```

Additional context I've created this issue because all other related issues I've found are marked as stale and closed 🤷 Like https://github.com/saltstack/salt/issues/18630

Possible fix

Extending the fix from https://github.com/saltstack/salt/pull/19369/files with noauto should fix this particular issue. Verified with a local adaption and applying salt-ssh -t redacted state.highstate test=True.

welcome[bot] commented 7 months ago

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey. Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. If you have additional questions, email us at saltproject@vmware.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!