|
|
2792dd |
From 1c294b5d960abeeb9e0f188af294d019bc82b20e Mon Sep 17 00:00:00 2001
|
|
|
2792dd |
From: Lidong Zhong <lidong.zhong@suse.com>
|
|
|
2792dd |
Date: Tue, 14 Apr 2020 16:19:41 +0800
|
|
|
2792dd |
Subject: [RHEL7.9 PATCH 72/77] Detail: adding sync status for cluster device
|
|
|
2792dd |
|
|
|
2792dd |
On the node with /proc/mdstat is
|
|
|
2792dd |
|
|
|
2792dd |
Personalities : [raid1]
|
|
|
2792dd |
md0 : active raid1 sdb[4] sdc[3] sdd[2]
|
|
|
2792dd |
1046528 blocks super 1.2 [3/2] [UU_]
|
|
|
2792dd |
recover=REMOTE
|
|
|
2792dd |
bitmap: 1/1 pages [4KB], 65536KB chunk
|
|
|
2792dd |
|
|
|
2792dd |
Let's change the 'State' of 'mdadm -Q -D' accordingly
|
|
|
2792dd |
State : clean, degraded
|
|
|
2792dd |
With this patch, it will be
|
|
|
2792dd |
State : clean, degraded, recovering (REMOTE)
|
|
|
2792dd |
|
|
|
2792dd |
Signed-off-by: Lidong Zhong <lidong.zhong@suse.com>
|
|
|
2792dd |
Acked-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
|
|
|
2792dd |
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
|
2792dd |
---
|
|
|
2792dd |
Detail.c | 9 ++++++---
|
|
|
2792dd |
mdadm.h | 3 ++-
|
|
|
2792dd |
mdstat.c | 2 ++
|
|
|
2792dd |
3 files changed, 10 insertions(+), 4 deletions(-)
|
|
|
2792dd |
|
|
|
2792dd |
diff --git a/Detail.c b/Detail.c
|
|
|
2792dd |
index daec4f1..24eeba0 100644
|
|
|
2792dd |
--- a/Detail.c
|
|
|
2792dd |
+++ b/Detail.c
|
|
|
2792dd |
@@ -498,17 +498,20 @@ int Detail(char *dev, struct context *c)
|
|
|
2792dd |
} else
|
|
|
2792dd |
arrayst = "active";
|
|
|
2792dd |
|
|
|
2792dd |
- printf(" State : %s%s%s%s%s%s \n",
|
|
|
2792dd |
+ printf(" State : %s%s%s%s%s%s%s \n",
|
|
|
2792dd |
arrayst, st,
|
|
|
2792dd |
(!e || (e->percent < 0 &&
|
|
|
2792dd |
e->percent != RESYNC_PENDING &&
|
|
|
2792dd |
- e->percent != RESYNC_DELAYED)) ?
|
|
|
2792dd |
+ e->percent != RESYNC_DELAYED &&
|
|
|
2792dd |
+ e->percent != RESYNC_REMOTE)) ?
|
|
|
2792dd |
"" : sync_action[e->resync],
|
|
|
2792dd |
larray_size ? "": ", Not Started",
|
|
|
2792dd |
(e && e->percent == RESYNC_DELAYED) ?
|
|
|
2792dd |
" (DELAYED)": "",
|
|
|
2792dd |
(e && e->percent == RESYNC_PENDING) ?
|
|
|
2792dd |
- " (PENDING)": "");
|
|
|
2792dd |
+ " (PENDING)": "",
|
|
|
2792dd |
+ (e && e->percent == RESYNC_REMOTE) ?
|
|
|
2792dd |
+ " (REMOTE)": "");
|
|
|
2792dd |
} else if (inactive && !is_container) {
|
|
|
2792dd |
printf(" State : inactive\n");
|
|
|
2792dd |
}
|
|
|
2792dd |
diff --git a/mdadm.h b/mdadm.h
|
|
|
2792dd |
index d94569f..399478b 100644
|
|
|
2792dd |
--- a/mdadm.h
|
|
|
2792dd |
+++ b/mdadm.h
|
|
|
2792dd |
@@ -1815,7 +1815,8 @@ enum r0layout {
|
|
|
2792dd |
#define RESYNC_NONE -1
|
|
|
2792dd |
#define RESYNC_DELAYED -2
|
|
|
2792dd |
#define RESYNC_PENDING -3
|
|
|
2792dd |
-#define RESYNC_UNKNOWN -4
|
|
|
2792dd |
+#define RESYNC_REMOTE -4
|
|
|
2792dd |
+#define RESYNC_UNKNOWN -5
|
|
|
2792dd |
|
|
|
2792dd |
/* When using "GET_DISK_INFO" it isn't certain how high
|
|
|
2792dd |
* we need to check. So we impose an absolute limit of
|
|
|
2792dd |
diff --git a/mdstat.c b/mdstat.c
|
|
|
2792dd |
index 7e600d0..20577a3 100644
|
|
|
2792dd |
--- a/mdstat.c
|
|
|
2792dd |
+++ b/mdstat.c
|
|
|
2792dd |
@@ -257,6 +257,8 @@ struct mdstat_ent *mdstat_read(int hold, int start)
|
|
|
2792dd |
ent->percent = RESYNC_DELAYED;
|
|
|
2792dd |
if (l > 8 && strcmp(w+l-8, "=PENDING") == 0)
|
|
|
2792dd |
ent->percent = RESYNC_PENDING;
|
|
|
2792dd |
+ if (l > 7 && strcmp(w+l-7, "=REMOTE") == 0)
|
|
|
2792dd |
+ ent->percent = RESYNC_REMOTE;
|
|
|
2792dd |
} else if (ent->percent == RESYNC_NONE &&
|
|
|
2792dd |
w[0] >= '0' &&
|
|
|
2792dd |
w[0] <= '9' &&
|
|
|
2792dd |
--
|
|
|
2792dd |
2.7.5
|
|
|
2792dd |
|