From: Alfredo Deza Date: Wed, 11 Oct 2017 18:30:41 +0000 (-0400) Subject: ceph-volume api.lvm allow to create a vg X-Git-Tag: v12.2.2~83^2~54 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=005359b92a910b72712edbcaa7b2e27a54d3a093;p=ceph.git ceph-volume api.lvm allow to create a vg Signed-off-by: Alfredo Deza (cherry picked from commit 16d7feb2b5d5eb5fa0bf23a95b60623ae2e1676f) --- diff --git a/src/ceph-volume/ceph_volume/api/lvm.py b/src/ceph-volume/ceph_volume/api/lvm.py index 3a2187ae521f..96809c9a2b02 100644 --- a/src/ceph-volume/ceph_volume/api/lvm.py +++ b/src/ceph-volume/ceph_volume/api/lvm.py @@ -190,14 +190,35 @@ def create_pv(device): ]) +def create_vg(name, *devices): + """ + Create a Volume Group. Command looks like:: + + vgcreate --force --yes group_name device + + Once created the volume group is returned as a ``VolumeGroup`` object + """ + process.run([ + 'sudo', + 'vgcreate', + '--force', + '--yes', + name] + list(devices) + ) + + vg = get_vg(vg_name=name) + return vg + + def create_lv(name, group, size=None, **tags): """ Create a Logical Volume in a Volume Group. Command looks like:: lvcreate -L 50G -n gfslv vg0 - ``name``, ``group``, and ``size`` are required. Tags are optional and are "translated" to include - the prefixes for the Ceph LVM tag API. + ``name``, ``group``, are required. If ``size`` is provided it must follow + lvm's size notation (like 1G, or 20M). Tags are optional and are + "translated" to include the prefixes for the Ceph LVM tag API. """ # XXX add CEPH_VOLUME_LVM_DEBUG to enable -vvvv on lv operations @@ -215,7 +236,7 @@ def create_lv(name, group, size=None, **tags): 'lvcreate', '--yes', '-L', - '%sG' % size, + '%s' % size, '-n', name, group ]) # create the lv with all the space available, this is needed because the