All of lore.kernel.org
 help / color / mirror / Atom feed
* master - dmeventd_thind: set LVM_RUN_BY_DMEVENTD
@ 2017-01-23 13:56 Zdenek Kabelac
  0 siblings, 0 replies; only message in thread
From: Zdenek Kabelac @ 2017-01-23 13:56 UTC (permalink / raw)
  To: lvm-devel

Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=836eb122cec35c1f00281968d92f9d85e67652d7
Commit:        836eb122cec35c1f00281968d92f9d85e67652d7
Parent:        4a7f2155c1d6bd5df1226632c5c5d5631c5abc97
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Mon Jan 23 14:23:24 2017 +0100
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Mon Jan 23 14:55:47 2017 +0100

dmeventd_thind: set LVM_RUN_BY_DMEVENTD

Set LVM_RUN_BY_DMEVENTD envvar to expose the command is runing from
dmeventd environment.
---
 daemons/dmeventd/plugins/thin/dmeventd_thin.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/daemons/dmeventd/plugins/thin/dmeventd_thin.c b/daemons/dmeventd/plugins/thin/dmeventd_thin.c
index a6a534d..f551971 100644
--- a/daemons/dmeventd/plugins/thin/dmeventd_thin.c
+++ b/daemons/dmeventd/plugins/thin/dmeventd_thin.c
@@ -69,19 +69,23 @@ DM_EVENT_LOG_FN("thin")
 
 static int _run_command(struct dso_state *state)
 {
-	char val[2][36];
-	char *env[] = { val[0], val[1], NULL };
+	char val[3][36];
+	char *env[] = { val[0], val[1], val[2], NULL };
 	int i;
 
+	/* Mark for possible lvm2 command we are running from dmeventd
+	 * lvm2 will not try to talk back to dmeventd while processing it */
+	(void) dm_snprintf(val[0], sizeof(val[0]), "LVM_RUN_BY_DMEVENTD=1");
+
 	if (state->data_percent) {
 		/* Prepare some known data to env vars for easy use */
-		(void) dm_snprintf(val[0], sizeof(val[0]), "DMEVENTD_THIN_POOL_DATA=%d",
+		(void) dm_snprintf(val[1], sizeof(val[1]), "DMEVENTD_THIN_POOL_DATA=%d",
 				   state->data_percent / DM_PERCENT_1);
-		(void) dm_snprintf(val[1], sizeof(val[1]), "DMEVENTD_THIN_POOL_METADATA=%d",
+		(void) dm_snprintf(val[2], sizeof(val[2]), "DMEVENTD_THIN_POOL_METADATA=%d",
 				   state->metadata_percent / DM_PERCENT_1);
 	} else {
 		/* For an error event it's for a user to check status and decide */
-		env[0] = NULL;
+		env[1] = NULL;
 		log_debug("Error event processing");
 	}
 



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-23 13:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-23 13:56 master - dmeventd_thind: set LVM_RUN_BY_DMEVENTD Zdenek Kabelac

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.