mirror of
git://sourceware.org/git/lvm2.git
synced 2025-11-24 08:23:49 +03:00
report: select: refactor: move percent handling code to libdm for reuse
This commit is contained in:
@@ -21,13 +21,13 @@ progress_t poll_mirror_progress(struct cmd_context *cmd,
|
||||
struct logical_volume *lv, const char *name,
|
||||
struct daemon_parms *parms)
|
||||
{
|
||||
percent_t segment_percent = PERCENT_0, overall_percent = PERCENT_0;
|
||||
dm_percent_t segment_percent = DM_PERCENT_0, overall_percent = DM_PERCENT_0;
|
||||
uint32_t event_nr = 0;
|
||||
|
||||
if (!lv_is_mirrored(lv) ||
|
||||
!lv_mirror_percent(cmd, lv, !parms->interval, &segment_percent,
|
||||
&event_nr) ||
|
||||
(segment_percent == PERCENT_INVALID)) {
|
||||
(segment_percent == DM_PERCENT_INVALID)) {
|
||||
log_error("ABORTING: Mirror percentage check failed.");
|
||||
return PROGRESS_CHECK_FAILED;
|
||||
}
|
||||
@@ -35,15 +35,15 @@ progress_t poll_mirror_progress(struct cmd_context *cmd,
|
||||
overall_percent = copy_percent(lv);
|
||||
if (parms->progress_display)
|
||||
log_print_unless_silent("%s: %s: %.1f%%", name, parms->progress_title,
|
||||
percent_to_float(overall_percent));
|
||||
dm_percent_to_float(overall_percent));
|
||||
else
|
||||
log_verbose("%s: %s: %.1f%%", name, parms->progress_title,
|
||||
percent_to_float(overall_percent));
|
||||
dm_percent_to_float(overall_percent));
|
||||
|
||||
if (segment_percent != PERCENT_100)
|
||||
if (segment_percent != DM_PERCENT_100)
|
||||
return PROGRESS_UNFINISHED;
|
||||
|
||||
if (overall_percent == PERCENT_100)
|
||||
if (overall_percent == DM_PERCENT_100)
|
||||
return PROGRESS_FINISHED_ALL;
|
||||
|
||||
return PROGRESS_FINISHED_SEGMENT;
|
||||
|
||||
Reference in New Issue
Block a user