]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume api.lvm default to null tags on lvs created
authorAlfredo Deza <adeza@redhat.com>
Wed, 23 May 2018 13:23:40 +0000 (09:23 -0400)
committerAlfredo Deza <adeza@redhat.com>
Thu, 2 Aug 2018 14:36:28 +0000 (10:36 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 490e73eff1b5b7cc98db5d3df292759e1773c0ab)

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

index cb3b16030ce8bfc30dcfb1557a4976c91988891e..a277a4ee59e89ef837f059a85b351c808e1a6e44 100644 (file)
@@ -487,16 +487,41 @@ def create_lvs(group, parts=None, size=None, name_prefix='ceph-lv'):
     Create multiple Logical Volumes from a Volume Group by calculating the
     proper extents from ``parts`` or ``size``. A custom prefix can be used
     (defaults to ``ceph-lv``), these names are always suffixed with a uuid.
+
+    LV creation in ceph-volume will require tags, this is expected to be
+    pre-computed by callers who know Ceph metadata like OSD IDs and FSIDs. It
+    will probably not be the case when mass-creating LVs, so common/default tags will be
+    set to ``"null"``.
+
+        ceph.empty dict is
+
+    LVs that are not in use can be detected by querying LVM for tags that are
+    set to ``"null"``
+
+    :param group: The volume group (vg) to use for LV creation
+    :type group: ``VolumeGroup()`` object
+    :param parts: Number of LVs to create *instead of* ``size``.
+    :type parts: int
+    :param size: Size (in gigabytes) of LVs to create, e.g. "as many 10gb LVs as possible"
+    :type size: int
+
+    .. warning:: Only one of ``parts`` or ``size`` is allowed.
     """
     if parts is None and size is None:
         raise RuntimeError("Unable to create lvs without 'parts' or 'size' being defined")
     lvs = []
+    tags = {
+        "ceph.osd_id": "null",
+        "ceph.type": "null",
+        "ceph.cluster_fsid": "null",
+        "ceph.osd_fsid": "null",
+    }
     sizing = group.sizing(parts=parts, size=size)
     for part in range(0, sizing['parts']):
         size = sizing['sizes']
         lv_name = '%s-%s' % (name_prefix, uuid.uuid4())
         lvs.append(
-            create_lv(lv_name, group.name, size="%sg" % size, tags={})
+            create_lv(lv_name, group.name, size="%sg" % size, tags=tags)
         )
     return lvs