Whamcloud - gitweb
LU-16479 utils: Add option to manage degraded ZFS OST 60/49660/6
authorAkash B <akash-b@hpe.com>
Tue, 17 Jan 2023 15:51:19 +0000 (10:51 -0500)
committerOleg Drokin <green@whamcloud.com>
Tue, 14 Feb 2023 06:04:47 +0000 (06:04 +0000)
Add new Lustre specific ZFS dataset user property to
control/manage degraded ZFS OSTs, also modify the existing
lustre/scripts/statechange-lustre.sh zedlet accordingly.
Extend the same to mkfs.lustre utility to add this property
by default when creating a new Lustre ZFS server.

HPE-bug-id: LUS-11447
Test-Parameters: trivial fstype=zfs testlist=sanity
Signed-off-by: Akash B <akash-b@hpe.com>
Change-Id: I7032538f507c9ad20d5b109b54e3c3bab8138458
Reviewed-by: Dipak Ghosh <dipak.ghosh@hpe.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49660
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Siddarth Raj <siddarth.raj@hpe.com>
Reviewed-by: Nikitas Angelinas <nikitas.angelinas@hpe.com>
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
lustre/include/uapi/linux/lustre/lustre_param.h
lustre/mgs/mgs_llog.c
lustre/scripts/statechange-lustre.sh
lustre/utils/mkfs_lustre.c

index 8b91770..e9df823 100644 (file)
@@ -70,6 +70,7 @@
 #define PARAM_ID_UPCALL                "identity_upcall="  /* identity upcall */
 #define PARAM_ROOTSQUASH          "root_squash="      /* root squash */
 #define PARAM_NOSQUASHNIDS        "nosquash_nids="    /* no squash nids */
+#define PARAM_AUTODEGRADE         "autodegrade="      /* autodegrade OST's */
 
 /* Prefixes for parameters handled by obd's proc methods (XXX_process_config) */
 #define PARAM_OST              "ost."
index 58a57c2..ddb4adc 100644 (file)
@@ -4385,6 +4385,10 @@ active_err:
                GOTO(end, rc);
        }
 
+       /* For handling degraded zfs OST */
+       if (class_match_param(ptr, PARAM_AUTODEGRADE, NULL) == 0)
+               GOTO(end, rc);
+
         LCONSOLE_WARN("Ignoring unrecognized param '%s'\n", ptr);
 
 end:
index b06e490..f7b08dd 100755 (executable)
@@ -53,14 +53,17 @@ sync_degrade_state()
        local dataset="$1"
        local state="$2"
        local service=$($ZFS list -H -o lustre:svname ${dataset})
-
-       zed_log_msg "Lustre:sync_degrade_state pool:${dataset} degraded:${state}"
+       local autodegrade=$($ZFS get -rH -s local -t filesystem -o value \
+                           lustre:autodegrade ${dataset})
 
        if [ -n "${service}" ] && [ "${service}" != "-" ] ; then
                local current=$($LCTL get_param -n obdfilter.${service}.degraded)
 
-               if [ "${current}" != "${state}" ] ; then
+               if [ "${current}" != "${state}" ] &&
+                  [ "${autodegrade}" == "on" ] ; then
                        $LCTL set_param obdfilter.${service}.degraded=${state}
+                       ds_state="pool:${dataset} degraded:${state}"
+                       zed_log_msg "Lustre:sync_degrade_state $ds_state"
                fi
        fi
 }
index 251b57b..94d35ce 100644 (file)
@@ -765,6 +765,13 @@ int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop,
                }
        }
 
+       if (ldd->ldd_mount_type == LDD_MT_ZFS &&
+           (ldd->ldd_flags & LDD_F_SV_TYPE_OST)) {
+               rc = add_param(ldd->ldd_params, PARAM_AUTODEGRADE, "on");
+               if (rc)
+                       return rc;
+       }
+
        if (strlen(new_fsname) > 0) {
                if (!(mop->mo_flags & (MO_FORCEFORMAT | MO_RENAME)) &&
                    (!(ldd->ldd_flags & (LDD_F_VIRGIN | LDD_F_WRITECONF)))) {