From: Alfredo Deza Date: Thu, 5 Jul 2018 15:39:53 +0000 (-0400) Subject: ceph-volume api.lvm create_vg should optionally name vgs on the fly X-Git-Tag: v14.0.1~847^2~13 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=01aece2b9ab034e8d4419f262a33764664ad93a2;p=ceph-ci.git ceph-volume api.lvm create_vg should optionally name vgs on the fly Signed-off-by: Alfredo Deza --- diff --git a/src/ceph-volume/ceph_volume/api/lvm.py b/src/ceph-volume/ceph_volume/api/lvm.py index 29962cac9e2..f6b0de0ffde 100644 --- a/src/ceph-volume/ceph_volume/api/lvm.py +++ b/src/ceph-volume/ceph_volume/api/lvm.py @@ -401,19 +401,27 @@ def create_pv(device): ]) -def create_vg(name, *devices): +def create_vg(devices, name=None): """ Create a Volume Group. Command looks like:: vgcreate --force --yes group_name device Once created the volume group is returned as a ``VolumeGroup`` object + + :param devices: A list of devices to create a VG. Optionally, a single + device (as a string) can be used. + :param name: Optionally set the name of the VG, defaults to 'ceph-{uuid}' """ + if not isinstance(devices, list): + devices = [devices] + if name is None: + name = "ceph-%s" % str(uuid.uuid4()) process.run([ 'vgcreate', '--force', '--yes', - name] + list(devices) + name] + devices ) vg = get_vg(vg_name=name)