From 584a59e94ed2957fd559873ef3c8b824e7302bb3 Mon Sep 17 00:00:00 2001 From: Suraj Jitindar Singh Date: Mon, 18 May 2020 23:38:50 +0000 Subject: [PATCH] Add udev rule to add by-path links for xen vbd devices Xen vbd (virtual block devices) are the storage devices used on xen instances. On AL1 these devices had by-path symlinks in /dev/disk which were created by a udev rule in 60-persistent-storage.rules, however this rule required that the ID_PATH attribute be set. This attribute isn't set by the systemd version shipped in AL2 (v219) as it's setting for the xen device was removed in v184. Thus add the 51-ec2-xen-vbd-devices.rules udev rule to preserve this behaviour. Note the rule sets the ID_PATH attribute but relies on the existing rule to generate the symlinks. AL1 output: $ ls -l /dev/disk/by-path total 0 lrwxrwxrwx 1 root root 10 May 18 23:45 xen-vbd-51712 -> ../../xvda lrwxrwxrwx 1 root root 11 May 18 23:45 xen-vbd-51712-part1 -> ../../xvda1 AL2 output without patch: $ ls -l /dev/disk/by-path ls: cannot access /dev/disk/by-path: No such file or directory AL2 output with patch: ]$ ls -l /dev/disk/by-path total 0 lrwxrwxrwx 1 root root 10 May 18 23:48 xen-vbd-51712 -> ../../xvda lrwxrwxrwx 1 root root 11 May 18 23:48 xen-vbd-51712-part1 -> ../../xvda1 --- 51-ec2-xen-vbd-devices.rules | 11 +++++++++++ amazon-ec2-utils.spec | 6 ++++++ 2 files changed, 17 insertions(+) create mode 100644 51-ec2-xen-vbd-devices.rules diff --git a/51-ec2-xen-vbd-devices.rules b/51-ec2-xen-vbd-devices.rules new file mode 100644 index 0000000..a608b05 --- /dev/null +++ b/51-ec2-xen-vbd-devices.rules @@ -0,0 +1,11 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the MIT License. See the LICENSE accompanying this file +# for the specific language governing permissions and limitations under +# the License. + +# Set ID_PATH for xen virtual block devices (vbd) which are no longer +# set by udev in systemd versions post v184 thus preserving prior +# behaviour and with by-path links generated by corresponding rules from +# 60-persistent-storage.rules +SUBSYSTEM=="block", SUBSYSTEMS=="xen", DRIVERS=="vbd", ENV{ID_PATH}="xen-%b", ENV{ID_PATH_TAG}="xen-%b" diff --git a/amazon-ec2-utils.spec b/amazon-ec2-utils.spec index 463312d..186cf61 100644 --- a/amazon-ec2-utils.spec +++ b/amazon-ec2-utils.spec @@ -14,6 +14,7 @@ Source16: 60-cdrom_id.rules Source22: 70-ec2-nvme-devices.rules Source23: ec2nvme-nsid Source24: ebsnvme-id +Source25: 51-ec2-xen-vbd-devices.rules URL: https://github.com/aws/amazon-ec2-utils BuildArch: noarch @@ -49,6 +50,7 @@ install -m755 %{SOURCE15} $RPM_BUILD_ROOT/sbin/ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d/ install -m645 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d/ install -m644 %{SOURCE16} $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d/ +install -m644 %{SOURCE25} $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d/ #udev rules for nvme block devices and supporting scripts install -m644 %{SOURCE22} $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d/ @@ -76,11 +78,15 @@ rm -rf $RPM_BUILD_ROOT /sbin/ec2udev-vbd /sbin/ec2udev-vcpu %{_sysconfdir}/udev/rules.d/51-ec2-hvm-devices.rules +%{_sysconfdir}/udev/rules.d/51-ec2-xen-vbd-devices.rules %{_sysconfdir}/udev/rules.d/52-ec2-vcpu.rules %{_sysconfdir}/udev/rules.d/60-cdrom_id.rules %{_sysconfdir}/udev/rules.d/70-ec2-nvme-devices.rules %changelog +* Mon May 18 2020 Suraj Jitindar Singh 1.3-1 +- Add udev rule to add by-path links for xen vbd devices + * Tue Apr 28 2020 Frederick Lefebvre 1.3-1 - Rename the project to amazon-ec2-utils - Add README file