ansible/ansible — pull request #8284 by ps-jay (2014-07-25 00:34:46+00:00)
Title: Fix for lvcreate vs. lvs case-sensitivity

lvcreate is case-*insenstive* with respect to units
i.e. 'g' = 'G' = GiB = powers of 2

lvs is case-*senstive* with respect to units
i.e. 'g' = powers of 10; 'G' = powers of 2

This causes the lvol module to want to shrink LV's if the size argument
is specified with an uppercase unit.

The fix is to always set the size unit to lower case.

##### Issue Type:

Bugfix Pull Request

##### Ansible Version:

ansible 1.6.7

##### Environment:

Red Hat Enterprise Linux Server release 6.5 (Santiago)

##### Summary:

lvcreate is case-*insenstive* with respect to units (i.e. 'g' = 'G' = GiB = powers of 2)
lvs is case-*senstive* with respect to units (i.e. 'g' = powers of 10; 'G' = powers of 2)

This causes the lvol module to want to shrink LV's if the size argument is specified with an uppercase unit.

My proposed fix is in this pull request.

##### Steps To Reproduce:

Using this play:
```
- name: Create the u01 LVM LV
lvol: vg=data lv=u01 size=40G
```

Results in a 40GiB LV being created:
```
--- Logical volume ---
LV Path /dev/data/u01
LV Name u01
VG Name data

LV Size 40.00 GiB

```

However, on a 2nd run through, we get an error about shrinking the partition:
```
TASK: [partitioning | Create the u01 LVM LV] **********************************
failed: [testwebpost21] => {"failed": true}
msg: Sorry, no shrinking of u01 without force=yes.

FATAL: all hosts have already failed -- aborting
```

##### Expected Results:

I expect to be able to re-run the lvol module multiple times with consistent results.

##### Actual Results:

Actual results as above in reproduction section