storage icon indicating copy to clipboard operation
storage copied to clipboard

Verify that disk volumes are mounted by UUID in fstab

Open pcahyna opened this issue 6 years ago • 9 comments

Note that disk volumes mean filesystems directly on disks.

Currently the test fails: on first invocation the filesystem gets mounted by device name and only on the second by UUID. This should be also caught by a real idempotence test.

XXX this should be part of the existing verification task lists: there is already a task called "Verify that the device identifier appears in /etc/fstab", but it does not check for this condition.

pcahyna avatar Oct 18 '19 11:10 pcahyna

here's what happens: One invocation has created a fstab entry which mounts the filesystem by block device path:

TASK [storage : manage mounts to match the specified state] ********************
changed: [/home/pcahyna/linux-system-roles-testing/local/rhel-guest-image-7.7-200.x86_64.qcow2] => (item={'path': '/opt/test', 'state': 'absent'}) => {"ansible_loop_var": "mount_info", "changed": true, "dump": "0", "fstab": "/etc/fstab", "mount_info": {"path": "/opt/test", "state": "absent"}, "name": "/opt/test", "opts": "defaults", "passno": "0"}
changed: [/home/pcahyna/linux-system-roles-testing/local/rhel-guest-image-7.7-200.x86_64.qcow2] => (item={'src': '/dev/vdc', 'dump': 0, 'passno': 0, 'fstype': 'ext4', 'state': 'mounted', 'path': '/opt/test', 'opts': 'defaults'}) => {"ansible_loop_var": "mount_info", "changed": true, "dump": "0", "fstab": "/etc/fstab", "fstype": "ext4", "mount_info": {"dump": 0, "fstype": "ext4", "opts": "defaults", "passno": 0, "path": "/opt/test", "src": "/dev/vdc", "state": "mounted"}, "name": "/opt/test", "opts": "defaults", "passno": "0", "src": "/dev/vdc"}

...

TASK [Read the /etc/fstab file for volume existence] ***************************
ok: [/home/pcahyna/linux-system-roles-testing/local/rhel-guest-image-7.7-200.x86_64.qcow2] => {"changed": false, "cmd": ["cat", "/etc/fstab"], "delta": "0:00:00.003845", "end": "2019-10-15 13:43:52.449118", "rc": 0, "start": "2019-10-15 13:43:52.445273", "stderr": "", "stderr_lines": [], "stdout_lines": ["/dev/vdc /opt/test ext4 defaults 0 0"]}

and the repeated invocation changes it to mount by UUID:

TASK [storage : manage mounts to match the specified state] ********************
changed: [/home/pcahyna/linux-system-roles-testing/local/rhel-guest-image-7.7-200.x86_64.qcow2] => (item={'src': 'UUID=26bddec8-c250-416c-b8f1-7d8bfc070d06', 'dump': 0, 'passno': 0, 'fstype': 'ext4', 'state': 'mounted', 'path': '/opt/test', 'opts': 'defaults'}) => {"ansible_loop_var": "mount_info", "changed": true, "dump": "0", "fstab": "/etc/fstab", "fstype": "ext4", "mount_info": {"dump": 0, "fstype": "ext4", "opts": "defaults", "passno": 0, "path": "/opt/test", "src": "UUID=26bddec8-c250-416c-b8f1-7d8bfc070d06", "state": "mounted"}, "name": "/opt/test", "opts": "defaults", "passno": "0", "src": "UUID=26bddec8-c250-416c-b8f1-7d8bfc070d06"}

...

TASK [Read the /etc/fstab file for volume existence] ***************************
ok: [/home/pcahyna/linux-system-roles-testing/local/rhel-guest-image-7.7-200.x86_64.qcow2] => {"changed": false, "cmd": ["cat", "/etc/fstab"], "delta": "0:00:00.004238", "end": "2019-10-15 13:45:30.693829", "rc": 0, "start": "2019-10-15 13:45:30.689591", "stderr": "", "stderr_lines": [], "stdout_lines": ["UUID=26bddec8-c250-416c-b8f1-7d8bfc070d06 /opt/test ext4 defaults 0 0"]}

(copied from https://github.com/linux-system-roles/storage/commit/36da735ad34a9b7c0cd2067adbd8124eef1641d4#r35511810 )

pcahyna avatar Oct 18 '19 11:10 pcahyna

The rules are a bit more complicated. Device-mapper devices are generally listed by path instead of by UUID since that path can only change as a direct result of the user changing it, as opposed to partitions or disks which can change arbitrarily depending on device detection ordering.

I am definitely open to verifying that the correct identifier is used, but it will have to be a bit more complex than this.

dwlehman avatar Jun 02 '20 18:06 dwlehman

should we close this in favor of #104 ?

richm avatar Mar 13 '21 00:03 richm

[citest pending]

richm avatar May 04 '21 19:05 richm

[citest bad]

richm avatar May 04 '21 19:05 richm

[citest pending]

richm avatar May 04 '21 23:05 richm

[citest pending]

richm avatar Oct 11 '21 20:10 richm

[citest pending]

richm avatar Oct 11 '21 21:10 richm

[citest pending]

richm avatar Oct 20 '21 15:10 richm

closing due to inactivity

richm avatar Aug 01 '24 22:08 richm