Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filesystem plugin creates duplicate entries for mounted nfs #536

Closed
liutc opened this issue May 6, 2015 · 3 comments
Closed

Filesystem plugin creates duplicate entries for mounted nfs #536

liutc opened this issue May 6, 2015 · 3 comments

Comments

@liutc
Copy link

liutc commented May 6, 2015

Version:

Ohai: 8.0.1
Chef: 12.0.3 (chef-client)

Environment:

CentOS 6.6

Scenario:

When I have a mounted nfs filesystem, I run chef-client / ohai discovery and I want to get a list of the filesystems. The issue is that for the mounted nfs filesystem, I got two entries for it under filesystem attributes. They are almost the same, except they have different "key" -- one is ending with "/" and another is not, as below example
remote_host:/test_export
remote_host:/test_export/

Steps to Reproduce:

  1. create a nfs export on one server, e.g. exporting /test_export on "remote_host"
  2. mount it on a second server
  3. run chef-client or ohai on the second server and check the discovery result

Expected Result:

If I run chef-client, I should see an entry -- "filesystem"->"remote_host:/test_export" on Chef server, with proper attributes under it.

Actual Result:

Two entries are seen, with keys of
remote_host:/test_export
remote_host:/test_export/

Root cause:

After reading the plugin code, I believe this a defect in filesystem plugin (ohai-xxxx/lib/ohai/linux/filesystem.rb). The last part of it is to "grab any missing mount information from /proc/mounts". In /proc/mounts, the filesystem name ends with "/", e.g.
remote_host:/test_export/ /test_mount nfs4 rw,relatime,vers=4,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.114.222.16,minorversion=0,local_lock=none,addr=10.114.222.16 0 0
While commands like df and mount will give the name without the last "/". This leads to the duplicated entries.

@cachamber
Copy link
Contributor

Do you, by chance, have the NFS mounts in /etc/fstab with a trailing "/", or do you mount them with a trailing "/"? If so, you will get this behavior. The fastest way to correct this would be to drop trailing "/" from your mounts.

@lamont-granquist
Copy link
Contributor

Is this replicatable in the filesystem2 plugin?

@tas50
Copy link
Contributor

tas50 commented Nov 30, 2016

Closing this since we haven't gotten a response about filesystem2. Most of these bugs go away with the new filesystem plugin.

@tas50 tas50 closed this as completed Nov 30, 2016
@chef chef locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants