We've got some updates regarding OBS and GitHub/GitLab integration. Have a look and let us know what you think! 🧐

https://openbuildservice.org/2021/06/14/scm-integration-improvements/

File 0132-Monitor-check_array-Get-nr_disks-active_disks-and-sp.patch of Package mdadm.7989

From b98943a4f889b466a3d07264068042b18c620d33 Mon Sep 17 00:00:00 2001
From: Jes Sorensen <jsorensen@fb.com>
Date: Tue, 9 May 2017 17:03:03 -0400
Subject: [PATCH] Monitor/check_array: Get nr_disks, active_disks and
 spare_disks from sysfs
Git-commit: b98943a4f889b466a3d07264068042b18c620d33
Patch-mainline: mdadm-4.0+
References: bsc#1069165, bsc#1069167, bsc#1068030

This leaves working_disks and utime missing before we can eliminate
check_array()'s call to md_get_array_info()

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Signed-off-by: Coly Li <colyli@suse.de>

---
 Monitor.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/Monitor.c b/Monitor.c
index fe6f2b4..2204528 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -482,7 +482,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
 		strcpy(st->devnm, fd2devnm(fd));
 
 	sra = sysfs_read(-1, st->devnm, GET_LEVEL | GET_DISKS | GET_DEGRADED |
-			 GET_MISMATCH);
+			 GET_MISMATCH | GET_DEVS | GET_STATE);
 	if (!sra)
 		goto disappeared;
 
@@ -525,7 +525,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
 
 	if (st->utime == array.utime && st->failed == sra->array.failed_disks &&
 	    st->working == array.working_disks &&
-	    st->spare == array.spare_disks &&
+	    st->spare == sra->array.spare_disks &&
 	    (mse == NULL  || (mse->percent == st->percent))) {
 		if ((st->active < st->raid) && st->spare == 0)
 			retval = 1;
@@ -535,8 +535,8 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
 	    mse->pattern && strchr(mse->pattern, '_') /* degraded */)
 		alert("DegradedArray", dev, NULL, ainfo);
 
-	if (st->utime == 0 && /* new array */
-	    st->expected_spares > 0 && array.spare_disks < st->expected_spares)
+	if (st->utime == 0 && /* new array */ st->expected_spares > 0 &&
+	    sra->array.spare_disks < st->expected_spares)
 		alert("SparesMissing", dev, NULL, ainfo);
 	if (st->percent < 0 && st->percent != RESYNC_UNKNOWN &&
 	    mse->percent >= 0)
@@ -574,7 +574,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
 	}
 	st->percent = mse->percent;
 
-	remaining_disks = array.nr_disks;
+	remaining_disks = sra->array.nr_disks;
 	for (i = 0; i < MAX_DISKS && remaining_disks > 0; i++) {
 		mdu_disk_info_t disc;
 		disc.number = i;
@@ -636,9 +636,9 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
 		st->devstate[i] = newstate;
 		st->devid[i] = makedev(disc.major, disc.minor);
 	}
-	st->active = array.active_disks;
+	st->active = sra->array.active_disks;
 	st->working = array.working_disks;
-	st->spare = array.spare_disks;
+	st->spare = sra->array.spare_disks;
 	st->failed = sra->array.failed_disks;
 	st->utime = array.utime;
 	st->raid = sra->array.raid_disks;
-- 
2.13.6
openSUSE Build Service is sponsored by