1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Differentiate between snapshot status of "Invalid" and "Merge failed".

This commit is contained in:
Mike Snitzer 2012-01-20 22:02:04 +00:00
parent 861c624acb
commit 23e34c729b
7 changed files with 17 additions and 6 deletions

View File

@ -1,6 +1,7 @@
Version 2.02.89 -
==================================
Lookup snapshot usage percent of origin when a snapshot is merging.
Differentiate between snapshot status of "Invalid" and "Merge failed".
Lookup snapshot usage percent of origin volume when a snapshot is merging.
Update lvdisplay with backward compat. config opt. lvm1_compatible_display.
Do not report linear segtype for non-striped targets.
Keep info about creation host and time for each logical volume.

View File

@ -482,6 +482,9 @@ int add_linear_area_to_dtree(struct dm_tree_node *node, uint64_t size, uint32_t
static percent_range_t _combine_percent(percent_t a, percent_t b,
uint32_t numerator, uint32_t denominator)
{
if (a == PERCENT_MERGE_FAILED || b == PERCENT_MERGE_FAILED)
return PERCENT_MERGE_FAILED;
if (a == PERCENT_INVALID || b == PERCENT_INVALID)
return PERCENT_INVALID;

View File

@ -34,7 +34,8 @@ typedef enum {
PERCENT_0 = 0,
PERCENT_1 = 1000000,
PERCENT_100 = 100 * PERCENT_1,
PERCENT_INVALID = -1
PERCENT_INVALID = -1,
PERCENT_MERGE_FAILED = -2
} percent_range_t;
float percent_to_float(percent_t v);

View File

@ -836,7 +836,7 @@ static int _snpercent_disp(struct dm_report *rh __attribute__((unused)), struct
}
if (!lv_snapshot_percent(lv, &snap_percent) ||
(snap_percent == PERCENT_INVALID)) {
(snap_percent == PERCENT_INVALID) || (snap_percent == PERCENT_MERGE_FAILED)) {
if (!lv_is_merging_origin(lv)) {
*sortval = UINT64_C(100);
dm_report_field_set_value(field, "100.00", sortval);

View File

@ -136,9 +136,11 @@ static int _snap_target_percent(void **target_state __attribute__((unused)),
*percent = PERCENT_100;
else
*percent = make_percent(*total_numerator, *total_denominator);
} else if (!strcmp(params, "Invalid") ||
!strcmp(params, "Merge failed"))
}
else if (!strcmp(params, "Invalid"))
*percent = PERCENT_INVALID;
else if (!strcmp(params, "Merge failed"))
*percent = PERCENT_MERGE_FAILED;
else
return 0;

View File

@ -1591,7 +1591,8 @@ typedef enum {
PERCENT_0 = 0,
PERCENT_1 = 1000000,
PERCENT_100 = 100 * PERCENT_1,
PERCENT_INVALID = -1
PERCENT_INVALID = -1,
PERCENT_MERGE_FAILED = -2
} percent_range_t;
typedef int32_t percent_t;

View File

@ -461,6 +461,9 @@ static progress_t _poll_merge_progress(struct cmd_context *cmd,
} else if (percent == PERCENT_INVALID) {
log_error("%s: Merging snapshot invalidated. Aborting merge.", lv->name);
return PROGRESS_CHECK_FAILED;
} else if (percent == PERCENT_MERGE_FAILED) {
log_error("%s: Merge failed. Retry merge or inspect manually.", lv->name);
return PROGRESS_CHECK_FAILED;
}
if (parms->progress_display)