mirror of
https://github.com/ceph/ceph
synced 2025-01-04 02:02:36 +00:00
ceph-volume api.lvm udpate create_lv for bluestore
Require full size notation for LVM (e.g. 50G or 100M) and do not "translate" tags by pre-fixing them with 'ceph'. That is already how the rest of the API works, no need to make that translation in one place Signed-off-by: Alfredo Deza <adeza@redhat.com>
This commit is contained in:
parent
1e8a79b8f4
commit
ac0d1555d3
@ -210,25 +210,26 @@ def create_vg(name, *devices):
|
||||
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([
|
||||
@ -252,17 +253,15 @@ def create_lv(name, group, size=None, **tags):
|
||||
])
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user