1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

lvol patch for Debian Squeeze

This commit is contained in:
Alexander Bulimov 2013-03-11 12:20:01 +04:00
parent 4eaca08664
commit a3b4488028

View file

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) 2013, Jeroen Hoekx <jeroen.hoekx@dsquare.be> # (c) 2013, Jeroen Hoekx <jeroen.hoekx@dsquare.be>, Alexander Bulimov <lazywolf0@gmail.com>
# #
# This file is part of Ansible # This file is part of Ansible
# #
@ -64,7 +64,6 @@ def parse_lvs(data):
lvs.append({ lvs.append({
'name': parts[0], 'name': parts[0],
'size': int(parts[1].split('.')[0]), 'size': int(parts[1].split('.')[0]),
'path': parts[2],
}) })
return lvs return lvs
@ -90,7 +89,7 @@ def main():
if size: if size:
size = int(size) size = int(size)
rc,current_lvs,err = module.run_command("lvs --noheadings -o lv_name,size,lv_path --units m --separator ';' %s"%(vg)) rc,current_lvs,err = module.run_command("lvs --noheadings -o lv_name,size --units m --separator ';' %s"%(vg))
if rc != 0: if rc != 0:
module.fail_json(msg="Volume group %s does not exist."%vg, rc=rc, err=err) module.fail_json(msg="Volume group %s does not exist."%vg, rc=rc, err=err)
@ -122,7 +121,7 @@ def main():
### remove LV ### remove LV
if module.check_mode: if module.check_mode:
module.exit_json(changed=True) module.exit_json(changed=True)
rc,_,err = module.run_command("lvremove --force %s"%(this_lv['path'])) rc,_,err = module.run_command("lvremove --force %s/%s"%(vg,this_lv['name']))
if rc == 0: if rc == 0:
module.exit_json(changed=True) module.exit_json(changed=True)
else: else:
@ -138,7 +137,7 @@ def main():
if module.check_mode: if module.check_mode:
changed = True changed = True
else: else:
rc,_,err = module.run_command("%s -L %sm %s"%(tool, size, this_lv['path'])) rc,_,err = module.run_command("%s -L %sm %s/%s"%(tool, size, vg, this_lv['name']))
if rc == 0: if rc == 0:
changed = True changed = True
else: else: