diff options
author | Sage Weil <sage@inktank.com> | 2013-06-17 09:49:46 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-06-17 15:47:33 -0700 |
commit | e36fb3267cdbe0ec5bb01f8a012485de1bbf1652 (patch) | |
tree | 41918314206f9d14eadfcc4083eb3c5dcc578cc7 | |
parent | c3936ebb159b419115bfdc5dc7a23f5807cff9fa (diff) | |
download | ceph-e36fb3267cdbe0ec5bb01f8a012485de1bbf1652.tar.gz |
ceph-disk-udev: set up by-partuuid, -typeuuid symlinks on ancient udev
Make the ancient-udev/blkid workaround script for RHEL/CentOS create the
symlinks for us too.
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit d7f7d613512fe39ec883e11d201793c75ee05db1)
-rwxr-xr-x | src/ceph-disk-udev | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/ceph-disk-udev b/src/ceph-disk-udev index 885f638a1e0..bdf524e6aea 100755 --- a/src/ceph-disk-udev +++ b/src/ceph-disk-udev @@ -1,8 +1,9 @@ #! /bin/sh -# Wrapper for the ceph udev rules. Since older versions of udev do not support gpt label fields, this shell -# script is invoked from the udev rule to read the needed gpt label fields and call the appropriate ceph -# OSD functions. +# Wrapper for the ceph udev rules. Since older versions of udev+blkid +# do not support gpt label fields, this shell script is invoked from +# the udev rule to read the needed gpt label fields and call the +# appropriate ceph OSD functions. PARTNO=$1 NAME=$2 @@ -10,6 +11,19 @@ PARENT_NAME=$3 # Get GPT partition type guid ID_PART_ENTRY_TYPE=$(/usr/sbin/sgdisk --info=${PARTNO} /dev/${PARENT_NAME} | grep "Partition GUID code" | awk '{print $4}' | tr '[:upper:]' '[:lower:]') + +if [ -z "$ID_PART_ENTRY_TYPE" ]; then + exit +fi + +ID_PART_ENTRY_UUID=$(/usr/sbin/sgdisk --info=${PARTNO} /dev/${PARENT_NAME} | grep "Partition unique GUID" | awk '{print $4}' | tr '[:upper:]' '[:lower:]') + +# set up the symlinks +mkdir -p /dev/disk/by-partuuid +ln -sf ../../${NAME} /dev/disk/by-partuuid/$ID_PART_ENTRY_UUID +mkdir -p /dev/disk/by-parttypeuuid +ln -sf ../../${NAME} /dev/disk/by-parttypeuuid/${ID_PART_ENTRY_TYPE}.${ID_PART_ENTRY_UUID} + case $ID_PART_ENTRY_TYPE in 45b0969e-9b03-4f30-b4c6-b4b80ceff106) @@ -21,7 +35,6 @@ case $ID_PART_ENTRY_TYPE in 45b0969e-9b03-4f30-b4c6-5ec00ceff106) # DMCRYPT_JOURNAL_UUID # Map journal if using dm-crypt - ID_PART_ENTRY_UUID=$(/usr/sbin/sgdisk --info=${PARTNO} /dev/${PARENT_NAME} | grep "Partition unique GUID" | awk '{print $4}' | tr '[:upper:]' '[:lower:]') /sbin/cryptsetup --key-file /etc/ceph/dmcrypt-keys/${ID_PART_ENTRY_UUID} --key-size 256 create ${ID_PART_ENTRY_UUID} /dev/${NAME} ;; @@ -35,7 +48,6 @@ case $ID_PART_ENTRY_TYPE in # DMCRYPT_OSD_UUID # Map data device and activate ceph-tagged partitions # for dm-crypted data devices - ID_PART_ENTRY_UUID=$(/usr/sbin/sgdisk --info=${PARTNO} /dev/${PARENT_NAME} | grep "Partition unique GUID" | awk '{print $4}' | tr '[:upper:]' '[:lower:]') /sbin/cryptsetup --key-file /etc/ceph/dmcrypt-keys/${ID_PART_ENTRY_UUID} --key-size 256 create ${ID_PART_ENTRY_UUID} /dev/${NAME} bash -c 'while [ ! -e /dev/mapper/${ID_PART_ENTRY_UUID} ];do sleep 1; done' /usr/sbin/ceph-disk-activate /dev/mapper/${ID_PART_ENTRY_UUID} |