summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2016-05-17 12:03:25 -0500
committerDavid Teigland <teigland@redhat.com>2016-05-17 12:03:25 -0500
commitaac94a925cf2bfb6e80a671fdaa1289dc78d30ee (patch)
treedbf1a198919de08a28067cf61f680e6e9b0fdf3d
parent890af1cc620f0ec5a1bedf5206fe59c890c3719c (diff)
downloadlvm2-dev-dct-config-context.tar.gz
lvm2_activation_generator: don't create full context for liblvm2appdev-dct-config-context
Don't create a full lvm command context with lvm_init() which does a lot of command setup (like connecting to daemons), which is unnecessary for simply reading a value from lvm.conf. Passing a NULL context arg to the lvm_config_ function is now allowed, in which case lvm.conf is read without doing lvm command setup.
-rw-r--r--scripts/lvm2_activation_generator_systemd_red_hat.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/scripts/lvm2_activation_generator_systemd_red_hat.c b/scripts/lvm2_activation_generator_systemd_red_hat.c
index 62467bddd..d83e721f1 100644
--- a/scripts/lvm2_activation_generator_systemd_red_hat.c
+++ b/scripts/lvm2_activation_generator_systemd_red_hat.c
@@ -69,16 +69,10 @@ static void kmsg(int log_level, const char *format, ...)
static void lvm_get_use_lvmetad_and_lvmpolld(int *use_lvmetad, int *use_lvmpolld)
{
- lvm_t lvm;
-
*use_lvmetad = *use_lvmpolld = 0;
- if (!(lvm = lvm_init(NULL))) {
- kmsg(LOG_ERR, "LVM: Failed to initialize library context for activation generator.\n");
- return;
- }
- *use_lvmetad = lvm_config_find_bool(lvm, LVM_CONF_USE_LVMETAD, 0);
- *use_lvmpolld = lvm_config_find_bool(lvm, LVM_CONF_USE_LVMPOLLD, 0);
- lvm_quit(lvm);
+
+ *use_lvmetad = lvm_config_find_bool(NULL, LVM_CONF_USE_LVMETAD, 0);
+ *use_lvmpolld = lvm_config_find_bool(NULL, LVM_CONF_USE_LVMPOLLD, 0);
}
static int register_unit_with_target(const char *dir, const char *unit, const char *target)