[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH 2/3] Polldaemon configurable progress title



polldaemon, which is used by pvmove, prints "Moved: x%" periodically
to show the progress of its work.
However, it can be used for other purpose like waiting for
sync completion of newly added mirror.
This patch change the strings "Moved" configurable by
a parameter passed to poll_daemon().

This is prepration for the next patch which changes lvconvert to
use polldaemon.

Thanks,
--
Jun'ichi Nomura, NEC Corporation of America
lvconvert can wait for sync comletion of added mirrors, like pvmove.

Changes in polldaemon:
  - Allowed 'update_metadata' method being NULL if the application
    doesn't require periodical update of the metadata.
  - Added 'progress_title' parameter to poll_daemon().
    pvmove will pass "Moved". lvconvert will pass "Converted".

Index: LVM2.work/tools/polldaemon.c
===================================================================
--- LVM2.work.orig/tools/polldaemon.c
+++ LVM2.work/tools/polldaemon.c
@@ -93,9 +93,11 @@ static int _check_mirror_status(struct c
 
 	overall_percent = copy_percent(lv_mirr);
 	if (parms->progress_display)
-		log_print("%s: Moved: %.1f%%", name, overall_percent);
+		log_print("%s: %s: %.1f%%", name, parms->progress_title,
+			  overall_percent);
 	else
-		log_verbose("%s: Moved: %.1f%%", name, overall_percent);
+		log_verbose("%s: %s: %.1f%%", name, parms->progress_title,
+			    overall_percent);
 
 	if (segment_percent < 100.0) {
 		/* The only case the caller *should* try again later */
@@ -224,7 +226,8 @@ static void _poll_for_all_vgs(struct cmd
 }
 
 int poll_daemon(struct cmd_context *cmd, const char *name, unsigned background,
-		uint32_t lv_type, struct poll_functions *poll_fns)
+		uint32_t lv_type, struct poll_functions *poll_fns,
+		const char *progress_title)
 {
 	struct daemon_parms parms;
 
@@ -232,6 +235,7 @@ int poll_daemon(struct cmd_context *cmd,
 	parms.background = background;
 	parms.interval = arg_uint_value(cmd, interval_ARG, DEFAULT_INTERVAL);
 	parms.progress_display = 1;
+	parms.progress_title = progress_title;
 	parms.lv_type = lv_type;
 	parms.poll_fns = poll_fns;
 
Index: LVM2.work/tools/polldaemon.h
===================================================================
--- LVM2.work.orig/tools/polldaemon.h
+++ LVM2.work/tools/polldaemon.h
@@ -42,11 +42,13 @@ struct daemon_parms {
 	unsigned background;
 	unsigned outstanding_count;
 	unsigned progress_display;
+	const char *progress_title;
 	uint32_t lv_type;
 	struct poll_functions *poll_fns;
 };
 
 int poll_daemon(struct cmd_context *cmd, const char *name, unsigned background,
-		uint32_t lv_type, struct poll_functions *poll_fns);
+		uint32_t lv_type, struct poll_functions *poll_fns,
+		const char *progress_title);
 
 #endif
Index: LVM2.work/tools/pvmove.c
===================================================================
--- LVM2.work.orig/tools/pvmove.c
+++ LVM2.work/tools/pvmove.c
@@ -525,7 +525,8 @@ static struct poll_functions _pvmove_fns
 int pvmove_poll(struct cmd_context *cmd, const char *pv_name,
 		unsigned background)
 {
-	return poll_daemon(cmd, pv_name, background, PVMOVE, &_pvmove_fns);
+	return poll_daemon(cmd, pv_name, background, PVMOVE, &_pvmove_fns,
+			   "Moved");
 }
 
 int pvmove(struct cmd_context *cmd, int argc, char **argv)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]