- Use udev rules file from upstream package, rather

have having a separate one.

OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=40
This commit is contained in:
Neil Brown 2011-08-18 06:03:57 +00:00 committed by Git OBS Bridge
parent 80b9aa3f04
commit b5de3e63a0
4 changed files with 26 additions and 43 deletions

View File

@ -1,40 +0,0 @@
# do not edit this file, it will be overwritten on update
SUBSYSTEM!="block", GOTO="md_end"
ACTION!="add|change", GOTO="md_end"
# import data from a raid member and activate it
ENV{ID_FS_TYPE}=="linux_raid_member", PROGRAM="/bin/grep -qs '^AUTO -all' /etc/mdadm.conf", IMPORT{program}="/sbin/mdadm --examine --export $tempnode", RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
# import data from a raid set
KERNEL!="md*", GOTO="md_end"
ENV{DEVTYPE}!="disk",GOTO="md_not_disk"
#this extra caution avoids some races with the device disappearing
TEST!="md/array_state", GOTO="md_end"
# 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"
ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"
LABEL="md_ignore_state"
IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}", OPTIONS+="string_escape=replace"
ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}"
ENV{MD_DEVNAME}=="?*", SYMLINK+="md/$env{MD_DEVNAME}"
LABEL="md_not_disk"
ENV{DEVTYPE}!="partition", GOTO="md_vol_id"
IMPORT{program}="/sbin/mdadm --detail --export %r/$parent"
ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}-part%n", OPTIONS+="string_escape=replace"
ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}-part%n"
ENV{MD_DEVNAME}=="*[^0-9]", SYMLINK+="md/$env{MD_DEVNAME}%n"
ENV{MD_DEVNAME}=="*[0-9]", SYMLINK+="md/$env{MD_DEVNAME}p%n"
LABEL="md_vol_id"
IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
OPTIONS+="link_priority=100"
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
LABEL="md_end"

View File

@ -949,6 +949,24 @@ index 44314ba..56813b7 100644
buf[n] = 0;
*val = strtoull(buf, &ep, 0);
if (ep == buf || (*ep != 0 && *ep != '\n' && *ep != ' '))
diff --git a/udev-md-raid.rules b/udev-md-raid.rules
index 1d89833..c2105bc 100644
--- a/udev-md-raid.rules
+++ b/udev-md-raid.rules
@@ -3,9 +3,11 @@
SUBSYSTEM!="block", GOTO="md_end"
# handle potential components of arrays
-ENV{ID_FS_TYPE}=="linux_raid_member", ACTION=="remove", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
+ENV{ID_FS_TYPE}=="linux_raid_member", ENV{ID_PATH}!="", ACTION=="remove", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
+ENV{ID_FS_TYPE}=="linux_raid_member", ENV{ID_PATH}=="", ACTION=="remove", RUN+="/sbin/mdadm -If $name"
ENV{ID_FS_TYPE}=="linux_raid_member", ACTION=="add", RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
-ENV{ID_FS_TYPE}=="isw_raid_member", ACTION=="remove", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
+ENV{ID_FS_TYPE}=="isw_raid_member", ENV{ID_PATH}!="", ACTION=="remove", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
+ENV{ID_FS_TYPE}=="isw_raid_member", ENV{ID_PATH}=="", ACTION=="remove", RUN+="/sbin/mdadm -If $name"
ENV{ID_FS_TYPE}=="isw_raid_member", ACTION=="add", RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
# handle md arrays
diff --git a/util.c b/util.c
index 10bbe56..ce03239 100644
--- a/util.c

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Aug 18 06:01:39 UTC 2011 - nfbrown@novell.com
- Use udev rules file from upstream package, rather
have having a separate one.
-------------------------------------------------------------------
Thu Aug 18 03:01:57 UTC 2011 - nfbrown@novell.com

View File

@ -37,8 +37,7 @@ Source3: mdadmd
Source4: boot.md
Source5: mkinitrd-setup.sh
Source6: mkinitrd-boot.sh
Source7: 64-md-raid.rules
Patch0: mdadm-3.2.2_git15537e75b1f5b
Patch0: mdadm-3.2.2_git3b1dab1bdbda0
%description
Mdadm is a program that can be used to control Linux md devices. It is
@ -77,7 +76,7 @@ rm -rf $RPM_BUILD_ROOT/var/run/mdadm
mkdir -p $RPM_BUILD_ROOT/var/run
ln -s mdadm $RPM_BUILD_ROOT/var/run/mdadm
install -d $RPM_BUILD_ROOT/lib/udev/rules.d
install -m 644 %_sourcedir/64-md-raid.rules $RPM_BUILD_ROOT/lib/udev/rules.d
install -m 644 udev-md-raid.rules $RPM_BUILD_ROOT/lib/udev/rules.d/64-md-raid.rules
%post
[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup