3 # Wrapper for the ceph udev rules. Since older versions of udev+blkid
4 # do not support gpt label fields, this shell script is invoked from
5 # the udev rule to read the needed gpt label fields and call the
6 # appropriate ceph OSD functions.
12 # Get GPT partition type guid
13 ID_PART_ENTRY_TYPE
=$
(/usr
/sbin
/sgdisk
--info=${PARTNO} /dev/${PARENT_NAME} | grep "Partition GUID code" | awk '{print $4}' | tr '[:upper
:]' '[:lower
:]')
15 if [ -z "$ID_PART_ENTRY_TYPE" ]; then
19 ID_PART_ENTRY_UUID=$(/usr/sbin/sgdisk --info=${PARTNO} /dev/${PARENT_NAME} | grep "Partition unique GUID" | awk '{print $4}' |
tr '[:upper:]' '[:lower:]')
22 mkdir
-p /dev
/disk
/by-partuuid
23 ln -sf ..
/..
/${NAME} /dev
/disk
/by-partuuid
/$ID_PART_ENTRY_UUID
24 mkdir
-p /dev
/disk
/by-parttypeuuid
25 ln -sf ..
/..
/${NAME} /dev/disk/by-parttypeuuid/${ID_PART_ENTRY_TYPE}.${ID_PART_ENTRY_UUID}
27 case $ID_PART_ENTRY_TYPE in
29 45b0969e-9b03-4f30-b4c6-b4b80ceff106
)
31 # activate ceph-tagged journal partitions.
32 /usr
/sbin
/ceph-disk
-v activate-journal
/dev
/${NAME}
35 45b0969e-9b03-4f30-b4c6-5ec00ceff106
)
36 # DMCRYPT_JOURNAL_UUID
37 # Map journal if using dm-crypt
38 /sbin
/cryptsetup
--key-file /etc
/ceph
/dmcrypt-keys
/${ID_PART_ENTRY_UUID} --key-size 256 create ${ID_PART_ENTRY_UUID} /dev/${NAME}
41 45b0969e-9b03-4f30-b4c6-35865ceff106
)
42 # DMCRYPT_LUKS_JOURNAL_UUID
43 # Map journal if using dm-crypt
44 /sbin
/cryptsetup
--key-file /etc
/ceph
/dmcrypt-keys
/${ID_PART_ENTRY_UUID} luksOpen /dev/${NAME} ${ID_PART_ENTRY_UUID}
47 4fbd7e29-9d25-41b8-afd0-062c0ceff05d
)
49 # activate ceph-tagged partitions.
50 /usr
/sbin
/ceph-disk
-v activate
/dev
/${NAME}
53 4fbd7e29-9d25-41b8-afd0-5ec00ceff05d
)
55 # Map data device and activate ceph-tagged partitions
56 # for dm-crypted data devices
57 /sbin
/cryptsetup
--key-file /etc
/ceph
/dmcrypt-keys
/${ID_PART_ENTRY_UUID} --key-size 256 create ${ID_PART_ENTRY_UUID} /dev/${NAME}
58 bash
-c 'while [ ! -e /dev/mapper/${ID_PART_ENTRY_UUID} ];do sleep 1; done'
59 /usr
/sbin
/ceph-disk activate
/dev
/mapper
/${ID_PART_ENTRY_UUID}
62 4fbd7e29-9d25-41b8-afd0-35865ceff05d
)
63 # DMCRYPT_LUKS_OSD_UUID
64 # Map data device and activate ceph-tagged partitions
65 # for dm-crypted data devices
66 /sbin
/cryptsetup
--key-file /etc
/ceph
/dmcrypt-keys
/${ID_PART_ENTRY_UUID} luksOpen /dev/${NAME} ${ID_PART_ENTRY_UUID}
67 bash
-c 'while [ ! -e /dev/mapper/${ID_PART_ENTRY_UUID} ];do sleep 1; done'
68 /usr
/sbin
/ceph-disk activate
/dev
/mapper
/${ID_PART_ENTRY_UUID}
71 89c57f98-2fe5-4dc0-89c1-f3ad0ceff2be
)
75 89c57f98-2fe5-4dc0-89c1-5ec00ceff2be
)