return vg
-def create_lv(name, group, size=None, **tags):
+def create_lv(name, group, size=None, tags=None):
"""
Create a Logical Volume in a Volume Group. Command looks like::
lvcreate -L 50G -n gfslv vg0
``name``, ``group``, are required. If ``size`` is provided it must follow
- lvm's size notation (like 1G, or 20M). Tags are optional and are
- "translated" to include the prefixes for the Ceph LVM tag API.
+ lvm's size notation (like 1G, or 20M). Tags are an optional dictionary and is expected to
+ conform to the convention of prefixing them with "ceph." like::
+ {"ceph.block_device": "/dev/ceph/osd-1"}
"""
# XXX add CEPH_VOLUME_LVM_DEBUG to enable -vvvv on lv operations
type_path_tag = {
'journal': 'ceph.journal_device',
'data': 'ceph.data_device',
- 'block': 'ceph.block',
- 'wal': 'ceph.wal',
- 'db': 'ceph.db',
- 'lockbox': 'ceph.lockbox_device',
+ 'block': 'ceph.block_device',
+ 'wal': 'ceph.wal_device',
+ 'db': 'ceph.db_device',
+ 'lockbox': 'ceph.lockbox_device', # XXX might not ever need this lockbox sorcery
}
if size:
process.run([
])
lv = get_lv(lv_name=name, vg_name=group)
- ceph_tags = {}
- for k, v in tags.items():
- ceph_tags['ceph.%s' % k] = v
- lv.set_tags(ceph_tags)
+ lv.set_tags(tags)
# when creating a distinct type, the caller doesn't know what the path will
# be so this function will set it after creation using the mapping
- path_tag = type_path_tag[tags['type']]
- lv.set_tags(
- {path_tag: lv.lv_path}
- )
+ path_tag = type_path_tag.get(tags.get('ceph.type'))
+ if path_tag:
+ lv.set_tags(
+ {path_tag: lv.lv_path}
+ )
return lv