Salt: Cannot specify logical volume size in percent

Created on 7 Apr 2015  路  5Comments  路  Source: saltstack/salt

I would like to create a logical volume and make it 100% of the available size. On the command line this can be specified with the lowercase l option as such:

lvcreate -l 100%FREE -n yourlv testvg

Tried this for the state as well

{{ lvname }}:
  lvm.lv_present:
    - vgname: {{ volgroup }}
    - size: '100%FREE'
    - require:
      - lvm: {{ volgroup }}

but it's using the uppercase l option:

[INFO    ] Executing command 'lvcreate -n lvname vgname -L 100%FREE ' in directory '/root'

I'm using:

 salt-call --versions-report
           Salt: 0.17.5
         Python: 2.7.6 (default, Mar 22 2014, 22:59:56)
         Jinja2: 2.7.2
       M2Crypto: 0.21.1
 msgpack-python: 0.1.10
   msgpack-pure: Not Installed
       pycrypto: 2.6.1
         PyYAML: 3.10
          PyZMQ: 13.0.0
            ZMQ: 3.2.2
Question fixed-pending-your-verification

Most helpful comment

+1. I just ran into this issue and am looking for a workaround currently.

I think something like an extents parameter is what we're looking for here, since that's what the -l option means to lvcreate. So, something like this.

{{ lvname }}:
  lvm.lv_present:
    - vgname: {{ volgroup }}
    - extents: '100%FREE'
    - require:
      - lvm: {{ volgroup }}`

All 5 comments

+1. I just ran into this issue and am looking for a workaround currently.

I think something like an extents parameter is what we're looking for here, since that's what the -l option means to lvcreate. So, something like this.

{{ lvname }}:
  lvm.lv_present:
    - vgname: {{ volgroup }}
    - extents: '100%FREE'
    - require:
      - lvm: {{ volgroup }}`

@pschuermann Nevermind, it's already there! Just use extents instead of size. I just ran it on 2014.7.1.

In fact, it's even in the docs. Looks like I need another coffee...

Thanks for the report/question @pschuermann, and thanks for following up here, @drawsmcgraw!

@pschuermann Give extents a try. It should work on the version that you're running, as it was available in that release, but if you run into problems with it, then you'll need to upgrade to a newer version as the 0.17 branch is not longer under development.

thanks @drawsmcgraw @rallytime via - extents: '100%FREE'this works fine

Great! I'll close this then. :)

Was this page helpful?
0 / 5 - 0 ratings