forked from pool/multipath-tools
This commit is contained in:
parent
ba8402c144
commit
9a4aa4389f
122
multipath-tools-add-dm_linear
Normal file
122
multipath-tools-add-dm_linear
Normal file
@ -0,0 +1,122 @@
|
||||
tree 9a91aba3efd7bd5d7cda9856b64aafb67ebed4d4
|
||||
parent 3cba05dca8ad0b09db7b738f7c3151047baccbc1
|
||||
author Hannes Reinecke <hare@suse.de> 1186757218 +0200
|
||||
committer Hannes Reinecke <hare@suse.de> 1186757218 +0200
|
||||
|
||||
Implement dm_linear
|
||||
|
||||
dm_linear can be used to activate kpartx-generated partitions
|
||||
instead of the 'normal' block-based partitions.
|
||||
|
||||
Signed-off-by: Hannes Reinecke <hare@suse.de>
|
||||
c595834d093c7d2f5a5c93d976ea18b8c271b490
|
||||
kpartx/Makefile | 2 ++
|
||||
kpartx/dm_linear | 6 ++++++
|
||||
kpartx/dm_linear.rules | 1 +
|
||||
kpartx/kpartx.rules | 6 ++++++
|
||||
kpartx/kpartx_id | 13 ++++++++++---
|
||||
5 files changed, 25 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/kpartx/Makefile b/kpartx/Makefile
|
||||
index d970d29..c2b9c50 100644
|
||||
--- a/kpartx/Makefile
|
||||
+++ b/kpartx/Makefile
|
||||
@@ -39,8 +39,10 @@ install: $(EXEC) kpartx_id $(EXEC).8
|
||||
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)
|
||||
install -d $(DESTDIR)$(libudevdir)
|
||||
install -m 755 kpartx_id $(DESTDIR)$(libudevdir)
|
||||
+ install -m 755 dm_linear $(DESTDIR)$(libudevdir)
|
||||
install -d $(DESTDIR)/etc/udev/rules.d
|
||||
install -m 644 kpartx.rules $(DESTDIR)/etc/udev/rules.d/70-kpartx.rules
|
||||
+ install -m 644 dm_linear.rules $(DESTDIR)/etc/udev/rules.d/62-dm_linear.rules
|
||||
install -d $(DESTDIR)$(mandir)
|
||||
install -m 644 $(EXEC).8 $(DESTDIR)$(mandir)
|
||||
|
||||
diff --git a/kpartx/dm_linear b/kpartx/dm_linear
|
||||
new file mode 100755
|
||||
index 0000000..1584019
|
||||
--- /dev/null
|
||||
+++ b/kpartx/dm_linear
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
+. /etc/sysconfig/kernel
|
||||
+if [ "DM_BLOCK" ]; then
|
||||
+ echo 0 $(/sbin/blockdev --getsize /dev/$1) linear /dev/$1 0 | /sbin/dmsetup create "linear-$ID_BUS-$ID_SERIAL" -u "linear-$ID_BUS-$ID_SERIAL"
|
||||
+fi
|
||||
diff --git a/kpartx/dm_linear.rules b/kpartx/dm_linear.rules
|
||||
new file mode 100644
|
||||
index 0000000..7bfcc50
|
||||
--- /dev/null
|
||||
+++ b/kpartx/dm_linear.rules
|
||||
@@ -0,0 +1 @@
|
||||
+ACTION=="add", KERNEL=="sd*[!0-9]", RUN+="/lib/udev/dm_linear $kernel"
|
||||
diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules
|
||||
index 9ab9a49..2746eff 100644
|
||||
--- a/kpartx/kpartx.rules
|
||||
+++ b/kpartx/kpartx.rules
|
||||
@@ -21,6 +21,10 @@ ENV{DM_UUID}=="mpath-*", \
|
||||
ENV{DM_UUID}=="dmraid-*", \
|
||||
SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}"
|
||||
|
||||
+# Create persistent links for linear tables
|
||||
+ENV{DM_UUID}=="linear-*", \
|
||||
+ SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}"
|
||||
+
|
||||
# Create persistent links for partitions
|
||||
ENV{DM_PART}=="?*", \
|
||||
SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}-part$env{DM_PART}"
|
||||
@@ -30,6 +34,8 @@ ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="mpath-*", \
|
||||
RUN+="/sbin/kpartx -a -p _part /dev/$kernel"
|
||||
ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="dmraid-*", \
|
||||
RUN+="/sbin/kpartx -a -p _part /dev/$kernel"
|
||||
+ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="linear-*", \
|
||||
+ RUN+="/sbin/kpartx -a -p _part /dev/$kernel"
|
||||
|
||||
LABEL="kpartx_end"
|
||||
|
||||
diff --git a/kpartx/kpartx_id b/kpartx/kpartx_id
|
||||
index 81f32bf..c402e98 100644
|
||||
--- a/kpartx/kpartx_id
|
||||
+++ b/kpartx/kpartx_id
|
||||
@@ -50,7 +50,7 @@ else
|
||||
fi
|
||||
|
||||
# Set the name of the table. We're only interested in dmraid,
|
||||
-# multipath, and kpartx tables; everything else is ignored.
|
||||
+# multipath, linear, and kpartx tables; everything else is ignored.
|
||||
if [ "$dmtbl" = "part" ] ; then
|
||||
# The name of the kpartx table is the name of the parent table
|
||||
dmname=$($DMSETUP info -c --noheadings -o name -u $dmuuid)
|
||||
@@ -61,6 +61,10 @@ if [ "$dmtbl" = "part" ] ; then
|
||||
mpath-*)
|
||||
dmdeps=$($DMSETUP deps -u $dmuuid)
|
||||
;;
|
||||
+ linear-*)
|
||||
+ dmtbl=linear
|
||||
+ dmuuid=${dmuuid#*-}
|
||||
+ ;;
|
||||
esac
|
||||
elif [ "$dmtbl" = "mpath" ] ; then
|
||||
dmname=$tblname
|
||||
@@ -72,8 +76,8 @@ fi
|
||||
|
||||
[ -n "$dmpart" ] && echo "DM_PART=$dmpart"
|
||||
|
||||
-# Figure out the type of the map. For non-multipath maps it's
|
||||
-# always 'raid'.
|
||||
+# Figure out the type of the map. For non-multipath non-linear
|
||||
+# maps it's always 'raid'.
|
||||
if [ -n "$dmdeps" ] ; then
|
||||
case "$dmdeps" in
|
||||
*\(94,*)
|
||||
@@ -86,6 +90,9 @@ if [ -n "$dmdeps" ] ; then
|
||||
echo "DM_TYPE=scsi"
|
||||
;;
|
||||
esac
|
||||
+elif [ "$dmtbl" = linear ]; then
|
||||
+ echo "DM_TYPE=${dmuuid%%-*}"
|
||||
+ echo "DM_NAME=${dmuuid#*-}"
|
||||
else
|
||||
echo "DM_TYPE=raid"
|
||||
fi
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Aug 10 16:48:31 CEST 2007 - hare@suse.de
|
||||
|
||||
- Implement dm_linear (#218122)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 2 11:10:35 CEST 2007 - hare@suse.de
|
||||
|
||||
|
@ -19,12 +19,13 @@ Requires: device-mapper kpartx
|
||||
PreReq: %insserv_prereq
|
||||
Autoreqprov: on
|
||||
Version: 0.4.7
|
||||
Release: 65
|
||||
Release: 67
|
||||
Summary: Tools to Manage Multipathed Devices with the device-mapper
|
||||
Source: multipath-tools-%{version}.tar.bz2
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
Patch0: %{name}-git-update.patch
|
||||
Patch10: %{name}-suse-update
|
||||
Patch11: %{name}-add-dm_linear
|
||||
|
||||
%description
|
||||
This package provides the tools to manage multipathed devices by
|
||||
@ -66,6 +67,7 @@ Authors:
|
||||
%setup -n multipath-tools-%{version}
|
||||
%patch0 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
|
||||
%build
|
||||
make OPTFLAGS="$RPM_OPT_FLAGS" BUILD=glibc
|
||||
@ -124,12 +126,16 @@ mkdir -p $RPM_BUILD_ROOT/var/cache/multipath/
|
||||
%dir /etc/udev
|
||||
%dir /etc/udev/rules.d
|
||||
%dir /lib/udev
|
||||
%config /etc/udev/rules.d/62-dm_linear.rules
|
||||
%config /etc/udev/rules.d/70-kpartx.rules
|
||||
/sbin/kpartx
|
||||
/lib/udev/kpartx_id
|
||||
/lib/udev/dm_linear
|
||||
%{_mandir}/man8/kpartx.8*
|
||||
|
||||
%changelog
|
||||
* Fri Aug 10 2007 - hare@suse.de
|
||||
- Implement dm_linear (#218122)
|
||||
* Thu Aug 02 2007 - hare@suse.de
|
||||
- Merge in latest fixes from upstream
|
||||
- Remove local patches; merge with upstream
|
||||
|
Loading…
x
Reference in New Issue
Block a user