Skip to content

Commit

Permalink
rbd: include RADOS namespace in krbd symlinks
Browse files Browse the repository at this point in the history
Fixes: https://tracker.ceph.com/issues/40247
Signed-off-by: Ilya Dryomov <[email protected]>
  • Loading branch information
idryomov committed Sep 8, 2020
1 parent 42766b3 commit 0b5c11f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
17 changes: 13 additions & 4 deletions src/ceph-rbdnamer
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@
DEV=$1
NUM=`echo $DEV | sed 's#p.*##g; s#[a-z]##g'`
POOL=`cat /sys/devices/rbd/$NUM/pool`
if [ -f /sys/devices/rbd/$NUM/pool_ns ]; then
NAMESPACE=`cat /sys/devices/rbd/$NUM/pool_ns`
else
NAMESPACE=""
fi
IMAGE=`cat /sys/devices/rbd/$NUM/name`
SNAP=`cat /sys/devices/rbd/$NUM/current_snap`
if [ "$SNAP" = "-" ]; then
echo -n "$POOL $IMAGE"
else
echo -n "$POOL $IMAGE@$SNAP"

echo -n "$POOL"
if [ -n "$NAMESPACE" ]; then
echo -n "/$NAMESPACE"
fi
echo -n "/$IMAGE"
if [ "$SNAP" != "-" ]; then
echo -n "@$SNAP"
fi
4 changes: 2 additions & 2 deletions udev/50-rbd.rules
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
KERNEL=="rbd[0-9]*", ENV{DEVTYPE}=="disk", PROGRAM="/usr/bin/ceph-rbdnamer %k", SYMLINK+="rbd/%c{1}/%c{2}"
KERNEL=="rbd[0-9]*", ENV{DEVTYPE}=="partition", PROGRAM="/usr/bin/ceph-rbdnamer %k", SYMLINK+="rbd/%c{1}/%c{2}-part%n"
KERNEL=="rbd[0-9]*", ENV{DEVTYPE}=="disk", PROGRAM="/usr/bin/ceph-rbdnamer %k", SYMLINK+="rbd/%c"
KERNEL=="rbd[0-9]*", ENV{DEVTYPE}=="partition", PROGRAM="/usr/bin/ceph-rbdnamer %k", SYMLINK+="rbd/%c-part%n"

# This is a placeholder, uncomment and edit as necessary
#KERNEL=="rbd[0-9]*", ENV{DEVTYPE}=="disk", ACTION=="add|change", ATTR{bdi/read_ahead_kb}="128"

0 comments on commit 0b5c11f

Please sign in to comment.