[PATCH 3/3] Add virtio-blk support to persistent-storage rules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Using virtioblk_id add rules to extract drive serial numbers and generate
by-id links for the block device and partitions.

With these rules added, we now see the following symlinks in disk/by-id

% ls -al /dev/disk/by-id | grep vdb
lrwxrwxrwx. 1 root root   9 Jun  1 22:09 virtio-QM00001 -> ../../vda
lrwxrwxrwx. 1 root root  10 Jun  1 22:09 virtio-QM00001-part1 -> ../../vda1

Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>
---
 rules/rules.d/60-persistent-storage.rules |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules
index 1f46041..da73526 100644
--- a/rules/rules.d/60-persistent-storage.rules
+++ b/rules/rules.d/60-persistent-storage.rules
@@ -30,6 +30,11 @@ KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="s
 KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
 KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
 
+# virtioblk
+KERNEL=="vd*[!0-9]", IMPORT{program}="virtioblk_id $tempnode"
+KERNEL=="vd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}"
+KERNEL=="vd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n"
+
 # firewire
 KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}"
 KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n"
-- 
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux