# bug in lvg module?

**URL:** <https://forum.ansible.com/t/bug-in-lvg-module/17325>\
**Category:** Ansible Project\
**Created:** [January 20, 2015, 12:06pm UTC](https://forum.ansible.com/t/bug-in-lvg-module/17325 "2015-01-20T12:06:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Maas](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Mark\_Maas](https://forum.ansible.com/u/Mark_Maas)\
**Post date:** [January 20, 2015, 12:06pm UTC](https://forum.ansible.com/t/bug-in-lvg-module/17325/1 "2015-01-20T12:06:18Z")

</div>

Hi List,

I’m trying to create an lvg using the lvg ansible module like so:

```auto
- name: Maak een vg-tc
  lvg: vg=vg.osddata.raven pvs=/dev/xvdb,/dev/xvdc state=present

```

But I’m getting this error back:

```auto
failed: [10.220.225.96] => {"err": " Device /dev/xvdb /dev/xvdc not found (or ignored by filtering).\n Unable to add physical volume '/dev/xvdb /dev/xvdc' to volume group 'vg.osddata.raven'.\n", "failed": true, "rc": 5}

```

It seems like it’s looking for a device called ‘/dev/xvdb /dev/xvdc’ instead of two separate devices.

I used the example from:  
[http://docs.ansible.com/lvg\_module.html](http://docs.ansible.com/lvg_module.html)

Am I calling it wrong or is this a bug?

Thanks,  
Mark

​

---

<div class="post-metadata">

**Author:** ![Mark\_Maas](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Mark\_Maas](https://forum.ansible.com/u/Mark_Maas)\
**Post date:** [January 20, 2015, 12:33pm UTC](https://forum.ansible.com/t/bug-in-lvg-module/17325/2 "2015-01-20T12:33:20Z")

</div>

BTW, using ansible 1.8.2.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [January 20, 2015, 12:36pm UTC](https://forum.ansible.com/t/bug-in-lvg-module/17325/3 "2015-01-20T12:36:23Z")

</div>

there is current bug in = option parser, try this:

- name: Maak een vg-tc  
&nbsp;&nbsp;lvg:  
&nbsp;&nbsp;&nbsp;vg: vg.osddata.raven  
&nbsp;&nbsp;&nbsp;pvs: /dev/xvdb,/dev/xvdc  
&nbsp;&nbsp;&nbsp;state: present

---

<div class="post-metadata">

**Author:** ![Mark\_Maas](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Mark\_Maas](https://forum.ansible.com/u/Mark_Maas)\
**Post date:** [January 20, 2015, 12:53pm UTC](https://forum.ansible.com/t/bug-in-lvg-module/17325/4 "2015-01-20T12:53:31Z")

</div>

Tried it with this:

```auto
- name: Maak een vg-tc
  lvg: 
    vg: vg.osddata.raven
    pvs: /dev/xvdb,/dev/xvdc
    state: present

```

But still no go:

```auto
failed: [10.220.226.90] => {"err": " Device /dev/xvdb /dev/xvdc not found (or ignored by filtering).\n Unable to add physical volume '/dev/xvdb /dev/xvdc' to volume group 'vg.osddata.raven'.\n", "failed": true, "rc": 5}
msg: Creating volume group 'vg.osddata.raven' failed

```

Thanks for looking btw!

---

<div class="post-metadata">

**Author:** ![Mark\_Maas](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Mark\_Maas](https://forum.ansible.com/u/Mark_Maas)\
**Post date:** [January 20, 2015, 12:57pm UTC](https://forum.ansible.com/t/bug-in-lvg-module/17325/5 "2015-01-20T12:57:14Z")

</div>

I’ve got a bit more verbosity:

```auto
<10.220.226.90> REMOTE_MODULE lvg vg=vg.osddata.raven state=present pvs=/dev/xvdb,/dev/xvdc

```

looks like the module is getting the correct data?

---

<div class="post-metadata">

**Author:** ![Giovanni\_Tirloni](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@Giovanni\_Tirloni](https://forum.ansible.com/u/Giovanni_Tirloni)\
**Post date:** [January 20, 2015, 6:54pm UTC](https://forum.ansible.com/t/bug-in-lvg-module/17325/6 "2015-01-20T18:54:04Z")

</div>

> Hi List,  
> I’m trying to create an lvg using the lvg ansible module like so:  
> - name: Maak een vg-tc

&nbsp;&nbsp;lvg: vg=vg.osddata.raven pvs=/dev/xvdb,/dev/xvdc state=present

> But I’m getting this error back:  
> failed: [10.220.225.96] =\> {"err": " Device /dev/xvdb /dev/xvdc not found (or ignored by filtering).\n Unable to add physical volume '/dev/xvdb /dev/xvdc' to volume group 'vg.osddata.raven'.\n", "failed": true, "rc": 5}
> 
> It seems like it’s looking for a device called ‘/dev/xvdb /dev/xvdc’ instead of two separate devices.

It might be because parse\_pvs() function is only considering devices  
that start with "/dev/dm-".

Try changing it like this in  
/usr/lib/python2.7/site-packages/ansible/ansible/modules/extras/system/lvg.py:

def parse\_pvs(module, data):  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pvs =   
- dm\_prefix = '/dev/dm-'  
+ dm\_prefix = '/dev/'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for line in data.splitlines():  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parts = line.strip().split(';')  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if parts[0].startswith(dm\_prefix):

I've not tested this modification. Does anyone know why it's limiting  
only to dm devices?

Giovanni

---

<div class="post-metadata">

**Author:** ![Mark\_Maas](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Mark\_Maas](https://forum.ansible.com/u/Mark_Maas)\
**Post date:** [January 21, 2015, 6:46am UTC](https://forum.ansible.com/t/bug-in-lvg-module/17325/7 "2015-01-21T06:46:03Z")

</div>

It seems this was indeed a bug:  
[https://github.com/ansible/ansible-modules-extras/issues/50](https://github.com/ansible/ansible-modules-extras/issues/50)

But is was closed as fixed on the 6th of november.

So I will need to wait until this bit:  
[https://github.com/ansible/ansible-modules-extras/commit/664858ec20630a65bbdedbe52b79bd4e61f6ceec](https://github.com/ansible/ansible-modules-extras/commit/664858ec20630a65bbdedbe52b79bd4e61f6ceec)

Finds it’s way to 1.8.3 or something?
