|
|
1abbee |
From b6fea1a0e0fd830e1aa82accf389cb8bfd0f0f37 Mon Sep 17 00:00:00 2001
|
|
|
1abbee |
From: Michal Sekletar <msekleta@redhat.com>
|
|
|
1abbee |
Date: Tue, 9 Feb 2016 09:57:45 +0100
|
|
|
1abbee |
Subject: [PATCH] path_id: reintroduce by-path links for virtio block devices
|
|
|
1abbee |
|
|
|
1abbee |
Enumeration of virtio buses is global and hence
|
|
|
1abbee |
non-deterministic. However, we are guaranteed there is never going to be
|
|
|
1abbee |
more than one virtio bus per parent PCI device. While populating
|
|
|
1abbee |
ID_PATH we simply skip virtio part of the syspath and we extend the path
|
|
|
1abbee |
using the sysname of the parent PCI device.
|
|
|
1abbee |
|
|
|
1abbee |
With this patch udev creates following by-path links for virtio-blk
|
|
|
1abbee |
device /dev/vda which contains two partitions.
|
|
|
1abbee |
|
|
|
1abbee |
ls -l /dev/disk/by-path/
|
|
|
1abbee |
total 0
|
|
|
1abbee |
lrwxrwxrwx 1 root root 9 Feb 9 10:47 virtio-pci-0000:00:05.0 -> ../../vda
|
|
|
1abbee |
lrwxrwxrwx 1 root root 10 Feb 9 10:47 virtio-pci-0000:00:05.0-part1 -> ../../vda1
|
|
|
1abbee |
lrwxrwxrwx 1 root root 10 Feb 9 10:47 virtio-pci-0000:00:05.0-part2 -> ../../vda2
|
|
|
1abbee |
|
|
|
1abbee |
See:
|
|
|
1abbee |
http://lists.linuxfoundation.org/pipermail/virtualization/2015-August/030328.html
|
|
|
1abbee |
|
|
|
1abbee |
Fixes #2501
|
|
|
1abbee |
|
|
|
1abbee |
Cherry-picked from: f073b1b3c0f4f0df1b0bd61042ce85fb5d27d407
|
|
|
1abbee |
Resolves: #952567
|
|
|
1abbee |
---
|
|
|
1abbee |
src/udev/udev-builtin-path_id.c | 6 ++++++
|
|
|
1abbee |
1 file changed, 6 insertions(+)
|
|
|
1abbee |
|
|
|
1abbee |
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
|
|
|
1abbee |
index 3b72922..8359e23 100644
|
|
|
1abbee |
--- a/src/udev/udev-builtin-path_id.c
|
|
|
1abbee |
+++ b/src/udev/udev-builtin-path_id.c
|
|
|
1abbee |
@@ -698,6 +698,12 @@ restart:
|
|
|
1abbee |
path_prepend(&path, "xen-%s", udev_device_get_sysname(parent));
|
|
|
1abbee |
parent = skip_subsystem(parent, "xen");
|
|
|
1abbee |
supported_parent = true;
|
|
|
1abbee |
+ } else if (streq(subsys, "virtio")) {
|
|
|
1abbee |
+ while (parent && streq_ptr("virtio", udev_device_get_subsystem(parent)))
|
|
|
1abbee |
+ parent = udev_device_get_parent(parent);
|
|
|
1abbee |
+ path_prepend(&path, "virtio-pci-%s", udev_device_get_sysname(parent));
|
|
|
1abbee |
+ supported_transport = true;
|
|
|
1abbee |
+ supported_parent = true;
|
|
|
1abbee |
} else if (streq(subsys, "scm")) {
|
|
|
1abbee |
path_prepend(&path, "scm-%s", udev_device_get_sysname(parent));
|
|
|
1abbee |
parent = skip_subsystem(parent, "scm");
|