raise RuntimeError('unable to use device')
return uuid
- def setup_device(self, device_type, device_name, tags, size):
+ def setup_device(self, device_type, device_name, tags, size, slots):
"""
Check if ``device`` is an lv, if so, set the tags, making sure to
update the tags with the lv_uuid and lv_path which the incoming tags
kwargs = {
'device': device_name,
'tags': tags,
- 'slots': getattr(self.args,
- 'block_{}_slots'.format(device_type),
- 1),
+ 'slots': slots
}
#TODO use get_block_db_size and co here to get configured size in
#conf file
#TODO: allow auto creation of journal on passed device, only works
# when physical device is passed, not LV
if not self.args.journal:
- raise RuntimeError('--journal is required when using --filestore')
+ logger.info(('no journal was specifed, creating journal lv '
+ 'on {}').format(self.args.data))
+ self.args.journal = self.args.data
+ self.args.journal_size = disk.Size(g=5)
+ # need to adjust data size/slots for colocated journal
+ if self.args.data_size:
+ self.args.data_size -= self.args.journal_size
+ if self.args.data_slots == 1:
+ self.args.data_slots = 0
+ else:
+ raise RuntimeError(('Can\'t handle multiple filestore OSDs '
+ 'with colocated journals yet. Please '
+ 'create journal LVs manually'))
+ tags['ceph.cephx_lockbox_secret'] = cephx_lockbox_secret
+ tags['ceph.encrypted'] = encrypted
+
+ journal_device, journal_uuid, tags = self.setup_device(
+ 'journal',
+ self.args.journal,
+ tags,
+ self.args.journal_size,
+ self.args.journal_slots)
try:
vg_name, lv_name = self.args.data.split('/')
tags['ceph.data_device'] = data_lv.lv_path
tags['ceph.data_uuid'] = data_lv.lv_uuid
- tags['ceph.cephx_lockbox_secret'] = cephx_lockbox_secret
- tags['ceph.encrypted'] = encrypted
tags['ceph.vdo'] = api.is_vdo(data_lv.lv_path)
-
- journal_device, journal_uuid, tags = self.setup_device(
- 'journal', self.args.journal, tags, self.args.journal_size)
-
tags['ceph.type'] = 'data'
data_lv.set_tags(tags)
+ if not journal_device.startswith('/'):
+ # we got a journal lv, set rest of the tags
+ api.get_first_lv(filters={'lv_name': lv_name,
+ 'vg_name': vg_name}).set_tags(tags)
prepare_filestore(
data_lv.lv_path,
tags['ceph.vdo'] = api.is_vdo(block_lv.lv_path)
wal_device, wal_uuid, tags = self.setup_device(
- 'wal', self.args.block_wal, tags, self.args.block_wal_size)
+ 'wal',
+ self.args.block_wal,
+ tags,
+ self.args.block_wal_size,
+ self.args.block_wal_slots)
db_device, db_uuid, tags = self.setup_device(
- 'db', self.args.block_db, tags, self.args.block_db_size)
+ 'db',
+ self.args.block_db,
+ tags,
+ self.args.block_db_size,
+ self.args.block_db_slots)
tags['ceph.type'] = 'block'
block_lv.set_tags(tags)