mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Merge pull request #3075 from torhve/lvm
Add two more functions to lvm, lvcreate and lvremove.
This commit is contained in:
commit
ce1eaa067d
@ -139,3 +139,30 @@ def lvdisplay(lvname=''):
|
||||
'Minor Device Number': comps[12],
|
||||
}
|
||||
return ret
|
||||
|
||||
def lvcreate(lvname, vgname, size, pv=''):
|
||||
'''
|
||||
Create a new logical volume, with option for which physical volume to be used
|
||||
CLI Examples::
|
||||
|
||||
salt '*' lvm.lvcreate new_volume_name vg_name 10G
|
||||
salt '*' lvm.lvcreate new_volume_name vg_name 10G /dev/sdb
|
||||
'''
|
||||
ret = {}
|
||||
cmd = 'lvcreate -n {0} {1} -L {2} {3}'.format(lvname, vgname, size, pv)
|
||||
out = __salt__['cmd.run'](cmd)
|
||||
return out
|
||||
|
||||
def lvremove(lvname, vgname, force=False):
|
||||
'''
|
||||
Remove a given existing logical volume from a named existing volume group
|
||||
CLI Examples::
|
||||
|
||||
salt '*' lvm.lvremove lvname vgname force=True
|
||||
'''
|
||||
forcearg = ''
|
||||
if force:
|
||||
forcearg = '-f'
|
||||
cmd = 'lvremove {0} {1}/{2}'.format(forcearg, vgname, lvname)
|
||||
out = __salt__['cmd.run'](cmd)
|
||||
return out
|
||||
|
Loading…
Reference in New Issue
Block a user