From: Mohamad Gebai Date: Sun, 31 Mar 2019 17:05:35 +0000 (-0400) Subject: ceph-volume: add option to specify a pv for lvcreate X-Git-Tag: v14.2.2~209^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=04d2ce2f656fbe81a2d6f013843c6f9bafdfcc1f;p=ceph.git ceph-volume: add option to specify a pv for lvcreate Signed-off-by: Mohamad Gebai (cherry picked from commit 38b2d7a66c76d9c5b1d2e00ada9503f22a7d8fb6) --- diff --git a/src/ceph-volume/ceph_volume/api/lvm.py b/src/ceph-volume/ceph_volume/api/lvm.py index e96725b7193a..1e4567d3a631 100644 --- a/src/ceph-volume/ceph_volume/api/lvm.py +++ b/src/ceph-volume/ceph_volume/api/lvm.py @@ -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)