The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Bug #7300

"puppet resource mount" reports wrong mountstate

Added by Stefan Schulte over 3 years ago. Updated over 3 years ago.

Status:ClosedStart date:05/01/2011
Priority:NormalDue date:
Assignee:Stefan Schulte% Done:

0%

Category:mount
Target version:2.7.2
Affected Puppet version:2.6.7 Branch:https://github.com/stschulte/puppet/tree/ticket/2.7.x/7300
Keywords:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This issue is currently not available for export. If you are experiencing the issue described below, please file a new ticket in JIRA. Once a new ticket has been created, please add a link to it that points back to this Redmine ticket.


Description

In 2.6.7 the instances method of the mountprovider is broken:

% puppet resource mount /
mount { '/':
  ensure  => 'unmounted', # obviously wrong
  [...]
  target  => '/etc/fstab',
}

Since puppet-2.6.7 the behaviour of the mounttype has changed (in order to fix #4914). The Mounttype doesn’t run the mountcommand anymore when retrieve is called. Instead it relies on the prefetched value of the mountprovider.

But when running puppet resource mount, puppet uses the instances method (instead of prefetch). Because the instances method just parses /etc/fstab every mount is reported as unmounted.

History

#1 Updated by Stefan Schulte over 3 years ago

  • Assignee set to Stefan Schulte

#2 Updated by Stefan Schulte over 3 years ago

  • Branch set to https://github.com/stschulte/puppet/tree/ticket/2.7.x/7300

#3 Updated by Stefan Schulte over 3 years ago

  • Status changed from Unreviewed to In Topic Branch Pending Review

#4 Updated by James Turnbull over 3 years ago

  • Target version set to 2.6.9

Nigel – this is impacting a customer too.

#5 Updated by Stefan Schulte over 3 years ago

I just want to mention that puppet resource mount now behaves different than before 2.6.7. It will also show mounts that are NOT in fstab but mounted.

Example: /sys is not in fstab but it is mounted:

mount { '/sys':
  ensure => 'ghost',
}

This may become important if you use the resources type to purge mounts. Before 2.6.7 this would never umount devices that are not mentioned in /etc/fstab. With this patch applied puppet umounts unmanaged mounts even if they do not appear in /etc/fstab.

If listing mounts that are not present in fstab is undesired, this will be an easy fix.

#6 Updated by Nigel Kersten over 3 years ago

ugh. This is the problem with our current type :(

I’m not quite sure whether we can reliably not show such mounts and still provide the fixes people cared about that led to this situation…

#7 Updated by Stefan Schulte over 3 years ago

The ensurestate of :ghost was introduced in 2.6.7. This was necessary because when the user has something like

mount { 'foo':
  ensure => mounted,
}

And the mount is not in fstab, puppet has to know whether it has to add an entry to fstab and then mount the device (change from :absent to :mounted) or it only has to add an entry to fstab (change from :ghost to :mounted).

My patch now also supports :mounted, :umounted and :ghost when running puppet resource mount

If I understand you correctly Nigel you just want to retrieve mounted and unmounted mountpoints when running puppet resource mount (pre 2.6.7 behaviour)?

If that’s true I can modify my patch (in fact it makes the patch simpler) but I didn’t know if it is desired behaviour to NOT show ghost mounts.

#8 Updated by Nigel Kersten over 3 years ago

I’m not sure if it’s desired behavior or not either. :(

Honestly I feel like we’re having to pick the lesser of two evils with the current provider, and given how much work you’ve done in this area for the community, I think your opinion matters a lot.

#9 Updated by Stefan Schulte over 3 years ago

In my opinion showing these ghost mounts is “right” because – well they are mounts ;–). Maybe the name for these mounts wasnt that great but I guess that’s another topic.

But I don’t know puppetlabs' policy here. Not changing behaviour between minor versions (2.6.6 –> 2.6.7) is a valid argument. I don’t know how may people out there will suffer from the change because they are purging mounts or in any other way rely on the output of puppet resource mount. So I would probably go for the second choice and only show mounts that do appear in fstab.

#10 Updated by Nigel Kersten over 3 years ago

Our goal is to not change behavior within a feature release, but I do think that these mounts should show up.

How about we don’t show them in 2.6.x, but we do show them in 2.7.x, and we call it out in the release notes as a change?

#11 Updated by Stefan Schulte over 3 years ago

Sounds reasonable.

How does the workflow looks like then? I have created a second branch

  • https://github.com/stschulte/puppet/commits/ticket%2F2.6.x%2F7300

which can be merged into 2.6.x. Merging the same branch into 2.7.x will raise conflicts because the specfile of the mountprovider changed quite a bit between 2.6.x and 2.7.x.

#12 Updated by Nick Lewis over 3 years ago

  • Status changed from In Topic Branch Pending Review to Merged - Pending Release

Merged stschulte/ticket/2.7.x/7300 to 2.7.next in commit:83fa8cf03133174d7182adee6f34efc6ba15d6b3.

#13 Updated by John Warburton over 3 years ago

Looks good to me on Solaris (after applying patch from issue #6845)

Unpatched 2.6.8

mount { '/system/object':
    ensure      => 'unmounted',
    atboot      => 'no',
    blockdevice => '-',
    device      => 'objfs',
    fstype      => 'objfs',
    options     => '-',
    pass        => '-',
    target      => '/etc/vfstab',
}
mount { '/tmp':
    ensure      => 'unmounted',
    atboot      => 'yes',
    blockdevice => '-',
    device      => 'swap',
    fstype      => 'tmpfs',
    options     => 'size=512m',
    pass        => '-',
    target      => '/etc/vfstab',
}

Patched with 7300

mount { '/system/object':
    ensure      => 'mounted',
    atboot      => 'no',
    blockdevice => '-',
    device      => 'objfs',
    fstype      => 'objfs',
    options     => '-',
    pass        => '-',
    target      => '/etc/vfstab',
}
mount { '/tmp':
    ensure      => 'mounted',
    atboot      => 'yes',
    blockdevice => '-',
    device      => 'swap',
    fstype      => 'tmpfs',
    options     => 'size=512m',
    pass        => '-',
    target      => '/etc/vfstab',
}

It has introduced these “ghost” mounts for my zfs mounts & Solaris bits and bobs – does it mean anything?

# zfs list
NAME                           USED  AVAIL  REFER  MOUNTPOINT
rpool                         5.68G  2.07G    97K  /rpool
rpool/ROOT                    4.74G  2.07G    21K  legacy
rpool/ROOT/Solaris_10_U9      4.74G  2.07G  4.19G  /
rpool/ROOT/Solaris_10_U9/var   563M  2.07G   563M  /var
rpool/dump                     250M  2.07G   250M  -
rpool/local                    343M  2.07G    25K  /local
rpool/local/app                 21K  2.07G    21K  /local/app
rpool/local/home              4.82M  2.07G  4.82M  /local/home
rpool/local/sendmail           338M  2.07G   338M  /local/sendmail
rpool/swap                     258M  2.25G  79.8M  -
rpool/varcore                  114M  2.07G   114M  /var/core
mount { '/':
ensure => 'ghost',
}
. . .
mount { '/etc/mnttab':
ensure => 'ghost',
}
mount { '/etc/svc/volatile':
ensure => 'ghost',
}
mount { '/local':
ensure => 'ghost',
}
mount { '/local/app':
ensure => 'ghost',
}
mount { '/local/home':
ensure => 'ghost',
}
mount { '/local/sendmail':
ensure => 'ghost',
}
mount { '/platform/sun4v/lib/libc_psr.so.1':
ensure => 'ghost',
}

#14 Updated by James Turnbull over 3 years ago

I don’t think actually went into 2.6.9 as far as I can see.

#15 Updated by James Turnbull over 3 years ago

  • Target version changed from 2.6.9 to 2.6.x

#16 Updated by Michael Stahnke over 3 years ago

  • Status changed from Merged - Pending Release to Closed
  • Target version changed from 2.6.x to 2.7.0

This is available in the 2.7 series.

83fa8cf Merge branch 'ticket/2.7.x/7300' into 2.7.next
0b8ebac (#7300) Fix instances method of mount provider
1f3b8e7 (#7300) Add specs for the mount provider

We may not have another 2.6 release.

#17 Updated by Michael Stahnke over 3 years ago

  • Target version changed from 2.7.0 to 2.7.2

And by 2.7 series, I mean 2.7.2 and later.

Also available in: Atom PDF