Skip to content

Commit

Permalink
Merge pull request #9885 from dachary/wip-16351-by-parttypeuuid
Browse files Browse the repository at this point in the history
udev: always populate /dev/disk/by-parttypeuuid

Reviewed-by: Alexandre Derumier <aderumier@odiso.com>
  • Loading branch information
Loic Dachary committed Jul 3, 2016
2 parents fcf8d9c + 35004a6 commit b8a4ca7
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Expand Up @@ -15,6 +15,7 @@ EXTRA_DIST += \
etc/sysconfig/SuSEfirewall2.d/services/ceph-mon \
etc/sysconfig/SuSEfirewall2.d/services/ceph-osd-mds \
udev/50-rbd.rules \
udev/60-ceph-by-parttypeuuid.rules \
udev/95-ceph-osd.rules \
share/known_hosts_drop.ceph.com \
share/id_dsa_drop.ceph.com \
Expand Down
1 change: 1 addition & 0 deletions ceph.spec.in
Expand Up @@ -711,6 +711,7 @@ install -m 0644 -D etc/sysconfig/SuSEfirewall2.d/services/ceph-osd-mds %{buildro

# udev rules
install -m 0644 -D udev/50-rbd.rules %{buildroot}%{_udevrulesdir}/50-rbd.rules
install -m 0644 -D udev/60-ceph-by-parttypeuuid.rules %{buildroot}%{_udevrulesdir}/60-ceph-by-parttypeuuid.rules
install -m 0644 -D udev/95-ceph-osd.rules %{buildroot}%{_udevrulesdir}/95-ceph-osd.rules

#set up placeholder directories
Expand Down
1 change: 1 addition & 0 deletions debian/ceph-osd.install
@@ -1,4 +1,5 @@
lib/udev/rules.d/95-ceph-osd.rules
lib/udev/rules.d/60-ceph-by-parttypeuuid.rules
usr/sbin/ceph-disk
usr/sbin/ceph-disk-udev
usr/bin/ceph-clsinfo
Expand Down
1 change: 1 addition & 0 deletions debian/rules
Expand Up @@ -37,6 +37,7 @@ override_dh_auto_install:
dh_auto_install --buildsystem=cmake --destdir=$(DESTDIR)
install -D -m 644 udev/50-rbd.rules $(DESTDIR)/lib/udev/rules.d/50-rbd.rules
install -D -m 644 udev/95-ceph-osd.rules $(DESTDIR)/lib/udev/rules.d/95-ceph-osd.rules
install -D -m 644 udev/60-ceph-by-parttypeuuid.rules $(DESTDIR)/lib/udev/rules.d/60-ceph-by-parttypeuuid.rules
install -D -m 644 src/etc-rbdmap $(DESTDIR)/etc/ceph/rbdmap
install -D -m 755 src/init-rbdmap $(DESTDIR)/etc/init.d/rbdmap

Expand Down
31 changes: 31 additions & 0 deletions udev/60-ceph-by-parttypeuuid.rules
@@ -0,0 +1,31 @@
#
# Make sure /dev/disk/by-parttypeuuid is populated because
# ceph-disk activate-all relies on it.
#

# forward scsi device event to corresponding block device
ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change"

ACTION=="remove", GOTO="persistent_storage_end_two"

SUBSYSTEM!="block", GOTO="persistent_storage_end_two"

# skip rules for inappropriate block devices
KERNEL=="fd*|mtd*|nbd*|gnbd*|btibm*|md*", GOTO="persistent_storage_end_two"

# ignore partitions that span the entire disk
TEST=="whole_disk", GOTO="persistent_storage_end_two"

# for partitions import parent information
ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"

# skip unpartitioned removable media devices from drivers which do not send "change" events
ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end_two"

# probe filesystem metadata of disks
KERNEL!="sr*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode"

# NEW: by-parttypeuuid links (type.id)
ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_TYPE}=="?*", ENV{ID_PART_ENTRY_UUID}=="?*", SYMLINK+="disk/by-parttypeuuid/$env{ID_PART_ENTRY_TYPE}.$env{ID_PART_ENTRY_UUID}"

LABEL="persistent_storage_end_two"

0 comments on commit b8a4ca7

Please sign in to comment.