mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
register->monitor etc.
This commit is contained in:
parent
8bbec04d5b
commit
8a37910d51
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.20 -
|
Version 2.02.20 -
|
||||||
===================================
|
===================================
|
||||||
|
Change remaining dmeventd terminology 'register' to 'monitor'.
|
||||||
Update reporting man pages.
|
Update reporting man pages.
|
||||||
No longer necessary to specify alignment for report fields.
|
No longer necessary to specify alignment for report fields.
|
||||||
|
|
||||||
|
@ -325,8 +325,8 @@ int do_lock_lv(unsigned char command, unsigned char lock_flags, char *resource)
|
|||||||
if (lock_flags & LCK_MIRROR_NOSYNC_MODE)
|
if (lock_flags & LCK_MIRROR_NOSYNC_MODE)
|
||||||
init_mirror_in_sync(1);
|
init_mirror_in_sync(1);
|
||||||
|
|
||||||
if (!(lock_flags & LCK_DMEVENTD_REGISTER_MODE))
|
if (!(lock_flags & LCK_DMEVENTD_MONITOR_MODE))
|
||||||
init_dmeventd_register(0);
|
init_dmeventd_monitor(0);
|
||||||
|
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case LCK_LV_EXCLUSIVE:
|
case LCK_LV_EXCLUSIVE:
|
||||||
@ -362,8 +362,8 @@ int do_lock_lv(unsigned char command, unsigned char lock_flags, char *resource)
|
|||||||
if (lock_flags & LCK_MIRROR_NOSYNC_MODE)
|
if (lock_flags & LCK_MIRROR_NOSYNC_MODE)
|
||||||
init_mirror_in_sync(0);
|
init_mirror_in_sync(0);
|
||||||
|
|
||||||
if (!(lock_flags & LCK_DMEVENTD_REGISTER_MODE))
|
if (!(lock_flags & LCK_DMEVENTD_MONITOR_MODE))
|
||||||
init_dmeventd_register(DEFAULT_DMEVENTD_MONITOR);
|
init_dmeventd_monitor(DEFAULT_DMEVENTD_MONITOR);
|
||||||
|
|
||||||
/* clean the pool for another command */
|
/* clean the pool for another command */
|
||||||
dm_pool_empty(cmd->mem);
|
dm_pool_empty(cmd->mem);
|
||||||
|
@ -640,28 +640,23 @@ int lvs_in_vg_opened(struct volume_group *vg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* register_dev_for_events
|
* Returns 0 if an attempt to (un)monitor the device failed.
|
||||||
*
|
* Returns 1 otherwise.
|
||||||
* This function uses proper error codes (but breaks convention)
|
|
||||||
* to return:
|
|
||||||
* -1 on error
|
|
||||||
* 0 if the lv's targets don't do event [un]registration
|
|
||||||
* 0 if the lv is already [un]registered -- FIXME: not implemented
|
|
||||||
* 1 if the lv had a segment which was [un]registered
|
|
||||||
*
|
|
||||||
* Returns: -1 on error
|
|
||||||
*/
|
*/
|
||||||
int register_dev_for_events(struct cmd_context *cmd,
|
int monitor_dev_for_events(struct cmd_context *cmd,
|
||||||
struct logical_volume *lv, int do_reg)
|
struct logical_volume *lv, int monitor)
|
||||||
{
|
{
|
||||||
#ifdef DMEVENTD
|
#ifdef DMEVENTD
|
||||||
int i, pending = 0, registered;
|
int i, pending = 0, monitored;
|
||||||
int r = 0;
|
int r = 1;
|
||||||
struct list *tmp;
|
struct list *tmp;
|
||||||
struct lv_segment *seg;
|
struct lv_segment *seg;
|
||||||
int (*reg) (struct cmd_context *c, struct lv_segment *s, int e);
|
int (*monitor_fn) (struct cmd_context *c, struct lv_segment *s, int e);
|
||||||
|
|
||||||
if (do_reg && !dmeventd_register_mode())
|
/*
|
||||||
|
* Nothing to do if dmeventd configured not to be used.
|
||||||
|
*/
|
||||||
|
if (monitor && !dmeventd_monitor_mode())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
list_iterate(tmp, &lv->segments) {
|
list_iterate(tmp, &lv->segments) {
|
||||||
@ -669,57 +664,61 @@ int register_dev_for_events(struct cmd_context *cmd,
|
|||||||
|
|
||||||
if (!seg_monitored(seg) || (seg->status & PVMOVE))
|
if (!seg_monitored(seg) || (seg->status & PVMOVE))
|
||||||
continue;
|
continue;
|
||||||
reg = NULL;
|
|
||||||
|
monitor_fn = NULL;
|
||||||
|
|
||||||
/* Check monitoring status */
|
/* Check monitoring status */
|
||||||
if (seg->segtype->ops->target_registered)
|
if (seg->segtype->ops->target_monitored)
|
||||||
registered = seg->segtype->ops->target_registered(seg, &pending);
|
monitored = seg->segtype->ops->target_monitored(seg, &pending);
|
||||||
else
|
else
|
||||||
continue; /* segtype doesn't support registration */
|
continue; /* segtype doesn't support registration */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FIXME: We should really try again if pending
|
* FIXME: We should really try again if pending
|
||||||
*/
|
*/
|
||||||
registered = (pending) ? 0 : registered;
|
monitored = (pending) ? 0 : monitored;
|
||||||
|
|
||||||
if (do_reg) {
|
if (monitor) {
|
||||||
if (registered)
|
if (monitored)
|
||||||
log_verbose("%s/%s already monitored.", lv->vg->name, lv->name);
|
log_verbose("%s/%s already monitored.", lv->vg->name, lv->name);
|
||||||
else if (seg->segtype->ops->target_register_events)
|
else if (seg->segtype->ops->target_monitor_events)
|
||||||
reg = seg->segtype->ops->target_register_events;
|
monitor_fn = seg->segtype->ops->target_monitor_events;
|
||||||
} else {
|
} else {
|
||||||
if (!registered)
|
if (!monitored)
|
||||||
log_verbose("%s/%s already not monitored.", lv->vg->name, lv->name);
|
log_verbose("%s/%s already not monitored.", lv->vg->name, lv->name);
|
||||||
else if (seg->segtype->ops->target_unregister_events)
|
else if (seg->segtype->ops->target_unmonitor_events)
|
||||||
reg = seg->segtype->ops->target_unregister_events;
|
monitor_fn = seg->segtype->ops->target_unmonitor_events;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do [un]monitor */
|
/* Do [un]monitor */
|
||||||
if (!reg)
|
if (!monitor_fn)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
log_verbose("%sonitoring %s/%s", monitor ? "M" : "Not m", lv->vg->name, lv->name);
|
||||||
|
|
||||||
/* FIXME specify events */
|
/* FIXME specify events */
|
||||||
if (!reg(cmd, seg, 0)) {
|
if (!monitor_fn(cmd, seg, 0)) {
|
||||||
stack;
|
log_error("%s/%s: %s segment monitoring function failed.",
|
||||||
return -1;
|
lv->vg->name, lv->name, seg->segtype->name);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check [un]monitor results */
|
/* Check [un]monitor results */
|
||||||
/* Try a couple times if pending, but not forever... */
|
/* Try a couple times if pending, but not forever... */
|
||||||
for (i = 0; i < 10; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
pending = 0;
|
pending = 0;
|
||||||
registered = seg->segtype->ops->target_registered(seg, &pending);
|
monitored = seg->segtype->ops->target_monitored(seg, &pending);
|
||||||
if (pending ||
|
if (pending ||
|
||||||
(!registered && do_reg) ||
|
(!monitored && monitor) ||
|
||||||
(registered && !do_reg))
|
(monitored && !monitor))
|
||||||
log_very_verbose("%s/%s %smonitoring still pending.",
|
log_very_verbose("%s/%s %smonitoring still pending: waiting...",
|
||||||
lv->vg->name, lv->name, do_reg ? "" : "un");
|
lv->vg->name, lv->name, monitor ? "" : "un");
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
r = (registered && do_reg) || (!registered && !do_reg);
|
r = (monitored && monitor) || (!monitored && !monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
@ -764,7 +763,7 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (register_dev_for_events(cmd, lv, 0) < 0)
|
if (!monitor_dev_for_events(cmd, lv, 0))
|
||||||
/* FIXME Consider aborting here */
|
/* FIXME Consider aborting here */
|
||||||
stack;
|
stack;
|
||||||
|
|
||||||
@ -822,7 +821,7 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
memlock_dec();
|
memlock_dec();
|
||||||
fs_unlock();
|
fs_unlock();
|
||||||
|
|
||||||
if (register_dev_for_events(cmd, lv, 1) < 0)
|
if (!monitor_dev_for_events(cmd, lv, 1))
|
||||||
stack;
|
stack;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -868,7 +867,7 @@ int lv_deactivate(struct cmd_context *cmd, const char *lvid_s)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (register_dev_for_events(cmd, lv, 0) < 0)
|
if (!monitor_dev_for_events(cmd, lv, 0))
|
||||||
stack;
|
stack;
|
||||||
|
|
||||||
memlock_inc();
|
memlock_inc();
|
||||||
@ -941,7 +940,7 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
memlock_dec();
|
memlock_dec();
|
||||||
fs_unlock();
|
fs_unlock();
|
||||||
|
|
||||||
if (!register_dev_for_events(cmd, lv, 1) < 0)
|
if (!monitor_dev_for_events(cmd, lv, 1))
|
||||||
stack;
|
stack;
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
@ -86,7 +86,7 @@ int lvs_in_vg_activated(struct volume_group *vg);
|
|||||||
int lvs_in_vg_opened(struct volume_group *vg);
|
int lvs_in_vg_opened(struct volume_group *vg);
|
||||||
|
|
||||||
|
|
||||||
int register_dev_for_events(struct cmd_context *cmd,
|
int monitor_dev_for_events(struct cmd_context *cmd,
|
||||||
struct logical_volume *lv, int do_reg);
|
struct logical_volume *lv, int do_reg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -321,8 +321,8 @@ static int _lock_for_cluster(unsigned char cmd, unsigned int flags, char *name)
|
|||||||
if (mirror_in_sync())
|
if (mirror_in_sync())
|
||||||
args[1] |= LCK_MIRROR_NOSYNC_MODE;
|
args[1] |= LCK_MIRROR_NOSYNC_MODE;
|
||||||
|
|
||||||
if (dmeventd_register_mode())
|
if (dmeventd_monitor_mode())
|
||||||
args[1] |= LCK_DMEVENTD_REGISTER_MODE;
|
args[1] |= LCK_DMEVENTD_MONITOR_MODE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* VG locks are just that: locks, and have no side effects
|
* VG locks are just that: locks, and have no side effects
|
||||||
|
@ -75,7 +75,7 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname);
|
|||||||
*/
|
*/
|
||||||
#define LCK_PARTIAL_MODE 0x00000001 /* Running in partial mode */
|
#define LCK_PARTIAL_MODE 0x00000001 /* Running in partial mode */
|
||||||
#define LCK_MIRROR_NOSYNC_MODE 0x00000002 /* Mirrors don't require sync */
|
#define LCK_MIRROR_NOSYNC_MODE 0x00000002 /* Mirrors don't require sync */
|
||||||
#define LCK_DMEVENTD_REGISTER_MODE 0x00000004 /* Register with dmeventd */
|
#define LCK_DMEVENTD_MONITOR_MODE 0x00000004 /* Register with dmeventd */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -48,7 +48,7 @@ static char _cmd_name[30] = "";
|
|||||||
static char _msg_prefix[30] = " ";
|
static char _msg_prefix[30] = " ";
|
||||||
static int _already_logging = 0;
|
static int _already_logging = 0;
|
||||||
static int _mirror_in_sync = 0;
|
static int _mirror_in_sync = 0;
|
||||||
static int _dmeventd_register = DEFAULT_DMEVENTD_MONITOR;
|
static int _dmeventd_monitor = DEFAULT_DMEVENTD_MONITOR;
|
||||||
|
|
||||||
static lvm2_log_fn_t _lvm2_log_fn = NULL;
|
static lvm2_log_fn_t _lvm2_log_fn = NULL;
|
||||||
|
|
||||||
@ -189,9 +189,9 @@ void init_mirror_in_sync(int in_sync)
|
|||||||
_mirror_in_sync = in_sync;
|
_mirror_in_sync = in_sync;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_dmeventd_register(int reg)
|
void init_dmeventd_monitor(int reg)
|
||||||
{
|
{
|
||||||
_dmeventd_register = reg;
|
_dmeventd_monitor = reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_cmd_name(int status)
|
void init_cmd_name(int status)
|
||||||
@ -268,9 +268,9 @@ int mirror_in_sync(void)
|
|||||||
return _mirror_in_sync;
|
return _mirror_in_sync;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dmeventd_register_mode(void)
|
int dmeventd_monitor_mode(void)
|
||||||
{
|
{
|
||||||
return _dmeventd_register;
|
return _dmeventd_monitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_debug(int level)
|
void init_debug(int level)
|
||||||
|
@ -75,7 +75,7 @@ void init_ignorelockingfailure(int level);
|
|||||||
void init_lockingfailed(int level);
|
void init_lockingfailed(int level);
|
||||||
void init_security_level(int level);
|
void init_security_level(int level);
|
||||||
void init_mirror_in_sync(int in_sync);
|
void init_mirror_in_sync(int in_sync);
|
||||||
void init_dmeventd_register(int reg);
|
void init_dmeventd_monitor(int reg);
|
||||||
|
|
||||||
void set_cmd_name(const char *cmd_name);
|
void set_cmd_name(const char *cmd_name);
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ int ignorelockingfailure(void);
|
|||||||
int lockingfailed(void);
|
int lockingfailed(void);
|
||||||
int security_level(void);
|
int security_level(void);
|
||||||
int mirror_in_sync(void);
|
int mirror_in_sync(void);
|
||||||
int dmeventd_register_mode(void);
|
int dmeventd_monitor_mode(void);
|
||||||
|
|
||||||
/* Suppress messages to stdout/stderr (1) or everywhere (2) */
|
/* Suppress messages to stdout/stderr (1) or everywhere (2) */
|
||||||
/* Returns previous setting */
|
/* Returns previous setting */
|
||||||
|
@ -83,10 +83,10 @@ struct segtype_handler {
|
|||||||
const struct lv_segment *seg,
|
const struct lv_segment *seg,
|
||||||
struct list *modules);
|
struct list *modules);
|
||||||
void (*destroy) (const struct segment_type * segtype);
|
void (*destroy) (const struct segment_type * segtype);
|
||||||
int (*target_registered) (struct lv_segment *seg, int *pending);
|
int (*target_monitored) (struct lv_segment *seg, int *pending);
|
||||||
int (*target_register_events) (struct cmd_context *cmd,
|
int (*target_monitor_events) (struct cmd_context *cmd,
|
||||||
struct lv_segment *seg, int events);
|
struct lv_segment *seg, int events);
|
||||||
int (*target_unregister_events) (struct cmd_context *cmd,
|
int (*target_unmonitor_events) (struct cmd_context *cmd,
|
||||||
struct lv_segment *seg, int events);
|
struct lv_segment *seg, int events);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ fail:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _target_registered(struct lv_segment *seg, int *pending)
|
static int _target_monitored(struct lv_segment *seg, int *pending)
|
||||||
{
|
{
|
||||||
char *dso, *name;
|
char *dso, *name;
|
||||||
struct logical_volume *lv;
|
struct logical_volume *lv;
|
||||||
@ -476,19 +476,19 @@ static int _target_set_events(struct cmd_context *cmd,
|
|||||||
if (!r)
|
if (!r)
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
log_info("%s %s for events", set ? "Registered" : "Unregistered", name);
|
log_info("%s %s for events", set ? "Monitored" : "Unmonitored", name);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _target_register_events(struct cmd_context *cmd,
|
static int _target_monitor_events(struct cmd_context *cmd,
|
||||||
struct lv_segment *seg,
|
struct lv_segment *seg,
|
||||||
int events)
|
int events)
|
||||||
{
|
{
|
||||||
return _target_set_events(cmd, seg, events, 1);
|
return _target_set_events(cmd, seg, events, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _target_unregister_events(struct cmd_context *cmd,
|
static int _target_unmonitor_events(struct cmd_context *cmd,
|
||||||
struct lv_segment *seg,
|
struct lv_segment *seg,
|
||||||
int events)
|
int events)
|
||||||
{
|
{
|
||||||
@ -536,9 +536,9 @@ static struct segtype_handler _mirrored_ops = {
|
|||||||
.target_percent = _mirrored_target_percent,
|
.target_percent = _mirrored_target_percent,
|
||||||
.target_present = _mirrored_target_present,
|
.target_present = _mirrored_target_present,
|
||||||
#ifdef DMEVENTD
|
#ifdef DMEVENTD
|
||||||
.target_registered = _target_registered,
|
.target_monitored = _target_monitored,
|
||||||
.target_register_events = _target_register_events,
|
.target_monitor_events = _target_monitor_events,
|
||||||
.target_unregister_events = _target_unregister_events,
|
.target_unmonitor_events = _target_unmonitor_events,
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
.modules_needed = _mirrored_modules_needed,
|
.modules_needed = _mirrored_modules_needed,
|
||||||
|
@ -80,10 +80,9 @@ static int lvchange_permission(struct cmd_context *cmd,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lvchange_registration(struct cmd_context *cmd,
|
static int lvchange_monitoring(struct cmd_context *cmd,
|
||||||
struct logical_volume *lv)
|
struct logical_volume *lv)
|
||||||
{
|
{
|
||||||
int r;
|
|
||||||
struct lvinfo info;
|
struct lvinfo info;
|
||||||
|
|
||||||
if (!lv_info(cmd, lv, &info, 0) || !info.exists) {
|
if (!lv_info(cmd, lv, &info, 0) || !info.exists) {
|
||||||
@ -91,27 +90,14 @@ static int lvchange_registration(struct cmd_context *cmd,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* do not register pvmove lv's */
|
/* do not monitor pvmove lv's */
|
||||||
if (lv->status & PVMOVE)
|
if (lv->status & PVMOVE)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
log_verbose("%smonitoring logical volume \"%s\"",
|
if (!monitor_dev_for_events(cmd, lv, dmeventd_monitor_mode()))
|
||||||
(dmeventd_register_mode()) ? "" : "Not ", lv->name);
|
stack;
|
||||||
r = register_dev_for_events(cmd, lv, dmeventd_register_mode());
|
|
||||||
|
|
||||||
if (r < 0) {
|
return 1;
|
||||||
log_error("Unable to %smonitor logical volume, %s",
|
|
||||||
(dmeventd_register_mode()) ? "" : "un", lv->name);
|
|
||||||
r = 0;
|
|
||||||
} else if (!r) {
|
|
||||||
log_verbose("Logical volume %s needs no %smonitoring, or is already %smonitored",
|
|
||||||
(dmeventd_register_mode()) ? "" : "un",
|
|
||||||
lv->name,
|
|
||||||
(dmeventd_register_mode()) ? "" : "un");
|
|
||||||
r = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lvchange_availability(struct cmd_context *cmd,
|
static int lvchange_availability(struct cmd_context *cmd,
|
||||||
@ -605,7 +591,7 @@ static int lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
init_dmeventd_register(arg_int_value(cmd, monitor_ARG, DEFAULT_DMEVENTD_MONITOR));
|
init_dmeventd_monitor(arg_int_value(cmd, monitor_ARG, DEFAULT_DMEVENTD_MONITOR));
|
||||||
|
|
||||||
/* access permission change */
|
/* access permission change */
|
||||||
if (arg_count(cmd, permission_ARG)) {
|
if (arg_count(cmd, permission_ARG)) {
|
||||||
@ -675,7 +661,7 @@ static int lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
if (!arg_count(cmd, available_ARG) &&
|
if (!arg_count(cmd, available_ARG) &&
|
||||||
!arg_count(cmd, refresh_ARG) &&
|
!arg_count(cmd, refresh_ARG) &&
|
||||||
arg_count(cmd, monitor_ARG)) {
|
arg_count(cmd, monitor_ARG)) {
|
||||||
if (!lvchange_registration(cmd, lv))
|
if (!lvchange_monitoring(cmd, lv))
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
static int _register_lvs_in_vg(struct cmd_context *cmd,
|
static int _monitor_lvs_in_vg(struct cmd_context *cmd,
|
||||||
struct volume_group *vg, int reg)
|
struct volume_group *vg, int reg)
|
||||||
{
|
{
|
||||||
struct lv_list *lvl;
|
struct lv_list *lvl;
|
||||||
@ -23,7 +23,6 @@ static int _register_lvs_in_vg(struct cmd_context *cmd,
|
|||||||
struct lvinfo info;
|
struct lvinfo info;
|
||||||
int lv_active;
|
int lv_active;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int r;
|
|
||||||
|
|
||||||
list_iterate_items(lvl, &vg->lvs) {
|
list_iterate_items(lvl, &vg->lvs) {
|
||||||
lv = lvl->lv;
|
lv = lvl->lv;
|
||||||
@ -39,16 +38,9 @@ static int _register_lvs_in_vg(struct cmd_context *cmd,
|
|||||||
if ((lv->status & PVMOVE) || !lv_active)
|
if ((lv->status & PVMOVE) || !lv_active)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
r = register_dev_for_events(cmd, lv, reg);
|
if (!monitor_dev_for_events(cmd, lv, reg)) {
|
||||||
|
|
||||||
if (r < 0) {
|
|
||||||
log_error("Failed to %s logical volume, %s",
|
|
||||||
(reg) ? "register" : "unregister",
|
|
||||||
lv->name);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
} else
|
||||||
|
|
||||||
if (r)
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,10 +106,10 @@ static int _vgchange_monitoring(struct cmd_context *cmd, struct volume_group *vg
|
|||||||
int active, monitored;
|
int active, monitored;
|
||||||
|
|
||||||
if ((active = lvs_in_vg_activated(vg))) {
|
if ((active = lvs_in_vg_activated(vg))) {
|
||||||
monitored = _register_lvs_in_vg(cmd, vg, dmeventd_register_mode());
|
monitored = _monitor_lvs_in_vg(cmd, vg, dmeventd_monitor_mode());
|
||||||
log_print("%d logical volume(s) in volume group "
|
log_print("%d logical volume(s) in volume group "
|
||||||
"\"%s\" %smonitored",
|
"\"%s\" %smonitored",
|
||||||
monitored, vg->name, (dmeventd_register_mode()) ? "" : "un");
|
monitored, vg->name, (dmeventd_monitor_mode()) ? "" : "un");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ECMD_PROCESSED;
|
return ECMD_PROCESSED;
|
||||||
@ -154,11 +146,11 @@ static int _vgchange_available(struct cmd_context *cmd, struct volume_group *vg)
|
|||||||
if (activate && (active = lvs_in_vg_activated(vg))) {
|
if (activate && (active = lvs_in_vg_activated(vg))) {
|
||||||
log_verbose("%d logical volume(s) in volume group \"%s\" "
|
log_verbose("%d logical volume(s) in volume group \"%s\" "
|
||||||
"already active", active, vg->name);
|
"already active", active, vg->name);
|
||||||
monitored = _register_lvs_in_vg(cmd, vg, dmeventd_register_mode());
|
monitored = _monitor_lvs_in_vg(cmd, vg, dmeventd_monitor_mode());
|
||||||
log_verbose("%d existing logical volume(s) in volume "
|
log_verbose("%d existing logical volume(s) in volume "
|
||||||
"group \"%s\" %smonitored",
|
"group \"%s\" %smonitored",
|
||||||
monitored, vg->name,
|
monitored, vg->name,
|
||||||
dmeventd_register_mode() ? "" : "un");
|
dmeventd_monitor_mode() ? "" : "un");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activate && _activate_lvs_in_vg(cmd, vg, available))
|
if (activate && _activate_lvs_in_vg(cmd, vg, available))
|
||||||
@ -540,7 +532,7 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
|
|||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
init_dmeventd_register(arg_int_value(cmd, monitor_ARG, DEFAULT_DMEVENTD_MONITOR));
|
init_dmeventd_monitor(arg_int_value(cmd, monitor_ARG, DEFAULT_DMEVENTD_MONITOR));
|
||||||
|
|
||||||
if (arg_count(cmd, available_ARG))
|
if (arg_count(cmd, available_ARG))
|
||||||
r = _vgchange_available(cmd, vg);
|
r = _vgchange_available(cmd, vg);
|
||||||
|
Loading…
Reference in New Issue
Block a user