Puppet: System Administration Automated

Support

Ticket #702 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

Large devices and/or long device names cause repeated mounts and no fstab entries

Reported by: mwr Assigned to: luke
Priority: normal Milestone: beaker
Component: library Version:
Severity: normal Keywords: mount, fstab, df
Cc: Triage Stage: Accepted
Attached Patches: None Complexity: Unknown

Description

Original mailing list posting

It appears that provider/mount.rb doesn't handle multi-line entries from df, so

        execute(df).split("\n").find do |line|
            fs = line.split(/\s+/)[-1]

may need to be modified to account for df output similar to the following:

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1            840369832   1000792 796680724   1% /
tmpfs                  1038308         0   1038308   0% /lib/init/rw
udev                     10240        48     10192   1% /dev
tmpfs                  1038308         0   1038308   0% /dev/shm
/dev/mapper/md1000-home
                     9516347392 1136722752 8379624640  12% /home/CAE

Perhaps it'd be easier to parse the output from mount instead of from df?

/dev/sda1 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
/dev/mapper/md1000-home on /home/CAE type xfs (rw)
rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)

Attachments

df.patch (0.8 kB) - added by spheromak on 07/10/07 21:59:07.
patch to check kernel and use df -P on linux

Change History

07/04/07 21:37:27 changed by luke

  • status changed from new to assigned.
  • stage changed from Unreviewed to Accepted.
  • milestone set to beaker.

07/07/07 11:21:51 changed by spheromak

using df -P would fix this (puts all the output on a single line).

this works with gnu df. I don't think the -P option exists on many if any ? other df implementations tho.

07/07/07 12:15:52 changed by spheromak

i tried to implement this simple fix for my current platform, but i still am not getting a fstab written out on my changes. my debugging shows that its pulling the right df output however:

what might i be missing ?

# diff provider/mount.rb provider/mount_orig.rb
41c41
<         case Facter["kernel"].value
---
>         case Facter["operatingsystem"].value
43,44c43
<         when "SunOS": df << "-k"
<       when "Linux": df << "-P"
---
>         when "Solaris": df << "-k"
46d44
<
49,50d46
<           Puppet.debug "Raw: %s" % line
<           Puppet.debug "Parsed: %s" % line.split(/\s+/)[-1]

heres the debug output showing that the parse went ok, but like i said still no write or change to the mounted state:

notice: Starting configuration run
debug: Prefetching parsed resources for mount
debug: Prefetching parsed resources for host
debug: Mount[usr](provider=parsed): Executing '/bin/df -P'
debug: Raw: Filesystem         1024-blocks      Used Available Capacity Mounted on
debug: Parsed: on
debug: Raw: /dev/sda2              1968528    250380   1618148      14% /
debug: Parsed: /
debug: Raw: /dev/sda1               243999     13621    217781       6% /boot
debug: Parsed: /boot
debug: Raw: tmpfs                   513480         0    513480       0% /dev/shm
debug: Parsed: /dev/shm
debug: Raw: /dev/mapper/vg01-opt   4128448    359156   3559580      10% /opt
debug: Parsed: /opt
debug: Raw: /dev/mapper/vg01-tmp   4128448    131280   3787456       4% /tmp
debug: Parsed: /tmp
debug: Raw: /dev/mapper/vg01-usr   4128448    626292   3292444      16% /usr
debug: Parsed: /usr
debug: //sfptrk01/centos_mounts/Mount[usr]: Changing options,pass,dump
debug: //sfptrk01/centos_mounts/Mount[usr]: 3 change(s)
notice: //sfptrk01/centos_mounts/Mount[usr]/options: defined 'options' as 'nodev,noatime,nosuid'
notice: //sfptrk01/centos_mounts/Mount[usr]/pass: defined 'pass' as '0'
notice: //sfptrk01/centos_mounts/Mount[usr]/dump: defined 'dump' as '0'
debug: Flushing mount provider target /etc/fstab
notice: //sfptrk01/centos_mounts/Mount[usr]: Refreshing self
info: Mount[usr](provider=parsed): Remounting
debug: mount provider parsed: Executing '/bin/mount -o remount /usr'
debug: Finishing transaction 23456259884500 with 3 changes
debug: Storing state
debug: Stored state in 0.07 seconds
notice: Finished configuration run in 0.23 seconds

07/10/07 21:59:07 changed by spheromak

  • attachment df.patch added.

patch to check kernel and use df -P on linux

07/18/07 22:41:09 changed by luke

  • status changed from assigned to closed.
  • resolution set to fixed.

Fixing the long names problem in [2707] by switching to 'mount' instead of 'df'. I cannot reproduce the "not writing mounts" problem, so I think I fixed it in the recent changes to Parsed File?. Please test that, and if it's still broken open a new bug specifically for that.