mirror of
git://sourceware.org/git/lvm2.git
synced 2025-02-21 05:57:48 +03:00
cleanup: move the "daemon is running" checks to lvm-wrappers
And use ifdefs there, not exposing it in the tool code itself. Later in the future, we should probably make the PIDFILE and daemon checking code available also in case the daemon itself is not built.
This commit is contained in:
parent
f115a4a53f
commit
943f3aec3d
@ -497,7 +497,7 @@ static int _mirrored_target_present(struct cmd_context *cmd,
|
||||
* otherwise, the kernel module will fail to make
|
||||
* contact.
|
||||
*/
|
||||
if (dm_daemon_is_running(CMIRRORD_PIDFILE)) {
|
||||
if (cmirrord_is_running()) {
|
||||
struct utsname uts;
|
||||
unsigned kmaj, kmin, krel;
|
||||
/*
|
||||
|
@ -139,3 +139,27 @@ unsigned lvm_even_rand(unsigned *seed, unsigned max)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CLVMD_PIDFILE
|
||||
inline int clvmd_is_running(void)
|
||||
{
|
||||
return dm_daemon_is_running(CLVMD_PIDFILE);
|
||||
}
|
||||
#else
|
||||
inline int clvmd_is_running(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CMIRRORD_PIDFILE
|
||||
inline int cmirrord_is_running(void)
|
||||
{
|
||||
return dm_daemon_is_running(CMIRRORD_PIDFILE);
|
||||
}
|
||||
#else
|
||||
inline int cmirrord_is_running(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -37,4 +37,8 @@ int read_urandom(void *buf, size_t len);
|
||||
*/
|
||||
unsigned lvm_even_rand(unsigned *seed, unsigned max);
|
||||
|
||||
inline int clvmd_is_running(void);
|
||||
inline int cmirrord_is_running(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -304,7 +304,6 @@ static int _vgchange_clustered(struct cmd_context *cmd,
|
||||
struct volume_group *vg)
|
||||
{
|
||||
int clustered = !strcmp(arg_str_value(cmd, clustered_ARG, "n"), "y");
|
||||
int clvmd_daemon_running = 0;
|
||||
|
||||
if (clustered && (vg_is_clustered(vg))) {
|
||||
log_error("Volume group \"%s\" is already clustered",
|
||||
@ -319,10 +318,7 @@ static int _vgchange_clustered(struct cmd_context *cmd,
|
||||
}
|
||||
|
||||
if (clustered && !arg_count(cmd, yes_ARG)) {
|
||||
#ifdef CLVMD_PIDFILE
|
||||
clvmd_daemon_running = dm_daemon_is_running(CLVMD_PIDFILE);
|
||||
#endif
|
||||
if (!clvmd_daemon_running) {
|
||||
if (!clvmd_is_running()) {
|
||||
if (yes_no_prompt("LVM cluster daemon (clvmd) is not"
|
||||
" running.\n"
|
||||
"Make volume group \"%s\" clustered"
|
||||
|
Loading…
x
Reference in New Issue
Block a user