Accepting request 545008 from Base:System
For fate#316335: Add udev rules for cluster-md to confirm device (forwarded request 545003 from gqjiang) OBS-URL: https://build.opensuse.org/request/show/545008 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mdadm?expand=0&rev=110
This commit is contained in:
commit
837c3e2ed5
93
0059-To-support-clustered-raid10.patch
Normal file
93
0059-To-support-clustered-raid10.patch
Normal file
@ -0,0 +1,93 @@
|
||||
From 5339f99606f19ce1eeadebf3c0849933dc0c6fd5 Mon Sep 17 00:00:00 2001
|
||||
From: Guoqing Jiang <gqjiang@suse.com>
|
||||
Date: Mon, 30 Oct 2017 17:09:51 +0800
|
||||
Subject: [PATCH] To support clustered raid10
|
||||
|
||||
We are now considering to extend clustered raid to
|
||||
support raid10. But only near layout is supported,
|
||||
so make the check when create the array or switch
|
||||
the bitmap from internal to clustered.
|
||||
|
||||
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
|
||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||
---
|
||||
Grow.c | 6 ++++++
|
||||
mdadm.c | 9 +++++++--
|
||||
mdadm.h | 1 +
|
||||
util.c | 11 +++++++++++
|
||||
4 files changed, 25 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Grow.c b/Grow.c
|
||||
index 0f9e89bcc5ba..80176e32c52f 100644
|
||||
--- a/Grow.c
|
||||
+++ b/Grow.c
|
||||
@@ -359,6 +359,12 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
|
||||
|
||||
ncopies = (array.layout & 255) * ((array.layout >> 8) & 255);
|
||||
bitmapsize = bitmapsize * array.raid_disks / ncopies;
|
||||
+
|
||||
+ if (strcmp(s->bitmap_file, "clustered") == 0 &&
|
||||
+ !is_near_layout_10(array.layout)) {
|
||||
+ pr_err("only near layout is supported with clustered raid10\n");
|
||||
+ return 1;
|
||||
+ }
|
||||
}
|
||||
|
||||
st = super_by_fd(fd, &subarray);
|
||||
diff --git a/mdadm.c b/mdadm.c
|
||||
index 7cdcdba7c652..87cb33f84ac2 100644
|
||||
--- a/mdadm.c
|
||||
+++ b/mdadm.c
|
||||
@@ -1542,8 +1542,13 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
|
||||
- if (s.level != 1) {
|
||||
- pr_err("--bitmap=clustered is currently supported with RAID mirror only\n");
|
||||
+ if (s.level != 1 && s.level != 10) {
|
||||
+ pr_err("--bitmap=clustered is currently supported with raid1/10 only\n");
|
||||
+ rv = 1;
|
||||
+ break;
|
||||
+ }
|
||||
+ if (s.level == 10 && !is_near_layout_10(s.layout)) {
|
||||
+ pr_err("only near layout is supported with clustered raid10\n");
|
||||
rv = 1;
|
||||
break;
|
||||
}
|
||||
diff --git a/mdadm.h b/mdadm.h
|
||||
index 85947bf62ff0..3cbf82f18d9e 100644
|
||||
--- a/mdadm.h
|
||||
+++ b/mdadm.h
|
||||
@@ -1434,6 +1434,7 @@ extern int get_linux_version(void);
|
||||
extern int mdadm_version(char *version);
|
||||
extern unsigned long long parse_size(char *size);
|
||||
extern int parse_uuid(char *str, int uuid[4]);
|
||||
+extern int is_near_layout_10(int layout);
|
||||
extern int parse_layout_10(char *layout);
|
||||
extern int parse_layout_faulty(char *layout);
|
||||
extern long parse_num(char *num);
|
||||
diff --git a/util.c b/util.c
|
||||
index c11729e3260e..543ec6cf46ef 100644
|
||||
--- a/util.c
|
||||
+++ b/util.c
|
||||
@@ -397,6 +397,17 @@ unsigned long long parse_size(char *size)
|
||||
return s;
|
||||
}
|
||||
|
||||
+int is_near_layout_10(int layout)
|
||||
+{
|
||||
+ int fc, fo;
|
||||
+
|
||||
+ fc = (layout >> 8) & 255;
|
||||
+ fo = layout & (1 << 16);
|
||||
+ if (fc > 1 || fo > 0)
|
||||
+ return 0;
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
int parse_layout_10(char *layout)
|
||||
{
|
||||
int copies, rv;
|
||||
--
|
||||
2.10.0
|
||||
|
@ -0,0 +1,68 @@
|
||||
From 7a717ada3297bef83c1f70c6baa50ea15ed10fd1 Mon Sep 17 00:00:00 2001
|
||||
From: Guoqing Jiang <gqjiang@suse.com>
|
||||
Date: Wed, 22 Nov 2017 12:59:15 +0800
|
||||
Subject: [PATCH] udev rules: introduce rules for cluster-md to confirm device
|
||||
|
||||
For cluster scenario, add device is different with native raid.
|
||||
When a node issues adds a device, then the node will broadcast
|
||||
a message with UUID to other nodes in the cluster. If receiving
|
||||
node can find the device with the specific UUID, it must confirm
|
||||
the device, otherwise reports it is missing.
|
||||
|
||||
[gqjiang: changed a little bit since difference context in Makefile]
|
||||
|
||||
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
|
||||
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
||||
---
|
||||
Makefile | 6 ++++--
|
||||
udev-md-clustered-confirm-device.rules | 21 +++++++++++++++++++++
|
||||
2 files changed, 25 insertions(+), 2 deletions(-)
|
||||
create mode 100644 udev-md-clustered-confirm-device.rules
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 5fd7f166e7e1..70df31267982 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -291,8 +291,10 @@ install-man: mdadm.8 md.4 mdadm.conf.5 mdmon.8
|
||||
$(INSTALL) -D -m 644 md.4 $(DESTDIR)$(MAN4DIR)/md.4
|
||||
$(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5
|
||||
|
||||
-install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules
|
||||
- @for file in 63-md-raid-arrays.rules 64-md-raid-assembly.rules ; \
|
||||
+install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules \
|
||||
+ udev-md-clustered-confirm-device.rules
|
||||
+ @for file in 63-md-raid-arrays.rules 64-md-raid-assembly.rules \
|
||||
+ 69-md-clustered-confirm-device.rules; \
|
||||
do sed -e 's,BINDIR,$(BINDIR),g' udev-$${file#??-} > .install.tmp.1 && \
|
||||
$(ECHO) $(INSTALL) -D -m 644 udev-$${file#??-} $(DESTDIR)$(UDEVDIR)/rules.d/$$file ; \
|
||||
$(INSTALL) -D -m 644 .install.tmp.1 $(DESTDIR)$(UDEVDIR)/rules.d/$$file ; \
|
||||
diff --git a/udev-md-clustered-confirm-device.rules b/udev-md-clustered-confirm-device.rules
|
||||
new file mode 100644
|
||||
index 000000000000..3e5381e19315
|
||||
--- /dev/null
|
||||
+++ b/udev-md-clustered-confirm-device.rules
|
||||
@@ -0,0 +1,21 @@
|
||||
+# do not edit this file, it will be overwritten on update
|
||||
+
|
||||
+SUBSYSTEM!="block", GOTO="clustermd_end"
|
||||
+
|
||||
+# handle md arrays
|
||||
+KERNEL!="md*", GOTO="clustermd_end"
|
||||
+ENV{DEVTYPE}!="disk", GOTO="clustermd_end"
|
||||
+ACTION!="change", GOTO="clustermd_end"
|
||||
+ENV{EVENT}!="ADD_DEVICE", GOTO="clustermd_end"
|
||||
+ENV{DEVICE_UUID}!="?*", GOTO="clustermd_end"
|
||||
+ENV{RAID_DISK}!="?*", GOTO="clustermd_end"
|
||||
+
|
||||
+# Based on the received UUID, node confirms the device if
|
||||
+# it is found by blkid, otherwise the node reports it is
|
||||
+# missing.
|
||||
+PROGRAM="BINDIR/blkid -o device -t UUID_SUB=$env{DEVICE_UUID}", ENV{.md.newdevice} = "$result"
|
||||
+
|
||||
+ENV{.md.newdevice}!="", RUN+="BINDIR/mdadm --manage $env{DEVNAME} --cluster-confirm $env{RAID_DISK}:$env{.md.newdevice}"
|
||||
+ENV{.md.newdevice}=="", RUN+="BINDIR/mdadm --manage $env{DEVNAME} --cluster-confirm $env{RAID_DISK}:missing"
|
||||
+
|
||||
+LABEL="clustermd_end"
|
||||
--
|
||||
2.10.0
|
||||
|
@ -1,3 +1,21 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Nov 24 01:26:09 UTC 2017 - gqjiang@suse.com
|
||||
|
||||
- Add udev rules for cluster-md to confirm device (fate#316335)
|
||||
0060-udev-rules-introduce-rules-for-cluster-md-to-confirm.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 23 13:40:30 UTC 2017 - rbrown@suse.com
|
||||
|
||||
- Replace references to /var/adm/fillup-templates with new
|
||||
%_fillupdir macro (boo#1069468)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Nov 15 01:27:06 UTC 2017 - gqjiang@suse.com
|
||||
|
||||
- Add one mdadm patch to support clustered raid10 (fate#323171)
|
||||
0059-To-support-clustered-raid10.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Aug 21 16:44:54 UTC 2017 - colyli@suse.com
|
||||
|
||||
|
18
mdadm.spec
18
mdadm.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package mdadm
|
||||
#
|
||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2017 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -16,6 +16,11 @@
|
||||
#
|
||||
|
||||
|
||||
#Compat macro for new _fillupdir macro introduced in Nov 2017
|
||||
%if ! %{defined _fillupdir}
|
||||
%define _fillupdir /var/adm/fillup-templates
|
||||
%endif
|
||||
|
||||
Name: mdadm
|
||||
Version: 4.0
|
||||
Release: 0
|
||||
@ -97,6 +102,8 @@ Patch55: 0055-Allow-more-spare-selection-criteria.patch
|
||||
Patch56: 0056-Add-sector-size-as-spare-selection-criterion.patch
|
||||
Patch57: 0057-super1-fix-sb-max_dev-when-adding-a-new-disk-in-line.patch
|
||||
Patch58: 0058-super1-only-set-clustered-flag-when-bitmap-is-presen.patch
|
||||
Patch59: 0059-To-support-clustered-raid10.patch
|
||||
Patch60: 0060-udev-rules-introduce-rules-for-cluster-md-to-confirm.patch
|
||||
Patch1000: 1000-The-mdcheck-script-now-adds-messages-to-the-system.patch
|
||||
|
||||
%define _udevdir %(pkg-config --variable=udevdir udev)
|
||||
@ -167,6 +174,8 @@ programs but with a very different interface.
|
||||
%patch56 -p1
|
||||
%patch57 -p1
|
||||
%patch58 -p1
|
||||
%patch59 -p1
|
||||
%patch60 -p1
|
||||
%patch1000 -p1
|
||||
|
||||
%build
|
||||
@ -178,14 +187,14 @@ sgml2txt Software-RAID.HOWTO.sgml
|
||||
%install
|
||||
make install install-systemd install-udev DESTDIR=%{buildroot} SYSTEMD_DIR=%{_unitdir} UDEVDIR=%{_udevdir} SUSE=yes
|
||||
rm -rf %{buildroot}/lib/udev
|
||||
install -d %{buildroot}%{_var}/adm/fillup-templates
|
||||
install -d %{buildroot}%{_fillupdir}
|
||||
install -d %{buildroot}/usr/share/mdadm
|
||||
install -m 755 misc/mdcheck %{buildroot}/usr/share/mdadm/mdcheck
|
||||
install -d %{buildroot}/etc/cron.daily
|
||||
install -d %{buildroot}/etc/cron.d
|
||||
install -m 755 %{S:7} %{buildroot}/etc/cron.daily/mdadm
|
||||
install -m 644 %{S:3} %{buildroot}/etc/cron.d/mdadm
|
||||
install -m 644 %{S:2} %{buildroot}%{_var}/adm/fillup-templates/
|
||||
install -m 644 %{S:2} %{buildroot}%{_fillupdir}/
|
||||
install -d %{buildroot}%{_systemdshutdowndir}
|
||||
install -d %{buildroot}%{_sbindir}
|
||||
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcmdmonitor
|
||||
@ -219,9 +228,10 @@ ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcmdmonitor
|
||||
%{_sbindir}/rcmdmonitor
|
||||
%dir /usr/share/mdadm
|
||||
/usr/share/mdadm/*
|
||||
%{_var}/adm/fillup-templates/sysconfig.mdadm
|
||||
%{_fillupdir}/sysconfig.mdadm
|
||||
%{_udevdir}/rules.d/63-md-raid-arrays.rules
|
||||
%{_udevdir}/rules.d/64-md-raid-assembly.rules
|
||||
%{_udevdir}/rules.d/69-md-clustered-confirm-device.rules
|
||||
%dir /etc/cron.daily
|
||||
/etc/cron.daily/mdadm
|
||||
%dir /etc/cron.d
|
||||
|
Loading…
Reference in New Issue
Block a user