Skip to content

Commit

Permalink
ceph-volume api.lvm create_vg should optionally name vgs on the fly
Browse files Browse the repository at this point in the history
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 01aece2)
  • Loading branch information
Alfredo Deza authored and andrewschoen committed Aug 28, 2018
1 parent 6ed901e commit 371ac00
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ceph-volume/ceph_volume/api/lvm.py
Expand Up @@ -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)
Expand Down

0 comments on commit 371ac00

Please sign in to comment.