mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvm2_activation_generator: don't create full context for liblvm2app
Don't use lvm_init() to create a full command context, 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.
This commit is contained in:
parent
7fd4119d24
commit
591ef307b3
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user