in cookbooks/fb_fstab/libraries/provider.rb [504:618]
def mount_status(desired)
if desired['type'] == 'tmpfs'
return tmpfs_mount_status(desired)
end
key = "#{desired['device']},#{desired['mount_point']}"
fs_data = node.filesystem_data
mounted = nil
if fs_data['by_pair'][key]
mounted = fs_data['by_pair'][key].to_hash
else
key = "#{desired['device']}/,#{desired['mount_point']}"
if fs_data['by_pair'][key]
mounted = fs_data['by_pair'][key].to_hash
end
end
if mounted
Chef::Log.debug(
"fb_fstab: There is an entry in node['filesystem'] for #{key}",
)
if compare_fstype(desired['type'], mounted['fs_type']) ||
(desired['device'].start_with?('/') &&
[desired['type'], mounted['fs_type']].include?('auto'))
Chef::Log.debug(
"fb_fstab: FS #{desired['device']} on #{desired['mount_point']}" +
' is currently mounted...',
)
if compare_opts(desired['opts'], mounted['mount_options'])
Chef::Log.debug('fb_fstab: ... with identical options.')
return :same
else
Chef::Log.debug(
"fb_fstab: ... with different options #{desired['opts']} vs " +
mounted['mount_options'].join(','),
)
Chef::Log.info(
"fb_fstab: #{desired['mount_point']} is mounted with options " +
"#{canonicalize_opts(mounted['mount_options'])} instead of " +
canonicalize_opts(desired['opts']).to_s,
)
return :remount
end
else
Chef::Log.warn(
"fb_fstab: Device #{desired['device']} is mounted at " +
"#{mounted['mount']} as desired, but with fstype " +
"#{mounted['fs_type']} instead of #{desired['type']}",
)
return :conflict
end
end
unless ['nfs', 'nfs4', 'glusterfs'].include?(desired['type'])
device = fs_data['by_device'][desired['device']]
if device && device['mounts'] && !device['mounts'].empty? &&
!(
FB::Fstab.btrfs_subvol?(
device['fs_type'],
device['mount_options'].join(','),
) &&
FB::Fstab.btrfs_subvol?(
desired['type'],
desired['opts'],
) &&
!FB::Fstab.same_subvol?(
device['mounts'][0],
device['mount_options'].join(','),
desired['opts'],
)
)
Chef::Log.warn(
"fb_fstab: #{desired['device']} is at #{device['mounts']}, but" +
" we want it at #{desired['mount_point']}",
)
return :moved
end
end
if fs_data['by_mountpoint'][desired['mount_point']]
devices = fs_data['by_mountpoint'][
desired['mount_point']]['devices']
Chef::Log.warn(
"fb_fstab: Device #{desired['device']} desired at " +
"#{desired['mount_point']} but something #{devices} already " +
'mounted there.',
)
return :conflict
end
:missing
end