Uploaded image for project: 'Modules'
  1. Modules
  2. MODULES-4753

puppetlabs-lvm : serious flaws with swap space on debian

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: lvm
    • Environment:

      all

    • Template:
      MODULES Bug Template
    • Epic Link:
    • Team:
      Modules
    • QA Risk Assessment:
      Needs Assessment

      Description

      Basic Info
      Module Version: 0.7.0; 0.9.0
      Puppet Version: 4.10.0
      OS Name/Version: debian 8 x64

      following situation, i bootstrap a debian 8 x64 system with api calls at my provider. to be as flexible as possible the lvm volumes are choosen as small as possible and then should be resized via puppetlabs-lvm.

      summary

      • swappoff is not called on swap resizes
      • blkid call required for swaps?
      • is "check if swap already exists" broken?

      detailed

      PART  lvm  vg_main  all
      ...
      LV  vg_main  swap  swap  swap  16M
      ...
      

      this works without problems with non-swap partitions (tested with ext3, ext4, xfs) but results problems with swap partitions.

      the initial swap partitions has 16M the target size in my case would be 2048M, so an increase is necessary. after getting errors with puppetlabs/lvm 0.7.0 i happily upgraded to puppetlabs/lvm 0.9.0 after reading about the swap changes

      > - Executed command swapoff before unmount swap partion

      unfortunately the problems are still there after the upgrade.

      first run puppet agent --test --debug:

      If the specified token was not found, or no (specified) devices could be identified, an exit code of 2 is returned.

      ...
      Info: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[home_root]/Mount[/root]: Scheduling refresh of Mount[/root]
      Debug: Lvm::Logical_volume[home_root]: The container Lvm::Volume_group[vg_main] will propagate my refresh event
      Debug: Executing: '/sbin/lvs vg_main'
      Debug: Executing: '/sbin/lvs --noheading --unit m /dev/vg_main/swap'
      Debug: Executing: '/sbin/lvs --noheading --unit m /dev/vg_main/swap'
      Debug: Executing: '/sbin/lvs --noheading -o vg_extent_size --units k /dev/vg_main/swap'
      Debug: Executing: '/sbin/lvextend -L 2048M /dev/vg_main/swap'
      Debug: Executing: '/sbin/blkid /dev/vg_main/swap'
      Error: Execution of '/sbin/blkid /dev/vg_main/swap' returned 2:
      Error: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Logical_volume[swap]/size: change from 16M to 2048M failed: Execution of '/sbin/blkid /dev/vg_main/swap' returned 2:
      Notice: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Filesystem[/dev/vg_main/swap]: Dependency Logical_volume[swap] has failures: true
      ...
      

      root@app ~ # lvs
        LV        VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
        ...
        swap      vg_main -wi-ao----   2.00g
        ...
      root@app ~ # cat /proc/swaps
      Filename                                Type            Size    Used    Priority
      /dev/dm-9                               partition       16380   0       -1
      root@app ~ # /sbin/blkid /dev/vg_main/swap
      root@app ~ # echo $?
      2
      
      

      so the lv size is correct but the filesystem is not. is calling blkid on swap a good thing?

      2nd & nth puppet run:

      Debug: Executing: '/sbin/lvs vg_main'
      Debug: Executing: '/sbin/lvs --noheading --unit m /dev/vg_main/swap'
      Debug: Executing: '/sbin/blkid /dev/vg_main/swap'
      Debug: Executing: 'mkswap /dev/vg_main/swap'
      Error: Execution of 'mkswap /dev/vg_main/swap' returned 1: mkswap: error: /dev/vg_main/swap is mounted; will not make swapspace
      Error: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Filesystem[/dev/vg_main/swap]/ensure: change from absent to present failed: Execution of 'mkswap /dev/vg_main/swap' returned 1: mkswap: error: /dev/vg_main/swap is mounted; will not make swapspace
      Notice: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Mount[/dev/vg_main/swap]: Dependency Filesystem[/dev/vg_main/swap] has failures: true
      

      shouldn't swap partitions get unmounted automatically? this would also allow decreasing without problems. see related issue

      running swappoff --all manually before the puppet run leads to correctly created swapspace:

      Debug: Executing: 'test -d /root'
      Debug: Executing: '/sbin/lvs vg_main'
      Debug: Executing: '/sbin/lvs --noheading --unit m /dev/vg_main/swap'
      Debug: Executing: '/sbin/blkid /dev/vg_main/swap'
      Debug: Executing: 'mkswap /dev/vg_main/swap'
      Notice: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Filesystem[/dev/vg_main/swap]/ensure: created
      Debug: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Filesystem[/dev/vg_main/swap]: The container Lvm::Logical_volume[swap] will propagate my refresh event
      Notice: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Mount[/dev/vg_main/swap]/ensure: defined 'ensure' as 'defined'
      Debug: Flushing mount provider target /etc/fstab
      Info: Computing checksum on file /etc/fstab
      Debug: Evicting cache entry for environment 'production'
      Debug: Caching environment 'production' (ttl = 0 sec)
      Info: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Mount[/dev/vg_main/swap]: Scheduling refresh of Exec[swapon for '/dev/vg_main/swap']
      Debug: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Mount[/dev/vg_main/swap]: The container Lvm::Logical_volume[swap] will propagate my refresh event
      Info: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Mount[/dev/vg_main/swap]: Scheduling refresh of Mount[/dev/vg_main/swap]
      Notice: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Mount[/dev/vg_main/swap]: Triggered 'refresh' from 1 events
      Info: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Mount[/dev/vg_main/swap]: Scheduling refresh of Exec[swapon for '/dev/vg_main/swap']
      Debug: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Mount[/dev/vg_main/swap]: The container Lvm::Logical_volume[swap] will propagate my refresh event
      Info: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Mount[/dev/vg_main/swap]: Scheduling refresh of Mount[/dev/vg_main/swap]
      Debug: Exec[swapon for '/dev/vg_main/swap'](provider=posix): Executing check 'grep `readlink -f /dev/vg_main/swap` /proc/swaps'
      Debug: Executing: 'grep `readlink -f /dev/vg_main/swap` /proc/swaps'
      Debug: Exec[swapon for '/dev/vg_main/swap'](provider=posix): Executing 'swapon /dev/vg_main/swap'
      Debug: Executing: 'swapon /dev/vg_main/swap'
      Notice: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Exec[swapon for '/dev/vg_main/swap']/returns: executed successfully
      Debug: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Exec[swapon for '/dev/vg_main/swap']: The container Lvm::Logical_volume[swap] will propagate my refresh event
      Debug: Exec[swapon for '/dev/vg_main/swap'](provider=posix): Executing check 'grep `readlink -f /dev/vg_main/swap` /proc/swaps'
      Debug: Executing: 'grep `readlink -f /dev/vg_main/swap` /proc/swaps'
      Debug: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Exec[swapon for '/dev/vg_main/swap']/unless: /dev/dm-9                               partition      2097148 0       -1
      Notice: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Exec[swapon for '/dev/vg_main/swap']: Triggered 'refresh' from 2 events
      Debug: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Exec[swapon for '/dev/vg_main/swap']: The container Lvm::Logical_volume[swap] will propagate my refresh event
      Debug: Lvm::Logical_volume[swap]: The container Lvm::Volume_group[vg_main] will propagate my refresh event
      

      but running puppet again leads to an error again, because the module tries to create the swapspace again, even if it already exists.

      root@app ~ # lvs
        LV        VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
        ...
        swap      vg_main -wi-ao----   2.00g
        ...
      root@app ~ # cat /proc/swaps
      Filename                                Type            Size    Used    Priority
      /dev/dm-9                               partition       2097148 0       -1
      

      Debug: Executing: '/sbin/lvs vg_main'
      Debug: Executing: '/sbin/lvs --noheading --unit m /dev/vg_main/swap'
      Debug: Executing: '/sbin/blkid /dev/vg_main/swap'
      Debug: Executing: 'mkswap /dev/vg_main/swap'
      Error: Execution of 'mkswap /dev/vg_main/swap' returned 1: mkswap: error: /dev/vg_main/swap is mounted; will not make swapspace
      Error: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Filesystem[/dev/vg_main/swap]/ensure: change from absent to present failed: Execution of 'mkswap /dev/vg_main/swap' returned 1: mkswap: error: /dev/vg_main/swap is mounted; will not make swapspace
      Notice: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Mount[/dev/vg_main/swap]: Dependency Filesystem[/dev/vg_main/swap] has failures: true
      Warning: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Mount[/dev/vg_main/swap]: Skipping because of failed dependencies
      Debug: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Mount[/dev/vg_main/swap]: Resource is being skipped, unscheduling all events
      Notice: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Exec[swapon for '/dev/vg_main/swap']: Dependency Filesystem[/dev/vg_main/swap] has failures: true
      Warning: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Exec[swapon for '/dev/vg_main/swap']: Skipping because of failed dependencies
      Debug: /Stage[one]/Lvm/Lvm::Volume_group[vg_main]/Lvm::Logical_volume[swap]/Exec[swapon for '/dev/vg_main/swap']: Resource is being skipped, unscheduling all events
      Debug: Lvm::Logical_volume[swap]: Resource is being skipped, unscheduling all events
      

      converted from markdown to jira with http://j2m.fokkezb.nl/

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dhollinger David Hollinger
              Reporter:
              c33s Julian
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support