puppetlabs-lvm icon indicating copy to clipboard operation
puppetlabs-lvm copied to clipboard

Support multiple pv's in lvm::volume

Open imp- opened this issue 1 year ago • 1 comments

Summary

Before data types were introduced in commit 83efe16, it was possible to pass an array of physical volumes to the $lvm::volume::pv parameter.

This commit updates the type of the pv parameter to either support a single path or an array of paths.

Spec test updated accordingly.

Additional Context

We have a vg with 2 pv's:

PV         VG  Fmt  Attr PSize    PFree
/dev/sda1  myvg lvm2 a--  <100g       0
/dev/sdb1  myvg lvm2 a--  <100g       0

We create an lvm volume:

lvm::volume {
  'myvol':
    ensure => 'present',
    vg     => 'myvg',
    pv     => [
      '/dev/sda1',
      '/dev/sda2'
    ],
    fstype => 'xfs',
    size   => '10G';
}

When passing an array as pv, we get this error:

Lvm::Volume[myvol]: parameter 'pv' expects a Stdlib::Absolutepath = Variant[Stdlib::Windowspath = Pattern[/\A(([a-zA-Z]:[\\\/])|([\\\/][\\\/][^\\\/]+[\\\/][^\\\/]+)|([\\\/][\\\/]\?[\\\/][^\\\/]+)).*\z/], Stdlib::Unixpath = Pattern[/\A\/([^\n\/\0]+\/*)*\z/]] value, got Tuple

Related Issues (if any)

Commit 83efe16 was merged in #283

Checklist

  • [ x ] 🟢 Spec tests.
  • [ x ] Manually verified.

imp- avatar Sep 04 '24 17:09 imp-