mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
CLVMD support for LVM_CLVMD_BINARY and LVM_BINARY
Read 2 environmental vars to learn about overide position for CLVMD and LVM binaries. We support LVM_BINARY in other script - and this way we could easily test restart in our test-suite.
This commit is contained in:
parent
a039e204e7
commit
d2c116058e
@ -1,5 +1,6 @@
|
||||
Version 2.02.89 -
|
||||
==================================
|
||||
Support env vars LVM_CLVMD_BINARY and LVM_BINARY in clvmd.
|
||||
Fix restart of clvmd (preserve exlusive locks). (2.02.64)
|
||||
Add 'Volume Type' lv_attr characters for RAID and RAID_IMAGE.
|
||||
Add activation/retry_deactivation to lvm.conf to retry deactivation of an LV.
|
||||
|
10
configure
vendored
10
configure
vendored
@ -626,6 +626,7 @@ OCF
|
||||
MIRRORS
|
||||
LVM_RELEASE_DATE
|
||||
LVM_RELEASE
|
||||
LVM_PATH
|
||||
LVM_PATCHLEVEL
|
||||
LVM_MINOR
|
||||
LVM_MAJOR
|
||||
@ -664,6 +665,7 @@ DEBUG
|
||||
COPTIMISE_FLAG
|
||||
CONFDIR
|
||||
CMDLIB
|
||||
CLVMD_PATH
|
||||
CLVMD_CMANAGERS
|
||||
CLVMD
|
||||
CLUSTER
|
||||
@ -9913,18 +9915,20 @@ fi
|
||||
lvm_exec_prefix=$exec_prefix
|
||||
test "$lvm_exec_prefix" = NONE && lvm_exec_prefix=$prefix
|
||||
test "$lvm_exec_prefix" = NONE && lvm_exec_prefix=$ac_default_prefix
|
||||
LVM_PATH="$lvm_exec_prefix/sbin/lvm"
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define LVM_PATH "$lvm_exec_prefix/sbin/lvm"
|
||||
#define LVM_PATH "$LVM_PATH"
|
||||
_ACEOF
|
||||
|
||||
|
||||
if test "$CLVMD" != none; then
|
||||
clvmd_prefix=$ac_default_prefix
|
||||
CLVMD_PATH="$clvmd_prefix/sbin/clvmd"
|
||||
test "$prefix" != NONE && clvmd_prefix=$prefix
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define CLVMD_PATH "$clvmd_prefix/sbin/clvmd"
|
||||
#define CLVMD_PATH "$CLVMD_PATH"
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
@ -10202,6 +10206,8 @@ LVM_LIBAPI=`echo "$VER" | $AWK -F '[()]' '{print $2}'`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1180,13 +1180,14 @@ fi
|
||||
lvm_exec_prefix=$exec_prefix
|
||||
test "$lvm_exec_prefix" = NONE && lvm_exec_prefix=$prefix
|
||||
test "$lvm_exec_prefix" = NONE && lvm_exec_prefix=$ac_default_prefix
|
||||
AC_DEFINE_UNQUOTED(LVM_PATH, ["$lvm_exec_prefix/sbin/lvm"], [Path to lvm binary.])
|
||||
LVM_PATH="$lvm_exec_prefix/sbin/lvm"
|
||||
AC_DEFINE_UNQUOTED(LVM_PATH, ["$LVM_PATH"], [Path to lvm binary.])
|
||||
|
||||
if test "$CLVMD" != none; then
|
||||
clvmd_prefix=$ac_default_prefix
|
||||
CLVMD_PATH="$clvmd_prefix/sbin/clvmd"
|
||||
test "$prefix" != NONE && clvmd_prefix=$prefix
|
||||
AC_DEFINE_UNQUOTED(CLVMD_PATH, ["$clvmd_prefix/sbin/clvmd"],
|
||||
[Path to clvmd binary.])
|
||||
AC_DEFINE_UNQUOTED(CLVMD_PATH, ["$CLVMD_PATH"], [Path to clvmd binary.])
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
@ -1309,6 +1310,7 @@ AC_SUBST(CLDWHOLEARCHIVE)
|
||||
AC_SUBST(CLUSTER)
|
||||
AC_SUBST(CLVMD)
|
||||
AC_SUBST(CLVMD_CMANAGERS)
|
||||
AC_SUBST(CLVMD_PATH)
|
||||
AC_SUBST(CMAN_CFLAGS)
|
||||
AC_SUBST(CMAN_LIBS)
|
||||
AC_SUBST(CMDLIB)
|
||||
@ -1357,6 +1359,7 @@ AC_SUBST(LVM_LIBAPI)
|
||||
AC_SUBST(LVM_MAJOR)
|
||||
AC_SUBST(LVM_MINOR)
|
||||
AC_SUBST(LVM_PATCHLEVEL)
|
||||
AC_SUBST(LVM_PATH)
|
||||
AC_SUBST(LVM_RELEASE)
|
||||
AC_SUBST(LVM_RELEASE_DATE)
|
||||
AC_SUBST(MIRRORS)
|
||||
|
@ -366,6 +366,7 @@ static int restart_clvmd(void)
|
||||
int argc = 0, max_locks = 0;
|
||||
struct dm_hash_node *hn = NULL;
|
||||
char debug_arg[16];
|
||||
const char *clvmd = getenv("LVM_CLVMD_BINARY") ? : CLVMD_PATH;
|
||||
|
||||
DEBUGLOG("clvmd restart requested\n");
|
||||
|
||||
@ -415,11 +416,11 @@ static int restart_clvmd(void)
|
||||
argv[argc] = NULL;
|
||||
|
||||
/* Exec new clvmd */
|
||||
DEBUGLOG("--- Restarting %s ---\n", CLVMD_PATH);
|
||||
DEBUGLOG("--- Restarting %s ---\n", clvmd);
|
||||
for (argc = 1; argv[argc]; argc++) DEBUGLOG("--- %d: %s\n", argc, argv[argc]);
|
||||
|
||||
/* NOTE: This will fail when downgrading! */
|
||||
execve(CLVMD_PATH, (char **)argv, NULL);
|
||||
execve(clvmd, (char **)argv, NULL);
|
||||
out:
|
||||
/* We failed */
|
||||
DEBUGLOG("Restart of clvmd failed.\n");
|
||||
|
@ -704,14 +704,21 @@ static int get_initial_state(struct dm_hash_table *excl_uuid)
|
||||
char lv[64], vg[64], flags[25], vg_flags[25];
|
||||
char uuid[65];
|
||||
char line[255];
|
||||
FILE *lvs =
|
||||
popen
|
||||
(LVM_PATH " lvs --config 'log{command_names=0 prefix=\"\"}' --nolocking --noheadings -o vg_uuid,lv_uuid,lv_attr,vg_attr",
|
||||
"r");
|
||||
char *lvs_cmd;
|
||||
const char *lvm_binary = getenv("LVM_BINARY") ? : LVM_PATH;
|
||||
FILE *lvs;
|
||||
|
||||
if (!lvs)
|
||||
if (dm_asprintf(&lvs_cmd, "%s lvs --config 'log{command_names=0 prefix=\"\"}' "
|
||||
"--nolocking --noheadings -o vg_uuid,lv_uuid,lv_attr,vg_attr",
|
||||
lvm_binary) < 0)
|
||||
return 0;
|
||||
|
||||
/* FIXME: Maybe link and use liblvm2cmd directly instead of fork */
|
||||
if (!(lvs = popen(lvs_cmd, "r"))) {
|
||||
dm_free(lvs_cmd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (fgets(line, sizeof(line), lvs)) {
|
||||
if (sscanf(line, "%s %s %s %s\n", vg, lv, flags, vg_flags) == 4) {
|
||||
|
||||
@ -749,6 +756,8 @@ static int get_initial_state(struct dm_hash_table *excl_uuid)
|
||||
if (fclose(lvs))
|
||||
DEBUGLOG("lvs fclose failed: %s\n", strerror(errno));
|
||||
|
||||
dm_free(lvs_cmd);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ $(MAN5) $(MAN8) $(MAN8DM) $(MAN8CLUSTER): Makefile
|
||||
%: %.in
|
||||
@case "$@" in \
|
||||
*/*) ;; \
|
||||
*) echo "Creating $@" ; $(SED) -e "s+#VERSION#+$(LVM_VERSION)+;s+#DEFAULT_SYS_DIR#+$(DEFAULT_SYS_DIR)+;s+#DEFAULT_ARCHIVE_DIR#+$(DEFAULT_ARCHIVE_DIR)+;s+#DEFAULT_BACKUP_DIR#+$(DEFAULT_BACKUP_DIR)+;s+#DEFAULT_CACHE_DIR#+$(DEFAULT_CACHE_DIR)+;s+#DEFAULT_LOCK_DIR#+$(DEFAULT_LOCK_DIR)+" $< > $@ ;; \
|
||||
*) echo "Creating $@" ; $(SED) -e "s+#VERSION#+$(LVM_VERSION)+;s+#DEFAULT_SYS_DIR#+$(DEFAULT_SYS_DIR)+;s+#DEFAULT_ARCHIVE_DIR#+$(DEFAULT_ARCHIVE_DIR)+;s+#DEFAULT_BACKUP_DIR#+$(DEFAULT_BACKUP_DIR)+;s+#DEFAULT_CACHE_DIR#+$(DEFAULT_CACHE_DIR)+;s+#DEFAULT_LOCK_DIR#+$(DEFAULT_LOCK_DIR)+;s+#CLVMD_PATH#+@CLVMD_PATH@+;s+#LVM_PATH#+@LVM_PATH@+;" $< > $@ ;; \
|
||||
esac
|
||||
|
||||
install_man5: $(MAN5)
|
||||
|
@ -95,5 +95,15 @@ manually specify this option to override the search.
|
||||
.TP
|
||||
.I \-V
|
||||
Display the version of the cluster LVM daemon.
|
||||
|
||||
.SH ENVIRONMENT VARIABLES
|
||||
.TP
|
||||
.B LVM_CLVMD_BINARY
|
||||
The CLVMD binary to use when clmvd restart is requested.
|
||||
Defaults to #CLVMD_PATH#.
|
||||
.TP
|
||||
.B LVM_BINARY
|
||||
The LVM2 binary to use. Defaults to #LVM_PATH#.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR lvm (8)
|
||||
|
Loading…
Reference in New Issue
Block a user