1

I'm using the lvm puppet module, this is up to date and unchanged, this functions perfectly as far as I can tell when creating a new server (code with identifiable values removed below).

   physical_volume { '/dev/sdb':
    ensure => present,
  } ->
  volume_group { 'testvg':
    ensure           => present,
    physical_volumes => '/dev/sdb',
  } ->
  logical_volume { 'test':
    ensure       => present,
    volume_group => 'testvg',
  } ->
  filesystem { '/dev/mapper/testvg-test':
    ensure  => present,
    fs_type => 'xfs',
  } ->
  file { '/test':
    ensure => directory,
    owner  => 'root',
    group  => 'root',
    mode   => '0644',
  } ->
  mount {'/test':
    ensure => 'mounted',
    fstype => 'xfs',
    device => '/dev/mapper/testvg-test',
    pass   => '2',
    atboot => true,
  }

Now comes the hard part; if I expand the physical size of the disk (/dev/sdb), let's say from 10gb to 20gb, I'd assume that without setting extents (quote from the module here: "Set to undef to use all available space") the lv would be automatically resized to fill the capacity of the disk and ideally the underlying filesystem would be resized (or at the very least lvdisplay would pick up the new size).

However absolutely nothing happens. Things I've tried:

Setting the extents to be 100%FREE (nothing happens) Exec to run a pvextend (exec runs fine, but nothing happens after this) Manually setting the size via facter (fails with insufficient disk space). Changing the extents to be "+100FREE" rather than "100%FREE" (unknown value).

I feel like any changes I make at this point are likely to be on the module, and thus something is either very wrong with my code or wrong with the module.

keeer
  • 783
  • 1
  • 5
  • 11
  • You're creating a physical volume on `/dev/sdb`, but you're creating a volume group using `/dev/sda`. Have you actually run this specific manifest? I think you're also using the wrong lv name when creating a filesystem. – larsks Nov 13 '19 at 14:44
  • Thanks larsks, I've tried to clean it up to match code I run. This should be pretty similar now (disks names, lv and vg names have been changed). – keeer Nov 13 '19 at 15:04
  • 1
    `I'd assume that without setting extents (quote from the module here: "Set to undef to use all available space") the lv would be automatically resized to fill the capacity of the disk and ideally the underlying filesystem would be resized` - I wouldn't assume that, No. `lvcreate` and `lvextend` are 2 different commands. Your expectation may require a feature request. But as a general rule, if you don't specify the size, you wouldn't want to fill up the filesystem based on physical space available. – azbarcea Nov 14 '19 at 23:02
  • 1
    for more details why `--extents` is treated differently, check [lvm.pp](https://github.com/puppetlabs/puppetlabs-lvm/blob/master/lib/puppet/provider/logical_volume/lvm.rb). As such, you can see that `lvextend` is used only in 1 particular case: `lvextend('-L', new_size, path) || raise("Cannot extend to size #{new_size} because lvextend failed.")` – azbarcea Nov 14 '19 at 23:11
  • @azbarcea I don't even get an error, absolutely nothing happens. [This](https://github.com/puppetlabs/puppetlabs-lvm/blob/d6c3514715acfa795fcf573ff6029a237ee060a0/lib/puppet/provider/logical_volume/lvm.rb#L87) piece of code looks wrong to me, it's 100% but never +100%; pity you can't set your own extents (including a "+" sign). Anyway, I've put in a pvextend exec and made the logical_volume section have "size" set as a fact. Thanks for your help - I still think this seems wrong somehow, I'm sure there's code here intended to extend the filesystem and work with extents. – keeer Nov 15 '19 at 18:45
  • 1
    Yes, you don't get an error, indeed. I get your point. My suggestion is to add a feature request as a dummy PR and we can all comment on [github:puppetlabs-lvm/issues](https://github.com/puppetlabs/puppetlabs-lvm/pulls). – azbarcea Nov 16 '19 at 03:14

0 Answers0