mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Fix lvscan snapshot full display.
dmeventd fixes
This commit is contained in:
parent
3c588200fe
commit
e64934773b
@ -1,5 +1,6 @@
|
||||
Version 2.02.02 -
|
||||
====================================
|
||||
Fix lvscan snapshot full display.
|
||||
Bring lvdisplay man page example into line.
|
||||
Add mirror dmeventd library.
|
||||
Add some activation logic to remove_mirror_images().
|
||||
|
@ -577,10 +577,11 @@ static int _register_dev(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
list_iterate(tmp, &lv->segments) {
|
||||
seg = list_item(tmp, struct lv_segment);
|
||||
|
||||
if (do_reg)
|
||||
reg = seg->segtype->ops->target_register;
|
||||
else
|
||||
reg = seg->segtype->ops->target_unregister;
|
||||
if (do_reg) {
|
||||
if (seg->segtype->ops->target_register_events)
|
||||
reg = seg->segtype->ops->target_register_events;
|
||||
} else if(seg->setype->ops->target_unregister_events)
|
||||
reg = seg->segtype->ops->target_unregister_events;
|
||||
|
||||
if (reg)
|
||||
/* FIXME specify events */
|
||||
@ -589,6 +590,7 @@ static int _register_dev(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
@ -78,10 +78,12 @@ struct segtype_handler {
|
||||
uint64_t *total_denominator, float *percent);
|
||||
int (*target_present) (void);
|
||||
void (*destroy) (const struct segment_type * segtype);
|
||||
int (*target_register) (struct dm_pool *mem, struct lv_segment *seg,
|
||||
struct config_tree *cft, int events);
|
||||
int (*target_unregister) (struct dm_pool *mem, struct lv_segment *seg,
|
||||
struct config_tree *cft, int events);
|
||||
int (*target_register_events) (struct dm_pool *mem,
|
||||
struct lv_segment *seg,
|
||||
struct config_tree *cft, int events);
|
||||
int (*target_unregister_events) (struct dm_pool *mem,
|
||||
struct lv_segment *seg,
|
||||
struct config_tree *cft, int events);
|
||||
};
|
||||
|
||||
struct segment_type *get_segtype_from_string(struct cmd_context *cmd,
|
||||
|
@ -341,8 +341,9 @@ static int _setup_registration(struct dm_pool *mem, struct config_tree *cft,
|
||||
}
|
||||
|
||||
/* FIXME This gets run while suspended and performs banned operations. */
|
||||
static int _target_register(struct dm_pool *mem, struct lv_segment *seg,
|
||||
struct config_tree *cft, int events)
|
||||
static int _target_register_events(struct dm_pool *mem,
|
||||
struct lv_segment *seg,
|
||||
struct config_tree *cft, int events)
|
||||
{
|
||||
char *dso;
|
||||
char dm_name[PATH_MAX];
|
||||
@ -362,7 +363,7 @@ static int _target_register(struct dm_pool *mem, struct lv_segment *seg,
|
||||
strncpy(dm_name, build_dm_name(mem, vg->name, lv->name, NULL),
|
||||
PATH_MAX);
|
||||
|
||||
if((err = dm_event_register(dso, dm_name, ALL_ERRORS)) < 0) {
|
||||
if((err = dm_event_register(dso, dm_name, DM_EVENT_ALL_ERRORS)) < 0) {
|
||||
log_error("Unable to register %s for events: %s", dm_name,
|
||||
strerror(-err));
|
||||
return 0;
|
||||
@ -372,8 +373,9 @@ static int _target_register(struct dm_pool *mem, struct lv_segment *seg,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _target_unregister(struct dm_pool *mem, struct lv_segment *seg,
|
||||
struct config_tree *cft, int events)
|
||||
static int _target_unregister_events(struct dm_pool *mem,
|
||||
struct lv_segment *seg,
|
||||
struct config_tree *cft, int events)
|
||||
{
|
||||
char *dso;
|
||||
char devpath[PATH_MAX];
|
||||
@ -424,8 +426,8 @@ static struct segtype_handler _mirrored_ops = {
|
||||
target_present:_target_present,
|
||||
#endif
|
||||
#ifdef DMEVENTD
|
||||
target_register:_target_register,
|
||||
target_unregister:_target_unregister,
|
||||
target_register_events:_target_register_events,
|
||||
target_unregister_events:_target_unregister_events,
|
||||
#endif
|
||||
destroy:_destroy,
|
||||
};
|
||||
|
@ -87,12 +87,12 @@ ifeq ("@CMDLIB@", "yes")
|
||||
INSTALL_TARGETS += $(INSTALL_CMDLIB_TARGETS)
|
||||
endif
|
||||
|
||||
ifeq ("@DEVMAPPER@", "yes")
|
||||
LVMLIBS += -ldevmapper
|
||||
ifeq ("@DMEVENTD@", "yes")
|
||||
LVMLIBS += -ldevmapper-event -lpthread
|
||||
endif
|
||||
|
||||
ifeq ("@DMEVENTD@", "yes")
|
||||
LVMLIBS += -ldevmapper-event
|
||||
ifeq ("@DEVMAPPER@", "yes")
|
||||
LVMLIBS += -ldevmapper
|
||||
endif
|
||||
|
||||
CFLAGS += -DLVM_SHARED_PATH=\"$(exec_prefix)/sbin/lvm\"
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 Red Hat, Inc. All rights reserved.
|
||||
* Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
@ -21,6 +21,9 @@ static int lvscan_single(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
struct lvinfo info;
|
||||
int lv_total = 0;
|
||||
uint64_t lv_capacity_total = 0;
|
||||
int inkernel, snap_active = 1;
|
||||
struct lv_segment *snap_seg = NULL;
|
||||
float snap_percent; /* fused, fsize; */
|
||||
|
||||
const char *active_str, *snapshot_str;
|
||||
|
||||
@ -29,8 +32,27 @@ static int lvscan_single(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
!(lv_is_cow(lv)))
|
||||
return ECMD_PROCESSED;
|
||||
|
||||
inkernel = lv_info(cmd, lv, &info, 1) && info.exists;
|
||||
if (lv_is_origin(lv)) {
|
||||
list_iterate_items_gen(snap_seg, &lv->snapshot_segs,
|
||||
origin_list) {
|
||||
if (inkernel &&
|
||||
(snap_active = lv_snapshot_percent(snap_seg->cow,
|
||||
&snap_percent)))
|
||||
if (snap_percent < 0 || snap_percent >= 100)
|
||||
snap_active = 0;
|
||||
}
|
||||
snap_seg = NULL;
|
||||
} else if ((snap_seg = find_cow(lv))) {
|
||||
if (inkernel &&
|
||||
(snap_active = lv_snapshot_percent(snap_seg->cow,
|
||||
&snap_percent)))
|
||||
if (snap_percent < 0 || snap_percent >= 100)
|
||||
snap_active = 0;
|
||||
}
|
||||
|
||||
/* FIXME Add -D arg to skip this! */
|
||||
if (lv_info(cmd, lv, &info, 0) && info.exists)
|
||||
if (inkernel && snap_active)
|
||||
active_str = "ACTIVE ";
|
||||
else
|
||||
active_str = "inactive ";
|
||||
|
@ -78,7 +78,7 @@ static int pvcreate_check(struct cmd_context *cmd, const char *name)
|
||||
}
|
||||
|
||||
if (!dev) {
|
||||
log_error("Device %s not found.", name);
|
||||
log_error("Device %s not found (or ignored by filtering).", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user