Re: [dm-devel] [PATCH] kpartx: partitions of mapped devices cannot be created in redhat OS

2016-09-11 Thread Hannes Reinecke
On 09/09/2016 09:04 PM, Benjamin Marzinski wrote:
> On Fri, Sep 09, 2016 at 10:24:29AM +0800, zhang.ka...@zte.com.cn 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}=""
> 
> 
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
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +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
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH] kpartx: partitions of mapped devices cannot be created in redhat OS

2016-09-09 Thread Benjamin Marzinski
On Fri, Sep 09, 2016 at 10:24:29AM +0800, zhang.ka...@zte.com.cn 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}=""


> 
>    ��:         "Benjamin Marzinski" 
>�ռ���:         Ritesh Raj Sarraf ,
>:        dm-devel@redhat.com
>:         2016-09-09 00:02
>:        Re: [dm-devel] [PATCH] kpartx: partitions of mapped devices
>cannot be created in redhat OS
>��:        dm-devel-boun...@redhat.com
> 
>--
> 
>On Tue, Sep 06, 2016 at 05:09:28PM +0530, Ritesh Raj Sarraf wrote:
>> Yes. In Debian too, we've been hit by something similar.
>>
>> [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_
>> env
> 
>I just want to point out that we don't actually distribute kpartx.rules
>in the redhat releases of the multipath-tools.
> 
>-Ben
> 
>>
>>
>>
>> On Mon, 2016-08-29 at 19:12 +0800, tang.jun...@zte.com.cn wrote:
>> > From: "tang.junhui" 
>> >
>> > 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.
>> --
>> Given the large number of mailing lists I follow, I request you to CC
>> me in replies for quicker response
> 
>> --
>> dm-devel mailing list
>> dm-devel@redhat.com
>> [3]https://www.redhat.com/mailman/listinfo/dm-devel
> 
>--
>dm-devel mailing list
>dm-devel@redhat.com
>[4]https://www.redhat.com/mailman/listinfo/dm-devel
> 
> 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
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH] kpartx: partitions of mapped devices cannot be created in redhat OS

2016-09-08 Thread zhang . kai16
How to create partitions without kpartx.rules if we want to use the latest 
version multipath-tools of opensvc in rhel7.2?



发件人: "Benjamin Marzinski" 
收件人: Ritesh Raj Sarraf , 
抄送:   dm-devel@redhat.com
日期:   2016-09-09 00:02
主题:   Re: [dm-devel] [PATCH] kpartx: partitions of mapped devices cannot 
be created in redhat OS
发件人: dm-devel-boun...@redhat.com



On Tue, Sep 06, 2016 at 05:09:28PM +0530, Ritesh Raj Sarraf wrote:
> 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

> 
> 
> 
> On Mon, 2016-08-29 at 19:12 +0800, tang.jun...@zte.com.cn wrote:
> > From: "tang.junhui" 
> > 
> > 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.
> -- 
> Given the large number of mailing lists I follow, I request you to CC
> me in replies for quicker response



> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH] kpartx: partitions of mapped devices cannot be created in redhat OS

2016-09-08 Thread Benjamin Marzinski
On Tue, Sep 06, 2016 at 05:09:28PM +0530, Ritesh Raj Sarraf wrote:
> 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

> 
> 
> 
> On Mon, 2016-08-29 at 19:12 +0800, tang.jun...@zte.com.cn wrote:
> > From: "tang.junhui" 
> > 
> > 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.
> -- 
> Given the large number of mailing lists I follow, I request you to CC
> me in replies for quicker response



> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


Re: [dm-devel] [PATCH] kpartx: partitions of mapped devices cannot be created in redhat OS

2016-09-06 Thread 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



On Mon, 2016-08-29 at 19:12 +0800, tang.jun...@zte.com.cn wrote:
> From: "tang.junhui" 
> 
> 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.
-- 
Given the large number of mailing lists I follow, I request you to CC
me in replies for quicker response

signature.asc
Description: This is a digitally signed message part
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

[dm-devel] [PATCH] kpartx: partitions of mapped devices cannot be created in redhat OS

2016-08-29 Thread tang . junhui
From: "tang.junhui" 

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.

Signed-off-by: tang.junhui 
---
 kpartx/kpartx.rules | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules
index 1713f3c..8c8b836 100644
--- a/kpartx/kpartx.rules
+++ b/kpartx/kpartx.rules
@@ -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"
-- 
2.8.1.windows.1

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


[dm-devel] [PATCH] kpartx: partitions of mapped devices cannot be created in redhat OS

2016-08-29 Thread tang . junhui
From: "tang.junhui" 

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.

Signed-off-by: tang.junhui 
---
 kpartx/kpartx.rules | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules
index 1713f3c..8c8b836 100644
--- a/kpartx/kpartx.rules
+++ b/kpartx/kpartx.rules
@@ -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"
-- 
2.8.1.windows.1

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel