All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] update vgchange's handling of -a, --refresh, --monitor and --poll
@ 2010-10-25 22:02 Mike Snitzer
  2010-10-25 22:10 ` Mike Snitzer
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Snitzer @ 2010-10-25 22:02 UTC (permalink / raw)
  To: lvm-devel

Update vgchange to have nearly comparable processing of -a, --refresh,
--monitor and --poll

This was motivated because vgchange disallows combining --monitor and
--poll but lvm2-monitor uses: vgchange --monitor y --poll y $VGNAME

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
 tools/lvchange.c |    2 +-
 tools/vgchange.c |   35 +++++++++++++++++++++++++++++------
 2 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/tools/lvchange.c b/tools/lvchange.c
index 5ac223a..4c7578f 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -715,7 +715,7 @@ static int lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
 
 int lvchange(struct cmd_context *cmd, int argc, char **argv)
 {
-	int update = /* options other than -a, --refresh or --monitor */
+	int update = /* options other than -a, --refresh, --monitor or --poll */
 		arg_count(cmd, contiguous_ARG) || arg_count(cmd, permission_ARG) ||
 		arg_count(cmd, readahead_ARG) || arg_count(cmd, persistent_ARG) ||
 		arg_count(cmd, addtag_ARG) || arg_count(cmd, deltag_ARG) ||
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 92f32db..1bf4004 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -592,14 +592,40 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
 						arg_int_value(cmd, poll_ARG,
 						DEFAULT_BACKGROUND_POLLING));
 
-	if (arg_count(cmd, available_ARG))
+	if (arg_count(cmd, available_ARG)) {
 		r = _vgchange_available(cmd, vg);
+		if (r != ECMD_PROCESSED)
+			return r;
+	}
 
-	else if (arg_count(cmd, monitor_ARG))
+	/* FIXME: disallow -a and --refresh (unlike lvchange)? */
+	if (arg_count(cmd, refresh_ARG)) {
+		/* refreshes the visible LVs (which starts polling) */
+		r = _vgchange_refresh(cmd, vg);
+		if (r != ECMD_PROCESSED)
+			return r;
+	}
+
+	if (!arg_count(cmd, available_ARG) &&
+	    !arg_count(cmd, refresh_ARG) &&
+	    arg_count(cmd, monitor_ARG)) {
+		/* -ay will have already done monitoring changes */
+		/* FIXME: unlike lvchange, allow --refresh and --monitor ? */
 		r = _vgchange_monitoring(cmd, vg);
+		if (r != ECMD_PROCESSED)
+			return r;
+	}
 
-	else if (arg_count(cmd, poll_ARG))
+	if (!arg_count(cmd, available_ARG) &&
+	    !arg_count(cmd, refresh_ARG) &&
+	    arg_count(cmd, poll_ARG)) {
+		/* avoid polling visible LVs multiple times (via refresh) */
+		/*
+		 * FIXME: allow --poll in conjunction with -a?
+		 * for reference: lvchange -ay also controls polling
+		 */
 		r = _vgchange_background_polling(cmd, vg);
+	}
 
 	else if (arg_count(cmd, resizeable_ARG))
 		r = _vgchange_resizeable(cmd, vg);
@@ -628,9 +654,6 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
 	else if (arg_count(cmd, clustered_ARG))
 		r = _vgchange_clustered(cmd, vg);
 
-	else if (arg_count(cmd, refresh_ARG))
-		r = _vgchange_refresh(cmd, vg);
-
 	else if (arg_count(cmd, vgmetadatacopies_ARG) ||
 		 arg_count(cmd, metadatacopies_ARG))
 		r = _vgchange_metadata_copies(cmd, vg);



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [RFC][PATCH] update vgchange's handling of -a, --refresh, --monitor and --poll
  2010-10-25 22:02 [RFC][PATCH] update vgchange's handling of -a, --refresh, --monitor and --poll Mike Snitzer
@ 2010-10-25 22:10 ` Mike Snitzer
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Snitzer @ 2010-10-25 22:10 UTC (permalink / raw)
  To: lvm-devel

On Mon, Oct 25 2010 at  6:02pm -0400,
Mike Snitzer <snitzer@redhat.com> wrote:

> Update vgchange to have nearly comparable processing of -a, --refresh,
> --monitor and --poll

Meant to say:

Update vgchange to have lvchange like processing of -a, --refresh,
--monitor and --poll

(I said "nearly comparable" before because I didn't make vgchange -ay
control polling like lvchange -ay does, like noted in this patch's last
FIXME)

Mike



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-25 22:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-25 22:02 [RFC][PATCH] update vgchange's handling of -a, --refresh, --monitor and --poll Mike Snitzer
2010-10-25 22:10 ` Mike Snitzer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.