master - tests: add small test for clustered conversion of mirror
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5e83682ccf1862...
Commit: 5e83682ccf1862289ed2f3bcbe03cfa1c190e1e0
Parent: b391ae88e5ed3720a8b5a87312e0cd907a94fcc2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Feb 19 23:30:49 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Feb 19 23:34:07 2014 +0100
tests: add small test for clustered conversion of mirror
Test currently fails with make check_cluster - so uses 'should'
CLVMD[4f435880]: Feb 19 23:27:36 Send local reply
format_text/archiver.c:230 WARNING: This metadata update is NOT backed up
metadata/mirror.c:1105 Failed to initialize log device
metadata/mirror.c:1145 <backtrace>
lvconvert.c:1547 <backtrace>
lvconvert.c:3084 <backtrace>
---
test/shell/lvconvert-mirror-updown.sh | 36 +++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvconvert-mirror-updown.sh b/test/shell/lvconvert-mirror-updown.sh
new file mode 100644
index 0000000..3b30738
--- /dev/null
+++ b/test/shell/lvconvert-mirror-updown.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+# Copyright (C) 2014 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# Demonstrate problem when upconverting and cutting leg in clvmd
+
+. lib/test
+
+aux prepare_pvs 3
+
+vgcreate -s 64k $vg $(cat DEVICES)
+
+lvcreate -aey -l10 --type mirror -m1 -n $lv1 $vg "$dev1" "$dev2"
+
+# Slow down device so we are able to start next conversion in parallel
+aux delay_dev "$dev3" 0 200
+
+lvconvert -m+1 -b $vg/$lv1 "$dev3"
+
+# To fix - wait helps here....
+#lvconvert $vg/$lv1
+
+lvs -a $vg
+#
+# It fails so use 'should' and -vvvv for now
+#
+should lvconvert -vvvv -m-1 $vg/$lv1 "$dev2"
+
+vgremove -f $vg
10 years, 3 months
master - format-text: Avoid a label_scan while in a critical_section().
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b391ae88e5ed37...
Commit: b391ae88e5ed3720a8b5a87312e0cd907a94fcc2
Parent: 00ce01e52d7fe3a8512d2c5fbe155186638172fd
Author: Petr Rockai <me(a)mornfall.net>
AuthorDate: Tue Feb 18 17:52:05 2014 +0100
Committer: Petr Rockai <me(a)mornfall.net>
CommitterDate: Wed Feb 19 17:43:30 2014 +0100
format-text: Avoid a label_scan while in a critical_section().
---
lib/format_text/format-text.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 6e309a3..6cedc99 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -1912,8 +1912,19 @@ static int _create_vg_text_instance(struct format_instance *fid,
}
if (type & FMT_INSTANCE_MDAS) {
- /* Scan PVs in VG for any further MDAs */
- lvmcache_label_scan(fid->fmt->cmd, 0);
+ /*
+ * TODO in theory, this function should be never reached
+ * while in critical_section(), because lvmcache's
+ * cached_vg should be valid. However, this assumption
+ * sometimes fails (possibly due to inconsistent
+ * (precommit) metadata and/or missing devices), and
+ * calling lvmcache_label_scan inside the critical
+ * section may be fatal (i.e. deadlock).
+ */
+ if (!critical_section())
+ /* Scan PVs in VG for any further MDAs */
+ lvmcache_label_scan(fid->fmt->cmd, 0);
+
if (!(vginfo = lvmcache_vginfo_from_vgname(vg_name, vg_id)))
goto_out;
if (!lvmcache_fid_add_mdas_vg(vginfo, fid))
10 years, 3 months
master - cache-pool: Change segtype name from cache_pool to cache-pool
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=00ce01e52d7fe3...
Commit: 00ce01e52d7fe3a8512d2c5fbe155186638172fd
Parent: c71a3bcbc07c277b277201425567f7e0864f3819
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed Feb 19 09:26:03 2014 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed Feb 19 09:26:03 2014 -0600
cache-pool: Change segtype name from cache_pool to cache-pool
Thin pools use "thin-pool" for the segment type name. To be consistent,
we use "cache-pool" instead of "cache_pool".
---
lib/cache_segtype/cache.c | 2 +-
lib/metadata/lv_manip.c | 5 +++--
man/lvconvert.8.in | 6 +++---
man/lvcreate.8.in | 2 +-
man/lvm.8.in | 6 +++---
test/shell/lvcreate-cache.sh | 22 +++++++++++-----------
tools/lvconvert.c | 6 +++---
tools/toollib.c | 2 +-
8 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/lib/cache_segtype/cache.c b/lib/cache_segtype/cache.c
index 90ed40e..57c7a5c 100644
--- a/lib/cache_segtype/cache.c
+++ b/lib/cache_segtype/cache.c
@@ -418,7 +418,7 @@ int init_cache_segtypes(struct cmd_context *cmd,
}
segtype->cmd = cmd;
- segtype->name = "cache_pool";
+ segtype->name = "cache-pool";
segtype->flags = SEG_CACHE_POOL;
segtype->ops = &_cache_pool_ops;
segtype->private = NULL;
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 5d49a70..2b1cdcc 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5917,11 +5917,12 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
}
if (lp->extents > org->le_count) {
- log_error("Cache_Pool size cannot be larger than"
+ log_error("cache-pool size cannot be larger than"
" the origin");
return NULL;
}
- if (!(lp->segtype = get_segtype_from_string(vg->cmd, "cache_pool")))
+ if (!(lp->segtype = get_segtype_from_string(vg->cmd,
+ "cache-pool")))
return_0;
} else if (seg_is_thin(lp) && lp->snapshot) {
if (!(org = find_lv(vg, lp->origin))) {
diff --git a/man/lvconvert.8.in b/man/lvconvert.8.in
index 32b251c..c496d74 100644
--- a/man/lvconvert.8.in
+++ b/man/lvconvert.8.in
@@ -113,7 +113,7 @@ lvconvert \- convert a logical volume from linear to mirror or snapshot
.RB [ \-v | \-\-verbose ]
.RB [ \-\-version ]
.sp
-.B lvconvert \-\-type cache_pool
+.B lvconvert \-\-type cache-pool
.RB [ \-c | \-\-chunksize
.IR ChunkSize [ bBsSkKmMgG ]]
.RB [ \-\-cachemode
@@ -207,7 +207,7 @@ A mirror is divided into regions of this size (in MB), and the mirror log
uses this granularity to track which regions are in sync.
.TP
.B \-\-type \fISegmentType
-Used to convert a logical volume to another segment type, like cache_pool,
+Used to convert a logical volume to another segment type, like cache-pool,
cache, raid1, mirror. When converting a logical volume to a cached logical
volume, the \-\-cachepool argument is required.
.TP
@@ -481,7 +481,7 @@ For the read-only external origin use the new name "vg00/external".
Convert an existing logical volume to a cache pool logical volume using the
given pool metadata LV.
.sp
-.B lvconvert --type cache_pool vg00/my_lv_data \-\-poolmetadata vg00/my_lv_meta
+.B lvconvert --type cache-pool vg00/my_lv_data \-\-poolmetadata vg00/my_lv_meta
.B lvrename vg00/my_lv_data vg00/my_lv_cachepool
Convert an existing logical volume to a cached logical volume using the given
diff --git a/man/lvcreate.8.in b/man/lvcreate.8.in
index f03fd48..682ff3a 100644
--- a/man/lvcreate.8.in
+++ b/man/lvcreate.8.in
@@ -532,7 +532,7 @@ in vg00 that will use an existing thin pool "vg00/pool":
Create a cache pool logical volume that can later be used to cache one
logical volume.
.sp
-.B lvcreate --type cache_pool -L 1G -n my_lv_cachepool vg /dev/fast1
+.B lvcreate --type cache-pool -L 1G -n my_lv_cachepool vg /dev/fast1
If there is an existing cache pool logical volume, create the large slow
device (i.e. the origin) and link it to the supplied cache pool LV,
diff --git a/man/lvm.8.in b/man/lvm.8.in
index e5cfb82..363f6af 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -465,7 +465,7 @@ Step-1> lvcreate -L 1G -n cachepool my_vg /dev/fast_dev
Step-2> lvcreate -L 8M -n meta my_vg /dev/fast_dev
# Combine cache pool sub-LVs into a cache pool.
-Step-3> lvconvert --type cache_pool vg/cachepool --poolmetadata vg/meta
+Step-3> lvconvert --type cache-pool vg/cachepool --poolmetadata vg/meta
# Combine the cache pool and origin to create a cached LV
Step-4> lvconvert --type cache my_vg/my_lv --cachepool vg/cachepool
@@ -490,7 +490,7 @@ Step-01> lvcreate --type raid1 -L 1G -n cachepool my_vg /dev/fast[12]
Step-2> lvcreate --type raid1 -L 8M -n meta my_vg /dev/fast1 /dev/fast2
# Combine cache pool sub-LVs into a cache pool.
-Step-3> lvconvert --type cache_pool vg/cachepool --poolmetadata vg/meta
+Step-3> lvconvert --type cache-pool vg/cachepool --poolmetadata vg/meta
# Combine the cache pool and origin to create a cached LV
Step-4> lvconvert --type cache my_vg/my_lv --cachepool vg/cachepool
@@ -517,7 +517,7 @@ Step-1> lvcreate -L 1G -n cachepool my_vg /dev/fast_dev
Step-2> lvcreate -L 8M -n meta my_vg /dev/fast_dev
# Combine cache pool sub-LVs into a cache pool and specify "writethough".
-Step-3> lvconvert --type cache_pool vg/cachepool \\
+Step-3> lvconvert --type cache-pool vg/cachepool \\
--poolmetadata vg/meta --cachemode writethrough -n cachepool
# Combine the cache pool and origin to create a cached LV
diff --git a/test/shell/lvcreate-cache.sh b/test/shell/lvcreate-cache.sh
index 01e6f51..c4c0794 100644
--- a/test/shell/lvcreate-cache.sh
+++ b/test/shell/lvcreate-cache.sh
@@ -23,7 +23,7 @@ aux prepare_vg 5 80
####################
# Full CLI (the advertised form)
-lvcreate --type cache_pool -l 1 -n ${lv}_cache_pool $vg
+lvcreate --type cache-pool -l 1 -n ${lv}_cache_pool $vg
lvremove -ff $vg/${lv}_cache_pool
# Shorthand CLI (not advertised) -- not yet implemented
@@ -42,34 +42,34 @@ lvremove -ff $vg/${lv}_cache_pool
################
# Create/remove cache_pool
-lvcreate --type cache_pool -l 1 -n ${lv}_cache_pool $vg
+lvcreate --type cache-pool -l 1 -n ${lv}_cache_pool $vg
lvremove -ff $vg
# Create cache_pool, then origin with cache, then remove all
-lvcreate --type cache_pool -l 1 -n ${lv}_cache_pool $vg
+lvcreate --type cache-pool -l 1 -n ${lv}_cache_pool $vg
lvcreate --type cache -l 2 $vg/${lv}_cache_pool -n $lv1
dmsetup table ${vg}-$lv1 | grep cache # ensure it is loaded in kernel
lvremove -ff $vg
# Create cache_pool, then origin with cache, then remove cache_pool/cache
-lvcreate --type cache_pool -l 1 -n ${lv}_cache_pool $vg
+lvcreate --type cache-pool -l 1 -n ${lv}_cache_pool $vg
lvcreate --type cache -l 2 $vg/${lv}_cache_pool -n $lv1
lvremove -ff $vg/${lv}_cache_pool
lvremove -ff $vg/$lv1
# Create cache_pool, then origin with cache, then remove origin
-lvcreate --type cache_pool -l 1 -n ${lv}_cache_pool $vg
+lvcreate --type cache-pool -l 1 -n ${lv}_cache_pool $vg
lvcreate --type cache -l 2 $vg/${lv}_cache_pool -n $lv1
lvremove -ff $vg/$lv1
lvremove -ff $vg/${lv}_cache_pool
# Shorthand CLI (cache_pool exists, create origin w/ cache)
-#lvcreate --type cache_pool -l 1 -n ${lv}_cache_pool $vg
+#lvcreate --type cache-pool -l 1 -n ${lv}_cache_pool $vg
#lvcreate --cache -l 2 $vg/${lv}_cache_pool -n $lv1
#lvremove -ff $vg
# Shorthand CLI (cache_pool exists, create origin w/ cache)
-#lvcreate --type cache_pool -l 1 -n ${lv}_cache_pool $vg
+#lvcreate --type cache-pool -l 1 -n ${lv}_cache_pool $vg
#lvcreate -H -l 2 $vg/${lv}_cache_pool -n $lv1
#lvremove -ff $vg
@@ -94,22 +94,22 @@ lvremove -ff $vg
# Repeat key tests with 'writethrough' cachemode
################################################
# Create/remove cache_pool
-lvcreate --type cache_pool -l 1 -n ${lv}_cache_pool $vg --cachemode writethrough
+lvcreate --type cache-pool -l 1 -n ${lv}_cache_pool $vg --cachemode writethrough
lvremove -ff $vg
# Create cache_pool, then origin with cache, then remove all
-lvcreate --type cache_pool -l 1 -n ${lv}_cache_pool $vg
+lvcreate --type cache-pool -l 1 -n ${lv}_cache_pool $vg
lvcreate --type cache -l 2 $vg/${lv}_cache_pool -n $lv1 --cachemode writethrough
lvremove -ff $vg
# Create cache_pool, then origin with cache, then remove cache_pool/cache
-lvcreate --type cache_pool -l 1 -n ${lv}_cache_pool $vg
+lvcreate --type cache-pool -l 1 -n ${lv}_cache_pool $vg
lvcreate --type cache -l 2 $vg/${lv}_cache_pool -n $lv1 --cachemode writethrough
lvremove -ff $vg/${lv}_cache_pool
lvremove -ff $vg/$lv1
# Create cache_pool, then origin with cache, then remove origin
-lvcreate --type cache_pool -l 1 -n ${lv}_cache_pool $vg
+lvcreate --type cache-pool -l 1 -n ${lv}_cache_pool $vg
lvcreate --type cache -l 2 $vg/${lv}_cache_pool -n $lv1 --cachemode writethrough
lvremove -ff $vg/$lv1
lvremove -ff $vg/${lv}_cache_pool
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 7fc1949..814ac65 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -202,7 +202,7 @@ static int _check_conversion_type(struct cmd_context *cmd, const char *type_str)
/* FIXME: Check thin-pool and thin more thoroughly! */
if (!strcmp(type_str, "snapshot") ||
!strncmp(type_str, "raid", 4) ||
- !strcmp(type_str, "cache_pool") || !strcmp(type_str, "cache") ||
+ !strcmp(type_str, "cache-pool") || !strcmp(type_str, "cache") ||
!strcmp(type_str, "thin-pool") || !strcmp(type_str, "thin"))
return 1;
@@ -255,7 +255,7 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
return 0;
}
- if (!strcmp(type_str, "cache_pool")) {
+ if (!strcmp(type_str, "cache-pool")) {
cache_pool = 1;
if ((tmp_str = arg_str_value(cmd, cachemode_ARG, NULL))) {
if (!strcmp(tmp_str, "writeback"))
@@ -520,7 +520,7 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
}
}
- lp->segtype = get_segtype_from_string(cmd, arg_str_value(cmd, type_ARG, cache_pool ? "cache_pool" : "thin-pool"));
+ lp->segtype = get_segtype_from_string(cmd, arg_str_value(cmd, type_ARG, cache_pool ? "cache-pool" : "thin-pool"));
if (!lp->segtype)
return_0;
} else { /* Mirrors (and some RAID functions) */
diff --git a/tools/toollib.c b/tools/toollib.c
index 9662aa8..31033e6 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1662,7 +1662,7 @@ int get_pool_params(struct cmd_context *cmd,
{
int cache_pool = 0;
- if (!strcmp("cache_pool", arg_str_value(cmd, type_ARG, "none")))
+ if (!strcmp("cache-pool", arg_str_value(cmd, type_ARG, "none")))
cache_pool = 1;
if (!cache_pool && !arg_count(cmd, thinpool_ARG)) {
10 years, 3 months
master - activation: lv_activation_skip remove always same arg.
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c71a3bcbc07c27...
Commit: c71a3bcbc07c277b277201425567f7e0864f3819
Parent: 750a310a40c09cd222d52299f2d682082d6a133c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Feb 19 11:02:16 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Feb 19 11:33:39 2014 +0100
activation: lv_activation_skip remove always same arg.
Remove 'skip' argument passed into the function.
We always used '0' - as this is the only supported
option (-K) and there is no complementary option.
Also add some testing for behaviour of skipping.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 9 +++------
lib/metadata/metadata-exported.h | 2 +-
test/shell/activation-skip.sh | 32 ++++++++++++++++++++++++++++++++
tools/lvchange.c | 2 +-
tools/vgchange.c | 2 +-
6 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 5bb37d8..c081898 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Remove (always 0) skip argument from lv_activation_skip().
Create /dev/disk/by-id/lvm-pv-uuid-<PV_UUID> symlink for each PV via udev.
lvcreate computes RAID4/5/6 stripes if not given from # of allocatable PVs.
Fix merging of old snapshot into thin volume origin.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index d0ae11e..5d49a70 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5673,11 +5673,11 @@ void lv_set_activation_skip(struct logical_volume *lv, int override_default,
* of the 'skip' arg supplied instead.
*/
int lv_activation_skip(struct logical_volume *lv, activation_change_t activate,
- int override_lv_skip_flag, int skip)
+ int override_lv_skip_flag)
{
if (!(lv->status & LV_ACTIVATION_SKIP) ||
!is_change_activating(activate) || /* Do not skip deactivation */
- (override_lv_skip_flag && !skip))
+ override_lv_skip_flag)
return 0;
log_verbose("ACTIVATON_SKIP flag set for LV %s/%s, skipping activation.",
@@ -6244,11 +6244,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
lp->activate = lv_passes_auto_activation_filter(cmd, lv) ?
CHANGE_ALY : CHANGE_ALN;
- if (lv_activation_skip(lv, lp->activate, lp->activation_skip & ACTIVATION_SKIP_IGNORE, 0)) {
- log_verbose("ACTIVATION_SKIP flag set for LV %s/%s, skipping activation.",
- lv->vg->name, lv->name);
+ if (lv_activation_skip(lv, lp->activate, lp->activation_skip & ACTIVATION_SKIP_IGNORE))
lp->activate = CHANGE_AN;
- }
/*
* For thin pools - deactivate when inactive pool is requested or
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 438f5b2..3e57113 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -832,7 +832,7 @@ struct logical_volume *lv_create_single(struct volume_group *vg,
*/
void lv_set_activation_skip(struct logical_volume *lv, int override_default, int add_skip_flag);
int lv_activation_skip(struct logical_volume *lv, activation_change_t activate,
- int override_lv_skip_flag, int skip);
+ int override_lv_skip_flag);
/*
* Functions for layer manipulation
diff --git a/test/shell/activation-skip.sh b/test/shell/activation-skip.sh
new file mode 100644
index 0000000..7c80283
--- /dev/null
+++ b/test/shell/activation-skip.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+# Copyright (C) 2014 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+. lib/test
+
+# Test skip activation flag -k|--setactivationskip
+
+aux prepare_vg
+
+lvcreate -an --zero n -l 1 -n $lv1 $vg
+lvcreate -ky -K -l1 -n $lv2 $vg
+get lv_field $vg/$lv2 lv_attr | grep -- "-wi-a----k"
+
+lvchange -ay -K $vg
+check active $vg $lv1
+lvchange -an $vg
+
+lvchange -ay --setactivationskip y $vg/$lv1
+check inactive $vg $lv1
+
+get lv_field $vg/$lv1 lv_attr | grep -- "-wi------k"
+
+lvchange -ay -K $vg
+check active $vg $lv1
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 5b6da56..8ceacc5 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -215,7 +215,7 @@ static int _lvchange_activate(struct cmd_context *cmd, struct logical_volume *lv
activate = (activation_change_t) arg_uint_value(cmd, activate_ARG, CHANGE_AY);
- if (lv_activation_skip(lv, activate, arg_count(cmd, ignoreactivationskip_ARG), 0))
+ if (lv_activation_skip(lv, activate, arg_count(cmd, ignoreactivationskip_ARG)))
return 1;
if (lv_is_cow(lv) && !lv_is_virtual_origin(origin_from_cow(lv)))
diff --git a/tools/vgchange.c b/tools/vgchange.c
index cb2d84b..e7b5e59 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -120,7 +120,7 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd, struct volume_group *vg,
if ((lv->status & PVMOVE) && !is_change_activating(activate))
continue;
- if (lv_activation_skip(lv, activate, arg_count(cmd, ignoreactivationskip_ARG), 0))
+ if (lv_activation_skip(lv, activate, arg_count(cmd, ignoreactivationskip_ARG)))
continue;
if ((activate == CHANGE_AAY) &&
10 years, 3 months
master - cleanup: indent
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=750a310a40c09c...
Commit: 750a310a40c09cd222d52299f2d682082d6a133c
Parent: e6fd16f8ea5e859925268838dba9341527c91a4c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 18 21:21:06 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 18 21:22:00 2014 +0100
cleanup: indent
---
tools/vgchange.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 814238b..cb2d84b 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -597,8 +597,8 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}
- if (arg_count(cmd, activate_ARG) == 1
- && arg_count(cmd, autobackup_ARG)) {
+ if ((arg_count(cmd, activate_ARG) == 1) &&
+ arg_count(cmd, autobackup_ARG)) {
log_error("-A option not necessary with -a option");
return EINVALID_CMD_LINE;
}
10 years, 3 months
master - cleanup: use is_change_activating
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e6fd16f8ea5e85...
Commit: e6fd16f8ea5e859925268838dba9341527c91a4c
Parent: fb519c35bbfae24a26346faf2b90d2a4189e8562
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 18 20:52:17 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 18 21:21:59 2014 +0100
cleanup: use is_change_activating
Use a single inline function to detect activation/deactivation
---
lib/metadata/lv_manip.c | 7 +++----
tools/lvcreate.c | 2 +-
tools/toollib.c | 5 ++---
tools/vgchange.c | 16 ++++++----------
4 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index c2cc590..d0ae11e 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6088,10 +6088,9 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
return NULL;
}
- if (lv_is_active(lvl->lv) ||
- ((lp->activate != CHANGE_AN) && (lp->activate != CHANGE_ALN)))
- if (!update_pool_lv(lvl->lv, 1))
- return_NULL;
+ if ((lv_is_active(lvl->lv) || is_change_activating(lp->activate)) &&
+ !update_pool_lv(lvl->lv, 1))
+ return_NULL;
/* For thin snapshot we must have matching pool */
if (org && lv_is_thin_volume(org) && (!lp->pool ||
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 67ea8c6..7e61203 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -724,7 +724,7 @@ static int _read_activation_params(struct lvcreate_params *lp,
lp->activate = (activation_change_t)
arg_uint_value(cmd, activate_ARG, CHANGE_AY);
- if (lp->activate == CHANGE_AN || lp->activate == CHANGE_ALN) {
+ if (!is_change_activating(lp->activate)) {
if (lp->zero && !seg_is_thin(lp)) {
log_error("--activate n requires --zero n");
return 0;
diff --git a/tools/toollib.c b/tools/toollib.c
index 7deb3a4..9662aa8 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1404,7 +1404,7 @@ int lv_change_activate(struct cmd_context *cmd, struct logical_volume *lv,
* deactivation of origin, which is the only visible LV
*/
if (!deactivate_lv(cmd, find_snapshot(lv)->lv)) {
- if ((activate != CHANGE_AN) && (activate != CHANGE_ALN)) {
+ if (is_change_activating(activate)) {
log_error("Refusing to activate merging \"%s\" while snapshot \"%s\" is still active.",
lv->name, find_snapshot(lv)->lv->name);
return 0;
@@ -1420,8 +1420,7 @@ int lv_change_activate(struct cmd_context *cmd, struct logical_volume *lv,
return_0;
if (background_polling() &&
- (activate != CHANGE_AN) &&
- (activate != CHANGE_ALN) &&
+ is_change_activating(activate) &&
(lv->status & (PVMOVE|CONVERTING|MERGING)))
lv_spawn_background_polling(cmd, lv);
diff --git a/tools/vgchange.c b/tools/vgchange.c
index d862ec2..814238b 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -117,8 +117,7 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd, struct volume_group *vg,
/* Can't deactivate a pvmove LV */
/* FIXME There needs to be a controlled way of doing this */
- if (((activate == CHANGE_AN) || (activate == CHANGE_ALN)) &&
- ((lv->status & PVMOVE) ))
+ if ((lv->status & PVMOVE) && !is_change_activating(activate))
continue;
if (lv_activation_skip(lv, activate, arg_count(cmd, ignoreactivationskip_ARG), 0))
@@ -152,8 +151,8 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd, struct volume_group *vg,
if (expected_count)
log_verbose("%s %d logical volumes in volume group %s",
- (activate == CHANGE_AN || activate == CHANGE_ALN)?
- "Deactivated" : "Activated", count, vg->name);
+ is_change_activating(activate) ?
+ "Activated" : "Deactivated", count, vg->name);
return (expected_count != count) ? 0 : 1;
}
@@ -193,12 +192,10 @@ static int _vgchange_background_polling(struct cmd_context *cmd, struct volume_g
int vgchange_activate(struct cmd_context *cmd, struct volume_group *vg,
activation_change_t activate)
{
- int lv_open, active, monitored = 0, r = 1, do_activate = 1;
+ int lv_open, active, monitored = 0, r = 1;
const struct lv_list *lvl;
struct lvinfo info;
-
- if ((activate == CHANGE_AN) || (activate == CHANGE_ALN))
- do_activate = 0;
+ int do_activate = is_change_activating(activate);
/*
* Safe, since we never write out new metadata here. Required for
@@ -589,8 +586,7 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
if (arg_count(cmd, activate_ARG) &&
(arg_count(cmd, monitor_ARG) || arg_count(cmd, poll_ARG))) {
- int activate = arg_uint_value(cmd, activate_ARG, 0);
- if (activate == CHANGE_AN || activate == CHANGE_ALN) {
+ if (!is_change_activating(arg_uint_value(cmd, activate_ARG, 0))) {
log_error("Only -ay* allowed with --monitor or --poll.");
return EINVALID_CMD_LINE;
}
10 years, 3 months
master - cleanup: move verbose message to lv_activation_skip
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fb519c35bbfae2...
Commit: fb519c35bbfae24a26346faf2b90d2a4189e8562
Parent: fdcd95a3b3dd92ed219571467fdc235e1a6cb0b6
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 18 20:49:32 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 18 20:49:32 2014 +0100
cleanup: move verbose message to lv_activation_skip
Simplify code and put verbose message into a single place.
---
lib/metadata/lv_manip.c | 12 ++++++------
tools/lvchange.c | 5 +----
tools/vgchange.c | 5 +----
3 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 6b4c9a8..c2cc590 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5675,14 +5675,14 @@ void lv_set_activation_skip(struct logical_volume *lv, int override_default,
int lv_activation_skip(struct logical_volume *lv, activation_change_t activate,
int override_lv_skip_flag, int skip)
{
- /* Do not skip deactivation! */
- if ((activate == CHANGE_AN) || (activate == CHANGE_ALN))
+ if (!(lv->status & LV_ACTIVATION_SKIP) ||
+ !is_change_activating(activate) || /* Do not skip deactivation */
+ (override_lv_skip_flag && !skip))
return 0;
- if (override_lv_skip_flag)
- return skip;
-
- return (lv->status & LV_ACTIVATION_SKIP) ? 1 : 0;
+ log_verbose("ACTIVATON_SKIP flag set for LV %s/%s, skipping activation.",
+ lv->vg->name, lv->name);
+ return 1;
}
/* Greatest common divisor */
diff --git a/tools/lvchange.c b/tools/lvchange.c
index a0e350f..5b6da56 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -215,11 +215,8 @@ static int _lvchange_activate(struct cmd_context *cmd, struct logical_volume *lv
activate = (activation_change_t) arg_uint_value(cmd, activate_ARG, CHANGE_AY);
- if (lv_activation_skip(lv, activate, arg_count(cmd, ignoreactivationskip_ARG), 0)) {
- log_verbose("ACTIVATON_SKIP flag set for LV %s/%s, skipping activation.",
- lv->vg->name, lv->name);
+ if (lv_activation_skip(lv, activate, arg_count(cmd, ignoreactivationskip_ARG), 0))
return 1;
- }
if (lv_is_cow(lv) && !lv_is_virtual_origin(origin_from_cow(lv)))
lv = origin_from_cow(lv);
diff --git a/tools/vgchange.c b/tools/vgchange.c
index af4b002..d862ec2 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -121,11 +121,8 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd, struct volume_group *vg,
((lv->status & PVMOVE) ))
continue;
- if (lv_activation_skip(lv, activate, arg_count(cmd, ignoreactivationskip_ARG), 0)) {
- log_verbose("ACTIVATION_SKIP flag set for LV %s/%s, skipping activation.",
- lv->vg->name, lv->name);
+ if (lv_activation_skip(lv, activate, arg_count(cmd, ignoreactivationskip_ARG), 0))
continue;
- }
if ((activate == CHANGE_AAY) &&
!lv_passes_auto_activation_filter(cmd, lv))
10 years, 3 months
master - tests: check locking is not lost during thin_check
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fdcd95a3b3dd92...
Commit: fdcd95a3b3dd92ed219571467fdc235e1a6cb0b6
Parent: 417e52c13a8156b11c25c411d44bda8b32bf87e4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 18 14:58:41 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 18 14:58:41 2014 +0100
tests: check locking is not lost during thin_check
---
test/shell/thin-vglock.sh | 51 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/test/shell/thin-vglock.sh b/test/shell/thin-vglock.sh
new file mode 100644
index 0000000..083fcd8
--- /dev/null
+++ b/test/shell/thin-vglock.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+# Copyright (C) 2014 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# Test locking works and doesn't update metadata
+# RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1063542
+
+. lib/test
+
+MKFS=mkfs.ext2
+which $MKFS || skip
+
+aux have_thin 1 0 0 || skip
+aux prepare_vg
+
+lvcreate -L10 -T -V5 -n $lv1 $vg/pool
+lvcreate -an -V10 -T $vg/pool
+
+$MKFS "$DM_DEV_DIR/$vg/$lv1"
+mkdir mnt
+mount "$DM_DEV_DIR/$vg/$lv1" mnt
+
+lvcreate -s -n snap $vg/$lv1
+check lv_field $vg/snap thin_id "3"
+
+lvconvert --merge $vg/snap
+
+umount mnt
+vgchange -an $vg
+
+# Check reboot case
+vgchange -ay --sysinit $vg
+# Metadata are still not updated (--poll n)
+check lv_field $vg/$lv1 thin_id "1"
+check lv_field $vg/pool transaction_id "3"
+
+# Check the metadata are updated after refresh
+vgchange --refresh $vg
+check lv_field $vg/$lv1 thin_id "3"
+check lv_field $vg/pool transaction_id "4"
+
+#lvs -a -o+transaction_id,thin_id $vg
+
+vgremove -f $vg
10 years, 3 months
master - udev: create /dev/disk/by-id/lvm-pv-uuid-<PV_UUID> symlink for a PV
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=417e52c13a8156...
Commit: 417e52c13a8156b11c25c411d44bda8b32bf87e4
Parent: 0e0f91b6ddcdd338bcd528b3f44eb3f019704fb3
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Feb 18 11:27:21 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Feb 18 11:37:20 2014 +0100
udev: create /dev/disk/by-id/lvm-pv-uuid-<PV_UUID> symlink for a PV
We already have /dev/disk/by-id/dm-uuid-... (which encompasses the
VG UUID and LV UUID in case of LVs since the mapping's UUID is
VG+LV UUID together) and /dev/disk/by-id/dm-name-... (which encompasses
the VG and LV name in case of LVs).
This patch addds /dev/disk/by-id/lvm-pv-uuid-<PV_UUID> that completes
this scheme and makes navigation a bit easier using PV UUIDs since
one can navigate using PV UUIDs only and there's no need to do extra
PV UUID <--> kernel name matching (the PV UUID is stable across reboots).
This may come in handy in various scripts.
Since we already have the PV UUID stored in udev database (as a result
of blkid call - returned in ID_FS_UUID blkid's variable), this operation
is very cheap indeed, just creating the extra one symlink.
---
WHATS_NEW | 1 +
udev/69-dm-lvm-metad.rules.in | 3 +++
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 39e8b88..5bb37d8 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Create /dev/disk/by-id/lvm-pv-uuid-<PV_UUID> symlink for each PV via udev.
lvcreate computes RAID4/5/6 stripes if not given from # of allocatable PVs.
Fix merging of old snapshot into thin volume origin.
Use --ignoreskippedcluster in lvm2-monitor initscript/systemd unit.
diff --git a/udev/69-dm-lvm-metad.rules.in b/udev/69-dm-lvm-metad.rules.in
index e8304b5..bd75fc8 100644
--- a/udev/69-dm-lvm-metad.rules.in
+++ b/udev/69-dm-lvm-metad.rules.in
@@ -34,6 +34,9 @@ ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="lvm_end"
# Inform lvmetad about any PV that is gone.
ACTION=="remove", GOTO="lvm_scan"
+# Create /dev/disk/by-id/lvm-pv-uuid-<PV_UUID> symlink for each PV
+ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-id/lvm-pv-uuid-$env{ID_FS_UUID_ENC}"
+
# If the PV is a special device listed below, scan only if the device is
# properly activated. These devices are not usable after an ADD event,
# but they require an extra setup and they are ready after a CHANGE event.
10 years, 3 months
master - tests: use exclusive activation for mirror case
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0e0f91b6ddcdd3...
Commit: 0e0f91b6ddcdd338bcd528b3f44eb3f019704fb3
Parent: b1e8284f339cb412b83f730783ee8a06feac9341
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 18 10:36:53 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 18 10:39:29 2014 +0100
tests: use exclusive activation for mirror case
Since mirror doesn't take exclusive lock implicitely yet,
enforce it for cluster testing.
---
test/shell/lvchange-partial.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvchange-partial.sh b/test/shell/lvchange-partial.sh
index 4e508a9..b79004d 100644
--- a/test/shell/lvchange-partial.sh
+++ b/test/shell/lvchange-partial.sh
@@ -17,7 +17,7 @@ aux prepare_vg 4
TYPE=raid1
aux target_at_least dm-raid 1 1 0 || TYPE=mirror
-lvcreate --type $TYPE -m 1 -l 2 -n $lv1 $vg
+lvcreate -aey --type $TYPE -m 1 -l 2 -n $lv1 $vg
lvchange -an $vg/$lv1
aux disable_dev "$dev1"
10 years, 3 months