Skip to content

Commit

Permalink
udev: install disk/by-partuuid rules
Browse files Browse the repository at this point in the history
Wheezy's udev (175-7.2) has broken rules for the /dev/disk/by-partuuid/
symlinks that ceph-disk relies on.  Install parallel rules that work.  On
new udev, this is harmless; old older udev, this will make life better.

Fixes: ceph#4865
Backport: cuttlefish
Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
Sage Weil committed May 17, 2013
1 parent 9b9d322 commit d8d7113
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ EXTRA_DIST += \
src/test/cli \
src/test/downloads \
udev/50-rbd.rules \
udev/60-ceph-partuuid-workaround.rules \
udev/95-ceph-osd.rules \
udev/95-ceph-osd-alt.rules

Expand Down
1 change: 1 addition & 0 deletions debian/ceph.install
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
etc/bash_completion.d/ceph
lib/udev/rules.d/95-ceph-osd.rules
lib/udev/rules.d/60-ceph-partuuid-workaround.rules
usr/sbin/ceph-create-keys
usr/sbin/ceph-disk
usr/sbin/ceph-disk-activate
Expand Down
1 change: 1 addition & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ install: build
$(MAKE) DESTDIR=$(DESTDIR) install
sed -i "/dependency_libs/ s/'.*'/''/" `find . -name '*.la'`
install -D -m 644 udev/50-rbd.rules $(DESTDIR)/lib/udev/rules.d/50-rbd.rules
install -D -m 644 udev/60-ceph-partuuid-workaround.rules $(DESTDIR)/lib/udev/rules.d/60-ceph-partuuid-workaround.rules
install -D -m 644 udev/95-ceph-osd.rules $(DESTDIR)/lib/udev/rules.d/95-ceph-osd.rules

# Add here commands to install the package into debian/testpack.
Expand Down
34 changes: 34 additions & 0 deletions udev/60-ceph-partuuid-workaround.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#
# this is a kludge installed by ceph to fix the /dev/disk/by-partuuid
# symlinks on systems with old udev (< 180). it's a stripped down
# version of a newer 60-persistent-storage.rules file that hopefully
# captures the same set of conditions for setting up those symlinks.
#

# 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*|dm-*|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"

# by-partlabel/by-partuuid links (partition metadata)
ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_UUID}=="?*", SYMLINK+="disk/by-partuuid/$env{ID_PART_ENTRY_UUID}"
ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK+="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}"

LABEL="persistent_storage_end_two"

0 comments on commit d8d7113

Please sign in to comment.