From 38b2d7a66c76d9c5b1d2e00ada9503f22a7d8fb6 Mon Sep 17 00:00:00 2001 From: Mohamad Gebai Date: Sun, 31 Mar 2019 13:05:35 -0400 Subject: [PATCH] ceph-volume: add option to specify a pv for lvcreate Signed-off-by: Mohamad Gebai --- src/ceph-volume/ceph_volume/api/lvm.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/ceph-volume/ceph_volume/api/lvm.py b/src/ceph-volume/ceph_volume/api/lvm.py index e96725b7193..1e4567d3a63 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) -- 2.39.5