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: v12.2.8~10^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=21565ee05c36cb11a1abc8a0dc67ebab6fae2c10;p=ceph.git ceph-volume api.lvm create_vg should optionally name vgs on the fly Signed-off-by: Alfredo Deza (cherry picked from commit 01aece2b9ab034e8d4419f262a33764664ad93a2) --- diff --git a/src/ceph-volume/ceph_volume/api/lvm.py b/src/ceph-volume/ceph_volume/api/lvm.py index 8ac38e2009c4..cc2c1132d0eb 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)