Skip to contentSkip to conversation

LVM2 ./WHATS_NEW man/lvchange.8 tools/args.h t ...

PATCH [email protected] 4 participants 4 messages Oct 23, 2006 – Oct 24, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2006-10-23 23:03:55

Modified files:

	.              : WHATS_NEW 
	man            : lvchange.8 
	tools          : args.h commands.h lvchange.c 

Log message:

	Add lvchange --forcesync.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.478&r2=1.479
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvchange.8.diff?cvsroot=lvm2&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/args.h.diff?cvsroot=lvm2&r1=1.47&r2=1.48
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/commands.h.diff?cvsroot=lvm2&r1=1.88&r2=1.89
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.69&r2=1.70

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.13 -
 ===================================
+  Add lvchange --forcesync.
   Perform high-level free space check before each allocation attempt.
   Don't allow a node to remove an LV that's exclusively active on anther node.
   Cope if same PV is included more than once in cmdline PE range list.
man/lvchange.8 +9 -0
@@ -7,6 +7,7 @@
 [\-A/\-\-autobackup y/n] [\-a/\-\-available y/n/ey/en/ly/ln]
 [\-\-alloc AllocationPolicy]
 [\-C/\-\-contiguous y/n] [\-d/\-\-debug] [\-\-deltag Tag]
+[\-\-forcesync]
 [\-h/\-?/\-\-help]
 [\-\-ignorelockingfailure]
 [\-\-monitor {y|n}]
@@ -40,6 +41,14 @@
 logical volume's allocation policy to contiguous, if all of the
 allocated physical extents are already contiguous.
 .TP
+.I \-\-forcesync
+This option only make sense if the logical volume being operated
+on is a mirrored logical volume.  This option is used to
+resynchronize the devices in a mirrored logical volume.  Since
+resynchronization can take considerable time and resources, you
+should consider using this option only if you have reason to
+believe that the devices in your mirror are no longer the same.
+.TP
 .I \-\-minor minor
 Set the minor number.
 .TP
tools/args.h +1 -0
@@ -46,6 +46,7 @@
 arg(separator_ARG, '\0', "separator", string_arg)
 arg(mirrorsonly_ARG, '\0', "mirrorsonly", NULL)
 arg(nosync_ARG, '\0', "nosync", NULL)
+arg(forcesync_ARG, '\0', "forcesync", NULL)
 arg(corelog_ARG, '\0', "corelog", NULL)
 arg(monitor_ARG, '\0', "monitor", yes_no_arg)
 arg(config_ARG, '\0', "config", string_arg)
tools/commands.h +5 -2
@@ -61,6 +61,7 @@
    "\t[-d|--debug]\n"
    "\t[--deltag Tag]\n"
    "\t[-f|--force]\n"
+   "\t[--forcesync]\n"
    "\t[-h|--help]\n"
    "\t[--ignorelockingfailure]\n"
    "\t[--monitor {y|n}]\n"
@@ -71,13 +72,14 @@
    "\t[--refresh]\n"
    "\t[-t|--test]\n"
    "\t[-v|--verbose]\n"
+   "\t[-y|--yes]\n"
    "\t[--version]" "\n"
    "\tLogicalVolume[Path] [LogicalVolume[Path]...]\n",
 
    alloc_ARG, autobackup_ARG, available_ARG, contiguous_ARG, force_ARG,
-   ignorelockingfailure_ARG, major_ARG, minor_ARG, monitor_ARG,
+   forcesync_ARG, ignorelockingfailure_ARG, major_ARG, minor_ARG, monitor_ARG,
    partial_ARG, permission_ARG, persistent_ARG, readahead_ARG,
-   refresh_ARG, addtag_ARG, deltag_ARG, test_ARG)
+   refresh_ARG, addtag_ARG, deltag_ARG, test_ARG, yes_ARG)
 
 xx(lvconvert,
    "Change logical volume layout",
@@ -274,6 +276,7 @@
    "\t[-r|--resizefs]\n"
    "\t[-t|--test]\n"
    "\t[-v|--verbose]\n"
+   "\t[-y|--yes]\n"
    "\t[--version]" "\n"
    "\tLogicalVolume[Path]\n",
 
tools/lvchange.c +162 -5

193 lines not on this page · raw message

#1 lore raw

Hi Jonathan, Alasdair,

Thanks for updating forcesync patch.
I have 2 comments, one for man page and the other for a minor bug.

man/lvchange.8 line 51

Quoted 8 lines · agk at sourceware.org

+.I \-\-forcesync

man/lvchange.8 +7 -0
+This option only make sense if the logical volume being operated
+on is a mirrored logical volume.  This option is used to
+resynchronize the devices in a mirrored logical volume.  Since
+resynchronization can take considerable time and resources, you
+should consider using this option only if you have reason to
+believe that the devices in your mirror are no longer the same.
+.TP

I think it's better to emphasize that
- resynchronization is generally done automatically based on persistent mirror log or upon activation if there is no log.
- resynchronization is done in background, so the completion of 'lvchange --forcesync' doesn't mean the devices are resynchronized.

So how about something like this?

This option only makes sense if the logical volume being operated on is a mirrored logical volume. This option is used to reset the sync status and start resynchronization of the devices in a mirrored logical volume. Please note that generally resynchronization is done automatically based on persistent log or upon every activation in case of in-memory log. Since resynchronization can take considerable time and resources, you should consider using this option only if you have reason to believe that the devices in your mirror are no longer the same.

Quoted 4 lines
tools/lvchange.c +4 -0
+static int lvchange_forcesync(struct cmd_context *cmd,
+			      struct logical_volume *lv)
+{
+	int active = 0;

...

Quoted 10 lines
tools/lvchange.c +10 -0
+
+	if (lv_info(cmd, lv, &info, 1)) {
+		if (info.open_count) {
+			log_error("Can't resync open logical volume \"%s\"",
+				  lv->name);
+			return ECMD_FAILED;
+		}
+
+		if (info.exists && !arg_count(cmd, yes_ARG)) {
+			if (yes_no_prompt("Do you really want to deactivate "

tools/lvchange.c line 219

Quoted 10 lines
tools/lvchange.c +10 -0
+					  "logical volume %s to resync it? [y/n]: ",
+					  lv->name) == 'n') {
+				log_print("Logical volume \"%s\" not resynced",
+					  lv->name);
+				return ECMD_FAILED;
+			}
+		}
+
+		active = 1;
+	}

This "active = 1" should be set only if info.exists is true, because lv_info() succeeds even if the lv is not activated.

Thanks,

Signature · 1 line
Jun'ichi Nomura, NEC Corporation of America
#2 lore raw
Quoted 5 lines · Jun'ichi Nomura

Review

Quoted 2 lines
(quoted diff) +2 -0
+		active = 1;
+	}

This "active = 1" should be set only if info.exists is true, because lv_info() succeeds even if the lv is not activated.

I also think we lost the ability to distinguish between clustered (active = -1) and active (active = 1).

Agk, we can send you a patch that will apply on top of the current patch now in CVS.

brassow

#3 lore raw
Quoted 1 line
Quoted 1 line

This "active = 1" should be set only if info.exists is true,

Yes

Quoted 2 lines

I also think we lost the ability to distinguish between clustered (active = -1) and active (active = 1).

Correct - there's no mechanism yet to distinguish between those cases: if it's not active locally, we don't reactivate.

Alasdair

Signature · 1 line
agk at redhat.com