]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume api.lvm udpate create_lv for bluestore
authorAlfredo Deza <adeza@redhat.com>
Thu, 12 Oct 2017 20:05:22 +0000 (16:05 -0400)
committerAlfredo Deza <adeza@redhat.com>
Fri, 27 Oct 2017 14:44:14 +0000 (10:44 -0400)
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>
(cherry picked from commit ac0d1555d3d9caeef9d4fc3e46bc11b7e437413b)

src/ceph-volume/ceph_volume/api/lvm.py

index 96809c9a2b02600f33d4c890d372e78dd3ce0cfb..2fb5138cfcedd8a1bfa88b931e66fbd95cd0cc71 100644 (file)
@@ -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