summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2015-10-22 15:36:21 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2015-10-22 22:41:12 +0200
commitaeec62ad1987a5ec59b782f3377d6ae1693e1eab (patch)
treed272f9c66ac3f54a91a5e1d00ed2f98c388ae31c
parent12aa56d29867b962257d7d2789a661a22c649347 (diff)
downloadlvm2-aeec62ad1987a5ec59b782f3377d6ae1693e1eab.tar.gz
dmeventd: snapshot plugin unmonitor
Send signal to itself to mark plugin as 'finished' as the watching rule is no longer usable.
-rw-r--r--daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c b/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
index d9bef5c74..7962e968a 100644
--- a/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
+++ b/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
@@ -18,6 +18,7 @@
#include <sys/wait.h>
#include <stdarg.h>
+#include <pthread.h>
/* First warning when snapshot is 80% full. */
#define WARNING_THRESH (DM_PERCENT_1 * 80)
@@ -203,6 +204,15 @@ void process_event(struct dm_task *dmt,
/* Maybe configurable ? */
_remove(dm_task_get_uuid(dmt));
#endif
+ pthread_kill(pthread_self(), SIGALRM);
+ goto out;
+ }
+
+ if (length <= (status->used_sectors - status->metadata_sectors)) {
+ /* TODO eventually recognize earlier when room is enough */
+ log_info("Dropping monitoring of fully provisioned snapshot %s.",
+ device);
+ pthread_kill(pthread_self(), SIGALRM);
goto out;
}