Add resizefs param in lvol (#31132)

This fix allows user to specify resizefs in logical volume extension.
Fix placement of new option, document.

Signed-off-by: Tim Rightnour <root@garbled.net>
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/33276/head
Tim Rightnour 7 years ago committed by Abhijeet Kasurde
parent 32635577a3
commit e197a94f2b

@ -58,7 +58,7 @@ options:
version_added: "1.5" version_added: "1.5"
opts: opts:
description: description:
- Free-form options to be passed to the lvcreate command - Free-form options to be passed to the lvcreate command.
version_added: "2.0" version_added: "2.0"
snapshot: snapshot:
description: description:
@ -66,16 +66,20 @@ options:
version_added: "2.1" version_added: "2.1"
pvs: pvs:
description: description:
- Comma separated list of physical volumes e.g. /dev/sda,/dev/sdb - Comma separated list of physical volumes (e.g. /dev/sda,/dev/sdb).
version_added: "2.2" version_added: "2.2"
shrink: shrink:
description: description:
- shrink if current size is higher than size requested - Shrink if current size is higher than size requested.
type: bool type: bool
default: 'yes' default: 'yes'
version_added: "2.2" version_added: "2.2"
notes: resizefs:
- Filesystems on top of the volume are not resized. description:
- Resize the underlying filesystem together with the logical volume.
type: bool
default: 'yes'
version_added: "2.5"
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -135,6 +139,7 @@ EXAMPLES = '''
vg: firefly vg: firefly
lv: test lv: test
size: 100%PVS size: 100%PVS
resizefs: true
- name: Resize the logical volume to % of VG - name: Resize the logical volume to % of VG
lvol: lvol:
@ -244,7 +249,8 @@ def main():
shrink=dict(type='bool', default=True), shrink=dict(type='bool', default=True),
active=dict(type='bool', default=True), active=dict(type='bool', default=True),
snapshot=dict(type='str'), snapshot=dict(type='str'),
pvs=dict(type='str') pvs=dict(type='str'),
resizefs=dict(type='bool', default=False),
), ),
supports_check_mode=True, supports_check_mode=True,
) )
@ -267,6 +273,7 @@ def main():
force = module.boolean(module.params['force']) force = module.boolean(module.params['force'])
shrink = module.boolean(module.params['shrink']) shrink = module.boolean(module.params['shrink'])
active = module.boolean(module.params['active']) active = module.boolean(module.params['active'])
resizefs = module.boolean(module.params['resizefs'])
size_opt = 'L' size_opt = 'L'
size_unit = 'm' size_unit = 'm'
snapshot = module.params['snapshot'] snapshot = module.params['snapshot']
@ -421,6 +428,8 @@ def main():
tool = '%s %s' % (tool, '--force') tool = '%s %s' % (tool, '--force')
if tool: if tool:
if resizefs:
tool = '%s %s' % (tool, '--resizefs')
cmd = "%s %s -%s %s%s %s/%s %s" % (tool, test_opt, size_opt, size, size_unit, vg, this_lv['name'], pvs) cmd = "%s %s -%s %s%s %s/%s %s" % (tool, test_opt, size_opt, size, size_unit, vg, this_lv['name'], pvs)
rc, out, err = module.run_command(cmd) rc, out, err = module.run_command(cmd)
if "Reached maximum COW size" in out: if "Reached maximum COW size" in out:
@ -450,6 +459,8 @@ def main():
tool = '%s %s' % (tool, '--force') tool = '%s %s' % (tool, '--force')
if tool: if tool:
if resizefs:
tool = '%s %s' % (tool, '--resizefs')
cmd = "%s %s -%s %s%s %s/%s %s" % (tool, test_opt, size_opt, size, size_unit, vg, this_lv['name'], pvs) cmd = "%s %s -%s %s%s %s/%s %s" % (tool, test_opt, size_opt, size, size_unit, vg, this_lv['name'], pvs)
rc, out, err = module.run_command(cmd) rc, out, err = module.run_command(cmd)
if "Reached maximum COW size" in out: if "Reached maximum COW size" in out:

Loading…
Cancel
Save