From ea0cd3c37ee5cd9e99b222346bce35bc1258cb9a Mon Sep 17 00:00:00 2001 From: Christian Schwede Date: Fri, 21 Aug 2020 06:57:01 +0200 Subject: [PATCH] Use UUID for mounted SwiftRawDisks When SwiftRawDisks is set, try to mount the disks using uuids instead of paths. This makes mounts more stable, eg. if a kernel gets updates and device orders are changed. This patch will also update existing entries in /etc/fstab and replaces the device path with the corresponding UUID. Change-Id: I275b962447015e804638ccf85c63a22d1bb6e3d6 (cherry picked from commit 6206d195928e11de4672404720e137422d619cad) --- deployment/swift/swift-storage-container-puppet.yaml | 8 +++++++- .../notes/swift-mount-by-uuid-7744fe7696db4b85.yaml | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/swift-mount-by-uuid-7744fe7696db4b85.yaml diff --git a/deployment/swift/swift-storage-container-puppet.yaml b/deployment/swift/swift-storage-container-puppet.yaml index a72088a778..ae63bc63ec 100644 --- a/deployment/swift/swift-storage-container-puppet.yaml +++ b/deployment/swift/swift-storage-container-puppet.yaml @@ -633,10 +633,16 @@ outputs: opts: -f -i size=1024 with_items: "{{ swift_raw_disks }}" when: swift_raw_disks + - name: Refresh facts if SwiftRawDisks is set to get uuids if newly created partitions + setup: + gather_subset: + - '!all' + - 'hardware' + when: swift_raw_disks - name: Mount devices defined in SwiftRawDisks mount: name: /srv/node/{{ item }} - src: "{{ swift_raw_disks[item]['base_dir']|default('/dev') }}/{{ item }}" + src: "{% if lsblk.results['uuids'][item] is defined %}UUID={{ ansible_device_links['uuids'][item][0] }}{% else %}{{ swift_raw_disks[item]['base_dir']|default('/dev') }}/{{ item }}{% endif %}" fstype: xfs opts: noatime state: mounted diff --git a/releasenotes/notes/swift-mount-by-uuid-7744fe7696db4b85.yaml b/releasenotes/notes/swift-mount-by-uuid-7744fe7696db4b85.yaml new file mode 100644 index 0000000000..9b199a50c7 --- /dev/null +++ b/releasenotes/notes/swift-mount-by-uuid-7744fe7696db4b85.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + When SwiftRawDisks is set, try to mount the disks using uuids instead of + paths. This makes mounts more stable, eg. if a kernel gets updates and + device orders are changed.