master - coverity: cleaning some PW.NOT_COMPATIBLE_WITH_PREVIOUS_DECL
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4661c6b6fb7adc...
Commit: 4661c6b6fb7adc01a3fd42b5e802051b92d15d9d
Parent: bbf574ab90a82f636a5f5e66c9523484492da946
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jul 12 16:42:14 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 13 21:52:14 2016 +0200
coverity: cleaning some PW.NOT_COMPATIBLE_WITH_PREVIOUS_DECL
Some very low-prio warns....
---
libdaemon/client/config-util.h | 2 +-
libdaemon/client/daemon-client.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libdaemon/client/config-util.h b/libdaemon/client/config-util.h
index 64cce8b..38f36af 100644
--- a/libdaemon/client/config-util.h
+++ b/libdaemon/client/config-util.h
@@ -26,7 +26,7 @@ int buffer_append_f(struct buffer *buf, ...);
int buffer_append(struct buffer *buf, const char *string);
void buffer_init(struct buffer *buf);
void buffer_destroy(struct buffer *buf);
-int buffer_realloc(struct buffer *buf, int required);
+int buffer_realloc(struct buffer *buf, int needed);
int buffer_line(const char *line, void *baton);
diff --git a/libdaemon/client/daemon-client.h b/libdaemon/client/daemon-client.h
index 173ea89..5235bea 100644
--- a/libdaemon/client/daemon-client.h
+++ b/libdaemon/client/daemon-client.h
@@ -78,7 +78,7 @@ daemon_handle daemon_open(daemon_info i);
* be ignored even if non-NULL). If the buffer is NULL, the cft is required to
* be a valid pointer, and is used to build up the request.
*/
-daemon_reply daemon_send(daemon_handle h, daemon_request r);
+daemon_reply daemon_send(daemon_handle h, daemon_request rq);
/*
* A simple interface to daemon_send. This function just takes the command id
7 years, 9 months
master - coverity: easier to follow set-up of vsn variable
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bbf574ab90a82f...
Commit: bbf574ab90a82f636a5f5e66c9523484492da946
Parent: 0b773eecd967599b38214fe321fc7e493046c880
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jul 12 16:41:25 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 13 21:52:14 2016 +0200
coverity: easier to follow set-up of vsn variable
Helping coverity to see 'vsn' really can't be NULL.
---
tools/dumpconfig.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/tools/dumpconfig.c b/tools/dumpconfig.c
index 3da04f0..e387e60 100644
--- a/tools/dumpconfig.c
+++ b/tools/dumpconfig.c
@@ -20,11 +20,8 @@ static int _get_vsn(struct cmd_context *cmd, uint16_t *version_int)
const char *vsn;
unsigned int major, minor, patchlevel;
- if (arg_is_set(cmd, atversion_ARG))
- vsn = arg_str_value(cmd, atversion_ARG, NULL);
- else if (arg_is_set(cmd, sinceversion_ARG))
- vsn = arg_str_value(cmd, sinceversion_ARG, NULL);
- else
+ if (!(vsn = arg_str_value(cmd, atversion_ARG, NULL)) &&
+ !(vsn = arg_str_value(cmd, sinceversion_ARG, NULL)))
vsn = LVM_VERSION;
if (sscanf(vsn, "%u.%u.%u", &major, &minor, &patchlevel) != 3) {
7 years, 9 months
master - tests: skip more cache tests for older driver
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0b773eecd96759...
Commit: 0b773eecd967599b38214fe321fc7e493046c880
Parent: 07587c2699b04058b6dd044adb69c854a6458e24
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jul 13 16:13:29 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 13 21:52:14 2016 +0200
tests: skip more cache tests for older driver
---
test/shell/lvchange-cache.sh | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/test/shell/lvchange-cache.sh b/test/shell/lvchange-cache.sh
index fa7d24c..385fcf4 100644
--- a/test/shell/lvchange-cache.sh
+++ b/test/shell/lvchange-cache.sh
@@ -33,16 +33,16 @@ not lvchange --cachesettings foo=bar $vg/noncache
lvchange --cachepolicy cleaner $vg/corigin
check lv_field $vg/corigin kernel_cache_policy "cleaner"
+# Skip these test on older cache driver as it shows errors with these lvchanges
+# device-mapper: space map common: index_check failed: blocknr 17179869216 != wanted 11
+if aux have_cache 1 5 0 ; then
+
lvchange --cachepolicy mq --cachesettings migration_threshold=333 $vg/corigin
# TODO once mq->smq happens we will get here some 0 for mq settings
check lv_field $vg/corigin kernel_cache_policy "mq"
get lv_field $vg/corigin kernel_cache_settings | grep 'migration_threshold=333'
-# Skip these test on older cache driver as it shows errors with these lvchanges
-# device-mapper: space map common: index_check failed: blocknr 17179869216 != wanted 11
-if aux have_cache 1 5 0 ; then
-
lvchange --refresh $vg/corigin
get lv_field $vg/corigin kernel_cache_settings | grep 'migration_threshold=333'
lvchange -an $vg
@@ -84,12 +84,12 @@ grep 'migration_threshold=2048' out
grep 'sequential_threshold=13' out
grep 'random_threshold=4' out
-fi
-
else
# When MQ is emulated by SMQ policy it does not hold settings.
# So just skip testing of param changes when sequential_threshold=0
grep 'sequential_threshold=0' out
fi
+fi # have_cache 1 5 0
+
vgremove -f $vg
7 years, 9 months
master - tests: resize of filesystem
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=07587c2699b040...
Commit: 07587c2699b04058b6dd044adb69c854a6458e24
Parent: deb6f6a06c2fa25b1c9aa4c6eeb9529ce7c5c4c3
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jul 13 21:15:34 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 13 21:52:14 2016 +0200
tests: resize of filesystem
Test for https://bugzilla.redhat.com/1354396
---
test/shell/lvresize-full.sh | 69 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 69 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvresize-full.sh b/test/shell/lvresize-full.sh
new file mode 100644
index 0000000..17ee6aa
--- /dev/null
+++ b/test/shell/lvresize-full.sh
@@ -0,0 +1,69 @@
+#!/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
+
+# Excersize resize of filesystem when size of LV already matches
+# https://bugzilla.redhat.com/1354396
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+FSCK=${FSCK-fsck}
+MKFS=${MKFS-mkfs.ext3}
+RESIZEFS=${RESIZEFS-resize2fs}
+
+which $FSCK || skip
+which $MKFS || skip
+which $RESIZEFS || skip
+
+aux prepare_vg 2 20
+
+lvcreate -l100%FREE -n $lv1 $vg
+
+lvdev="$DM_DEV_DIR/$vg/$lv1"
+
+lvs -a $vg
+
+"$MKFS" "$lvdev"
+
+# this should resolve to resize to same actual size
+lvreduce -r -f -l-100%FREE $vg/$lv1
+"$FSCK" -n "$lvdev"
+
+# size should remain the same
+lvextend -r -f -l+100%FREE $vg/$lv1
+"$FSCK" -n "$lvdev"
+
+#lvchange -an $vg/$lv1
+lvresize -r -f -l+100%FREE $vg/$lv1
+"$FSCK" -n "$lvdev"
+
+# Check there is really file system resize happening
+# even when LV itself has still the same size
+"$RESIZEFS" -f "$lvdev" 20000
+"$FSCK" -n "$lvdev" | tee out
+grep "20000 blocks" out
+
+SIZE=$(get lv_field $vg/$lv1 size)
+lvresize -r -f -l-100%FREE $vg/$lv1
+test "$SIZE" = "$(get lv_field $vg/$lv1 size)"
+
+"$FSCK" -n "$lvdev" | tee out
+grep -v "20000 blocks" out
+
+
+# Also check it fails when the user 'resize' volume without
+# resizing fs and then retries with '-r'.
+lvreduce -f -l50%VG $vg/$lv1
+fail lvresize -r -f -l50%VG $vg/$lv1
+
+lvremove -ff $vg
7 years, 9 months
master - cleanup: add some dots to messages
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=deb6f6a06c2fa2...
Commit: deb6f6a06c2fa25b1c9aa4c6eeb9529ce7c5c4c3
Parent: e1112227d19cc252e1404eb4bf44d03e3867e463
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jul 12 22:25:21 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 13 21:52:14 2016 +0200
cleanup: add some dots to messages
---
lib/metadata/lv_manip.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 022bb1f..a47bd16 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4989,14 +4989,14 @@ static int _lvresize_adjust_extents(struct logical_volume *lv,
/* At this point, lp->extents should hold the correct NEW logical size required. */
if (!lp->extents) {
- log_error("New size of 0 not permitted");
+ log_error("New size of 0 not permitted.");
return 0;
}
if (lp->extents == existing_logical_extents) {
if (!lp->resizefs) {
- log_error("New size (%d extents) matches existing size "
- "(%d extents)", lp->extents, existing_logical_extents);
+ log_error("New size (%d extents) matches existing size (%d extents).",
+ lp->extents, existing_logical_extents);
return 0;
}
lp->resize = LV_EXTEND; /* lets pretend zero size extension */
@@ -5005,7 +5005,7 @@ static int _lvresize_adjust_extents(struct logical_volume *lv,
/* Perform any rounding to produce complete stripes. */
if (lp->stripes > 1) {
if (lp->stripe_size < STRIPE_SIZE_MIN) {
- log_error("Invalid stripe size %s",
+ log_error("Invalid stripe size %s.",
display_size(cmd, (uint64_t) lp->stripe_size));
return 0;
}
@@ -5024,7 +5024,7 @@ static int _lvresize_adjust_extents(struct logical_volume *lv,
(vg->free_count >= (lp->extents - existing_logical_extents - size_rest +
stripes_extents)))) {
log_print_unless_silent("Rounding size (%d extents) up to stripe "
- "boundary size for segment (%d extents)",
+ "boundary size for segment (%d extents).",
lp->extents,
lp->extents - size_rest + stripes_extents);
lp->extents = lp->extents - size_rest + stripes_extents;
@@ -5088,7 +5088,7 @@ static int _lvresize_check_type(const struct logical_volume *lv,
if (lv_is_active(lv)) {
log_error("Snapshot origin volumes can be resized "
- "only while inactive: try lvchange -an");
+ "only while inactive: try lvchange -an.");
return 0;
}
}
7 years, 9 months
master - lvresize: fix zero size extension
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e1112227d19cc2...
Commit: e1112227d19cc252e1404eb4bf44d03e3867e463
Parent: 3928c96a37941d765bf467d82502cd2aec7fd809
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jul 13 16:23:25 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 13 21:52:04 2016 +0200
lvresize: fix zero size extension
Commit ca878a3426197b629c76e98cfc049948da470cd7 changed behavior
or resize operation. Later the code has been futher changed
to skip fs resize completely when size of LV is already matching
and finaly at the most recent resize changeset for resize the
check for matching size has been eliminated as well so we ended
with a request call to resize fs to 0 size in some cases.
This commit reoders some test so the prompt happens just once before
resize of possibly 2 related volumes.
Also extra test for having LV already given size is added, and
whole metadata update is skipped for this case as the only
result would be an increment of seqno.
However the filesystem is still resized when requested,
so if the LV has some size and the resize is resolved to
the same size, the filesystem resize is called so in case FS
would not match, the resize will happen.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 88 ++++++++++++++++++++++----------------
lib/metadata/metadata-exported.h | 1 +
3 files changed, 53 insertions(+), 37 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 5653b13..3ed398c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.161 -
================================
+ Fix lvresize of filesystem when LV has already right size (2.02.141).
New LVM_LOG_FILE_MAX_LINES env var to limit max size of created logs.
Version 2.02.160 - 6th July 2016
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index d11b125..022bb1f 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5130,38 +5130,8 @@ static int _lvresize_volume(struct logical_volume *lv,
struct volume_group *vg = lv->vg;
struct cmd_context *cmd = vg->cmd;
uint32_t old_extents;
- int status;
alloc_policy_t alloc = lp->alloc ? : lv->alloc;
- if ((lp->resize == LV_REDUCE) && (pvh != &vg->pvs))
- log_print_unless_silent("Ignoring PVs on command line when reducing.");
-
- /* Request confirmation before operations that are often mistakes. */
- if ((lp->resizefs || (lp->resize == LV_REDUCE)) &&
- !_request_confirmation(lv, lp))
- return_0;
-
- if (lp->resizefs) {
- if (!lp->nofsck &&
- !_fsadm_cmd(FSADM_CMD_CHECK, lv, 0, lp->force, &status)) {
- if (status != FSADM_CHECK_FAILS_FOR_MOUNTED) {
- log_error("Filesystem check failed.");
- return 0;
- }
- /* some filesystems support online resize */
- }
-
- /* FIXME forks here */
- if ((lp->resize == LV_REDUCE) &&
- !_fsadm_cmd(FSADM_CMD_RESIZE, lv, lp->extents, lp->force, NULL)) {
- log_error("Filesystem resize failed.");
- return 0;
- }
- }
-
- if (!archive(vg))
- return_0;
-
old_extents = lv->le_count;
log_verbose("%sing logical volume %s to %s%s",
(lp->resize == LV_REDUCE) ? "Reduc" : "Extend",
@@ -5187,11 +5157,13 @@ static int _lvresize_volume(struct logical_volume *lv,
log_print_unless_silent("Size of logical volume %s unchanged from %s (%" PRIu32 " extents).",
display_lvname(lv),
display_size(cmd, (uint64_t) old_extents * vg->extent_size), old_extents);
- else
+ else {
+ lp->size_changed = 1;
log_print_unless_silent("Size of logical volume %s changed from %s (%" PRIu32 " extents) to %s (%" PRIu32 " extents).",
display_lvname(lv),
display_size(cmd, (uint64_t) old_extents * vg->extent_size), old_extents,
display_size(cmd, (uint64_t) lv->le_count * vg->extent_size), lv->le_count);
+ }
return 1;
}
@@ -5211,10 +5183,10 @@ static int _lvresize_prepare(struct logical_volume **lv,
else if (lp->extents && !_lvresize_extents_from_percent(*lv, lp, pvh))
return_0;
- if (lp->extents && !_lvresize_adjust_extents(*lv, lp, pvh))
+ if (!_lvresize_adjust_extents(*lv, lp, pvh))
return_0;
- if (lp->extents && !_lvresize_check_type(*lv, lp))
+ if (!_lvresize_check_type(*lv, lp))
return_0;
return 1;
@@ -5246,6 +5218,7 @@ int lv_resize(struct logical_volume *lv,
struct lvresize_params aux_lp;
int activated = 0;
int ret = 0;
+ int status;
if (!_lvresize_check(lv, lp))
return_0;
@@ -5271,8 +5244,8 @@ int lv_resize(struct logical_volume *lv,
}
} else if (lp->poolmetadata_size) {
if (!lp->extents && !lp->size) {
- /* When only --poolmetadatasize give and not --size
- * swith directly to resize metadata LV */
+ /* When only --poolmetadatasize given and not --size
+ * switch directly to resize metadata LV */
lv = first_seg(lv)->metadata_lv;
lp->size = lp->poolmetadata_size;
lp->sign = lp->poolmetadata_sign;
@@ -5287,9 +5260,44 @@ int lv_resize(struct logical_volume *lv,
if (aux_lv && !_lvresize_prepare(&aux_lv, &aux_lp, pvh))
return_0;
+ /* Always should have lp->size or lp->extents */
if (!_lvresize_prepare(&lv, lp, pvh))
return_0;
+ if (((lp->resize == LV_REDUCE) ||
+ (aux_lv && aux_lp.resize == LV_REDUCE)) &&
+ (pvh != &vg->pvs))
+ log_print_unless_silent("Ignoring PVs on command line when reducing.");
+
+ /* Request confirmation before operations that are often mistakes. */
+ /* aux_lv never resize fs */
+ if ((lp->resizefs || (lp->resize == LV_REDUCE)) &&
+ !_request_confirmation(lv, lp))
+ return_0;
+
+ if (lp->resizefs) {
+ if (!lp->nofsck &&
+ !_fsadm_cmd(FSADM_CMD_CHECK, lv, 0, lp->force, &status)) {
+ if (status != FSADM_CHECK_FAILS_FOR_MOUNTED) {
+ log_error("Filesystem check failed.");
+ return 0;
+ }
+ /* some filesystems support online resize */
+ }
+
+ /* FIXME forks here */
+ if ((lp->resize == LV_REDUCE) &&
+ !_fsadm_cmd(FSADM_CMD_RESIZE, lv, lp->extents, lp->force, NULL)) {
+ log_error("Filesystem resize failed.");
+ return 0;
+ }
+ }
+
+ if (!lp->extents && (!aux_lv || !aux_lp.extents)) {
+ lp->extents = lv->le_count;
+ goto out; /* Nothing to do */
+ }
+
if (lv_is_thin_pool(lock_lv) && /* Lock holder is thin-pool */
!lv_is_active(lock_lv)) {
@@ -5322,12 +5330,15 @@ int lv_resize(struct logical_volume *lv,
if (!lockd_lv(cmd, lock_lv, "ex", 0))
return_0;
+ if (!archive(vg))
+ return_0;
+
if (aux_lv) {
if (!_lvresize_volume(aux_lv, &aux_lp, pvh))
goto_bad;
/* store vg on disk(s) */
- if (!lv_update_and_reload(lock_lv))
+ if (aux_lp.size_changed && !lv_update_and_reload(lock_lv))
goto_bad;
}
@@ -5335,6 +5346,9 @@ int lv_resize(struct logical_volume *lv,
goto_bad;
/* store vg on disk(s) */
+ if (!lp->size_changed)
+ goto out; /* No table reload needed */
+
if (!lv_update_and_reload(lock_lv))
goto_bad;
@@ -5349,7 +5363,7 @@ int lv_resize(struct logical_volume *lv,
backup(vg);
}
-
+out:
log_print_unless_silent("Logical volume %s successfully resized.",
display_lvname(lv));
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 7765d23..84b510b 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -637,6 +637,7 @@ struct lvresize_params {
int approx_alloc;
int extents_are_pes; /* Is 'extents' counting PEs or LEs? */
+ int size_changed; /* Was there actually a size change */
};
void pvcreate_params_set_defaults(struct pvcreate_params *pp);
7 years, 9 months
master - lvcreate: raid0 needs default number of stripes
by Heinz Mauelshagen
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3928c96a37941d...
Commit: 3928c96a37941d765bf467d82502cd2aec7fd809
Parent: 26f3b321f92f49fe20749cb09727f0908867b534
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Wed Jul 13 21:44:06 2016 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Wed Jul 13 21:45:49 2016 +0200
lvcreate: raid0 needs default number of stripes
raid0/raid0_meta type LVs don't have a default number of stripes when
created without '-i/--stripes Stripes' whereas other raid types have one.
Patch sets the default for raid0/raid0_meta to 2 stripes.
The default amount of stripes for raid4/5/10 is changed to 2 and for raid6 to 3
rather than using all PVs in the VG or those provided on the command line.
This is to avoid unintended high number of stripes in case of many PVs.
To select a different amount of stripes from the default,
use 'lvcreate -i/--stripes Stripes'.
- resolves rhbz1354650
---
tools/lvcreate.c | 64 +++++++++++++++++++++++++++---------------------------
1 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 0dd9b1e..6eca8f2 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -458,17 +458,29 @@ static int _read_mirror_params(struct cmd_context *cmd,
static int _read_raid_params(struct cmd_context *cmd,
struct lvcreate_params *lp)
{
- if ((lp->stripes < 2) && segtype_is_raid10(lp->segtype)) {
- if (arg_is_set(cmd, stripes_ARG)) {
- /* User supplied the bad argument */
- log_error("Segment type 'raid10' requires 2 or more stripes.");
- return 0;
- }
- /* No stripe argument was given - default to 2 */
- lp->stripes = 2;
- lp->stripe_size = find_config_tree_int(cmd, metadata_stripesize_CFG, NULL) * 2;
+ if (lp->stripes < 2) {
+ if (segtype_is_raid10(lp->segtype)) {
+ if (arg_is_set(cmd, stripes_ARG)) {
+ /* User supplied the bad argument */
+ log_error("Segment type 'raid10' requires 2 or more stripes.");
+ return 0;
+ }
+ /* No stripe argument was given - default to 2 */
+ /* FIXME: this needs to change to 3 once we support odd numbers of stripes */
+ lp->stripes = 2;
+ } else if (segtype_is_any_raid6(lp->segtype))
+ lp->stripes = 3;
+ else if (segtype_is_raid4(lp->segtype) ||
+ segtype_is_any_raid5(lp->segtype) ||
+ segtype_is_any_raid0(lp->segtype))
+ lp->stripes = 2;
+ else
+ lp->stripes = 1;
}
+ if (lp->stripes > 1)
+ lp->stripe_size = find_config_tree_int(cmd, metadata_stripesize_CFG, NULL) * 2;
+
/*
* RAID1 does not take a stripe arg
*/
@@ -1219,43 +1231,31 @@ static int _check_raid_parameters(struct volume_group *vg,
struct lvcreate_params *lp,
struct lvcreate_cmdline_params *lcp)
{
- unsigned devs = lcp->pv_count ? : dm_list_size(&vg->pvs);
struct cmd_context *cmd = vg->cmd;
if (!seg_is_mirrored(lp) && !lp->stripe_size)
lp->stripe_size = find_config_tree_int(cmd, metadata_stripesize_CFG, NULL) * 2;
- if (seg_is_any_raid0(lp)) {
+ if (segtype_is_any_raid0(lp->segtype) ||
+ segtype_is_raid4(lp->segtype) ||
+ segtype_is_any_raid5(lp->segtype)) {
if (lp->stripes < 2) {
- log_error("Segment type 'raid0' requires 2 or more stripes.");
+ log_error("Segment type \'%s\' requires 2 or more stripes.", lp->segtype->name);
return 0;
}
- } else if (!seg_is_mirrored(lp)) {
- /*
- * If number of devices was not supplied, we can infer from
- * the PVs given.
- */
- if (!arg_is_set(cmd, stripes_ARG) &&
- (devs > 2 * lp->segtype->parity_devs))
- lp->stripes = devs - lp->segtype->parity_devs;
-
- if (lp->stripes <= lp->segtype->parity_devs) {
- log_error("Number of stripes must be at least %d for %s",
- lp->segtype->parity_devs + 1,
- lp->segtype->name);
+ } else if (segtype_is_any_raid6(lp->segtype)) {
+ if (lp->stripes < 3) {
+ log_error("Segment type \'%s\' requires 3 or more stripes.", lp->segtype->name);
return 0;
}
- } else if (segtype_is_any_raid0(lp->segtype) ||
- segtype_is_raid10(lp->segtype)) {
- if (!arg_is_set(cmd, stripes_ARG))
- lp->stripes = devs / lp->mirrors;
+ } else if (segtype_is_raid10(lp->segtype)) {
if (lp->stripes < 2) {
- log_error("Unable to create RAID(1)0 LV: "
- "insufficient number of devices.");
+ log_error("Unable to create %s LV: "
+ "insufficient number of devices.", lp->segtype->name);
return 0;
}
}
- /* 'mirrors' defaults to 2 - not the number of PVs supplied */
+ /* 'mirrors' defaults to 2 */
return 1;
}
7 years, 9 months
master - man: changes to lvconvert
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=26f3b321f92f49...
Commit: 26f3b321f92f49fe20749cb09727f0908867b534
Parent: df5021a2017e395c68d1bee012a54a1d59c63c90
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Jul 13 13:09:38 2016 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Jul 13 13:13:05 2016 -0500
man: changes to lvconvert
Generally include more information about options.
---
man/lvconvert.8.in | 270 +++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 225 insertions(+), 45 deletions(-)
diff --git a/man/lvconvert.8.in b/man/lvconvert.8.in
index f51ad61..5f15f34 100644
--- a/man/lvconvert.8.in
+++ b/man/lvconvert.8.in
@@ -8,19 +8,168 @@ lvconvert \(em change LV type and other utilities
.RI [ OPTION ]...
.IR VolumeGroup / LogicalVolume
+OPTIONS:
+.br
+.BR \-b ,
+.BR \-\-background
+.br
+.BR \-\-cachepolicy
+.IR Policy
+.br
+.BR \-\-cachepool
+.IR CachePoolLogicalVolume { Name | Path }
+.br
+.BR \-\-cachesettings
+.IB Key = Value
+.br
+.BR \-c ,
+.BR \-\-chunksize
+.BR \fIChunkSize [ b | B | s | S | k | K | m | M | g | G ]
+.br
+.BR \-\-corelog
+.br
+.BR \-\-discards
+.RB { ignore | nopassdown | passdown }
+.br
+.BR \-i ,
+.BR \-\-interval
+.IR Seconds
+.br
+.BR \-\-merge
+.br
+.BR \-\-mirrorlog
+.RB { disk | core | mirrored }
+.br
+.BR \-m ,
+.BR \-\-mirrors
+.IR Number
+.br
+.BR \-n ,
+.BR \-\-name
+.IR Name
+.br
+.BR \-\-noudevsync
+.br
+.BR \-\-originname
+.IR NewExternalOriginVolumeName
+.br
+.BR \-\-poolmetadata
+.IR PoolMetadataLogicalVolume { Name | Path }
+.br
+.BR \-\-poolmetadatasize
+.BR \fIPoolMetadataSize [ b | B | s | S | k | K | m | M | g | G ]
+.br
+.BR \-\-poolmetadataspare
+.RB { y | n }
+.br
+.BR \-r ,
+.BR \-\-readahead
+.RB { \fIReadAheadSectors | auto | none }
+.br
+.BR \-R ,
+.BR \-\-regionsize
+.IR MirrorLogRegionSize
+.br
+.BR \-\-repair
+.br
+.BR \-\-replace
+.IR PhysicalVolume
+.br
+.BR \-\-splitcache
+.br
+.BR \-\-splitmirrors
+.IR Number
+.br
+.BR \-\-splitsnapshot
+.br
+.BR \-\-stripes
+.IR Number
+.br
+.BR \-I ,
+.BR \-\-stripesize
+.IR StripeSize
+.br
+.B \-\-type striped
+.br
+.B \-\-type snapshot
+.R |
+.B \-\-snapshot
+.R |
+.B \-s
+.br
+.B \-\-type mirror
+.br
+.B \-\-type raid*
+.br
+.B \-\-type thin
+.R |
+.B \-\-thin
+.R |
+.B \-T
+.br
+.B \-\-type cache
+.R |
+.B \-\-cache
+.R |
+.B \-H
+.br
+.B \-\-type thin\-pool
+.br
+.B \-\-type cache\-pool
+.br
+.BR \-\-thinpool
+.IR ThinPoolLogicalVolume { Name | Path }
+.br
+.BR \-\-trackchanges
+.br
+.BR \-\-uncache
+.br
+.BR \-Z ,
+.BR \-\-zero
+.RB { y | n }
+.br
+
+Common options:
+.br
+.BR \-A ,
+.BR \-\-alloc
+.IR AllocationPolicy
+.br
+.BR \-f ,
+.BR \-\-force
+.br
+.BR \-\-commandprofile
+.IR ProfileName
+.br
+.BR \-h ,
+.BR \-? ,
+.BR \-\-help
+.br
+.BR \-v ,
+.BR \-\-verbose
+.br
+.BR \-y ,
+.BR \-\-yes
+.br
+.BR \-\-version
+
+
+
+
.SH DESCRIPTION
lvconvert changes the LV type and includes various LV utilities.
To display the current LV type, run the command:
-.B lvs \-o name,segtype VG/LV
+.B lvs \-o name,segtype
+.IR VG / LV
To change the LV type, run the command:
.B lvconvert \-\-type
.I NewType
-.B VG/LV
+.IR VG / LV
.SS LV types
@@ -93,10 +242,10 @@ VG/StripedLV
Merge StripedLV into an LV when it is a previously split mirror.
.br
\[bu]
-See corresponding operation --splitmirrors.
+Options \-\-background, \-\-interval.
.br
\[bu]
-Also see \-\-background, \-\-interval.
+See corresponding operation --splitmirrors.
.B lvconvert \-\-type snapshot
VG/StripedLV VG/SnapshotLV
@@ -105,6 +254,9 @@ VG/StripedLV VG/SnapshotLV
Recombine StripedLV with SnapshotLV which was previously split.
.br
\[bu]
+Options \-\-chunksize, \-\-zero.
+.br
+\[bu]
See corresponding operation --splitsnapshot.
.B lvconvert \-\-type thin
@@ -114,13 +266,13 @@ VG/StripedLV
Convert StripedLV to type thin with an external origin.
.br
\[bu]
-Requires \-\-thinpool to specify the thin pool to use.
+StripedLV becomes a read\-only external origin LV with a new name.
.br
\[bu]
-StripedLV becomes a read\-only external origin LV with a new name.
+Requires \-\-thinpool to specify the thin pool to use.
.br
\[bu]
-Also see \-\-originname.
+Options \-\-originname.
.B lvconvert \-\-type cache
VG/StripedLV
@@ -132,7 +284,7 @@ Convert StripedLV to type cache.
Requires \-\-cachepool to specify the cache pool to use.
.br
\[bu]
-Also see \-\-cachepolicy, \-\-cachesettings.
+Options \-\-cachepolicy, \-\-cachesettings.
.B lvconvert \-\-type thin\-pool
VG/StripedLV
@@ -141,7 +293,12 @@ VG/StripedLV
Convert StripedLV to type thin\-pool.
.br
\[bu]
-Also see \-\-chunksize, \-\-discards, \-\-zero, \-\-poolmetadata{size}.
+The StripedLV is used for thin pool data.
+.br
+\[bu]
+Options \-\-chunksize, \-\-discards, \-\-poolmetadata{size,spare},
+.br
+ \-\-readahead, \-\-zero.
.B lvconvert \-\-type cache\-pool
VG/StripedLV
@@ -150,7 +307,7 @@ VG/StripedLV
Convert StripedLV to type cache\-pool.
.br
\[bu]
-Also see \-\-chunksize, \-\-poolmetadata{size}.
+Options \-\-chunksize, \-\-poolmetadata{size,spare}.
.B lvconvert \-\-type mirror
VG/StripedLV
@@ -160,6 +317,9 @@ Convert StripedLV to type mirror.
.br
\[bu]
Requires \-\-mirrors to specify the number of mirrors to use.
+.br
+\[bu]
+Options \-\-mirrorlog, \-\-regionsize.
.B lvconvert \-\-type raid*
VG/StripedLV
@@ -199,10 +359,10 @@ VG/RaidLV
Merge RaidLV into an LV when it is a previously split mirror.
.br
\[bu]
-See corresponding operation --splitmirrors.
+Options \-\-background, \-\-interval.
.br
\[bu]
-Also see \-\-background, \-\-interval.
+See corresponding operation --splitmirrors.
.B lvconvert \-\-repair
VG/RaidLV
@@ -218,7 +378,7 @@ VG/RaidLV
Replace specific PV(s) in a raid* LV with another PV.
.br
\[bu]
-The replacement PV can be optionally specified, see below.
+The new PV(s) to use can be optionally specified after the LV.
.br
\[bu]
Repeat to replace multiple: \-\-replace PV1 \-\-replace PV2 ...
@@ -231,6 +391,9 @@ VG/SnapshotLV
Combine RaidLV with SnapshotLV that was previously split.
.br
\[bu]
+Options \-\-chunksize, \-\-zero.
+.br
+\[bu]
See corresponding operation \-\-splitsnapshot.
.B lvconvert \-\-type thin
@@ -240,13 +403,13 @@ VG/RaidLV
Convert RaidLV to type thin with an external origin.
.br
\[bu]
-Requires \-\-thinpool to specify the thin pool to use.
+RaidLV becomes a read\-only external origin LV with a new name.
.br
\[bu]
-RaidLV becomes a read\-only external origin LV with a new name.
+Requires \-\-thinpool to specify the thin pool to use.
.br
\[bu]
-Also see \-\-originname.
+Options \-\-originname.
.B lvconvert \-\-type cache
VG/RaidLV
@@ -258,7 +421,7 @@ Convert RaidLV to type cache.
Requires \-\-cachepool to specify the cache pool to use.
.br
\[bu]
-Also see \-\-cachepolicy, \-\-cachesettings.
+Options \-\-cachepolicy, \-\-cachesettings.
.B lvconvert \-\-type thin\-pool
VG/RaidLV
@@ -267,7 +430,12 @@ VG/RaidLV
Convert RaidLV to type thin\-pool.
.br
\[bu]
-Also see \-\-chunksize, \-\-discards, \-\-zero, \-\-poolmetadata{size}.
+The RaidLV is used for thin pool data.
+.br
+\[bu]
+Options \-\-chunksize, \-\-discards, \-\-poolmetadata{size,spare},
+.br
+ \-\-readahead, \-\-zero.
.B lvconvert \-\-type cache\-pool
VG/RaidLV
@@ -276,7 +444,7 @@ VG/RaidLV
Convert RaidLV to type cache\-pool.
.br
\[bu]
-Also see \-\-chunksize, \-\-poolmetadata{size}.
+Options \-\-chunksize, \-\-poolmetadata{size,spare}.
.B lvconvert \-\-type raid*
VG/RaidLV
@@ -400,7 +568,9 @@ Convert CacheLV to type thin-pool.
The CacheLV is used for thin pool data.
.br
\[bu]
-Also see \-\-chunksize, \-\-discards, \-\-zero, \-\-poolmetadata{size}.
+Options \-\-chunksize, \-\-discards, \-\-poolmetadata{size,spare},
+.br
+ \-\-readahead, \-\-zero.
.SS Operations on ThinPoolLV with type thin\-pool:
@@ -441,7 +611,7 @@ Convert the data portion of ThinPoolLV to type cache.
Operates on the data sub LV of the thin pool LV.
.br
\[bu]
-Also see \-\-cachepolicy, \-\-cachesettings.
+Options \-\-cachepolicy, \-\-cachesettings.
.B lvconvert \-\-repair
VG/ThinPoolLV
@@ -464,7 +634,7 @@ Merge ThinLV into its origin LV.
ThinLV must have been created as a snapshot of another thin LV.
.br
\[bu]
-Also see \-\-background, \-\-interval.
+Options \-\-background, \-\-interval.
.SS Operations on SnapshotLV with type snapshot:
@@ -484,7 +654,7 @@ VG/SnapshotLV
Merge COW snapshot SnapshotLV into its origin.
.br
\[bu]
-Also see \-\-background, \-\-interval.
+Options \-\-background, \-\-interval.
.SH OPTIONS
.
@@ -568,6 +738,16 @@ Also see
.BR lvmthin (7).
.
.HP
+.BR \-H ,
+.BR \-\-cache
+.br
+Alias for
+.B \-\-type cache.
+See COMMANDS description for
+.br
+.B lvconvert \-\-type cache.
+.
+.HP
.BR \-i ,
.BR \-\-interval
.IR Seconds
@@ -763,6 +943,15 @@ for specific limits on device replacement for each raid level.
(This option only applies to \fBraid*\fP LV types.)
.
.HP
+.BR \-s ,
+.BR \-\-snapshot
+.br
+Alias for
+.B \-\-type snapshot.
+See COMMANDS description for
+.br
+.B lvconvert \-\-type snapshot.
+.HP
.BR \-\-split
.br
Separates \fISplitableLogicalVolume\fP.
@@ -827,7 +1016,8 @@ and cannot exceed the VG physical extent (PE) size.
.BR \-\-type
.IR SegmentType
.br
-Converts an LV from one segment type to another. See commmands above.
+Converts an LV from one segment type to another.
+See COMMANDS section for a description of converting between each type.
.
.HP
.BR \-\-thinpool
@@ -850,6 +1040,16 @@ changed data are resynchronized during merge. (This option only applies
to the \fBraid1\fP LV type.)
.
.HP
+.BR \-T ,
+.BR \-\-thin
+.br
+Alias for
+.B \-\-type thin.
+See COMMANDS description for
+.br
+.B lvconvert \-\-type thin.
+.
+.HP
.BR \-\-uncache
.br
Separates a cache pool from a cache LV, and removes the unused cache pool
@@ -872,26 +1072,6 @@ Also see
.BR lvmthin (7).
.
-.SS Option aliases
-
-.B \-\-type cache
-can be replaced with
-.B \-H
-or
-.B \-\-cache.
-
-.B \-\-type thin
-can be replaced with
-.B \-T
-or
-.B \-\-thin.
-
-.B \-\-type snapshot
-can be replaced with
-.B \-s
-or
-.B \-\-snapshot.
-
.SH Examples
.
Convert a linear LV to a two-way mirror LV:
@@ -980,7 +1160,7 @@ metadata:
Convert an LV to a cache LV using the specified cache pool and chunk size:
.br
-.B lvconvert \-\-cache \-\-cachepool vg/cpool1 \-c 128 vg/lvol1
+.B lvconvert \-\-type cache \-\-cachepool vg/cpool1 \-c 128 vg/lvol1
Detach and keep the cache pool from a cache LV:
.br
7 years, 9 months
master - lv_manip: extension of raid0 causes livelock
by Heinz Mauelshagen
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=df5021a2017e39...
Commit: df5021a2017e395c68d1bee012a54a1d59c63c90
Parent: 9c2757349370cb0b098fb3a3d137107543818fd7
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Wed Jul 13 15:16:23 2016 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Wed Jul 13 15:17:24 2016 +0200
lv_manip: extension of raid0 causes livelock
A livelock occurs on extension in lv_manip when adjusting the region size,
which doesn't apply to any raid0/raid0_meta LVs (these don't have a bitmap).
Fix by prohibiting the region size adjustment on any such LVs.
- resolves rhbz1354604
---
lib/metadata/lv_manip.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 5cf9618..d11b125 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -3921,14 +3921,16 @@ static int _lv_extend_layered_lv(struct alloc_handle *ah,
/*
* The MD bitmap is limited to being able to track 2^21 regions.
- * The region_size must be adjusted to meet that criteria.
+ * The region_size must be adjusted to meet that criteria
+ * unless raid0/raid0_meta, which doesn't have a bitmap.
*/
- while (seg_is_raid(seg) && (seg->region_size < (lv->size / (1 << 21)))) {
- seg->region_size *= 2;
- log_very_verbose("Adjusting RAID region_size from %uS to %uS"
- " to support large LV size",
- seg->region_size/2, seg->region_size);
- }
+ if (seg_is_raid(seg) && !seg_is_any_raid0(seg))
+ while (seg->region_size < (lv->size / (1 << 21))) {
+ seg->region_size *= 2;
+ log_very_verbose("Adjusting RAID region_size from %uS to %uS"
+ " to support large LV size",
+ seg->region_size/2, seg->region_size);
+ }
return 1;
}
7 years, 9 months
master - raid_manip: 'vgreduce --removemissing --force ...' segfaults on raid0 LV
by Heinz Mauelshagen
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9c2757349370cb...
Commit: 9c2757349370cb0b098fb3a3d137107543818fd7
Parent: c77c59f3d9a97b43cd2bd9be1c5892aea384f857
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Tue Jul 12 17:55:01 2016 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Tue Jul 12 17:55:01 2016 +0200
raid_manip: 'vgreduce --removemissing --force ...' segfaults on raid0 LV
An unconditional access to the non-existing MetaLV of a raid0 LV in
lv_raid_remove_missing() was causing the segfault.
Only call log_debug() on replacements of existing MetaLVs.
- resolves rhbz1354646
---
lib/metadata/raid_manip.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 9ac061f..2ef47b2 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -3090,8 +3090,11 @@ int lv_raid_remove_missing(struct logical_volume *lv)
(!seg->meta_areas || !seg_metalv(seg, s) || !lv_is_partial(seg_metalv(seg, s))))
continue;
- log_debug("Replacing %s and %s segments with error target",
- seg_lv(seg, s)->name, seg_metalv(seg, s)->name);
+ log_debug("Replacing %s segments with error target",
+ display_lvname(seg_lv(seg, s)));
+ if (seg->meta_areas && seg_metalv(seg, s))
+ log_debug("Replacing %s segments with error target",
+ display_lvname(seg_metalv(seg, s)));
if (!replace_lv_with_error_segment(seg_lv(seg, s))) {
log_error("Failed to replace %s's extents with error target.",
display_lvname(seg_lv(seg, s)));
7 years, 9 months