]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: add option to specify a pv for lvcreate
authorMohamad Gebai <mgebai@suse.com>
Sun, 31 Mar 2019 17:05:35 +0000 (13:05 -0400)
committerMohamad Gebai <mgebai@suse.com>
Thu, 25 Apr 2019 17:03:24 +0000 (13:03 -0400)
Signed-off-by: Mohamad Gebai <mgebai@suse.com>
(cherry picked from commit 38b2d7a66c76d9c5b1d2e00ada9503f22a7d8fb6)

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

index e96725b7193a7026d85914f44bbba317aa6ea5ec..1e4567d3a631e6fea4aaadb3d8174b5ad304ee7d 100644 (file)
@@ -562,7 +562,7 @@ def remove_lv(lv):
     return True
 
 
-def create_lv(name, group, extents=None, size=None, tags=None, uuid_name=False):
+def create_lv(name, group, extents=None, size=None, tags=None, uuid_name=False, pv=None):
     """
     Create a Logical Volume in a Volume Group. Command looks like::
 
@@ -596,31 +596,34 @@ def create_lv(name, group, extents=None, size=None, tags=None, uuid_name=False):
         'lockbox': 'ceph.lockbox_device',  # XXX might not ever need this lockbox sorcery
     }
     if size:
-        process.run([
+        command = [
             'lvcreate',
             '--yes',
             '-L',
             '%s' % size,
             '-n', name, group
-        ])
+        ]
     elif extents:
-        process.run([
+        command = [
             'lvcreate',
             '--yes',
             '-l',
             '%s' % extents,
             '-n', name, group
-        ])
+        ]
     # create the lv with all the space available, this is needed because the
     # system call is different for LVM
     else:
-        process.run([
+        command = [
             'lvcreate',
             '--yes',
             '-l',
             '100%FREE',
             '-n', name, group
-        ])
+        ]
+    if pv:
+        command.append(pv)
+    process.run(command)
 
     lv = get_lv(lv_name=name, vg_name=group)
     lv.set_tags(tags)