FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 05-15-2008, 05:46 PM
 
Default simple question... to tough to answer?

Wim Colgate [Wim.Colgate@citrix.com] wrote:
> Hi,
>
Simply (re)stated:
> 1) Are there hooks for dm/multipath events to notify software?

Not that I know of, but multipath uses uevets, so you can have your own
daemon listening.

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 05-15-2008, 05:54 PM
Konrad Rzeszutek
 
Default simple question... to tough to answer?

On Thu, May 15, 2008 at 10:09:35AM -0700, Wim Colgate wrote:
> Hi,
>
>
>
> I'm not quite sure why no one in the community hasn't been able to
> answer my questions.

Probably b/c folks are too busy..

>
>
>
> Simply (re)stated:
>
>
>
> 1) Are there hooks for dm/multipath events to notify software?

You can also listen to the NETLINK_DM socket and parse the data.

But that complicated by the fact that there is only one
socket that the kernel uses and it cannot be shared.

>
> 2) does path down/up fire up udev rules?

Yes. I am attaching a simple program you can use to listen to the kobject uevents
that get fired.

You can also modify it to use NETLINK_DM instead of NETLINK_KOBJECT_UEVENT and see
what comes out.

#include <sys/socket.h>
#include <linux/netlink.h>
#include <stdio.h>
#include <string.h>
#define MAX_PAYLOAD 1024 /* maximum payload size */
struct sockaddr_nl src_addr;
int sock_fd;
static char buff[MAX_PAYLOAD];
ssize_t buflen;

int
main ()
{
sock_fd = socket (PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);

memset (&src_addr, 0, sizeof (src_addr));
src_addr.nl_family = AF_NETLINK;
src_addr.nl_pid = getpid (); /* self pid */
src_addr.nl_groups = 0xffffffff;

printf ("Listen..
");
bind (sock_fd, (struct sockaddr *) &src_addr, sizeof (src_addr));
printf ("Receiving..
");
while (1)
{
buflen = recv (sock_fd, &buff, sizeof (buff), 0);
printf ("Got data: %d
", buflen);
int i, bufpos;
char *key;
for (i = 0, bufpos = 0; (bufpos < buflen) && i < MAX_PAYLOAD; i++)
{
key = &buff[bufpos];
printf ("[%s]
", key);
bufpos += strlen (key) + 1;
}
memset (&buff, 0, MAX_PAYLOAD);
}
/* Close Netlink Socket */
close (sock_fd);
return 0;
}
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 05-16-2008, 11:19 AM
Hannes Reinecke
 
Default simple question... to tough to answer?

Hi Wim,

Wim Colgate wrote:

Hi,

I’m not quite sure why no one in the community hasn’t been able to
answer my questions.


Simply (re)stated:

1) Are there hooks for dm/multipath events to notify software?


Yes. There is the general dm_event mechanism (which I wouldn't recommend)
or with newer kernels you'll get netlink events from multipath for any
path-related events.


2) does path down/up fire up udev rules?


Not as such. As stated above we should be sending out netlink events for
path up/down events, but to my knowledge no-one is taking advantage
of them. Certainly not udev in its default setting nor multipath.

Cheers,

Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 05-16-2008, 03:27 PM
Mike Anderson
 
Default simple question... to tough to answer?

Hannes Reinecke <hare@suse.de> wrote:
> Hi Wim,
>
> Wim Colgate wrote:
>> Hi,
>>
>> I???m not quite sure why no one in the community hasn???t been able to
>> answer my questions.
>>
>> Simply (re)stated:
>>
>> 1) Are there hooks for dm/multipath events to notify software?
>>
> Yes. There is the general dm_event mechanism (which I wouldn't recommend)
> or with newer kernels you'll get netlink events from multipath for any
> path-related events.
>

You can look at the documentation in recent kernels trees to get an
example of the event attributes provided with each event using the
uevent interface: Documentation/device-mapper/dm-uevent.txt

>> 2) does path down/up fire up udev rules?
>>
> Not as such. As stated above we should be sending out netlink events for
> path up/down events, but to my knowledge no-one is taking advantage
> of them. Certainly not udev in its default setting nor multipath.

One should note that if using the the current git version of the multipath
tools and one wants to experiment with additional events one would need to
add a udev rule "(i.e., RUN+="socket:...") You can reference this previous
email for context.
http://article.gmane.org/gmane.linux.scsi/36165

On some what related note. With all the work around making sure we can run
in low memory situations we should make a choice to use raw netlink
interface or the udev abstract namespace socket.

-andmike
--
Michael Anderson
andmike@linux.vnet.ibm.com

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 06-05-2008, 07:06 PM
"Craig Simpson"
 
Default simple question... to tough to answer?

By chance does anyone have a working configuration of some example of
this working?

I am not so interested in a SNMP trap. But if I could have it email/page
me, now that would rock.

Craig

-----Original Message-----
From: dm-devel-bounces@redhat.com [mailto:dm-devel-bounces@redhat.com]
On Behalf Of Mike Anderson
Sent: Friday, May 16, 2008 8:27 AM
To: device-mapper development
Subject: Re: [dm-devel] simple question... to tough to answer?

Hannes Reinecke <hare@suse.de> wrote:
> Hi Wim,
>
> Wim Colgate wrote:
>> Hi,
>>
>> I???m not quite sure why no one in the community hasn???t been able
to
>> answer my questions.
>>
>> Simply (re)stated:
>>
>> 1) Are there hooks for dm/multipath events to notify software?
>>
> Yes. There is the general dm_event mechanism (which I wouldn't
recommend)
> or with newer kernels you'll get netlink events from multipath for any
> path-related events.
>

You can look at the documentation in recent kernels trees to get an
example of the event attributes provided with each event using the
uevent interface: Documentation/device-mapper/dm-uevent.txt

>> 2) does path down/up fire up udev rules?
>>
> Not as such. As stated above we should be sending out netlink events
for
> path up/down events, but to my knowledge no-one is taking advantage
> of them. Certainly not udev in its default setting nor multipath.

One should note that if using the the current git version of the
multipath
tools and one wants to experiment with additional events one would need
to
add a udev rule "(i.e., RUN+="socket:...") You can reference this
previous
email for context.
http://article.gmane.org/gmane.linux.scsi/36165

On some what related note. With all the work around making sure we can
run
in low memory situations we should make a choice to use raw netlink
interface or the udev abstract namespace socket.

-andmike
--
Michael Anderson
andmike@linux.vnet.ibm.com

--
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
 

Thread Tools




All times are GMT. The time now is 10:41 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org