"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "salt/states/lvm.py" between
salt-3002.1.tar.gz and salt-3002.2.tar.gz

About: SaltStack is a systems management software for data center automation, cloud orchestration, server provisioning, configuration management and more. Community version.

lvm.py  (salt-3002.1):lvm.py  (salt-3002.2)
skipping to change at line 24 skipping to change at line 24
- devices: /dev/sda - devices: /dev/sda
lvroot: lvroot:
lvm.lv_present: lvm.lv_present:
- vgname: my_vg - vgname: my_vg
- size: 10G - size: 10G
- stripes: 5 - stripes: 5
- stripesize: 8K - stripesize: 8K
""" """
# Import python libs
import os import os
# Import salt libs
import salt.utils.path import salt.utils.path
def __virtual__(): def __virtual__():
""" """
Only load the module if lvm is installed Only load the module if lvm is installed
""" """
if salt.utils.path.which("lvm"): if salt.utils.path.which("lvm"):
return "lvm" return "lvm"
return (False, "lvm command not found") return (False, "lvm command not found")
skipping to change at line 224 skipping to change at line 222
extents=None, extents=None,
snapshot=None, snapshot=None,
pv="", pv="",
thinvolume=False, thinvolume=False,
thinpool=False, thinpool=False,
force=False, force=False,
resizefs=False, resizefs=False,
**kwargs **kwargs
): ):
""" """
Create a new Logical Volume Ensure that a Logical Volume is present, creating it if absent.
name name
The name of the Logical Volume The name of the Logical Volume
vgname vgname
The name of the Volume Group on which the Logical Volume resides The name of the Volume Group on which the Logical Volume resides
size size
The size of the Logical Volume The size of the Logical Volume
extents extents
The number of logical extents to allocate The number of logical extents allocated to the Logical Volume
It can be a percentage allowed by lvcreate's syntax, in this case
it will set the Logical Volume initial size and won't be resized.
snapshot snapshot
The name of the snapshot The name of the snapshot
pv pv
The Physical Volume to use The Physical Volume to use
kwargs kwargs
Any supported options to lvcreate. See Any supported options to lvcreate. See
:mod:`linux_lvm <salt.modules.linux_lvm>` for more details. :mod:`linux_lvm <salt.modules.linux_lvm>` for more details.
skipping to change at line 261 skipping to change at line 261
Logical Volume is thinly provisioned Logical Volume is thinly provisioned
thinpool thinpool
Logical Volume is a thin pool Logical Volume is a thin pool
.. versionadded:: 2018.3.0 .. versionadded:: 2018.3.0
force force
Assume yes to all prompts Assume yes to all prompts
.. versionadded:: to_complete .. versionadded:: 3002.0
resizefs resizefs
Use fsadm to resize the logical volume filesystem if needed Use fsadm to resize the logical volume filesystem if needed
""" """
ret = {"changes": {}, "comment": "", "name": name, "result": True} ret = {"changes": {}, "comment": "", "name": name, "result": True}
if extents and size: if extents and size:
ret["comment"] = "Only one of extents or size can be specified." ret["comment"] = "Only one of extents or size can be specified."
ret["result"] = False ret["result"] = False
skipping to change at line 317 skipping to change at line 317
if __salt__["lvm.lvdisplay"](lvpath): if __salt__["lvm.lvdisplay"](lvpath):
ret["comment"] = "Created Logical Volume {}".format(name) ret["comment"] = "Created Logical Volume {}".format(name)
ret["changes"]["created"] = changes ret["changes"]["created"] = changes
else: else:
ret["comment"] = "Failed to create Logical Volume {}. Error: {}" .format( ret["comment"] = "Failed to create Logical Volume {}. Error: {}" .format(
name, changes["Output from lvcreate"] name, changes["Output from lvcreate"]
) )
ret["result"] = False ret["result"] = False
else: else:
ret["comment"] = "Logical Volume {} already present".format(name) ret["comment"] = "Logical Volume {} already present".format(name)
if size or extents: if size or extents:
old_extents = int(lv_info["Current Logical Extents Associated"]) old_extents = int(lv_info["Current Logical Extents Associated"])
old_size_mb = _convert_to_mb(lv_info["Logical Volume Size"] + "s") old_size_mb = _convert_to_mb(lv_info["Logical Volume Size"] + "s")
if size: if size:
size_mb = _convert_to_mb(size) size_mb = _convert_to_mb(size)
extents = old_extents extents = old_extents
else: else:
# ignore percentage "extents" if the logical volume already exis
ts
if "%" in str(extents):
ret[
"comment"
] = "Logical Volume {} already present, {} won't be resized.
".format(
name, extents
)
extents = old_extents
size_mb = old_size_mb size_mb = old_size_mb
# This is here waiting a change in lvm.lvresize backend
if force is False and (size_mb < old_size_mb or extents < old_extent s): if force is False and (size_mb < old_size_mb or extents < old_extent s):
ret[ ret[
"comment" "comment"
] = "To reduce a Logical Volume option 'force' must be True." ] = "To reduce a Logical Volume option 'force' must be True."
ret["result"] = False ret["result"] = False
return ret return ret
if size_mb != old_size_mb or extents != old_extents: if size_mb != old_size_mb or extents != old_extents:
if __opts__["test"]: if __opts__["test"]:
ret["comment"] = "Logical Volume {} is set to be resized".fo rmat( ret["comment"] = "Logical Volume {} is set to be resized".fo rmat(
 End of changes. 8 change blocks. 
6 lines changed or deleted 16 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)