master - lvconvert: tune cache-pool zeroing
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3c377f83344914...
Commit: 3c377f8334491421207ae91094e9d7b3be0a300f
Parent: 5636bfd83d54f119d313603f4f9070bf0dfba2fe
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Jul 23 21:17:56 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 27 16:20:57 2016 +0200
lvconvert: tune cache-pool zeroing
Follow-up to 27a767d5e8cedf9cac31eb3562cf8fdd4aa88b7c.
Tunning behavior in a way we always prompt when option --zero is NOT specified.
Without -Z lvm expects user wants to 'reset' cache-pool metadata
(they could have been splitted from some cached LV)
If user doesn't want to zero metadata he needs to specify -Zn.
User may also avoid prompting for zeroing by using -Zy for
cache-pool (basically equals using --yes without -Z being given)
(unlike full convert case, there is no cache-pool being converted,
so there is not 'uncoditional' prompt in this case).
---
WHATS_NEW | 2 +-
tools/lvconvert.c | 28 ++++++++++++++++------------
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index abd9fb8..5c09a1f 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -5,7 +5,7 @@ Version 2.02.162 -
Improve lvconvert --trackchanges validation to require --splitmirrors 1.
Add note about lastlog built-in command to lvm man page.
Fix unrecognised segtype flag message.
- lvconvert reuse cachepool metadade now ONLY with -Zn and clear otherwise.
+ lvconvert not clears cache pool metadata ONLY with -Zn.
Enabled lvconvert --uncache to work with partial VG.
Version 2.02.161 - 15th July 2016
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index be7425f..f3586b2 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2998,24 +2998,28 @@ static int _lvconvert_pool(struct cmd_context *cmd,
return_0;
if (lp->cache) {
- /* Check is user has not requested -Zn */
- if (!arg_int_value(cmd, zero_ARG, 1)) {
- /* Note: requires rather deep know-how to skip zeroing
- * so show major warnings */
- log_warn("WARNING: Reusing old cache pool metadata %s to "
- "for volume caching.",
- display_lvname(pool_lv));
- log_warn("THIS MAY DESTROY YOUR DATA (filesystem etc.)");
-
+ /* Check is user requested zeroing logic via [-Z y|n] */
+ if (!arg_is_set(cmd, zero_ARG)) {
+ /* Note: requires rather deep know-how to skip zeroing */
if (!lp->yes &&
- yes_no_prompt("Do you really want to keep old metadata for "
+ yes_no_prompt("Do you want wipe existing metadata of "
"cache pool volume %s? [y/n]: ",
display_lvname(pool_lv)) == 'n') {
log_error("Conversion aborted.");
+ log_error("To preserve cache metadata add option \"--zero n\".");
+ log_warn("WARNING: Reusing mismatched cache pool metadata "
+ "MAY DESTROY YOUR DATA!");
return 0;
}
- } else if (!wipe_cache_pool(pool_lv))
- return_0;
+ /* Wiping confirmed, go ahead */
+ if (!wipe_cache_pool(pool_lv))
+ return_0;
+ } else if (arg_int_value(cmd, zero_ARG, 0)) {
+ if (!wipe_cache_pool(pool_lv)) /* Wipe according to -Z y|n */
+ return_0;
+ } else
+ log_warn("WARNING: Reusing cache pool metadata %s "
+ "for volume caching.", display_lvname(pool_lv));
}
if (lp->thin || lp->cache)
7 years, 8 months
master - lvconvert: suppress zeroing warning when converting to thin
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5636bfd83d54f1...
Commit: 5636bfd83d54f119d313603f4f9070bf0dfba2fe
Parent: f66ae6e80f37e83d6e71f93127b60978801dc445
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jul 27 13:36:25 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 27 16:20:57 2016 +0200
lvconvert: suppress zeroing warning when converting to thin
When volume was lvconvert-ed to a thin-volume with external origin,
then in case thin-pool was in non-zeroing mode
it's been printing WARNING about not zeroing thin volume - but
this is wanted and expected - so nothing to warn about.
So in this particular use case WARNING needs to be suppressed.
Adding parameter support for lvcreate_params.
So now lvconvert creates 'normal thin LV' in read-only mode
(so any read will 'return 0' for a moment)
then deactivate regular thin LV and reacreate in 'final R/RW' mode
thin LV with external origin and activate again.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 2 +-
lib/metadata/metadata-exported.h | 1 +
tools/lvconvert.c | 5 ++++-
4 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 4f24476..abd9fb8 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.162 -
=================================
+ Suppress not zeroing warn when converting to thin LV for non-zeroing tpool.
Fix automatic updates of PV extension headers to newest version.
Improve lvconvert --trackchanges validation to require --splitmirrors 1.
Add note about lastlog built-in command to lvm man page.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index c6b8eb5..2a55be7 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7592,7 +7592,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
goto deactivate_and_revert_new_lv;
}
- if (_should_wipe_lv(lp, lv, 1)) {
+ if (_should_wipe_lv(lp, lv, !lp->suppress_zero_warn)) {
if (!wipe_lv(lv, (struct wipe_params)
{
.do_zero = lp->zero,
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 37d4bf8..ff879bb 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -922,6 +922,7 @@ struct lvcreate_params {
#define THIN_CHUNK_SIZE_CALC_METHOD_GENERIC 0x01
#define THIN_CHUNK_SIZE_CALC_METHOD_PERFORMANCE 0x02
int thin_chunk_size_calc_policy;
+ unsigned suppress_zero_warn : 1;
unsigned needs_lockd_init : 1;
const char *vg_name; /* only-used when VG is not yet opened (in /tools) */
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index c0838d1..be7425f 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2679,6 +2679,7 @@ static int _lvconvert_thin(struct cmd_context *cmd,
.lv_name = lp->origin_name,
.major = -1,
.minor = -1,
+ .suppress_zero_warn = 1, /* Suppress warning for this thin */
.permission = LVM_READ,
.pool_name = pool_lv->name,
.pvh = &vg->pvs,
@@ -2735,7 +2736,9 @@ static int _lvconvert_thin(struct cmd_context *cmd,
if (!archive(vg))
return_0;
- /* New thin LV needs to be created (all messages sent to pool) */
+ /* New thin LV needs to be created (all messages sent to pool)
+ * In this case thin volume is created READ-ONLY and
+ * also warn about not zeroing is suppressed. */
if (!(torigin_lv = lv_create_single(vg, &lvc)))
return_0;
7 years, 8 months
master - tests: add pv-ext-update.sh test
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f66ae6e80f37e8...
Commit: f66ae6e80f37e83d6e71f93127b60978801dc445
Parent: 070c0d31ab3847240081e7593f959b03e716923d
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jul 27 12:11:53 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Jul 27 12:17:21 2016 +0200
tests: add pv-ext-update.sh test
Tests automatic update of PV header (its "extension" part) to recent
version.
---
test/shell/pv-ext-update.sh | 186 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 186 insertions(+), 0 deletions(-)
diff --git a/test/shell/pv-ext-update.sh b/test/shell/pv-ext-update.sh
new file mode 100644
index 0000000..eb4e7a9
--- /dev/null
+++ b/test/shell/pv-ext-update.sh
@@ -0,0 +1,186 @@
+#!/bin/sh
+# Copyright (C) 2016 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# lvmetad does not handle pool labels so skip test.
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+env printf "" || skip # skip if printf is not available
+
+# create the PV with PV ext vsn 1 and a vg
+create_pv_with_ext_vsn1_and_vg()
+{
+ VG_NAME="LVMTEST12345pvextupdatevg"
+ LV_NAME="lvol0"
+
+ # FIXME
+ # echo -e is bashism, dash builtin sh doesn't do \xNN in printf either
+ # printf comes from coreutils, and is probably not posix either
+
+ # PV header with PV extension version 1
+ env printf \
+"\x4c\x41\x42\x45\x4c\x4f\x4e\x45\x01\x00\x00\x00\x00\x00\x00\x00"\
+"\x78\x1c\x12\x43\x20\x00\x00\x00\x4c\x56\x4d\x32\x20\x30\x30\x31"\
+"\x64\x35\x56\x33\x38\x5a\x57\x49\x63\x7a\x64\x63\x34\x38\x37\x67"\
+"\x4d\x79\x46\x4b\x6c\x6d\x68\x39\x4e\x73\x34\x6f\x78\x61\x6b\x51"\
+"\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00"\
+"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"\
+"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00"\
+"\x00\xf0\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"\
+"\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00"\
+"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" | dd of="$1" bs=512 seek=1 conv=notrunc
+
+ # MDA header
+ env printf \
+"\xd8\x36\x2c\xf6\x20\x4c\x56\x4d\x32\x20\x78\x5b\x35\x41\x25\x72"\
+"\x30\x4e\x2a\x3e\x01\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00"\
+"\x00\xf0\x0f\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00"\
+"\x06\x04\x00\x00\x00\x00\x00\x00\x07\x3d\x06\x28\x00\x00\x00\x00"\
+"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" | dd of="$1" bs=4096 seek=1 conv=notrunc
+
+ # VG metadata
+ env printf \
+"\x4c\x56\x4d\x54\x45\x53\x54\x31\x32\x33\x34\x35\x70\x76\x65\x78"\
+"\x74\x75\x70\x64\x61\x74\x65\x76\x67\x20\x7b\x0a\x69\x64\x20\x3d"\
+"\x20\x22\x42\x72\x47\x6f\x34\x33\x2d\x36\x35\x62\x48\x2d\x41\x55"\
+"\x6d\x43\x2d\x77\x56\x74\x71\x2d\x51\x53\x63\x66\x2d\x6b\x5a\x51"\
+"\x45\x2d\x58\x51\x6e\x79\x31\x44\x22\x0a\x73\x65\x71\x6e\x6f\x20"\
+"\x3d\x20\x31\x0a\x66\x6f\x72\x6d\x61\x74\x20\x3d\x20\x22\x6c\x76"\
+"\x6d\x32\x22\x0a\x73\x74\x61\x74\x75\x73\x20\x3d\x20\x5b\x22\x52"\
+"\x45\x53\x49\x5a\x45\x41\x42\x4c\x45\x22\x2c\x20\x22\x52\x45\x41"\
+"\x44\x22\x2c\x20\x22\x57\x52\x49\x54\x45\x22\x5d\x0a\x66\x6c\x61"\
+"\x67\x73\x20\x3d\x20\x5b\x5d\x0a\x65\x78\x74\x65\x6e\x74\x5f\x73"\
+"\x69\x7a\x65\x20\x3d\x20\x38\x31\x39\x32\x0a\x6d\x61\x78\x5f\x6c"\
+"\x76\x20\x3d\x20\x30\x0a\x6d\x61\x78\x5f\x70\x76\x20\x3d\x20\x30"\
+"\x0a\x6d\x65\x74\x61\x64\x61\x74\x61\x5f\x63\x6f\x70\x69\x65\x73"\
+"\x20\x3d\x20\x30\x0a\x0a\x70\x68\x79\x73\x69\x63\x61\x6c\x5f\x76"\
+"\x6f\x6c\x75\x6d\x65\x73\x20\x7b\x0a\x0a\x70\x76\x30\x20\x7b\x0a"\
+"\x69\x64\x20\x3d\x20\x22\x64\x35\x56\x33\x38\x5a\x2d\x57\x49\x63"\
+"\x7a\x2d\x64\x63\x34\x38\x2d\x37\x67\x4d\x79\x2d\x46\x4b\x6c\x6d"\
+"\x2d\x68\x39\x4e\x73\x2d\x34\x6f\x78\x61\x6b\x51\x22\x0a\x64\x65"\
+"\x76\x69\x63\x65\x20\x3d\x20\x22\x2f\x64\x65\x76\x2f\x6c\x6f\x6f"\
+"\x70\x30\x22\x0a\x0a\x73\x74\x61\x74\x75\x73\x20\x3d\x20\x5b\x22"\
+"\x41\x4c\x4c\x4f\x43\x41\x54\x41\x42\x4c\x45\x22\x5d\x0a\x66\x6c"\
+"\x61\x67\x73\x20\x3d\x20\x5b\x5d\x0a\x64\x65\x76\x5f\x73\x69\x7a"\
+"\x65\x20\x3d\x20\x31\x36\x33\x38\x34\x0a\x70\x65\x5f\x73\x74\x61"\
+"\x72\x74\x20\x3d\x20\x32\x30\x34\x38\x0a\x70\x65\x5f\x63\x6f\x75"\
+"\x6e\x74\x20\x3d\x20\x31\x0a\x7d\x0a\x7d\x0a\x0a\x7d\x0a\x23\x20"\
+"\x47\x65\x6e\x65\x72\x61\x74\x65\x64\x20\x62\x79\x20\x4c\x56\x4d"\
+"\x32\x20\x76\x65\x72\x73\x69\x6f\x6e\x20\x32\x2e\x30\x32\x2e\x31"\
+"\x34\x32\x28\x32\x29\x2d\x67\x69\x74\x20\x28\x32\x30\x31\x36\x2d"\
+"\x30\x32\x2d\x31\x35\x29\x3a\x20\x57\x65\x64\x20\x4a\x75\x6c\x20"\
+"\x32\x37\x20\x31\x31\x3a\x32\x35\x3a\x30\x37\x20\x32\x30\x31\x36"\
+"\x0a\x0a\x63\x6f\x6e\x74\x65\x6e\x74\x73\x20\x3d\x20\x22\x54\x65"\
+"\x78\x74\x20\x46\x6f\x72\x6d\x61\x74\x20\x56\x6f\x6c\x75\x6d\x65"\
+"\x20\x47\x72\x6f\x75\x70\x22\x0a\x76\x65\x72\x73\x69\x6f\x6e\x20"\
+"\x3d\x20\x31\x0a\x0a\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e"\
+"\x20\x3d\x20\x22\x22\x0a\x0a\x63\x72\x65\x61\x74\x69\x6f\x6e\x5f"\
+"\x68\x6f\x73\x74\x20\x3d\x20\x22\x66\x65\x64\x6f\x72\x61\x2e\x76"\
+"\x69\x72\x74\x22\x09\x23\x20\x4c\x69\x6e\x75\x78\x20\x66\x65\x64"\
+"\x6f\x72\x61\x2e\x76\x69\x72\x74\x20\x34\x2e\x36\x2e\x34\x2d\x33"\
+"\x30\x31\x2e\x66\x63\x32\x34\x2e\x78\x38\x36\x5f\x36\x34\x20\x23"\
+"\x31\x20\x53\x4d\x50\x20\x54\x75\x65\x20\x4a\x75\x6c\x20\x31\x32"\
+"\x20\x31\x31\x3a\x35\x30\x3a\x30\x30\x20\x55\x54\x43\x20\x32\x30"\
+"\x31\x36\x20\x78\x38\x36\x5f\x36\x34\x0a\x63\x72\x65\x61\x74\x69"\
+"\x6f\x6e\x5f\x74\x69\x6d\x65\x20\x3d\x20\x31\x34\x36\x39\x36\x31"\
+"\x31\x35\x30\x37\x09\x23\x20\x57\x65\x64\x20\x4a\x75\x6c\x20\x32"\
+"\x37\x20\x31\x31\x3a\x32\x35\x3a\x30\x37\x20\x32\x30\x31\x36\x0a"\
+"\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"\
+"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" | dd of="$1" bs=4608 seek=1 conv=notrunc
+
+ env printf \
+"\x4c\x56\x4d\x54\x45\x53\x54\x31\x32\x33\x34\x35\x70\x76\x65\x78"\
+"\x74\x75\x70\x64\x61\x74\x65\x76\x67\x20\x7b\x0a\x69\x64\x20\x3d"\
+"\x20\x22\x42\x72\x47\x6f\x34\x33\x2d\x36\x35\x62\x48\x2d\x41\x55"\
+"\x6d\x43\x2d\x77\x56\x74\x71\x2d\x51\x53\x63\x66\x2d\x6b\x5a\x51"\
+"\x45\x2d\x58\x51\x6e\x79\x31\x44\x22\x0a\x73\x65\x71\x6e\x6f\x20"\
+"\x3d\x20\x32\x0a\x66\x6f\x72\x6d\x61\x74\x20\x3d\x20\x22\x6c\x76"\
+"\x6d\x32\x22\x0a\x73\x74\x61\x74\x75\x73\x20\x3d\x20\x5b\x22\x52"\
+"\x45\x53\x49\x5a\x45\x41\x42\x4c\x45\x22\x2c\x20\x22\x52\x45\x41"\
+"\x44\x22\x2c\x20\x22\x57\x52\x49\x54\x45\x22\x5d\x0a\x66\x6c\x61"\
+"\x67\x73\x20\x3d\x20\x5b\x5d\x0a\x65\x78\x74\x65\x6e\x74\x5f\x73"\
+"\x69\x7a\x65\x20\x3d\x20\x38\x31\x39\x32\x0a\x6d\x61\x78\x5f\x6c"\
+"\x76\x20\x3d\x20\x30\x0a\x6d\x61\x78\x5f\x70\x76\x20\x3d\x20\x30"\
+"\x0a\x6d\x65\x74\x61\x64\x61\x74\x61\x5f\x63\x6f\x70\x69\x65\x73"\
+"\x20\x3d\x20\x30\x0a\x0a\x70\x68\x79\x73\x69\x63\x61\x6c\x5f\x76"\
+"\x6f\x6c\x75\x6d\x65\x73\x20\x7b\x0a\x0a\x70\x76\x30\x20\x7b\x0a"\
+"\x69\x64\x20\x3d\x20\x22\x64\x35\x56\x33\x38\x5a\x2d\x57\x49\x63"\
+"\x7a\x2d\x64\x63\x34\x38\x2d\x37\x67\x4d\x79\x2d\x46\x4b\x6c\x6d"\
+"\x2d\x68\x39\x4e\x73\x2d\x34\x6f\x78\x61\x6b\x51\x22\x0a\x64\x65"\
+"\x76\x69\x63\x65\x20\x3d\x20\x22\x2f\x64\x65\x76\x2f\x6c\x6f\x6f"\
+"\x70\x30\x22\x0a\x0a\x73\x74\x61\x74\x75\x73\x20\x3d\x20\x5b\x22"\
+"\x41\x4c\x4c\x4f\x43\x41\x54\x41\x42\x4c\x45\x22\x5d\x0a\x66\x6c"\
+"\x61\x67\x73\x20\x3d\x20\x5b\x5d\x0a\x64\x65\x76\x5f\x73\x69\x7a"\
+"\x65\x20\x3d\x20\x31\x36\x33\x38\x34\x0a\x70\x65\x5f\x73\x74\x61"\
+"\x72\x74\x20\x3d\x20\x32\x30\x34\x38\x0a\x70\x65\x5f\x63\x6f\x75"\
+"\x6e\x74\x20\x3d\x20\x31\x0a\x7d\x0a\x7d\x0a\x0a\x6c\x6f\x67\x69"\
+"\x63\x61\x6c\x5f\x76\x6f\x6c\x75\x6d\x65\x73\x20\x7b\x0a\x0a\x6c"\
+"\x76\x6f\x6c\x30\x20\x7b\x0a\x69\x64\x20\x3d\x20\x22\x46\x73\x36"\
+"\x6c\x6a\x6b\x2d\x4a\x65\x5a\x35\x2d\x55\x4e\x75\x37\x2d\x32\x41"\
+"\x33\x50\x2d\x76\x30\x41\x43\x2d\x64\x63\x64\x36\x2d\x32\x33\x38"\
+"\x39\x4d\x76\x22\x0a\x73\x74\x61\x74\x75\x73\x20\x3d\x20\x5b\x22"\
+"\x52\x45\x41\x44\x22\x2c\x20\x22\x57\x52\x49\x54\x45\x22\x2c\x20"\
+"\x22\x56\x49\x53\x49\x42\x4c\x45\x22\x5d\x0a\x66\x6c\x61\x67\x73"\
+"\x20\x3d\x20\x5b\x5d\x0a\x63\x72\x65\x61\x74\x69\x6f\x6e\x5f\x68"\
+"\x6f\x73\x74\x20\x3d\x20\x22\x66\x65\x64\x6f\x72\x61\x2e\x76\x69"\
+"\x72\x74\x22\x0a\x63\x72\x65\x61\x74\x69\x6f\x6e\x5f\x74\x69\x6d"\
+"\x65\x20\x3d\x20\x31\x34\x36\x39\x36\x31\x31\x35\x31\x30\x0a\x73"\
+"\x65\x67\x6d\x65\x6e\x74\x5f\x63\x6f\x75\x6e\x74\x20\x3d\x20\x31"\
+"\x0a\x0a\x73\x65\x67\x6d\x65\x6e\x74\x31\x20\x7b\x0a\x73\x74\x61"\
+"\x72\x74\x5f\x65\x78\x74\x65\x6e\x74\x20\x3d\x20\x30\x0a\x65\x78"\
+"\x74\x65\x6e\x74\x5f\x63\x6f\x75\x6e\x74\x20\x3d\x20\x31\x0a\x0a"\
+"\x74\x79\x70\x65\x20\x3d\x20\x22\x73\x74\x72\x69\x70\x65\x64\x22"\
+"\x0a\x73\x74\x72\x69\x70\x65\x5f\x63\x6f\x75\x6e\x74\x20\x3d\x20"\
+"\x31\x0a\x0a\x73\x74\x72\x69\x70\x65\x73\x20\x3d\x20\x5b\x0a\x22"\
+"\x70\x76\x30\x22\x2c\x20\x30\x0a\x5d\x0a\x7d\x0a\x7d\x0a\x7d\x0a"\
+"\x7d\x0a\x23\x20\x47\x65\x6e\x65\x72\x61\x74\x65\x64\x20\x62\x79"\
+"\x20\x4c\x56\x4d\x32\x20\x76\x65\x72\x73\x69\x6f\x6e\x20\x32\x2e"\
+"\x30\x32\x2e\x31\x34\x32\x28\x32\x29\x2d\x67\x69\x74\x20\x28\x32"\
+"\x30\x31\x36\x2d\x30\x32\x2d\x31\x35\x29\x3a\x20\x57\x65\x64\x20"\
+"\x4a\x75\x6c\x20\x32\x37\x20\x31\x31\x3a\x32\x35\x3a\x31\x30\x20"\
+"\x32\x30\x31\x36\x0a\x0a\x63\x6f\x6e\x74\x65\x6e\x74\x73\x20\x3d"\
+"\x20\x22\x54\x65\x78\x74\x20\x46\x6f\x72\x6d\x61\x74\x20\x56\x6f"\
+"\x6c\x75\x6d\x65\x20\x47\x72\x6f\x75\x70\x22\x0a\x76\x65\x72\x73"\
+"\x69\x6f\x6e\x20\x3d\x20\x31\x0a\x0a\x64\x65\x73\x63\x72\x69\x70"\
+"\x74\x69\x6f\x6e\x20\x3d\x20\x22\x22\x0a\x0a\x63\x72\x65\x61\x74"\
+"\x69\x6f\x6e\x5f\x68\x6f\x73\x74\x20\x3d\x20\x22\x66\x65\x64\x6f"\
+"\x72\x61\x2e\x76\x69\x72\x74\x22\x09\x23\x20\x4c\x69\x6e\x75\x78"\
+"\x20\x66\x65\x64\x6f\x72\x61\x2e\x76\x69\x72\x74\x20\x34\x2e\x36"\
+"\x2e\x34\x2d\x33\x30\x31\x2e\x66\x63\x32\x34\x2e\x78\x38\x36\x5f"\
+"\x36\x34\x20\x23\x31\x20\x53\x4d\x50\x20\x54\x75\x65\x20\x4a\x75"\
+"\x6c\x20\x31\x32\x20\x31\x31\x3a\x35\x30\x3a\x30\x30\x20\x55\x54"\
+"\x43\x20\x32\x30\x31\x36\x20\x78\x38\x36\x5f\x36\x34\x0a\x63\x72"\
+"\x65\x61\x74\x69\x6f\x6e\x5f\x74\x69\x6d\x65\x20\x3d\x20\x31\x34"\
+"\x36\x39\x36\x31\x31\x35\x31\x30\x09\x23\x20\x57\x65\x64\x20\x4a"\
+"\x75\x6c\x20\x32\x37\x20\x31\x31\x3a\x32\x35\x3a\x31\x30\x20\x32"\
+"\x30\x31\x36\x0a\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"\
+"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" | dd of="$1" bs=5632 seek=1 conv=notrunc
+
+ aux notify_lvmetad "$1"
+}
+
+aux prepare_devs 1 8
+
+create_pv_with_ext_vsn1_and_vg "$dev1"
+
+# pvs doesn't update PV header because it holds only VG read lock
+check pv_field "$dev1" pv_ext_vsn 1
+check pv_field "$dev1" pv_in_use "used"
+check pv_field "$dev1" vg_name "$VG_NAME"
+lvs "$VG_NAME"/"$LV_NAME"
+
+# an LVM command taking VG write lock will also cause PV header update to recent version
+vgchange --addtag test $VG_NAME
+check pv_field "$dev1" pv_ext_vsn 2
+check pv_field "$dev1" pv_in_use "used"
+check pv_field "$dev1" vg_name "$VG_NAME"
+lvs "$VG_NAME"/"$LV_NAME"
7 years, 8 months
master - metadata: fix automatic updates of PV extension headers to newest version
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=070c0d31ab3847...
Commit: 070c0d31ab3847240081e7593f959b03e716923d
Parent: f9697ea0067ef574aff09f1c8f25e1c7fab74c17
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jul 26 15:46:36 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 26 16:22:55 2016 +0200
metadata: fix automatic updates of PV extension headers to newest version
Before, the automatic update from older to newer version of PV extension
header happened within vg_write call. This may have caused problems under
some circumnstances where there's a code in between vg_write and vg_commit
which may have failed. In such situation, we reverted precommitted metadata
and put back the state to working version of VG metadata.
However, we don't have revert for PV write operation at the moment. So
if we updated PV headers already and we reverted vg_write due to failure
in subsequent code (before vg_commit), we ended up with lost VG metadata
(because old metadata pointers got reset by the PV write operation).
To minimize problematic situations here, we should put vg_write and
vg_commit that is done after PV header rewrites as close to each
other as possible.
This patch moves the automatic PV header rewrite for new extension
header part from vg_write to _vg_read where it's done the same way
as we do any other VG repairs if detected during VG read operation
(under VG write lock).
---
WHATS_NEW | 1 +
lib/metadata/metadata.c | 43 +++++++++++++++++++++++++++++++++----------
2 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index c96b5be..4f24476 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.162 -
=================================
+ Fix automatic updates of PV extension headers to newest version.
Improve lvconvert --trackchanges validation to require --splitmirrors 1.
Add note about lastlog built-in command to lvm man page.
Fix unrecognised segtype flag message.
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 8a9a1b2..a32649f 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3297,7 +3297,7 @@ static int _pv_in_pv_list(struct physical_volume *pv, struct dm_list *head)
* Check if any of the PVs in VG still contain old PV headers
* and if yes, schedule them for PV header update.
*/
-static int _check_old_pv_ext_for_vg(struct volume_group *vg)
+static int _vg_update_old_pv_ext_if_needed(struct volume_group *vg)
{
struct pv_list *pvl, *new_pvl;
int pv_needs_rewrite;
@@ -3330,9 +3330,17 @@ static int _check_old_pv_ext_for_vg(struct volume_group *vg)
}
new_pvl->pv = pvl->pv;
dm_list_add(&vg->pv_write_list, &new_pvl->list);
+ log_debug("PV %s has old extension header, updating to newest version.",
+ pv_dev_name(pvl->pv));
}
}
+ if (!dm_list_empty(&vg->pv_write_list) &&
+ (!vg_write(vg) || !vg_commit(vg))) {
+ log_error("Failed to update old PV extension headers in VG %s.", vg->name);
+ return 0;
+ }
+
return 1;
}
@@ -3463,11 +3471,6 @@ int vg_write(struct volume_group *vg)
return 0;
}
- if (!(_check_old_pv_ext_for_vg(vg))) {
- log_error("Failed to schedule physical volume header update.");
- return 0;
- }
-
if (!drop_cached_metadata(vg)) {
log_error("Unable to drop cached metadata for VG %s.", vg->name);
return 0;
@@ -4139,6 +4142,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
int inconsistent_mdas = 0;
int inconsistent_mda_count = 0;
int strip_historical_lvs = *consistent;
+ int update_old_pv_ext = *consistent;
unsigned use_precommitted = precommitted;
struct dm_list *pvids;
struct pv_list *pvl;
@@ -4175,8 +4179,18 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
}
}
- if (correct_vg && strip_historical_lvs && !vg_strip_outdated_historical_lvs(correct_vg))
- return_NULL;
+
+ if (correct_vg) {
+ if (update_old_pv_ext && !_vg_update_old_pv_ext_if_needed(correct_vg)) {
+ release_vg(correct_vg);
+ return_NULL;
+ }
+
+ if (strip_historical_lvs && !vg_strip_outdated_historical_lvs(correct_vg)) {
+ release_vg(correct_vg);
+ return_NULL;
+ }
+ }
return correct_vg;
}
@@ -4616,8 +4630,17 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
*consistent = !inconsistent_pvs;
- if (*consistent && correct_vg && strip_historical_lvs && !vg_strip_outdated_historical_lvs(correct_vg))
- return_NULL;
+ if (correct_vg && *consistent) {
+ if (update_old_pv_ext && !_vg_update_old_pv_ext_if_needed(correct_vg)) {
+ release_vg(correct_vg);
+ return_NULL;
+ }
+
+ if (strip_historical_lvs && !vg_strip_outdated_historical_lvs(correct_vg)) {
+ release_vg(correct_vg);
+ return_NULL;
+ }
+ }
return correct_vg;
}
7 years, 8 months
master - libdm: report: fix json reporting to escape '"' character that may appear in reported string
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f9697ea0067ef5...
Commit: f9697ea0067ef574aff09f1c8f25e1c7fab74c17
Parent: d180bf63119580073235191c3527c9c8ee9cacbb
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jul 26 12:27:41 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 26 12:27:41 2016 +0200
libdm: report: fix json reporting to escape '"' character that may appear in reported string
---
WHATS_NEW_DM | 1 +
libdm/libdm-report.c | 32 +++++++++++++++++++++++++++++---
2 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 53d0388..00f897a 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.132 -
=================================
+ Fix json reporting to escape '"' character that may appear in reported string.
Version 1.02.131 - 15th July 2016
=================================
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 8993201..02fead5 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -4320,6 +4320,7 @@ static int _sort_rows(struct dm_report *rh)
#define JSON_OBJECT_END "}"
#define JSON_ARRAY_START "["
#define JSON_ARRAY_END "]"
+#define JSON_ESCAPE_CHAR "\\"
#define UNABLE_TO_EXTEND_OUTPUT_LINE_MSG "dm_report: Unable to extend output line"
@@ -4346,6 +4347,7 @@ static int _output_field(struct dm_report *rh, struct dm_report_field *field)
int32_t width;
uint32_t align;
const char *repstr;
+ const char *p1_repstr, *p2_repstr;
char *buf = NULL;
size_t buf_size = 0;
@@ -4393,9 +4395,33 @@ static int _output_field(struct dm_report *rh, struct dm_report_field *field)
repstr = field->report_string;
width = field->props->width;
if (!(rh->flags & DM_REPORT_OUTPUT_ALIGNED)) {
- if (!dm_pool_grow_object(rh->mem, repstr, 0)) {
- log_error(UNABLE_TO_EXTEND_OUTPUT_LINE_MSG);
- return 0;
+ if (_is_json_report(rh)) {
+ /* Escape any JSON_QUOTE that may appear in reported string. */
+ p1_repstr = repstr;
+ while ((p2_repstr = strstr(p1_repstr, JSON_QUOTE))) {
+ if (p2_repstr > p1_repstr) {
+ if (!dm_pool_grow_object(rh->mem, p1_repstr, p2_repstr - p1_repstr)) {
+ log_error(UNABLE_TO_EXTEND_OUTPUT_LINE_MSG);
+ return 0;
+ }
+ }
+ if (!dm_pool_grow_object(rh->mem, JSON_ESCAPE_CHAR, 1) ||
+ !dm_pool_grow_object(rh->mem, JSON_QUOTE, 1)) {
+ log_error(UNABLE_TO_EXTEND_OUTPUT_LINE_MSG);
+ return 0;
+ }
+ p1_repstr = p2_repstr + 1;
+ }
+
+ if (!dm_pool_grow_object(rh->mem, p1_repstr, 0)) {
+ log_error(UNABLE_TO_EXTEND_OUTPUT_LINE_MSG);
+ return 0;
+ }
+ } else {
+ if (!dm_pool_grow_object(rh->mem, repstr, 0)) {
+ log_error(UNABLE_TO_EXTEND_OUTPUT_LINE_MSG);
+ return 0;
+ }
}
} else {
if (!(align = field->props->flags & DM_REPORT_FIELD_ALIGN_MASK))
7 years, 8 months
master - lvconvert: --trackchanges requires --splitmirrors 1
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d180bf63119580...
Commit: d180bf63119580073235191c3527c9c8ee9cacbb
Parent: d0e15b86b53bd4960a7c15a7771548ab4aface8b
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Jul 25 21:15:25 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Jul 25 21:15:25 2016 +0100
lvconvert: --trackchanges requires --splitmirrors 1
---
WHATS_NEW | 2 +-
tools/lvconvert.c | 10 ++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index b80d189..c96b5be 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,6 +1,6 @@
Version 2.02.162 -
=================================
- Improve lvconvert --trackchanges validation to require --splitmirrors.
+ Improve lvconvert --trackchanges validation to require --splitmirrors 1.
Add note about lastlog built-in command to lvm man page.
Fix unrecognised segtype flag message.
lvconvert reuse cachepool metadade now ONLY with -Zn and clear otherwise.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 91765d6..c0838d1 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1894,6 +1894,13 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
lp->keep_mimages ? "split" : "reduce");
return 0;
}
+
+ /* --trackchanges requires --splitmirrors which always has SIGN_MINUS */
+ if (lp->track_changes && lp->mirrors != 1) {
+ log_error("Exactly one image must be split off from %s when tracking changes.",
+ display_lvname(lv));
+ return 0;
+ }
}
if (lp->merge_mirror)
@@ -1903,8 +1910,7 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
return lv_raid_split_and_track(lv, lp->pvh);
if (lp->keep_mimages)
- return lv_raid_split(lv, lp->lv_split_name,
- image_count, lp->pvh);
+ return lv_raid_split(lv, lp->lv_split_name, image_count, lp->pvh);
if (lp->mirrors_supplied)
return lv_raid_change_image_count(lv, image_count, lp->pvh);
7 years, 9 months
master - lvmlockd: improve error message about missing global lock
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d0e15b86b53bd4...
Commit: d0e15b86b53bd4960a7c15a7771548ab4aface8b
Parent: 1efb1c23432f504db685c4ff9f2c08a5ba74e68f
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Jul 25 14:45:11 2016 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Jul 25 14:49:01 2016 -0500
lvmlockd: improve error message about missing global lock
If the VG holding the global lock is removed, we can indicate
that as the reason for not being able to acquire the global
lock in subsequent error messages, and can suggest enabling
the global lock in another VG. (This helpful error message
will go away if the global lock is enabled in another VG,
or if lvmlockd is restarted.)
---
daemons/lvmlockd/lvmlockd-core.c | 9 +++++++--
daemons/lvmlockd/lvmlockd-internal.h | 1 +
lib/locking/lvmlockd.c | 17 ++++++++++++++++-
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index b561529..8fcbdec 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -1654,6 +1654,9 @@ static int res_able(struct lockspace *ls, struct resource *r,
}
rv = lm_able_gl_sanlock(ls, act->op == LD_OP_ENABLE);
+
+ if (!rv && (act->op == LD_OP_ENABLE))
+ gl_vg_removed = 0;
out:
return rv;
}
@@ -2627,8 +2630,10 @@ out_act:
if (free_vg && ls->sanlock_gl_enabled && act_op_free) {
pthread_mutex_lock(&lockspaces_mutex);
- if (other_sanlock_vgs_exist(ls))
+ if (other_sanlock_vgs_exist(ls)) {
act_op_free->flags |= LD_AF_WARN_GL_REMOVED;
+ gl_vg_removed = 1;
+ }
pthread_mutex_unlock(&lockspaces_mutex);
}
@@ -3668,7 +3673,7 @@ static int client_send_result(struct client *cl, struct action *act)
if (act->flags & LD_AF_DUP_GL_LS)
strcat(result_flags, "DUP_GL_LS,");
- if (act->flags & LD_AF_WARN_GL_REMOVED)
+ if ((act->flags & LD_AF_WARN_GL_REMOVED) || gl_vg_removed)
strcat(result_flags, "WARN_GL_REMOVED,");
if (act->op == LD_OP_INIT) {
diff --git a/daemons/lvmlockd/lvmlockd-internal.h b/daemons/lvmlockd/lvmlockd-internal.h
index 2e21981..a2280b8 100644
--- a/daemons/lvmlockd/lvmlockd-internal.h
+++ b/daemons/lvmlockd/lvmlockd-internal.h
@@ -320,6 +320,7 @@ static inline int list_empty(const struct list_head *head)
EXTERN int gl_type_static;
EXTERN int gl_use_dlm;
EXTERN int gl_use_sanlock;
+EXTERN int gl_vg_removed;
EXTERN char gl_lsname_dlm[MAX_NAME+1];
EXTERN char gl_lsname_sanlock[MAX_NAME+1];
EXTERN int global_dlm_lockspace_exists;
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 03d0014..8acf69c 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -969,6 +969,7 @@ int lockd_start_vg(struct cmd_context *cmd, struct volume_group *vg, int start_i
{
char uuid[64] __attribute__((aligned(8)));
daemon_reply reply;
+ uint32_t lockd_flags = 0;
int host_id = 0;
int result;
int ret;
@@ -1018,13 +1019,16 @@ int lockd_start_vg(struct cmd_context *cmd, struct volume_group *vg, int start_i
"opts = %s", start_init ? "start_init" : "none",
NULL);
- if (!_lockd_result(reply, &result, NULL)) {
+ if (!_lockd_result(reply, &result, &lockd_flags)) {
ret = 0;
result = -ELOCKD;
} else {
ret = (result < 0) ? 0 : 1;
}
+ if (lockd_flags & LD_RF_WARN_GL_REMOVED)
+ cmd->lockd_gl_removed = 1;
+
switch (result) {
case 0:
log_print_unless_silent("VG %s starting %s lockspace", vg->name, vg->lock_type);
@@ -1140,6 +1144,11 @@ int lockd_start_wait(struct cmd_context *cmd)
daemon_reply_destroy(reply);
+ if (cmd->lockd_gl_removed) {
+ log_error("Missing global lock: global lock was lost by removing a previous VG.");
+ log_error("To enable the global lock in another VG, see lvmlockctl --gl-enable.");
+ }
+
return ret;
}
@@ -1556,6 +1565,12 @@ int lockd_gl(struct cmd_context *cmd, const char *def_mode, uint32_t flags)
goto allow;
}
+ if ((lockd_flags & LD_RF_NO_GL_LS) && (lockd_flags & LD_RF_WARN_GL_REMOVED)) {
+ log_warn("Skipping global lock: VG with global lock was removed");
+ force_cache_update = 1;
+ goto allow;
+ }
+
if ((lockd_flags & LD_RF_NO_GL_LS) || (lockd_flags & LD_RF_NO_LOCKSPACES)) {
log_warn("Skipping global lock: lockspace not found or started");
force_cache_update = 1;
7 years, 9 months
master - lvconvert: --trackchanges requires --splitmirrors
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1efb1c23432f50...
Commit: 1efb1c23432f504db685c4ff9f2c08a5ba74e68f
Parent: 7b1daa248ffdc473e016b9694c1f85a827334c89
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Jul 25 19:32:10 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Jul 25 19:32:10 2016 +0100
lvconvert: --trackchanges requires --splitmirrors
---
WHATS_NEW | 1 +
tools/lvconvert.c | 39 ++++++++++++++++++++++++---------------
2 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index f5b8306..b80d189 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.162 -
=================================
+ Improve lvconvert --trackchanges validation to require --splitmirrors.
Add note about lastlog built-in command to lvm man page.
Fix unrecognised segtype flag message.
lvconvert reuse cachepool metadade now ONLY with -Zn and clear otherwise.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index c31a8a3..91765d6 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -59,6 +59,8 @@ struct lvconvert_params {
int merge_snapshot; /* merge is also set */
int merge_mirror; /* merge is also set */
+ int track_changes; /* keep_mimages is also set (--splitmirrors) */
+
int poolmetadataspare;
int force;
int yes;
@@ -77,7 +79,7 @@ struct lvconvert_params {
uint32_t mirrors;
sign_t mirrors_sign;
- uint32_t keep_mimages;
+ uint32_t keep_mimages; /* --splitmirrors */
uint32_t stripes;
uint32_t stripe_size;
uint32_t read_ahead;
@@ -335,7 +337,7 @@ static int _read_pool_params(struct cmd_context *cmd, int *pargc, char ***pargv,
strcmp(lp->type_str, "cache") &&
strcmp(lp->type_str, "cache-pool")) {
log_error("--cachepool argument is only valid with "
- " the cache or cache-pool segment type.");
+ "the cache or cache-pool segment type.");
return 0;
}
cachepool = 1;
@@ -347,7 +349,7 @@ static int _read_pool_params(struct cmd_context *cmd, int *pargc, char ***pargv,
strcmp(lp->type_str, "thin") &&
strcmp(lp->type_str, "thin-pool")) {
log_error("--thinpool argument is only valid with "
- " the thin or thin-pool segment type.");
+ "the thin or thin-pool segment type.");
return 0;
}
thinpool = 1;
@@ -542,6 +544,9 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
lp->snapshot = 1;
}
+ if (arg_is_set(cmd, trackchanges_ARG))
+ lp->track_changes = 1;
+
if (lp->split) {
lp->lv_split_name = arg_str_value(cmd, name_ARG, NULL);
@@ -557,8 +562,8 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
"mutually exclusive.");
return 0;
}
- if (!arg_is_set(cmd, name_ARG) &&
- !arg_is_set(cmd, trackchanges_ARG)) {
+
+ if (!arg_is_set(cmd, name_ARG) && !lp->track_changes) {
log_error("Please name the new logical volume using '--name'");
return 0;
}
@@ -567,10 +572,15 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
lp->keep_mimages = 1;
lp->mirrors = arg_uint_value(cmd, splitmirrors_ARG, 0);
lp->mirrors_sign = SIGN_MINUS;
- } else if (arg_is_set(cmd, name_ARG)) {
- log_error("The 'name' argument is only valid"
- " with --splitmirrors");
- return 0;
+ } else {
+ if (lp->track_changes) {
+ log_error("--trackchanges is only valid with --splitmirrors.");
+ return 0;
+ }
+ if (arg_is_set(cmd, name_ARG)) {
+ log_error("The 'name' argument is only valid with --splitmirrors");
+ return 0;
+ }
}
if (arg_is_set(cmd, merge_ARG))
@@ -1504,7 +1514,7 @@ static int _lvconvert_mirrors_aux(struct cmd_context *cmd,
/* Reduce number of mirrors */
if (lp->keep_mimages) {
- if (arg_is_set(cmd, trackchanges_ARG)) {
+ if (lp->track_changes) {
log_error("--trackchanges is not available "
"to 'mirror' segment type.");
return 0;
@@ -1889,7 +1899,7 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
if (lp->merge_mirror)
return lv_raid_merge(lv);
- if (arg_is_set(cmd, trackchanges_ARG))
+ if (lp->track_changes)
return lv_raid_split_and_track(lv, lp->pvh);
if (lp->keep_mimages)
@@ -1933,8 +1943,7 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
}
if (sync_percent != DM_PERCENT_100) {
- log_warn("WARNING: %s is not in-sync.",
- display_lvname(lv));
+ log_warn("WARNING: %s is not in-sync.", display_lvname(lv));
log_warn("WARNING: Portions of the array may be unrecoverable.");
/*
@@ -1957,8 +1966,8 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
return 0;
}
- log_print_unless_silent("Faulty devices in %s successfully"
- " replaced.", display_lvname(lv));
+ log_print_unless_silent("Faulty devices in %s successfully replaced.",
+ display_lvname(lv));
return 1;
}
7 years, 9 months
master - lvconvert: remove warnings about deprecated split option
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7b1daa248ffdc4...
Commit: 7b1daa248ffdc473e016b9694c1f85a827334c89
Parent: 70bad99894003c9e2fcec5db2b1f39cf09f75077
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Jul 25 11:01:56 2016 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Jul 25 11:01:56 2016 -0500
lvconvert: remove warnings about deprecated split option
A warning seems too severe for this message, so leave it
out until there's a better idea.
---
tools/lvconvert.c | 12 +++---------
1 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 5d29cc4..c31a8a3 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -4047,10 +4047,8 @@ static int _convert_thin_pool(struct cmd_context *cmd, struct logical_volume *lv
if (arg_is_set(cmd, splitcache_ARG))
return _convert_thin_pool_splitcache(cmd, lv, lp);
- if (arg_is_set(cmd, split_ARG)) {
- log_warn("WARNING: Using --splitcache which has replaced the --split option.");
+ if (arg_is_set(cmd, split_ARG))
return _convert_thin_pool_splitcache(cmd, lv, lp);
- }
if (arg_is_set(cmd, uncache_ARG))
return _convert_thin_pool_uncache(cmd, lv, lp);
@@ -4084,10 +4082,8 @@ static int _convert_cache_volume(struct cmd_context *cmd, struct logical_volume
if (arg_is_set(cmd, splitcache_ARG))
return _convert_cache_volume_splitcache(cmd, lv, lp);
- if (arg_is_set(cmd, split_ARG)) {
- log_warn("WARNING: Using --splitcache which has replaced the --split option.");
+ if (arg_is_set(cmd, split_ARG))
return _convert_cache_volume_splitcache(cmd, lv, lp);
- }
if (arg_is_set(cmd, uncache_ARG))
return _convert_cache_volume_uncache(cmd, lv, lp);
@@ -4117,10 +4113,8 @@ static int _convert_cache_pool(struct cmd_context *cmd, struct logical_volume *l
if (arg_is_set(cmd, splitcache_ARG))
return _convert_cache_pool_splitcache(cmd, lv, lp);
- if (arg_is_set(cmd, split_ARG)) {
- log_warn("WARNING: Using --splitcache which has replaced the --split option.");
+ if (arg_is_set(cmd, split_ARG))
return _convert_cache_pool_splitcache(cmd, lv, lp);
- }
/* FIXME: swapping the cache pool metadata LV needs a specific option like --swapmetadata */
if (arg_is_set(cmd, poolmetadata_ARG))
7 years, 9 months
master - lvmlockd: improve message for lock-start
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=70bad99894003c...
Commit: 70bad99894003c9e2fcec5db2b1f39cf09f75077
Parent: 94141c7797caabe23607a554fa7c6f44a4d570fc
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Jul 25 10:40:48 2016 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Jul 25 10:43:06 2016 -0500
lvmlockd: improve message for lock-start
Only print this for shared VGs, and include the
time it may take for sanlock.
---
tools/vgchange.c | 43 +++++++++++++++++++++++++++++++++++--------
1 files changed, 35 insertions(+), 8 deletions(-)
diff --git a/tools/vgchange.c b/tools/vgchange.c
index fb751a2..910f33a 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -15,6 +15,11 @@
#include "tools.h"
+struct vgchange_params {
+ int lock_start_count;
+ unsigned int lock_start_sanlock : 1;
+};
+
/*
* Increments *count by the number of _new_ monitored devices.
*/
@@ -849,10 +854,12 @@ static int _passes_lock_start_filter(struct cmd_context *cmd,
return 0;
}
-static int _vgchange_lock_start(struct cmd_context *cmd, struct volume_group *vg)
+static int _vgchange_lock_start(struct cmd_context *cmd, struct volume_group *vg,
+ struct vgchange_params *vp)
{
const char *start_opt = arg_str_value(cmd, lockopt_ARG, NULL);
int auto_opt = 0;
+ int r;
if (!is_lockd_type(vg->lock_type))
return 1;
@@ -878,7 +885,14 @@ static int _vgchange_lock_start(struct cmd_context *cmd, struct volume_group *vg
}
do_start:
- return lockd_start_vg(cmd, vg, 0);
+ r = lockd_start_vg(cmd, vg, 0);
+
+ if (r)
+ vp->lock_start_count++;
+ if (!strcmp(vg->lock_type, "sanlock"))
+ vp->lock_start_sanlock = 1;
+
+ return r;
}
static int _vgchange_lock_stop(struct cmd_context *cmd, struct volume_group *vg)
@@ -888,8 +902,9 @@ static int _vgchange_lock_stop(struct cmd_context *cmd, struct volume_group *vg)
static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg,
- struct processing_handle *handle __attribute__((unused)))
+ struct processing_handle *handle)
{
+ struct vgchange_params *vp = (struct vgchange_params *)handle->custom_handle;
int ret = ECMD_PROCESSED;
unsigned i;
struct lv_list *lvl;
@@ -1002,7 +1017,7 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
return_ECMD_FAILED;
if (arg_is_set(cmd, lockstart_ARG)) {
- if (!_vgchange_lock_start(cmd, vg))
+ if (!_vgchange_lock_start(cmd, vg, vp))
return_ECMD_FAILED;
} else if (arg_is_set(cmd, lockstop_ARG)) {
if (!_vgchange_lock_stop(cmd, vg))
@@ -1092,6 +1107,8 @@ static int _lockd_vgchange(struct cmd_context *cmd, int argc, char **argv)
int vgchange(struct cmd_context *cmd, int argc, char **argv)
{
+ struct processing_handle *handle;
+ struct vgchange_params vp = { 0 };
uint32_t flags = 0;
int ret;
@@ -1216,24 +1233,34 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
if (arg_is_set(cmd, lockstart_ARG) || arg_is_set(cmd, lockstop_ARG))
flags |= READ_ALLOW_EXPORTED;
- ret = process_each_vg(cmd, argc, argv, NULL, NULL, flags, 0, NULL, &vgchange_single);
+ if (!(handle = init_processing_handle(cmd, NULL))) {
+ log_error("Failed to initialize processing handle.");
+ return ECMD_FAILED;
+ }
+
+ handle->custom_handle = &vp;
+
+ ret = process_each_vg(cmd, argc, argv, NULL, NULL, flags, 0, handle, &vgchange_single);
/* Wait for lock-start ops that were initiated in vgchange_lockstart. */
- if (arg_is_set(cmd, lockstart_ARG)) {
+ if (arg_is_set(cmd, lockstart_ARG) && vp.lock_start_count) {
const char *start_opt = arg_str_value(cmd, lockopt_ARG, NULL);
if (!lockd_gl(cmd, "un", 0))
stack;
if (!start_opt || !strcmp(start_opt, "auto")) {
- log_print_unless_silent("Starting locking. Waiting until locks are ready...");
+ if (vp.lock_start_sanlock)
+ log_print_unless_silent("Starting locking. Waiting for sanlock may take 20 sec to 3 min...");
+ else
+ log_print_unless_silent("Starting locking. Waiting until locks are ready...");
lockd_start_wait(cmd);
-
} else if (!strcmp(start_opt, "nowait") || !strcmp(start_opt, "autonowait")) {
log_print_unless_silent("Starting locking. VG can only be read until locks are ready.");
}
}
+ destroy_processing_handle(cmd, handle);
return ret;
}
7 years, 9 months