* mdadm >= 3.0 - udev test rule
@ 2013-10-08 12:12 Hristo Chonov
2013-10-08 18:40 ` Martin Wilck
0 siblings, 1 reply; 3+ messages in thread
From: Hristo Chonov @ 2013-10-08 12:12 UTC (permalink / raw)
To: linux-raid
Hello,
I have just a simple question about the udev rule:
TEST!="md/array_state", GOTO="md_end" or in the last two releases with
the systemd support: TEST!="md/array_state", ENV{SYSTEMD_READY}="0",
GOTO="md_end".
We are running a XenSever 6.2 system which is based on CentOS 5.7 with
included an old version of udev: udev-095. This version doesn't
support the ATTR keyword so I am going to swap it with the old one
SYSFS, but it appears that udev doesn't recognize as well the TEST
keyword, so I am wondering what exactly this rule is there for? Is it
checking if "md/array_state" appears somewhere in the attributes and
if not it jumps to "md_end"?
And do you have any idea how the rule should be rewritten for older
versions of udev?
Kind regards,
Hristo Chonov,
VKM, TU Darmstadt
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: mdadm >= 3.0 - udev test rule
2013-10-08 12:12 mdadm >= 3.0 - udev test rule Hristo Chonov
@ 2013-10-08 18:40 ` Martin Wilck
2013-10-09 9:08 ` Hristo Chonov
0 siblings, 1 reply; 3+ messages in thread
From: Martin Wilck @ 2013-10-08 18:40 UTC (permalink / raw)
To: Hristo Chonov, linux-raid
On 10/08/2013 02:12 PM, Hristo Chonov wrote:
> Hello,
>
> I have just a simple question about the udev rule:
> TEST!="md/array_state", GOTO="md_end" or in the last two releases with
> the systemd support: TEST!="md/array_state", ENV{SYSTEMD_READY}="0",
> GOTO="md_end".
>
> We are running a XenSever 6.2 system which is based on CentOS 5.7 with
> included an old version of udev: udev-095. This version doesn't
> support the ATTR keyword so I am going to swap it with the old one
> SYSFS, but it appears that udev doesn't recognize as well the TEST
> keyword, so I am wondering what exactly this rule is there for? Is it
> checking if "md/array_state" appears somewhere in the attributes and
> if not it jumps to "md_end"?
from mdadm(8):
TEST{octal mode mask}
Test the existence of a file. An octal mode mask can be
specified if needed.
So, this checks if the file "/sys/class/block/md$X/md/array_state"
exists, and exits otherwise.
> And do you have any idea how the rule should be rewritten for older
> versions of udev?
It could probably be done with PROGRAM="/bin/test -f md/array_state" or
the like (not tested).
Martin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: mdadm >= 3.0 - udev test rule
2013-10-08 18:40 ` Martin Wilck
@ 2013-10-09 9:08 ` Hristo Chonov
0 siblings, 0 replies; 3+ messages in thread
From: Hristo Chonov @ 2013-10-09 9:08 UTC (permalink / raw)
To: Martin Wilck; +Cc: linux-raid
yeah, you are right I had to check the man pages of new udev versions..
But PROGRAM="/bin/test -f md/array_state" will be true if the file
exists and it will go to md_end.
So I guess the proper way to do it will be to introduce a new label
for example something like this:
# container devices have a metadata version of e.g. 'external:ddf' and
# never leave state 'inactive'
ATTR{md/metadata_version}=="external:[A-Za-z]*",
ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
PROGRAM="/bin/test -f md/array_state" , ENV{SYSTEMD_READY}="0", GOTO="md_test"
GOTO="md_end"
LABEL="md_test"
ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0", GOTO="md_end"
LABEL="md_ignore_state"
I am not sure it if will work with just a single action on line like
GOTO="md_end" but my idea is if PROGRAM is false (the file doesn't
exists) then it will not jump to "md_test" and goes to the next line
which points a jump to "md_end".
Is this going to work?
On Tue, Oct 8, 2013 at 8:40 PM, Martin Wilck <mwilck@arcor.de> wrote:
> On 10/08/2013 02:12 PM, Hristo Chonov wrote:
>> Hello,
>>
>> I have just a simple question about the udev rule:
>> TEST!="md/array_state", GOTO="md_end" or in the last two releases with
>> the systemd support: TEST!="md/array_state", ENV{SYSTEMD_READY}="0",
>> GOTO="md_end".
>>
>> We are running a XenSever 6.2 system which is based on CentOS 5.7 with
>> included an old version of udev: udev-095. This version doesn't
>> support the ATTR keyword so I am going to swap it with the old one
>> SYSFS, but it appears that udev doesn't recognize as well the TEST
>> keyword, so I am wondering what exactly this rule is there for? Is it
>> checking if "md/array_state" appears somewhere in the attributes and
>> if not it jumps to "md_end"?
>
> from mdadm(8):
> TEST{octal mode mask}
> Test the existence of a file. An octal mode mask can be
> specified if needed.
>
> So, this checks if the file "/sys/class/block/md$X/md/array_state"
> exists, and exits otherwise.
>
>> And do you have any idea how the rule should be rewritten for older
>> versions of udev?
>
> It could probably be done with PROGRAM="/bin/test -f md/array_state" or
> the like (not tested).
>
> Martin
--
Hristo Chonov
kleine Hochstraße 4
60313, Frankfurt am Main
Mobile: 0176 55 33 19 83
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-09 9:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-08 12:12 mdadm >= 3.0 - udev test rule Hristo Chonov
2013-10-08 18:40 ` Martin Wilck
2013-10-09 9:08 ` Hristo Chonov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox