Skip to content

Commit

Permalink
ceph-disk: bluestore trigger
Browse files Browse the repository at this point in the history
Copy paste the journal code and s/journal/block/

More work will be needed to support multiple auxiliary
devices (block.wal etc). But the goal is to minimize the change because
this commit is part of a series of commits focusing on refactoring
prepare, not the entire ceph-disk codebase.

Signed-off-by: Loic Dachary <[email protected]>
  • Loading branch information
ldachary committed Feb 4, 2016
1 parent 170dca3 commit fbc0984
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 0 deletions.
75 changes: 75 additions & 0 deletions src/ceph-disk/ceph_disk/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3921,6 +3921,81 @@ def main_trigger(args):
]
)

elif parttype in (PTYPE['regular']['block']['ready'],
PTYPE['mpath']['block']['ready']):
command(
[
'ceph-disk',
'activate-block',
args.dev,
]
)

# blocks are easy: map, chown, activate-block
elif parttype == PTYPE['plain']['block']['ready']:
command(
[
'/sbin/cryptsetup',
'--key-file',
'/etc/ceph/dmcrypt-keys/{partid}'.format(partid=partid),
'--key-size',
'256',
'create',
partid,
args.dev,
]
)
newdev = '/dev/mapper/' + partid
count = 0
while not os.path.exists(newdev) and count <= 10:
time.sleep(1)
count += 1
command(
[
'/bin/chown',
'ceph:ceph',
newdev,
]
)
command(
[
'/usr/sbin/ceph-disk',
'activate-block',
newdev,
]
)
elif parttype == PTYPE['luks']['block']['ready']:
command(
[
'/sbin/cryptsetup',
'--key-file',
'/etc/ceph/dmcrypt-keys/{partid}.luks.key'.format(
partid=partid),
'luksOpen',
args.dev,
partid,
]
)
newdev = '/dev/mapper/' + partid
count = 0
while not os.path.exists(newdev) and count <= 10:
time.sleep(1)
count += 1
command(
[
'/bin/chown',
'ceph:ceph',
newdev,
]
)
command(
[
'/usr/sbin/ceph-disk',
'activate-block',
newdev,
]
)

# osd data: map, activate
elif parttype == PTYPE['plain']['osd']['ready']:
command(
Expand Down
39 changes: 39 additions & 0 deletions udev/95-ceph-osd.rules
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ ACTION=="change", SUBSYSTEM=="block", \
ENV{ID_PART_ENTRY_TYPE}=="45b0969e-9b03-4f30-b4c6-b4b80ceff106", \
OWNER="ceph", GROUP="ceph", MODE="660"

# BLOCK_UUID
ACTION=="add", SUBSYSTEM=="block", \
ENV{DEVTYPE}=="partition", \
ENV{ID_PART_ENTRY_TYPE}=="cafecafe-9b03-4f30-b4c6-b4b80ceff106", \
OWNER:="ceph", GROUP:="ceph", MODE:="660", \
RUN+="/usr/sbin/ceph-disk --log-stdout -v trigger /dev/$name"
ACTION=="change", SUBSYSTEM=="block", \
ENV{ID_PART_ENTRY_TYPE}=="cafecafe-9b03-4f30-b4c6-b4b80ceff106", \
OWNER="ceph", GROUP="ceph", MODE="660"

# MPATH_OSD_UUID
ACTION=="add", SUBSYSTEM=="block", \
ENV{ID_PART_ENTRY_TYPE}=="4fbd7e29-8ae0-4982-bf9d-5a8d867af560", \
Expand All @@ -36,6 +46,15 @@ ACTION=="change", SUBSYSTEM=="block", \
ENV{ID_PART_ENTRY_TYPE}=="45b0969e-8ae0-4982-bf9d-5a8d867af560", \
OWNER="ceph", GROUP="ceph", MODE="660"

# MPATH_BLOCK_UUID
ACTION=="add", SUBSYSTEM=="block", \
ENV{ID_PART_ENTRY_TYPE}=="cafecafe-8ae0-4982-bf9d-5a8d867af560", \
OWNER:="ceph", GROUP:="ceph", MODE:="660", \
RUN+="/usr/sbin/ceph-disk --log-stdout -v trigger /dev/$name"
ACTION=="change", SUBSYSTEM=="block", \
ENV{ID_PART_ENTRY_TYPE}=="cafecafe-8ae0-4982-bf9d-5a8d867af560", \
OWNER="ceph", GROUP="ceph", MODE="660"

# DMCRYPT_JOURNAL_UUID
ACTION=="add" SUBSYSTEM=="block", \
ENV{DEVTYPE}=="partition", \
Expand All @@ -46,6 +65,16 @@ ACTION=="change", SUBSYSTEM=="block", \
ENV{ID_PART_ENTRY_TYPE}=="45b0969e-9b03-4f30-b4c6-5ec00ceff106", \
OWNER="ceph", GROUP="ceph", MODE="660"

# DMCRYPT_BLOCK_UUID
ACTION=="add" SUBSYSTEM=="block", \
ENV{DEVTYPE}=="partition", \
ENV{ID_PART_ENTRY_TYPE}=="cafecafe-9b03-4f30-b4c6-5ec00ceff106", \
OWNER:="ceph", GROUP:="ceph", MODE:="660", \
RUN+="/usr/sbin/ceph-disk --log-stdout -v trigger /dev/$name"
ACTION=="change", SUBSYSTEM=="block", \
ENV{ID_PART_ENTRY_TYPE}=="cafecafe-9b03-4f30-b4c6-5ec00ceff106", \
OWNER="ceph", GROUP="ceph", MODE="660"

# DMCRYPT_LUKS_JOURNAL_UUID
ACTION=="add" SUBSYSTEM=="block", \
ENV{DEVTYPE}=="partition", \
Expand All @@ -56,6 +85,16 @@ ACTION=="change", SUBSYSTEM=="block", \
ENV{ID_PART_ENTRY_TYPE}=="45b0969e-9b03-4f30-b4c6-35865ceff106", \
OWNER="ceph", GROUP="ceph", MODE="660"

# DMCRYPT_LUKS_BLOCK_UUID
ACTION=="add" SUBSYSTEM=="block", \
ENV{DEVTYPE}=="partition", \
ENV{ID_PART_ENTRY_TYPE}=="cafecafe-9b03-4f30-b4c6-35865ceff106", \
OWNER:="ceph", GROUP:="ceph", MODE:="660", \
RUN+="/usr/sbin/ceph-disk --log-stdout -v trigger /dev/$name"
ACTION=="change", SUBSYSTEM=="block", \
ENV{ID_PART_ENTRY_TYPE}=="cafecafe-9b03-4f30-b4c6-35865ceff106", \
OWNER="ceph", GROUP="ceph", MODE="660"

# DMCRYPT_OID_UUID
ACTION=="add" SUBSYSTEM=="block", \
ENV{DEVTYPE}=="partition", \
Expand Down

0 comments on commit fbc0984

Please sign in to comment.