OpenMediaVault-Plugin-Developers / openmediavault-zfs

OpenMediaVault plugin for zfs
74 stars 15 forks source link

Degraded ZFS not reported #48

Closed geelenbert closed 3 years ago

geelenbert commented 6 years ago

I'm testing OMV with ZFS on one of my virtual machines. I set up reporting in OVM and check the ZFS ZED box.

Running OMV: 4.1.5-1 openmediavailt-zfs 4.0.2-1

Testing the scenario when one drive fails. Start situation:

root@openmediavault-testing:/etc# zpool status
  pool: TANK
 state: ONLINE
  scan: none requested
config:

        NAME                                                         STATE     READ WRITE CKSUM
        TANK                                                         ONLINE       0     0     0
          mirror-0                                                   ONLINE       0     0     0
            ata-VMware_Virtual_SATA_Hard_Drive_01000000000000000001  ONLINE       0     0     0
            ata-VMware_Virtual_SATA_Hard_Drive_02000000000000000001  ONLINE       0     0     0
          mirror-1                                                   ONLINE       0     0     0
            ata-VMware_Virtual_SATA_Hard_Drive_03000000000000000001  ONLINE       0     0     0
            ata-VMware_Virtual_SATA_Hard_Drive_04000000000000000001  ONLINE       0     0     0

errors: No known data errors

Now I set one drive offline: root@openmediavault-testing:/etc# zpool offline TANK ata-VMware_Virtual_SATA_Hard_Drive_01000000000000000001

This results in a degraded Zpool:

root@openmediavault-testing:/etc# zpool status
  pool: TANK
 state: DEGRADED
status: One or more devices has been taken offline by the administrator.
        Sufficient replicas exist for the pool to continue functioning in a
        degraded state.
action: Online the device using 'zpool online' or replace the device with
        'zpool replace'.
  scan: none requested
config:

        NAME                                                         STATE     READ WRITE CKSUM
        TANK                                                         DEGRADED     0     0     0
          mirror-0                                                   DEGRADED     0     0     0
            ata-VMware_Virtual_SATA_Hard_Drive_01000000000000000001  OFFLINE      0     0     0
            ata-VMware_Virtual_SATA_Hard_Drive_02000000000000000001  ONLINE       0     0     0
          mirror-1                                                   ONLINE       0     0     0
            ata-VMware_Virtual_SATA_Hard_Drive_03000000000000000001  ONLINE       0     0     0
            ata-VMware_Virtual_SATA_Hard_Drive_04000000000000000001  ONLINE       0     0     0

errors: No known data errors

Now I don't get any notification by email, or in the GUI that there is anything wrong with my device.

This does not look like expected behaviour to me.

phschoen commented 4 years ago

even now its stillt the case i think its comes down to the parsing in ZpoolStatus.php But i can not find the code that is generating the notification for the other cases in order to pinpoint the error (new to omv development).

subzero79 commented 4 years ago

The notifications are sent by zfs zed

http://manpages.ubuntu.com/manpages/xenial/man8/zed.8.html

The only thing the plugin checkbox that is configuring zed to use the system root mail. If i am not mistaken is not enabling zed service, maybe it comes disabled by default and we should enabled it with the notification service. Now zed notifies according to scripts in the zed folder which are provided by the zed package. You have to check if the default scripts include a something like that, by i am sure it has as i've degraded pools in my proxmox server (debian 9) and it works.

phschoen commented 4 years ago

so this issue can be closed i guess since its not intended to send notifications in case a manual command is issued unless you force the degraded state with the zpool offline -f option. (see https://github.com/openzfs/zfs/issues/7516)

If the author wants also in this case a notification the notification scrip has to be changed

--- /etc/zfs/zed.d/statechange-notify.sh        2020-04-27 10:47:56.129574210 +0200
+++ ./statechange-notify.sh     2020-04-27 10:47:48.933386922 +0200
@@ -34,6 +34,7 @@

 if [ "${ZEVENT_VDEV_STATE_STR}" != "FAULTED" ] \
         && [ "${ZEVENT_VDEV_STATE_STR}" != "DEGRADED" ] \
+        && [ "${ZEVENT_VDEV_STATE_STR}" != "OFFLINE" ] \
         && [ "${ZEVENT_VDEV_STATE_STR}" != "REMOVED" ]; then
     exit 3
 fi