[linux-lvm] How to monitor and possibly autoextend snapshots

Marcin Kałuża marcin.kaluza at comarch.pl
Wed Oct 29 11:10:41 UTC 2008


Wow - this was quick ;))

I tried to compile it with kernel-2.6.18-92.1.13.el5.centos.plus kernel and
it threw 3 errors:

1)
drivers/md/dm-snap.c:792: error: snap undeclared (first use in this
function)
2)
drivers/md/dm-snap.c:797: error: struct dm_snapshot has no member named ti
3)
drivers/md/dm-snap.c: In function snapshot_message:
drivers/md/dm-snap.c:1066: error: too few arguments to function strncmp

1)
There was:
snap->store.fraction_full(&snap->store, &numerator,
and I think it should be
s->store.fraction_full(&s->store, &numerator,

3)
There was
if (strncmp(argv[0], "notify")) {
changed to:
if (strncmp(argv[0], "notify", 6)) {

2)
dm_table_event(s->ti->table);
changed to 
dm_table_event(s->table);
or should there be "ti" field in the dm_snapshot ?

But now I'm not sure if it'll do what it's meant to do ;)
It compiles. As soon as I set up some test vm with this kernel I'll let you
know if it works.

Changed patch is enclosed.

Martin
-----Original Message-----
From: linux-lvm-bounces at redhat.com [mailto:linux-lvm-bounces at redhat.com] On
Behalf Of Jonathan Brassow
Sent: Tuesday, October 28, 2008 9:51 PM
To: LVM general discussion and development
Subject: Re: [linux-lvm] How to monitor and possibly autoextend snapshots

On Oct 27, 2008, at 7:17 AM, Marcin Kałuża wrote:

> Hi,
> Well, that's not much of help since after it becomes invalid I'll  
> know it
> anyway (IO error ;D), so the event is purely informational.


Well, I've thrown together a quick patch that should give you what you  
want.  (I have not compiled/tested it.)  We'd have to give it more  
thought for it to become a permanent feature (or get integrated into  
LVM), but it should be a nice little hack.  If you turn out to like  
the idea, maybe more discussion will evolve.

You'll have to compile your own kernel with the patch applied, but  
once you've done so, you should be able to do the following:

# Get snapshot to raise an event when 75% full
prompt> dmsetup message <snapshot device> 0 notify 75
prompt> dmsetup wait <snapshot device>
# Ok, now we are 75% full - let me know when 95% full
prompt> dmsetup message <snapshot device> 0 notify 95
prompt> dmsetup wait <snapshot device>

  brassow

-------------- next part --------------
A non-text attachment was scrubbed...
Name: snap.patch
Type: application/octet-stream
Size: 2313 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20081029/00598a36/attachment.obj>


More information about the linux-lvm mailing list