jcnelson / vdev

A device-file manager for *nix
GNU General Public License v3.0
101 stars 13 forks source link

disk.sh Observation/Question #91

Closed suedi closed 8 years ago

suedi commented 8 years ago
   if [ -x /sbin/pvs ]; then 
      PVS="/sbin/pvs --nameprefixes --noheadings $VDEV_MOUNTPOINT/$VDEV_PATH"
      PVS_DATA="$($PVS -o pv_uuid 2>"$VDEV_MOUNTPOINT/null")"
      PVS_RC=$?
   else
      vdev_warn "Could not find pvs in /sbin/pvs.  LVM physical volume symlinks in $VDEV_MOUNTPOINT/disk/by-id will not be created."
   fi

About the vdev_warn "Could not find pvs ...

I don't use pvs but have a lot of loop devices so this code path is taken a lot of times like 46 lines in my most recent log.

I think this is a little verbose and only serves to clutter up the logs, true even if you use logelevel=warn

I solved it locally by replacing vdev_warn with vdev_log and that works for me but might not be an optimal solution.

I think the message is important but ideally would only want it once in log.

I am not sure how to achieve this?

Do you have any input?

jcnelson commented 8 years ago

Hi @suedi,

vdev_warn has a higher priority than vdev_log, which is why vdev_log will print nothing when loglevel=warn is set, but vdev_warn will.

I just pushed some code that lets helpers record and test underlying features of the OS (such as the absence of a program like pvs). The patch uses this mechanism to record when it has already tried using pvs (and failed), so it won't log the absence of pvs more than once.

Hope this helps!

suedi commented 8 years ago

This helps! I like it --- Good Job Jude :+1:

checkout my log with warn log level

02155:00007FB33DCB1700: [          vdev.c:0395] vdev_error_thread_main: ERROR: [helpers] [WARN]: Could not find pvs in /sbin/pvs.  LVM physical volume symlinks in /dev/disk/by-id will not be created.
parent: all initial devices processed

closing...