* [PATCH] udev rules: introduce rules for cluster-md to confirm device
@ 2017-08-01 3:15 Guoqing Jiang
2017-08-01 4:40 ` NeilBrown
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Guoqing Jiang @ 2017-08-01 3:15 UTC (permalink / raw)
To: linux-raid; +Cc: jes.sorensen, neilb, Guoqing Jiang
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.
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
---
Makefile | 6 ++++--
udev-md-clustered-confirm-device.rules | 20 ++++++++++++++++++++
2 files changed, 24 insertions(+), 2 deletions(-)
create mode 100644 udev-md-clustered-confirm-device.rules
diff --git a/Makefile b/Makefile
index 021d3ad..0977f27 100644
--- a/Makefile
+++ b/Makefile
@@ -256,8 +256,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 udev-md-raid-creating.rules
- @for file in 01-md-raid-creating.rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules ; \
+install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules udev-md-raid-creating.rules \
+ udev-md-clustered-confirm-device.rules
+ @for file in 01-md-raid-creating.rules 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 0000000..d763e27
--- /dev/null
+++ b/udev-md-clustered-confirm-device.rules
@@ -0,0 +1,20 @@
+# 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"
+
+# Based on the received UUID, node confirms the device if
+# it is found by blkid, otherwise the node reports it is
+# missing.
+ACTION=="change", ENV{EVENT}=="ADD_DEVICE", ENV{DEVICE_UUID}=="?*", ENV{RAID_DISK}=="?*", \
+PROGRAM="BINDIR/blkid -o device -t UUID_SUB=$env{DEVICE_UUID}", RESULT!="", \
+RUN+="BINDIR/mdadm --manage $env{DEVNAME} --cluster-confirm $env{RAID_DISK}:$result"
+
+ACTION=="change", ENV{EVENT}=="ADD_DEVICE", ENV{DEVICE_UUID}=="?*", ENV{RAID_DISK}=="?*", \
+PROGRAM="BINDIR/blkid -o device -t UUID_SUB=$env{DEVICE_UUID}", RESULT=="", \
+RUN+="BINDIR/mdadm --manage $env{DEVNAME} --cluster-confirm $env{RAID_DISK}:missing"
+
+LABEL="clustermd_end"
--
2.10.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] udev rules: introduce rules for cluster-md to confirm device
2017-08-01 3:15 [PATCH] udev rules: introduce rules for cluster-md to confirm device Guoqing Jiang
@ 2017-08-01 4:40 ` NeilBrown
2017-08-01 8:05 ` Guoqing Jiang
2017-08-01 8:19 ` [PATCH V2] " Guoqing Jiang
2017-08-02 2:05 ` [PATCH v3] " Guoqing Jiang
2 siblings, 1 reply; 11+ messages in thread
From: NeilBrown @ 2017-08-01 4:40 UTC (permalink / raw)
To: linux-raid; +Cc: jes.sorensen, Guoqing Jiang
[-- Attachment #1: Type: text/plain, Size: 3275 bytes --]
On Tue, Aug 01 2017, Guoqing Jiang wrote:
> 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.
>
> Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
> ---
> Makefile | 6 ++++--
> udev-md-clustered-confirm-device.rules | 20 ++++++++++++++++++++
> 2 files changed, 24 insertions(+), 2 deletions(-)
> create mode 100644 udev-md-clustered-confirm-device.rules
>
> diff --git a/Makefile b/Makefile
> index 021d3ad..0977f27 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -256,8 +256,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 udev-md-raid-creating.rules
> - @for file in 01-md-raid-creating.rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules ; \
> +install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules udev-md-raid-creating.rules \
> + udev-md-clustered-confirm-device.rules
> + @for file in 01-md-raid-creating.rules 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 0000000..d763e27
> --- /dev/null
> +++ b/udev-md-clustered-confirm-device.rules
> @@ -0,0 +1,20 @@
> +# 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"
> +
> +# Based on the received UUID, node confirms the device if
> +# it is found by blkid, otherwise the node reports it is
> +# missing.
> +ACTION=="change", ENV{EVENT}=="ADD_DEVICE", ENV{DEVICE_UUID}=="?*", ENV{RAID_DISK}=="?*", \
> +PROGRAM="BINDIR/blkid -o device -t UUID_SUB=$env{DEVICE_UUID}", RESULT!="", \
> +RUN+="BINDIR/mdadm --manage $env{DEVNAME} --cluster-confirm $env{RAID_DISK}:$result"
> +
> +ACTION=="change", ENV{EVENT}=="ADD_DEVICE", ENV{DEVICE_UUID}=="?*", ENV{RAID_DISK}=="?*", \
> +PROGRAM="BINDIR/blkid -o device -t UUID_SUB=$env{DEVICE_UUID}", RESULT=="", \
> +RUN+="BINDIR/mdadm --manage $env{DEVNAME} --cluster-confirm $env{RAID_DISK}:missing"
> +
> +LABEL="clustermd_end"
> --
> 2.10.0
This can run "blkid" twice, which seems wasteful.
I think it would be best to skip to the end if ACTION != "change" and if
event != ADD_DEVICE etc.
Then
PROGRAM="BINDIR/blkid -o device -t UUID_SUB=$env{DEVICE_UUID}", ENV{".mdadm.blkid"} = "$result"
Then have two rules which tests ENV{".mdadm.blkid"} and run one of the
two mdadm commands.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] udev rules: introduce rules for cluster-md to confirm device
2017-08-01 4:40 ` NeilBrown
@ 2017-08-01 8:05 ` Guoqing Jiang
0 siblings, 0 replies; 11+ messages in thread
From: Guoqing Jiang @ 2017-08-01 8:05 UTC (permalink / raw)
To: NeilBrown, linux-raid; +Cc: jes.sorensen
On 08/01/2017 12:40 PM, NeilBrown wrote:
> On Tue, Aug 01 2017, Guoqing Jiang wrote:
>
>> 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.
>>
>> Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
>> ---
>> Makefile | 6 ++++--
>> udev-md-clustered-confirm-device.rules | 20 ++++++++++++++++++++
>> 2 files changed, 24 insertions(+), 2 deletions(-)
>> create mode 100644 udev-md-clustered-confirm-device.rules
>>
>> diff --git a/Makefile b/Makefile
>> index 021d3ad..0977f27 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -256,8 +256,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 udev-md-raid-creating.rules
>> - @for file in 01-md-raid-creating.rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules ; \
>> +install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules udev-md-raid-creating.rules \
>> + udev-md-clustered-confirm-device.rules
>> + @for file in 01-md-raid-creating.rules 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 0000000..d763e27
>> --- /dev/null
>> +++ b/udev-md-clustered-confirm-device.rules
>> @@ -0,0 +1,20 @@
>> +# 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"
>> +
>> +# Based on the received UUID, node confirms the device if
>> +# it is found by blkid, otherwise the node reports it is
>> +# missing.
>> +ACTION=="change", ENV{EVENT}=="ADD_DEVICE", ENV{DEVICE_UUID}=="?*", ENV{RAID_DISK}=="?*", \
>> +PROGRAM="BINDIR/blkid -o device -t UUID_SUB=$env{DEVICE_UUID}", RESULT!="", \
>> +RUN+="BINDIR/mdadm --manage $env{DEVNAME} --cluster-confirm $env{RAID_DISK}:$result"
>> +
>> +ACTION=="change", ENV{EVENT}=="ADD_DEVICE", ENV{DEVICE_UUID}=="?*", ENV{RAID_DISK}=="?*", \
>> +PROGRAM="BINDIR/blkid -o device -t UUID_SUB=$env{DEVICE_UUID}", RESULT=="", \
>> +RUN+="BINDIR/mdadm --manage $env{DEVNAME} --cluster-confirm $env{RAID_DISK}:missing"
>> +
>> +LABEL="clustermd_end"
>> --
>> 2.10.0
> This can run "blkid" twice, which seems wasteful.
> I think it would be best to skip to the end if ACTION != "change" and if
> event != ADD_DEVICE etc.
> Then
> PROGRAM="BINDIR/blkid -o device -t UUID_SUB=$env{DEVICE_UUID}", ENV{".mdadm.blkid"} = "$result"
>
> Then have two rules which tests ENV{".mdadm.blkid"} and run one of the
> two mdadm commands.
Thanks for the suggestion! I will send v2 soon.
Cheers,
Guoqing
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH V2] udev rules: introduce rules for cluster-md to confirm device
2017-08-01 3:15 [PATCH] udev rules: introduce rules for cluster-md to confirm device Guoqing Jiang
2017-08-01 4:40 ` NeilBrown
@ 2017-08-01 8:19 ` Guoqing Jiang
2017-08-01 21:15 ` NeilBrown
2017-08-02 2:05 ` [PATCH v3] " Guoqing Jiang
2 siblings, 1 reply; 11+ messages in thread
From: Guoqing Jiang @ 2017-08-01 8:19 UTC (permalink / raw)
To: linux-raid; +Cc: jes.sorensen, neilb, Guoqing Jiang
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.
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
---
Makefile | 6 ++++--
udev-md-clustered-confirm-device.rules | 20 ++++++++++++++++++++
2 files changed, 24 insertions(+), 2 deletions(-)
create mode 100644 udev-md-clustered-confirm-device.rules
diff --git a/Makefile b/Makefile
index 021d3ad..0977f27 100644
--- a/Makefile
+++ b/Makefile
@@ -256,8 +256,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 udev-md-raid-creating.rules
- @for file in 01-md-raid-creating.rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules ; \
+install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules udev-md-raid-creating.rules \
+ udev-md-clustered-confirm-device.rules
+ @for file in 01-md-raid-creating.rules 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 0000000..08ac74a
--- /dev/null
+++ b/udev-md-clustered-confirm-device.rules
@@ -0,0 +1,20 @@
+# 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"
+
+# Based on the received UUID, node confirms the device if
+# it is found by blkid, otherwise the node reports it is
+# missing.
+ACTION=="change", ENV{EVENT}=="ADD_DEVICE", ENV{DEVICE_UUID}=="?*", ENV{RAID_DISK}=="?*", \
+PROGRAM="BINDIR/blkid -o device -t UUID_SUB=$env{DEVICE_UUID}", ENV{device} = "$result"
+
+ENV{device}!="", RUN+="BINDIR/mdadm --manage $env{DEVNAME} --cluster-confirm $env{RAID_DISK}:$env{device}"
+ENV{device}=="", RUN+="BINDIR/mdadm --manage $env{DEVNAME} --cluster-confirm $env{RAID_DISK}:missing"
+
+LABEL="clustermd_end"
--
2.10.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH V2] udev rules: introduce rules for cluster-md to confirm device
2017-08-01 8:19 ` [PATCH V2] " Guoqing Jiang
@ 2017-08-01 21:15 ` NeilBrown
2017-08-02 1:53 ` Guoqing Jiang
0 siblings, 1 reply; 11+ messages in thread
From: NeilBrown @ 2017-08-01 21:15 UTC (permalink / raw)
To: linux-raid; +Cc: jes.sorensen, Guoqing Jiang
[-- Attachment #1: Type: text/plain, Size: 3358 bytes --]
On Tue, Aug 01 2017, Guoqing Jiang wrote:
> 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.
>
> Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
> ---
> Makefile | 6 ++++--
> udev-md-clustered-confirm-device.rules | 20 ++++++++++++++++++++
> 2 files changed, 24 insertions(+), 2 deletions(-)
> create mode 100644 udev-md-clustered-confirm-device.rules
>
> diff --git a/Makefile b/Makefile
> index 021d3ad..0977f27 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -256,8 +256,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 udev-md-raid-creating.rules
> - @for file in 01-md-raid-creating.rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules ; \
> +install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules udev-md-raid-creating.rules \
> + udev-md-clustered-confirm-device.rules
> + @for file in 01-md-raid-creating.rules 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 0000000..08ac74a
> --- /dev/null
> +++ b/udev-md-clustered-confirm-device.rules
> @@ -0,0 +1,20 @@
> +# 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"
Move these here is good.
> +
> +# Based on the received UUID, node confirms the device if
> +# it is found by blkid, otherwise the node reports it is
> +# missing.
> +ACTION=="change", ENV{EVENT}=="ADD_DEVICE", ENV{DEVICE_UUID}=="?*", ENV{RAID_DISK}=="?*", \
leaving them here as well is careless. Maybe move the tests on
DEVICE_UUID and RAID_DISK up to the "goto" section too.
> +PROGRAM="BINDIR/blkid -o device -t UUID_SUB=$env{DEVICE_UUID}", ENV{device} = "$result"
I don't think using a generic environment name like "device" is a good
idea.
This will get included in the udev database.
At least include "md" or "mdadm" in the name so people know what it
means.
In my example I put a "." at the start. This cause the name to be
excluded from the udev database.
NeilBrown
> +
> +ENV{device}!="", RUN+="BINDIR/mdadm --manage $env{DEVNAME} --cluster-confirm $env{RAID_DISK}:$env{device}"
> +ENV{device}=="", RUN+="BINDIR/mdadm --manage $env{DEVNAME} --cluster-confirm $env{RAID_DISK}:missing"
> +
> +LABEL="clustermd_end"
> --
> 2.10.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH V2] udev rules: introduce rules for cluster-md to confirm device
2017-08-01 21:15 ` NeilBrown
@ 2017-08-02 1:53 ` Guoqing Jiang
0 siblings, 0 replies; 11+ messages in thread
From: Guoqing Jiang @ 2017-08-02 1:53 UTC (permalink / raw)
To: NeilBrown, linux-raid; +Cc: jes.sorensen
On 08/02/2017 05:15 AM, NeilBrown wrote:
> On Tue, Aug 01 2017, Guoqing Jiang wrote:
>
>> 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.
>>
>> Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
>> ---
>> Makefile | 6 ++++--
>> udev-md-clustered-confirm-device.rules | 20 ++++++++++++++++++++
>> 2 files changed, 24 insertions(+), 2 deletions(-)
>> create mode 100644 udev-md-clustered-confirm-device.rules
>>
>> diff --git a/Makefile b/Makefile
>> index 021d3ad..0977f27 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -256,8 +256,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 udev-md-raid-creating.rules
>> - @for file in 01-md-raid-creating.rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules ; \
>> +install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules udev-md-raid-creating.rules \
>> + udev-md-clustered-confirm-device.rules
>> + @for file in 01-md-raid-creating.rules 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 0000000..08ac74a
>> --- /dev/null
>> +++ b/udev-md-clustered-confirm-device.rules
>> @@ -0,0 +1,20 @@
>> +# 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"
> Move these here is good.
>
>
>> +
>> +# Based on the received UUID, node confirms the device if
>> +# it is found by blkid, otherwise the node reports it is
>> +# missing.
>> +ACTION=="change", ENV{EVENT}=="ADD_DEVICE", ENV{DEVICE_UUID}=="?*", ENV{RAID_DISK}=="?*", \
> leaving them here as well is careless. Maybe move the tests on
> DEVICE_UUID and RAID_DISK up to the "goto" section too.
Ok, I will move them above.
ENV{DEVICE_UUID}!="?*", GOTO="clustermd_end"
ENV{RAID_DISK}!="?*", GOTO="clustermd_end"
>> +PROGRAM="BINDIR/blkid -o device -t UUID_SUB=$env{DEVICE_UUID}", ENV{device} = "$result"
> I don't think using a generic environment name like "device" is a good
> idea.
> This will get included in the udev database.
Hmm, yes, I can see it by run "udevadm info -e", not good ...
> At least include "md" or "mdadm" in the name so people know what it
> means.
> In my example I put a "." at the start. This cause the name to be
> excluded from the udev database.
Thanks for detailed explanation, I didn't know that.
Best Regards,
Guoqing
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3] udev rules: introduce rules for cluster-md to confirm device
2017-08-01 3:15 [PATCH] udev rules: introduce rules for cluster-md to confirm device Guoqing Jiang
2017-08-01 4:40 ` NeilBrown
2017-08-01 8:19 ` [PATCH V2] " Guoqing Jiang
@ 2017-08-02 2:05 ` Guoqing Jiang
2017-08-02 13:31 ` Jes Sorensen
2017-08-03 1:43 ` John Stoffel
2 siblings, 2 replies; 11+ messages in thread
From: Guoqing Jiang @ 2017-08-02 2:05 UTC (permalink / raw)
To: linux-raid; +Cc: jes.sorensen, neilb, Guoqing Jiang
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.
Signed-off-by: Guoqing Jiang <gqjiang@suse.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 021d3ad..0977f27 100644
--- a/Makefile
+++ b/Makefile
@@ -256,8 +256,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 udev-md-raid-creating.rules
- @for file in 01-md-raid-creating.rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules ; \
+install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules udev-md-raid-creating.rules \
+ udev-md-clustered-confirm-device.rules
+ @for file in 01-md-raid-creating.rules 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 0000000..3e5381e
--- /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
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v3] udev rules: introduce rules for cluster-md to confirm device
2017-08-02 2:05 ` [PATCH v3] " Guoqing Jiang
@ 2017-08-02 13:31 ` Jes Sorensen
2017-08-03 1:43 ` John Stoffel
1 sibling, 0 replies; 11+ messages in thread
From: Jes Sorensen @ 2017-08-02 13:31 UTC (permalink / raw)
To: Guoqing Jiang, linux-raid; +Cc: neilb
On 08/01/2017 10:05 PM, Guoqing Jiang wrote:
> 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.
>
> Signed-off-by: Guoqing Jiang <gqjiang@suse.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
Looks reasonable to me - and thanks Neil for the previous reviews.
Applied!
Jes
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3] udev rules: introduce rules for cluster-md to confirm device
2017-08-02 2:05 ` [PATCH v3] " Guoqing Jiang
2017-08-02 13:31 ` Jes Sorensen
@ 2017-08-03 1:43 ` John Stoffel
2017-08-03 1:57 ` Guoqing Jiang
1 sibling, 1 reply; 11+ messages in thread
From: John Stoffel @ 2017-08-03 1:43 UTC (permalink / raw)
To: Guoqing Jiang; +Cc: linux-raid, jes.sorensen, neilb
>>>>> "Guoqing" == Guoqing Jiang <gqjiang@suse.com> writes:
Guoqing> For cluster scenario, add device is different with native raid.
Guoqing> When a node issues adds a device, then the node will broadcast
Guoqing> a message with UUID to other nodes in the cluster. If receiving
Guoqing> node can find the device with the specific UUID, it must confirm
Guoqing> the device, otherwise reports it is missing.
Guoqing> Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Guoqing> ---
Guoqing> Makefile | 6 ++++--
Guoqing> udev-md-clustered-confirm-device.rules | 21 +++++++++++++++++++++
Guoqing> 2 files changed, 25 insertions(+), 2 deletions(-)
Guoqing> create mode 100644 udev-md-clustered-confirm-device.rules
Guoqing> diff --git a/Makefile b/Makefile
Guoqing> index 021d3ad..0977f27 100644
Guoqing> --- a/Makefile
Guoqing> +++ b/Makefile
Guoqing> @@ -256,8 +256,10 @@ install-man: mdadm.8 md.4 mdadm.conf.5 mdmon.8
Guoqing> $(INSTALL) -D -m 644 md.4 $(DESTDIR)$(MAN4DIR)/md.4
Guoqing> $(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5
Guoqing> -install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules udev-md-raid-creating.rules
Guoqing> - @for file in 01-md-raid-creating.rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules ; \
Guoqing> +install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules udev-md-raid-creating.rules \
Guoqing> + udev-md-clustered-confirm-device.rules
You have udev-md-clustered-.... here, but down below you use
clustermd-end in your names. Which I find slightly annoying because
they're different. Just me being annoying here. :-) I didn't check
if the other raid rules have this issue as well.
Guoqing> + @for file in 01-md-raid-creating.rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules \
Guoqing> + 69-md-clustered-confirm-device.rules ; \
Guoqing> do sed -e 's,BINDIR,$(BINDIR),g' udev-$${file#??-} > .install.tmp.1 && \
Guoqing> $(ECHO) $(INSTALL) -D -m 644 udev-$${file#??-} $(DESTDIR)$(UDEVDIR)/rules.d/$$file ; \
Guoqing> $(INSTALL) -D -m 644 .install.tmp.1 $(DESTDIR)$(UDEVDIR)/rules.d/$$file ; \
Guoqing> diff --git a/udev-md-clustered-confirm-device.rules b/udev-md-clustered-confirm-device.rules
Guoqing> new file mode 100644
Guoqing> index 0000000..3e5381e
Guoqing> --- /dev/null
Guoqing> +++ b/udev-md-clustered-confirm-device.rules
Guoqing> @@ -0,0 +1,21 @@
Guoqing> +# do not edit this file, it will be overwritten on update
Guoqing> +
Guoqing> +SUBSYSTEM!="block", GOTO="clustermd_end"
Guoqing> +
Guoqing> +# handle md arrays
Guoqing> +KERNEL!="md*", GOTO="clustermd_end"
Guoqing> +ENV{DEVTYPE}!="disk", GOTO="clustermd_end"
Guoqing> +ACTION!="change", GOTO="clustermd_end"
Guoqing> +ENV{EVENT}!="ADD_DEVICE", GOTO="clustermd_end"
Guoqing> +ENV{DEVICE_UUID}!="?*", GOTO="clustermd_end"
Guoqing> +ENV{RAID_DISK}!="?*", GOTO="clustermd_end"
Guoqing> +
Guoqing> +# Based on the received UUID, node confirms the device if
Guoqing> +# it is found by blkid, otherwise the node reports it is
Guoqing> +# missing.
Guoqing> +PROGRAM="BINDIR/blkid -o device -t UUID_SUB=$env{DEVICE_UUID}", ENV{.md.newdevice} = "$result"
Guoqing> +
Guoqing> +ENV{.md.newdevice}!="", RUN+="BINDIR/mdadm --manage $env{DEVNAME} --cluster-confirm $env{RAID_DISK}:$env{.md.newdevice}"
Guoqing> +ENV{.md.newdevice}=="", RUN+="BINDIR/mdadm --manage $env{DEVNAME} --cluster-confirm $env{RAID_DISK}:missing"
Guoqing> +
Guoqing> +LABEL="clustermd_end"
Guoqing> --
Guoqing> 2.10.0
Guoqing> --
Guoqing> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
Guoqing> the body of a message to majordomo@vger.kernel.org
Guoqing> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3] udev rules: introduce rules for cluster-md to confirm device
2017-08-03 1:43 ` John Stoffel
@ 2017-08-03 1:57 ` Guoqing Jiang
2017-08-03 2:50 ` John Stoffel
0 siblings, 1 reply; 11+ messages in thread
From: Guoqing Jiang @ 2017-08-03 1:57 UTC (permalink / raw)
To: John Stoffel; +Cc: linux-raid, jes.sorensen, neilb
On 08/03/2017 09:43 AM, John Stoffel wrote:
>>>>>> "Guoqing" == Guoqing Jiang <gqjiang@suse.com> writes:
> Guoqing> For cluster scenario, add device is different with native raid.
> Guoqing> When a node issues adds a device, then the node will broadcast
> Guoqing> a message with UUID to other nodes in the cluster. If receiving
> Guoqing> node can find the device with the specific UUID, it must confirm
> Guoqing> the device, otherwise reports it is missing.
>
> Guoqing> Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
> Guoqing> ---
> Guoqing> Makefile | 6 ++++--
> Guoqing> udev-md-clustered-confirm-device.rules | 21 +++++++++++++++++++++
> Guoqing> 2 files changed, 25 insertions(+), 2 deletions(-)
> Guoqing> create mode 100644 udev-md-clustered-confirm-device.rules
>
> Guoqing> diff --git a/Makefile b/Makefile
> Guoqing> index 021d3ad..0977f27 100644
> Guoqing> --- a/Makefile
> Guoqing> +++ b/Makefile
> Guoqing> @@ -256,8 +256,10 @@ install-man: mdadm.8 md.4 mdadm.conf.5 mdmon.8
> Guoqing> $(INSTALL) -D -m 644 md.4 $(DESTDIR)$(MAN4DIR)/md.4
> Guoqing> $(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5
>
> Guoqing> -install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules udev-md-raid-creating.rules
> Guoqing> - @for file in 01-md-raid-creating.rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules ; \
> Guoqing> +install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules udev-md-raid-creating.rules \
> Guoqing> + udev-md-clustered-confirm-device.rules
>
>
> You have udev-md-clustered-.... here, but down below you use
> clustermd-end in your names. Which I find slightly annoying because
> they're different. Just me being annoying here. :-) I didn't check
> if the other raid rules have this issue as well.
>
Well, I named it as "udev-md-clustered-*" to align with the name of
existed udev rules,
it also means the array is clustered. And clustermd is a
convenient/short name to use.
But not a big deal, I am open to the name if you have better idea, :-) .
Thanks,
Guoqing
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3] udev rules: introduce rules for cluster-md to confirm device
2017-08-03 1:57 ` Guoqing Jiang
@ 2017-08-03 2:50 ` John Stoffel
0 siblings, 0 replies; 11+ messages in thread
From: John Stoffel @ 2017-08-03 2:50 UTC (permalink / raw)
To: Guoqing Jiang; +Cc: John Stoffel, linux-raid, jes.sorensen, neilb
>>>>> "Guoqing" == Guoqing Jiang <gqjiang@suse.com> writes:
Guoqing> On 08/03/2017 09:43 AM, John Stoffel wrote:
>>>>>>> "Guoqing" == Guoqing Jiang <gqjiang@suse.com> writes:
Guoqing> For cluster scenario, add device is different with native raid.
Guoqing> When a node issues adds a device, then the node will broadcast
Guoqing> a message with UUID to other nodes in the cluster. If receiving
Guoqing> node can find the device with the specific UUID, it must confirm
Guoqing> the device, otherwise reports it is missing.
>>
Guoqing> Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Guoqing> ---
Guoqing> Makefile | 6 ++++--
Guoqing> udev-md-clustered-confirm-device.rules | 21 +++++++++++++++++++++
Guoqing> 2 files changed, 25 insertions(+), 2 deletions(-)
Guoqing> create mode 100644 udev-md-clustered-confirm-device.rules
>>
Guoqing> diff --git a/Makefile b/Makefile
Guoqing> index 021d3ad..0977f27 100644
Guoqing> --- a/Makefile
Guoqing> +++ b/Makefile
Guoqing> @@ -256,8 +256,10 @@ install-man: mdadm.8 md.4 mdadm.conf.5 mdmon.8
Guoqing> $(INSTALL) -D -m 644 md.4 $(DESTDIR)$(MAN4DIR)/md.4
Guoqing> $(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5
>>
Guoqing> -install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules udev-md-raid-creating.rules
Guoqing> - @for file in 01-md-raid-creating.rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules ; \
Guoqing> +install-udev: udev-md-raid-arrays.rules udev-md-raid-assembly.rules udev-md-raid-creating.rules \
Guoqing> + udev-md-clustered-confirm-device.rules
>>
>>
>> You have udev-md-clustered-.... here, but down below you use
>> clustermd-end in your names. Which I find slightly annoying because
>> they're different. Just me being annoying here. :-) I didn't check
>> if the other raid rules have this issue as well.
>>
Guoqing> Well, I named it as "udev-md-clustered-*" to align with the
Guoqing> name of existed udev rules, it also means the array is
Guoqing> clustered. And clustermd is a convenient/short name to use.
I think mdcluster is better than clustermd, but that's only because
it's the same order as udev-md-clustered-* but we're both just
bike shedding here. :-)
Guoqing> But not a big deal, I am open to the name if you have better
Guoqing> idea, :-) .
Not really. Appreciate your nice reply to my semi-inane comment.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-08-03 2:50 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-01 3:15 [PATCH] udev rules: introduce rules for cluster-md to confirm device Guoqing Jiang
2017-08-01 4:40 ` NeilBrown
2017-08-01 8:05 ` Guoqing Jiang
2017-08-01 8:19 ` [PATCH V2] " Guoqing Jiang
2017-08-01 21:15 ` NeilBrown
2017-08-02 1:53 ` Guoqing Jiang
2017-08-02 2:05 ` [PATCH v3] " Guoqing Jiang
2017-08-02 13:31 ` Jes Sorensen
2017-08-03 1:43 ` John Stoffel
2017-08-03 1:57 ` Guoqing Jiang
2017-08-03 2:50 ` John Stoffel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).