kpartx: partitions of mapped devices cannot be created in redhat OS
PATCH 1/1 kpartx: partitions of mapped devices cannot be created in redhat OS
From: "tang.junhui" <[email protected]>
Environment variables such as DM_TABLE_STATE are used in kpartx.rules which exported by "dmsetup export" in previous udev rules in SuSE OS, however, there is no such command "dmsetup export" in redhat OS, so these environment variables are not initialized and partitions cannot be created. This patch replace "dmsetup export" with "dmsetup info" to get the status of mapped device, which can work well both in SuSE and redhat OS.
--- kpartx/kpartx.rules | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
kpartx/kpartx.rules +7 -3
@@ -7,8 +7,12 @@ KERNEL!="dm-*", GOTO="kpartx_end" ACTION=="remove", GOTO="kpartx_end" -ENV{DM_TABLE_STATE}!="LIVE", GOTO="kpartx_end" -ENV{DM_DEPS}=="0", GOTO="kpartx_end" +ENV{DMSETUP_SBIN_PATH}="/sbin" +TEST!="$env{DMSETUP_SBIN_PATH}/dmsetup", ENV{DMSETUP_SBIN_PATH}="/usr/sbin" +IMPORT{program}="$env{DMSETUP_SBIN_PATH}/dmsetup info -j %M -m %m -c --nameprefixes --noheadings --rows -o tables_loaded,device_count" + +ENV{DM_TABLES_LOADED}!="Live", GOTO="kpartx_end" +ENV{DM_DEVICE_COUNT}=="0", GOTO="kpartx_end" ENV{DM_UUID}=="?*", IMPORT{program}=="kpartx_id %M %m $env{DM_UUID}"
@@ -37,7 +41,7 @@ ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", \ # Create dm tables for partitions ENV{DM_ACTION}=="PATH_FAILED|PATH_REINSTATED", GOTO="kpartx_end" ENV{DM_NR_VALID_PATHS}=="0", GOTO="kpartx_end" -ENV{DM_STATE}!="SUSPENDED", ENV{DM_UUID}=="mpath-*", \ +ENV{DM_SUSPENDED}!="Suspended", ENV{DM_UUID}=="mpath-*", \ RUN+="/sbin/kpartx -u -p -part /dev/$name" LABEL="kpartx_end"
Signature · 1 line
2.8.1.windows.1
Yes. In Debian too, we've been hit by something similar.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=827412
https://anonscm.debian.org/cgit/pkg-lvm/multipath-tools.git/tree/debian/dmsetup_
env
Quoted 12 lines · On Mon, 2016-08-29 at 19:12 +0800, [email protected] wrote:
From: "tang.junhui" <[email protected]>
Environment variables such as
DM_TABLE_STATEare used in kpartx.rules which exported
by "dmsetup export" in previous udev rules in SuSE OS, however, there is no such command
"dmsetup export" in redhat OS, so these environment variables are not initialized and
partitions cannot be created. This patch replace "dmsetup export" with "dmsetup info"
to get the status of mapped device, which can work well both in SuSE and redhat OS.
Signature · 2 lines
Given the large number of mailing lists I follow, I request you to CC me in replies for quicker response
Benjamin Marzinski
maintainerQuoted 5 lines · Ritesh Raj Sarraf
Yes. In Debian too, we've been hit by something similar.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=827412
https://anonscm.debian.org/cgit/pkg-lvm/multipath-tools.git/tree/debian/dmsetup_
env
I just want to point out that we don't actually distribute kpartx.rules in the redhat releases of the multipath-tools.
-Ben
Quoted 26 lines · On Mon, 2016-08-29 at 19:12 +0800, [email protected] wrote:
Quoted 12 lines
From: "tang.junhui" <[email protected]>
Environment variables such as
DM_TABLE_STATEare used in kpartx.rules which exported
by "dmsetup export" in previous udev rules in SuSE OS, however, there is no such command
"dmsetup export" in redhat OS, so these environment variables are not initialized and
partitions cannot be created. This patch replace "dmsetup export" with "dmsetup info"
to get the status of mapped device, which can work well both in SuSE and redhat OS.Signature · 9 lines
Given the large number of mailing lists I follow, I request you to CC me in replies for quicker response -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
How to create partitions without kpartx.rules if we want to use the latest version multipath-tools of opensvc in rhel7.2?
发件人: "Benjamin Marzinski" <[email protected]>
收件人: Ritesh Raj Sarraf <[email protected]>,
抄送: [email protected] 日期: 2016-09-09 00:02 主题: Re: [dm-devel] [PATCH] kpartx: partitions of mapped devices cannot
be created in redhat OS
发件人: [email protected]
Quoted 4 lines · Ritesh Raj Sarraf
Yes. In Debian too, we've been hit by something similar.
https://anonscm.debian.org/cgit/pkg-lvm/multipath-tools.git/tree/debian/dmsetup_
Quoted 1 line
env
I just want to point out that we don't actually distribute kpartx.rules in the redhat releases of the multipath-tools.
-Ben
Quoted 7 lines · On Mon, 2016-08-29 at 19:12 +0800, [email protected] wrote:
Quoted 3 lines
From: "tang.junhui" <[email protected]>
Environment variables such as
DM_TABLE_STATEare used in kpartx.rules
which
Quoted 2 lines
Quoted 2 lines
exported
by "dmsetup export" in previous udev rules in SuSE OS, however, there
is no
Quoted 6 lines
Quoted 6 lines
such command
"dmsetup export" in redhat OS, so these environment variables are not initialized and
partitions cannot be created. This patch replace "dmsetup export" with "dmsetup info"
to get the status of mapped device, which can work well both in SuSE
and
Quoted 11 lines
Quoted 1 line
redhat OS.
Signature · 9 lines
Given the large number of mailing lists I follow, I request you to CC me in replies for quicker response -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerQuoted 2 lines · On Fri, Sep 09, 2016 at 10:24:29AM +0800, [email protected] wrote:
How to create partitions without kpartx.rules if we want to use the latest version multipath-tools of opensvc in rhel7.2?
This is what's at the end of the /lib/udev/rules.d/62-multipath.rules file that gets installed with the regular rhel-7.2 multipath package. If you add it to the end of the multipath.rules file that gets installed with the upstream package, just before the
LABEL="end_mpath"
line, it should work fine:
ACTION=="change", IMPORT{db}="DM_MULTIPATH_NEED_KPARTX" KERNEL!="dm-*", GOTO="end_mpath" ENV{DM_UUID}=="mpath-?*|part[0-9]*-mpath-?*", OPTIONS+="link_priority=10"
ACTION!="change", GOTO="end_mpath" ENV{DM_UUID}!="mpath-?*", GOTO="end_mpath" ENV{DM_SUBSYSTEM_UDEV_FLAG1}=="1", GOTO="end_mpath" ENV{DM_ACTIVATION}=="1", ENV{DM_MULTIPATH_NEED_KPARTX}="1" ENV{DM_SUSPENDED}=="1", GOTO="end_mpath" ENV{DM_ACTION}=="PATH_FAILED", GOTO="end_mpath" ENV{DM_ACTIVATION}!="1", ENV{DM_MULTIPATH_NEED_KPARTX}!="1", GOTO="end_mpath" RUN+="$env{MPATH_SBIN_PATH}/kpartx -a $tempnode", \
ENV{DM_MULTIPATH_NEED_KPARTX}=""
Quoted 57 lines
������: "Benjamin Marzinski" <[email protected]> �ռ���: Ritesh Raj Sarraf <[email protected]>,
����: [email protected]
����: 2016-09-09 00:02
����: Re: [dm-devel] [PATCH] kpartx: partitions of mapped devices cannot be created in redhat OS
������: [email protected]--------------------------------------------------------------------------
Quoted 4 lines · Ritesh Raj Sarraf
Yes. In Debian too, we've been hit by something similar.
[2]https://anonscm.debian.org/cgit/pkg-lvm/multipath-tools.git/tree/debian/dmsetup_
Quoted 1 line
env
I just want to point out that we don't actually distribute kpartx.rules in the redhat releases of the multipath-tools.
-Ben
Quoted 7 lines · On Mon, 2016-08-29 at 19:12 +0800, [email protected] wrote:
Quoted 3 lines
From: "tang.junhui" <[email protected]>
Environment variables such as
DM_TABLE_STATEare used in kpartx.ruleswhich
Quoted 2 lines
Quoted 2 lines
exported
by "dmsetup export" in previous udev rules in SuSE OS, however, thereis no
Quoted 6 lines
Quoted 6 lines
such command
"dmsetup export" in redhat OS, so these environment variables are not initialized and
partitions cannot be created. This patch replace "dmsetup export" with "dmsetup info"
to get the status of mapped device, which can work well both in SuSEand
Quoted 9 lines
Quoted 1 line
redhat OS.
--
Given the large number of mailing lists I follow, I request you to CC me in replies for quicker response--
dm-devel mailing list
[email protected] [3]https://www.redhat.com/mailman/listinfo/dm-devel--
dm-devel mailing list
[email protected] [4]https://www.redhat.com/mailman/listinfo/dm-devel
Quoted 7 lines
References
Visible links
1. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=827412
2. https://anonscm.debian.org/cgit/pkg-lvm/multipath-tools.git/tree/debian/dmsetup_
3. https://www.redhat.com/mailman/listinfo/dm-devel
4. https://www.redhat.com/mailman/listinfo/dm-devel
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Quoted 13 lines · Benjamin Marzinski
Quoted 2 lines · On Fri, Sep 09, 2016 at 10:24:29AM +0800, [email protected] wrote:
How to create partitions without kpartx.rules if we want to use the latest version multipath-tools of opensvc in rhel7.2?
This is what's at the end of the
/lib/udev/rules.d/62-multipath.rulesfile that gets installed with the regular rhel-7.2 multipath package. If you add it to the end of the multipath.rules file that gets installed with the upstream package, just before theLABEL="end_mpath"
line, it should work fine:
Quoted 16 lines
ACTION=="change", IMPORT{db}="DM_MULTIPATH_NEED_KPARTX" KERNEL!="dm-*", GOTO="end_mpath" ENV{DM_UUID}=="mpath-?*|part[0-9]*-mpath-?*", OPTIONS+="link_priority=10"
ACTION!="change", GOTO="end_mpath" ENV{DM_UUID}!="mpath-?*", GOTO="end_mpath" ENV{DM_SUBSYSTEM_UDEV_FLAG1}=="1", GOTO="end_mpath" ENV{DM_ACTIVATION}=="1", ENV{DM_MULTIPATH_NEED_KPARTX}="1" ENV{DM_SUSPENDED}=="1", GOTO="end_mpath" ENV{DM_ACTION}=="PATH_FAILED", GOTO="end_mpath" ENV{DM_ACTIVATION}!="1", ENV{DM_MULTIPATH_NEED_KPARTX}!="1", GOTO="end_mpath" RUN+="$env{MPATH_SBIN_PATH}/kpartx -a $tempnode", \
ENV{DM_MULTIPATH_NEED_KPARTX}=""
Any particular reason why this can't be a separate rules file? I'm perfectly fine with having SUSE and RH specific kpartx rules...
Cheers,
Hannes
Signature · 10 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel