|
|
ecbff1 |
From 104d13b765fac0308dbd01a1f3a0221504bd0412 Mon Sep 17 00:00:00 2001
|
|
|
ecbff1 |
From: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
|
|
|
ecbff1 |
Date: Wed, 1 Mar 2017 21:30:17 +0100
|
|
|
ecbff1 |
Subject: [PATCH] udev: Use parent bus id for virtio disk builtin path-id
|
|
|
ecbff1 |
(#5500)
|
|
|
ecbff1 |
|
|
|
ecbff1 |
The builtin path id for virtio block devices has been changed
|
|
|
ecbff1 |
to use the bus id without a prefix "virtio-pci" to be
|
|
|
ecbff1 |
compatible with all virtio transport types.
|
|
|
ecbff1 |
|
|
|
ecbff1 |
In order to not break existing setups, the by-path symlinks for
|
|
|
ecbff1 |
virtio block devices on the PCI bus are reintroduced by udev rules.
|
|
|
ecbff1 |
The virtio-pci symlinks are considered to be deprecated and
|
|
|
ecbff1 |
should be replaced by the native PCI symlinks.
|
|
|
ecbff1 |
|
|
|
ecbff1 |
Example output for a virtio disk in PCI slot 7:
|
|
|
ecbff1 |
$ ls /dev/disk/by-path
|
|
|
ecbff1 |
pci-0000:00:07.0
|
|
|
ecbff1 |
pci-0000:00:07.0-part1
|
|
|
ecbff1 |
virtio-pci-0000:00:07.0
|
|
|
ecbff1 |
virtio-pci-0000:00:07.0-part1
|
|
|
ecbff1 |
|
|
|
ecbff1 |
See also
|
|
|
ecbff1 |
[1] https://lists.freedesktop.org/archives/systemd-devel/2017-February/038326.html
|
|
|
ecbff1 |
[2] https://lists.freedesktop.org/archives/systemd-devel/2017-March/038397.html
|
|
|
ecbff1 |
|
|
|
ecbff1 |
This reverts f073b1b but keeps the same symlinks for compatibility.
|
|
|
ecbff1 |
|
|
|
ecbff1 |
(cherry picked from commit fb92fbb1b171ef94207a1ebc111ef0e414d49b4c)
|
|
|
ecbff1 |
|
|
|
ecbff1 |
Resolves: #1496697
|
|
|
ecbff1 |
---
|
|
|
ecbff1 |
rules/60-persistent-storage.rules | 4 ++++
|
|
|
ecbff1 |
src/udev/udev-builtin-path_id.c | 5 +----
|
|
|
ecbff1 |
2 files changed, 5 insertions(+), 4 deletions(-)
|
|
|
ecbff1 |
|
|
|
ecbff1 |
diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules
|
|
|
ecbff1 |
index 06e3329cc..10642a1fd 100644
|
|
|
ecbff1 |
--- a/rules/60-persistent-storage.rules
|
|
|
ecbff1 |
+++ b/rules/60-persistent-storage.rules
|
|
|
ecbff1 |
@@ -71,6 +71,10 @@ ENV{DEVTYPE}=="partition", ENV{ID_SAS_PATH}=="?*", SYMLINK+="disk/by-path/$env{I
|
|
|
ecbff1 |
# skip unpartitioned removable media devices from drivers which do not send "change" events
|
|
|
ecbff1 |
ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end"
|
|
|
ecbff1 |
|
|
|
ecbff1 |
+# legacy virtio-pci by-path links (deprecated)
|
|
|
ecbff1 |
+KERNEL=="vd*[!0-9]", ENV{ID_PATH}=="pci-*", SYMLINK+="disk/by-path/virtio-$env{ID_PATH}"
|
|
|
ecbff1 |
+KERNEL=="vd*[0-9]", ENV{ID_PATH}=="pci-*", SYMLINK+="disk/by-path/virtio-$env{ID_PATH}-part%n"
|
|
|
ecbff1 |
+
|
|
|
ecbff1 |
# probe filesystem metadata of optical drives which have a media inserted
|
|
|
ecbff1 |
KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", \
|
|
|
ecbff1 |
IMPORT{builtin}="blkid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}"
|
|
|
ecbff1 |
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
|
|
|
ecbff1 |
index 19447201b..d113ff21b 100644
|
|
|
ecbff1 |
--- a/src/udev/udev-builtin-path_id.c
|
|
|
ecbff1 |
+++ b/src/udev/udev-builtin-path_id.c
|
|
|
ecbff1 |
@@ -688,11 +688,8 @@ restart:
|
|
|
ecbff1 |
parent = skip_subsystem(parent, "xen");
|
|
|
ecbff1 |
supported_parent = true;
|
|
|
ecbff1 |
} else if (streq(subsys, "virtio")) {
|
|
|
ecbff1 |
- while (parent && streq_ptr("virtio", udev_device_get_subsystem(parent)))
|
|
|
ecbff1 |
- parent = udev_device_get_parent(parent);
|
|
|
ecbff1 |
- path_prepend(&path, "virtio-pci-%s", udev_device_get_sysname(parent));
|
|
|
ecbff1 |
+ parent = skip_subsystem(parent, "virtio");
|
|
|
ecbff1 |
supported_transport = true;
|
|
|
ecbff1 |
- supported_parent = true;
|
|
|
ecbff1 |
} else if (streq(subsys, "scm")) {
|
|
|
ecbff1 |
path_prepend(&path, "scm-%s", udev_device_get_sysname(parent));
|
|
|
ecbff1 |
parent = skip_subsystem(parent, "scm");
|