lvcreateopts ordering / sizing

Luke Alexander luke at brandwatch.com
Wed Nov 19 21:07:18 CET 2014


Hi,

I have a problem where I'd like to be able to specify a physical device as an LV create option:

---

disk_config lvm fstabkey:device
vg main md2,md3
main-root /               10G xfs defaults
main-mnt  /home/mnt       50G xfs defaults
main-solr /srv/solr/disk1 0-  xfs defaults lvcreateopts="/dev/md3"

---

Please assume that the md devices are created OK (which they are), I'd like for main-solr LV to use 100% of the PD /dev/md3

Using (undocumented?) lvcreateopts I was able to see the device trying to be used, but the ordering is incorrect, the PD switch to the lvcreate command should be at the end of the command, but lvcreateopts is added as the beginning flags the 'lvcreate' command...

To get past that we can change /usr/share/fai/setup-storage/Commands.pm :

    &FAI::push_command( "lvcreate -n $lv -L " .
      &FAI::convert_unit($lv_size->{eff_size} . "B") . " $vg $create_options", "vg_enabled_$vg",

However this didn't work as the size option used '0-' trys to consume the entire VG size (so both, md2 and md3)

  VG   #PV #LV #SN Attr   VSize VFree
  main   2   2   0 wz--n- 1.79t 1.73t

the lvcreate command looks like: 
lvcreate -n solr -L 1794482.72765625 main /dev/md3

the command fails as there are already devices using the VG - so the full VG size is not possible to use...

I then thought maybe I could change the lvcreateopts to comsume 100% of the PV (rather than VG), but I think this isn't parsed by Parsed.pm properly?
lvcreateopts="-l +100%PVS /dev/md3"

Anyway, I can work round this by using the above hack to Commands.pm and setting the size option in the disk_config recipe to something like 900G:

main-solr /srv/solr/disk1 900G xfs defaults lvcreateopts="/dev/md3"

There is probably a more elegant way to do this though, you may have some pointers?

Apologies if this is the wrong list, I wasn't sure since I thought I could assist with the Commands.pm change if needed?

Thanks,
Luke


More information about the linux-fai-devel mailing list