From aa9152d16901bc0d450161913145b5937e261569 Mon Sep 17 00:00:00 2001 From: Pavol Ipoth Date: Mon, 11 Apr 2016 21:55:40 +0200 Subject: [PATCH] Fixes #2008 Lvol module is not indempodent for cache lv's --- lib/ansible/modules/extras/system/lvol.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/extras/system/lvol.py b/lib/ansible/modules/extras/system/lvol.py index f6774596f0b..5cd082e96b0 100644 --- a/lib/ansible/modules/extras/system/lvol.py +++ b/lib/ansible/modules/extras/system/lvol.py @@ -79,6 +79,9 @@ EXAMPLES = ''' # Create a logical volume of 512m with disks /dev/sda and /dev/sdb - lvol: vg=firefly lv=test size=512 pvs=/dev/sda,/dev/sdb +# Create cache pool logical volume +- lvol: vg=firefly lv=lvcache size=512m opts='--type cache-pool' + # Create a logical volume of 512g. - lvol: vg=firefly lv=test size=512g @@ -122,7 +125,7 @@ def parse_lvs(data): for line in data.splitlines(): parts = line.strip().split(';') lvs.append({ - 'name': parts[0], + 'name': parts[0].replace('[','').replace(']',''), 'size': int(decimal_point.match(parts[1]).group(1)) }) return lvs @@ -245,7 +248,7 @@ def main(): # Get information on logical volume requested lvs_cmd = module.get_bin_path("lvs", required=True) rc, current_lvs, err = module.run_command( - "lvs --noheadings --nosuffix -o lv_name,size --units %s --separator ';' %s" % (unit, vg)) + "%s -a --noheadings --nosuffix -o lv_name,size --units %s --separator ';' %s" % (lvs_cmd, unit, vg)) if rc != 0: if state == 'absent':