master - thin: fix resize of stacked thin pool volume
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4c001a78544d29...
Commit: 4c001a78544d29688f6609b1ceafe123af280323
Parent: fe6b19a6a3deb707243a5728842fff17e52258e0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Sep 6 10:54:50 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Sep 7 03:24:48 2013 +0200
thin: fix resize of stacked thin pool volume
When the pool is created from non-linear target the more complex rules
have to be used and stacking needs to properly decode args for _tdata
LV. Also proper allocation policies are being used according to those
set in lvm2 metadata for data and metadata LVs.
Also properly check for active pool and extra code to active it
temporarily.
With this fix it's now possible to use:
lvcreate -L20 -m2 -n pool vg --alloc anywhere
lvcreate -L10 -m2 -n poolm vg --alloc anywhere
lvconvert --thinpool vg/pool --poolmetadata vg/poolm
lvresize -L+10 vg/pool
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 160 +++++++++++++++++++++++++-------------
lib/metadata/metadata-exported.h | 1 +
3 files changed, 107 insertions(+), 55 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 212f4bb..11f31aa 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.101 -
===================================
+ Fix lvresize for stacked thin pool volumes (i.e. mirrors).
Write Completed debug message before reinstating log defaults after command.
Skip pvmove of RAID, thin, snapshot, origin, or mirror LVs in a cluster.
Refresh existing VG before autoactivation (event retrigger/device reappeared).
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 9728310..1cccd8c 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -2963,11 +2963,12 @@ int lv_extend(struct logical_volume *lv,
return_0;
if (segtype_is_thin_pool(segtype)) {
- if (!lv->le_count) {
- if (!(r = create_pool(lv, segtype, ah, stripes, stripe_size)))
- stack;
- } else if (!(r = _lv_extend_layered_lv(ah, lv, extents, 0,
- stripes, stripe_size)))
+ if (lv->le_count) {
+ /* lv_resize abstracts properly _tdata */
+ log_error(INTERNAL_ERROR "Cannot lv_extend() the existing thin pool segment.");
+ return 0;
+ }
+ if (!(r = create_pool(lv, segtype, ah, stripes, stripe_size)))
stack;
} else if (!segtype_is_mirrored(segtype) && !segtype_is_raid(segtype)) {
if (!(r = lv_add_segment(ah, 0, ah->area_count, lv, segtype,
@@ -3499,16 +3500,15 @@ static uint32_t lvseg_get_stripes(struct lv_segment *seg, uint32_t *stripesize)
return 0;
}
-static int _lvresize_poolmetadata(struct cmd_context *cmd, struct volume_group *vg,
- struct lvresize_params *lp,
- const struct logical_volume *pool_lv,
- struct dm_list *pvh,
- alloc_policy_t alloc)
+static int _lvresize_poolmetadata_prepare(struct cmd_context *cmd,
+ struct lvresize_params *lp,
+ const struct logical_volume *pool_lv)
{
- struct logical_volume *lv;
- struct lv_segment *mseg;
uint32_t extents;
- uint32_t seg_mirrors;
+ struct logical_volume *lv = first_seg(pool_lv)->metadata_lv;
+ struct volume_group *vg = pool_lv->vg;
+
+ lp->poolmetadataextents = 0;
if (!pool_can_resize_metadata(pool_lv)) {
log_error("Support for online metadata resize not detected.");
@@ -3526,7 +3526,6 @@ static int _lvresize_poolmetadata(struct cmd_context *cmd, struct volume_group *
vg->extent_size)))
return_0;
- lv = first_seg(pool_lv)->metadata_lv;
if (lp->poolmetadatasign == SIGN_PLUS) {
if (extents >= (MAX_EXTENT_COUNT - lv->le_count)) {
log_error("Unable to extend %s by %u extents, exceeds limit (%u).",
@@ -3550,21 +3549,35 @@ static int _lvresize_poolmetadata(struct cmd_context *cmd, struct volume_group *
return 2;
}
- if (!lp->sizeargs && !archive(vg))
+ lp->poolmetadataextents = extents;
+
+ return 1;
+}
+
+static int _lvresize_poolmetadata(struct cmd_context *cmd, struct volume_group *vg,
+ struct lvresize_params *lp,
+ const struct logical_volume *pool_lv,
+ struct dm_list *pvh)
+{
+ struct logical_volume *lv = first_seg(pool_lv)->metadata_lv;
+ alloc_policy_t alloc = lp->ac_alloc ?: lv->alloc;
+ struct lv_segment *mseg = last_seg(lv);
+ uint32_t seg_mirrors = lv_mirror_count(lv);
+
+ if (!archive(vg))
return_0;
log_print_unless_silent("Extending logical volume %s to %s.",
lv->name,
- display_size(cmd, (uint64_t) extents * vg->extent_size));
- mseg = last_seg(lv);
- seg_mirrors = lv_mirror_count(lv);
+ display_size(cmd, (uint64_t) lp->poolmetadataextents *
+ vg->extent_size));
if (!lv_extend(lv,
mseg->segtype,
mseg->area_count / seg_mirrors,
mseg->stripe_size,
seg_mirrors,
mseg->region_size,
- extents - lv->le_count, NULL,
+ lp->poolmetadataextents - lv->le_count, NULL,
pvh, alloc))
return_0;
@@ -3774,6 +3787,10 @@ static int _lvresize_adjust_extents(struct cmd_context *cmd, struct logical_volu
seg_size = lp->extents - lv->le_count;
+ if (lv_is_thin_pool(lv))
+ /* Now prepare args like we would be resizing _tdata layer */
+ lv = seg_lv(first_seg(lv), 0);
+
/* Use segment type of last segment */
lp->segtype = last_seg(lv)->segtype;
@@ -3993,19 +4010,26 @@ static int _lvresize_check_type(struct cmd_context *cmd, const struct logical_vo
static struct logical_volume *_lvresize_volume(struct cmd_context *cmd,
struct logical_volume *lv,
- struct lvresize_params *lp, struct dm_list *pvh,
- alloc_policy_t alloc)
+ struct lvresize_params *lp,
+ struct dm_list *pvh)
{
struct volume_group *vg = lv->vg;
struct logical_volume *lock_lv = NULL;
+ struct lv_segment *seg;
int status;
+ alloc_policy_t alloc;
if (lv_is_thin_pool(lv)) {
if (lp->resizefs) {
log_warn("Thin pool volumes do not have filesystem.");
lp->resizefs = 0;
}
+ lock_lv = lv;
+ seg = first_seg(lv);
+ /* Switch to layered LV resizing */
+ lv = seg_lv(seg, 0);
}
+ alloc = lp->ac_alloc ?: lv->alloc;
if ((lp->resize == LV_REDUCE) && lp->argc)
log_warn("Ignoring PVs on command line when reducing");
@@ -4043,7 +4067,7 @@ static struct logical_volume *_lvresize_volume(struct cmd_context *cmd,
if (lp->resize == LV_REDUCE) {
if (!lv_reduce(lv, lv->le_count - lp->extents))
- return NULL;
+ return_NULL;
} else if ((lp->extents > lv->le_count) && /* Ensure we extend */
!lv_extend(lv, lp->segtype,
lp->stripes, lp->stripe_size,
@@ -4052,8 +4076,14 @@ static struct logical_volume *_lvresize_volume(struct cmd_context *cmd,
pvh, alloc))
return_NULL;
+ if (lock_lv) {
+ /* Update thin pool segment from the layered LV */
+ seg->area_len = lv->le_count;
+ seg->len = lv->le_count;
+ lock_lv->le_count = lv->le_count;
+ lock_lv->size = lv->size;
/* If thin metadata, must suspend thin pool */
- if (lv_is_thin_pool_metadata(lv)) {
+ } else if (lv_is_thin_pool_metadata(lv)) {
if (!(lock_lv = find_pool_lv(lv)))
return_NULL;
/* If snapshot, must suspend all associated devices */
@@ -4089,6 +4119,10 @@ int lv_resize_prepare(struct cmd_context *cmd, struct logical_volume *lv,
if (lp->sizeargs && !_lvresize_check_type(cmd, lv, lp))
return_0;
+ if (lp->poolmetadatasize &&
+ !_lvresize_poolmetadata_prepare(cmd, lp, lv))
+ return_0;
+
return 1;
}
@@ -4098,68 +4132,76 @@ int lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
{
struct volume_group *vg = lv->vg;
struct logical_volume *lock_lv = NULL;
- alloc_policy_t alloc;
- int r;
+ int inactive = 0;
- /* FIXME Could pool metadata have different policy? */
- alloc = lp->ac_alloc ?: lv->alloc;
-
- if (lp->sizeargs) {
- if (!(lock_lv = _lvresize_volume(cmd, lv, lp, pvh, alloc)))
- return_0;
- }
+ if (lp->sizeargs &&
+ !(lock_lv = _lvresize_volume(cmd, lv, lp, pvh)))
+ return_0;
- if (lp->poolmetadatasize) {
- /* FIXME Pull validation / calculcations out of this function and do earlier */
- if (!(r = _lvresize_poolmetadata(cmd, vg, lp, lv, pvh, alloc)))
+ if (lp->poolmetadataextents) {
+ if (!_lvresize_poolmetadata(cmd, vg, lp, lv, pvh))
return_0;
- else if (r == 1) /* Metadata needs writing out */
- lock_lv = lv;
+ lock_lv = lv;
}
if (!lock_lv)
return 1; /* Nothing to do */
+ if (lv_is_thin_pool(lock_lv) &&
+ pool_is_active(lock_lv) &&
+ !lv_is_active(lock_lv)) {
+ /*
+ * Active 'hidden' -tpool can be waiting for resize, but the
+ * pool LV itself might be inactive.
+ * Here plain suspend/resume would not work.
+ * So active temporarily pool LV (with on disk metadata)
+ * then use suspend and resume and deactivate pool LV,
+ * instead of searching for an active thin volume.
+ */
+ inactive = 1;
+ if (!activate_lv_excl(cmd, lock_lv)) {
+ log_error("Failed to activate %s.", lock_lv->name);
+ return 0;
+ }
+ }
+
/* store vg on disk(s) */
if (!vg_write(vg))
- return_0;
+ goto_out;
if (!suspend_lv(cmd, lock_lv)) {
log_error("Failed to suspend %s", lock_lv->name);
vg_revert(vg);
- backup(vg);
- return 0;
+ goto bad;
}
if (!vg_commit(vg)) {
stack;
if (!resume_lv(cmd, lock_lv))
stack;
- backup(vg);
- return 0;
+ goto bad;
}
if (!resume_lv(cmd, lock_lv)) {
log_error("Problem reactivating %s", lock_lv->name);
- backup(vg);
- return 0;
+ goto bad;
}
if (lv_is_cow_covering_origin(lv))
if (!monitor_dev_for_events(cmd, lv, 0, 0))
stack;
- /*
- * Update lvm pool metadata (drop messages) if the pool has been
- * resumed and do a pool active/deactivate in other case.
- *
- * Note: Active thin pool can be waiting for resize.
- *
- * FIXME: Activate only when thin volume is active
- */
- if (lv_is_thin_pool(lv) &&
- !update_pool_lv(lv, !lv_is_active(lv)))
- return_0;
+ if (lv_is_thin_pool(lock_lv)) {
+ /* Update lvm pool metadata (drop messages). */
+ if (!update_pool_lv(lock_lv, 0))
+ goto_bad;
+
+ if (inactive && !deactivate_lv(cmd, lock_lv)) {
+ log_error("Problem deactivating %s.", lock_lv->name);
+ backup(vg);
+ return 0;
+ }
+ }
backup(vg);
@@ -4170,6 +4212,14 @@ int lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
return_0;
return 1;
+
+bad:
+ backup(vg);
+out:
+ if (inactive && !deactivate_lv(cmd, lock_lv))
+ log_error("Problem deactivating %s.", lock_lv->name);
+
+ return 0;
}
char *generate_lv_name(struct volume_group *vg, const char *format,
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 0df710c..f20dfd0 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -455,6 +455,7 @@ struct lvresize_params {
sign_t sign;
uint64_t poolmetadatasize;
sign_t poolmetadatasign;
+ uint32_t poolmetadataextents;
percent_type_t percent;
enum {
10 years, 7 months
master - test: Add the 64b fc17 kernel to the mirror recovery blacklist.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fe6b19a6a3deb7...
Commit: fe6b19a6a3deb707243a5728842fff17e52258e0
Parent: 10a5838a600bbadfe9e20f686f86ffcd9d0c473e
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Fri Sep 6 16:35:49 2013 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Fri Sep 6 16:50:05 2013 +0200
test: Add the 64b fc17 kernel to the mirror recovery blacklist.
---
test/lib/aux.sh | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 286fb96..5ff0b0c 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -606,6 +606,7 @@ api() {
skip_if_mirror_recovery_broken() {
if test `uname -r` = 3.3.4-5.fc17.i686; then skip; fi
+ if test `uname -r` = 3.3.4-5.fc17.x86_64; then skip; fi
}
udev_wait() {
10 years, 7 months
master - toollib: tweak background forking
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=10a5838a600bba...
Commit: 10a5838a600bbadfe9e20f686f86ffcd9d0c473e
Parent: 96880102a3b792cadbfc97e44c09c5714a96ca9e
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Sep 6 01:49:43 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Sep 6 01:49:43 2013 +0100
toollib: tweak background forking
Log what is forked and replace #if 1 with DEBUG_CHILD.
---
tools/toollib.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index 50c43d9..5868ac0 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -44,7 +44,7 @@ int become_daemon(struct cmd_context *cmd, int skip_lvm)
.sa_flags = SA_NOCLDSTOP,
};
- log_verbose("Forking background process");
+ log_verbose("Forking background process: %s", cmd->cmd_line);
sigaction(SIGCHLD, &act, NULL);
@@ -65,8 +65,10 @@ int become_daemon(struct cmd_context *cmd, int skip_lvm)
log_error("Background process failed to setsid: %s",
strerror(errno));
- /* For poll debugging it's best to disable for compilation */
-#if 1
+/* Set this to avoid discarding output from background process */
+/* #define DEBUG_CHILD /* */
+
+#ifndef DEBUG_CHILD
if ((null_fd = open(devnull, O_RDWR)) == -1) {
log_sys_error("open", devnull);
_exit(ECMD_FAILED);
@@ -84,7 +86,8 @@ int become_daemon(struct cmd_context *cmd, int skip_lvm)
(void) close(null_fd);
init_verbose(VERBOSE_BASE_LEVEL);
-#endif
+#endif /* DEBUG_CHILD */
+
strncpy(*cmd->argv, "(lvm2)", strlen(*cmd->argv));
if (!skip_lvm) {
10 years, 7 months
master - logging: Write Completed message before resetting.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=96880102a3b792...
Commit: 96880102a3b792cadbfc97e44c09c5714a96ca9e
Parent: 5face2010dfb4e9fef43b867b4736a90abe51c00
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Sep 6 01:47:41 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Sep 6 01:47:41 2013 +0100
logging: Write Completed message before resetting.
---
WHATS_NEW | 1 +
tools/lvmcmdline.c | 7 +++----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index abfe0e1..212f4bb 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.101 -
===================================
+ Write Completed debug message before reinstating log defaults after command.
Skip pvmove of RAID, thin, snapshot, origin, or mirror LVs in a cluster.
Refresh existing VG before autoactivation (event retrigger/device reappeared).
Use pvscan -b in udev rules to avoid a deadlock on udev process count limit.
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index c7917ea..116e963 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1190,15 +1190,14 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
stack;
}
- /* FIXME Move this? */
- cmd->current_settings = cmd->default_settings;
- _apply_settings(cmd);
-
if (ret == EINVALID_CMD_LINE && !_cmdline.interactive)
_short_usage(cmd->command->name);
log_debug("Completed: %s", cmd->cmd_line);
+ cmd->current_settings = cmd->default_settings;
+ _apply_settings(cmd);
+
/*
* free off any memory the command used.
*/
10 years, 7 months
master - tools: Use backgroundfork_ARG for pvscan -b
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5face2010dfb4e...
Commit: 5face2010dfb4e9fef43b867b4736a90abe51c00
Parent: 374653f2b55fe06431e4db4ef8e3d4340cdab29b
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Sep 6 01:43:24 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Sep 6 01:43:24 2013 +0100
tools: Use backgroundfork_ARG for pvscan -b
Change pvscan -b to use a new backgroundfork_ARG instead of
background_ARG so as not to affect pvmove -b and lvconvert -b.
---
tools/args.h | 1 +
tools/commands.h | 2 +-
tools/lvmcmdline.c | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/args.h b/tools/args.h
index 4b89ebd..c5e4d14 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -114,6 +114,7 @@ arg(all_ARG, 'a', "all", NULL, 0)
arg(autobackup_ARG, 'A', "autobackup", yes_no_arg, 0)
arg(activevolumegroups_ARG, 'A', "activevolumegroups", NULL, 0)
arg(background_ARG, 'b', "background", NULL, 0)
+arg(backgroundfork_ARG, 'b', "background", NULL, 0)
arg(blockdevice_ARG, 'b', "blockdevice", NULL, 0)
arg(chunksize_ARG, 'c', "chunksize", size_kb_arg, 0)
arg(clustered_ARG, 'c', "clustered", yes_no_arg, 0)
diff --git a/tools/commands.h b/tools/commands.h
index ef7848d..a8623bf 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -736,7 +736,7 @@ xx(pvscan,
"\t[-v|--verbose] " "\n"
"\t[--version]\n",
- activate_ARG, available_ARG, background_ARG, cache_ARG,
+ activate_ARG, available_ARG, backgroundfork_ARG, cache_ARG,
exported_ARG, ignorelockingfailure_ARG, major_ARG, minor_ARG,
novolumegroup_ARG, partial_ARG, short_ARG, uuid_ARG)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index dc5d592..c7917ea 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1097,7 +1097,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
set_cmd_name(cmd->command->name);
- if (arg_count(cmd, background_ARG)) {
+ if (arg_count(cmd, backgroundfork_ARG)) {
if (!become_daemon(cmd, 1)) {
/* parent - quit immediately */
ret = ECMD_PROCESSED;
10 years, 7 months
master - test: Include tests that timed out in the final summary.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=374653f2b55fe0...
Commit: 374653f2b55fe06431e4db4ef8e3d4340cdab29b
Parent: cc66dedc0ebe9a7f7718d6340ccd6247d1a471e1
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Wed Sep 4 16:20:35 2013 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Wed Sep 4 16:21:08 2013 +0200
test: Include tests that timed out in the final summary.
---
test/lib/harness.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/test/lib/harness.c b/test/lib/harness.c
index 52fa62f..53814dc 100644
--- a/test/lib/harness.c
+++ b/test/lib/harness.c
@@ -520,6 +520,9 @@ int main(int argc, char **argv) {
case INTERRUPTED:
printf("interrupted: %s\n", argv[i]);
break;
+ case TIMEOUT:
+ printf("timeout: %s\n", argv[i]);
+ break;
default: /* do nothing */ ;
}
}
10 years, 7 months
master - pvmove: Skip pvmove of RAID, thin, snapshot, origin, and mirror LVs in cluster
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cc66dedc0ebe9a...
Commit: cc66dedc0ebe9a7f7718d6340ccd6247d1a471e1
Parent: 7918217c754555fc685851e7d80f86a8f6c8abcb
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Tue Sep 3 13:17:01 2013 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Tue Sep 3 13:17:01 2013 -0500
pvmove: Skip pvmove of RAID, thin, snapshot, origin, and mirror LVs in cluster
pvmove of the above types should only have been enabled in single machine
mode.
---
WHATS_NEW | 1 +
tools/pvmove.c | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 8134714..abfe0e1 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.101 -
===================================
+ Skip pvmove of RAID, thin, snapshot, origin, or mirror LVs in a cluster.
Refresh existing VG before autoactivation (event retrigger/device reappeared).
Use pvscan -b in udev rules to avoid a deadlock on udev process count limit.
Add pvscan -b/--background for the command to be processed in the background.
diff --git a/tools/pvmove.c b/tools/pvmove.c
index 1007370..ab2e03b 100644
--- a/tools/pvmove.c
+++ b/tools/pvmove.c
@@ -292,6 +292,14 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
if (lv_name && strcmp(lv->name, lv_name))
continue;
+ /*
+ * RAID, thin, mirror, and snapshot-related LVs are not
+ * processed in a cluster, so we don't have to worry about
+ * avoiding certain PVs in that context.
+ */
+ if (vg_is_clustered(lv->vg))
+ continue;
+
if (!lv_is_on_pvs(lv, source_pvl))
continue;
@@ -334,6 +342,36 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
if (!lv_is_on_pvs(lv, source_pvl))
continue;
+ /*
+ * If the VG is clustered, we are unable to handle
+ * snapshots, origins, thin types, RAID or mirror
+ */
+ if (vg_is_clustered(vg) &&
+ (lv_is_origin(lv) || lv_is_cow(lv) ||
+ lv_is_thin_type(lv) || lv_is_raid_type(lv) ||
+ lv_is_mirrored(lv))) {
+ log_print_unless_silent("Skipping %s LV %s",
+ lv_is_origin(lv) ? "origin" :
+ lv_is_cow(lv) ?
+ "snapshot-related" :
+ lv_is_thin_volume(lv) ? "thin" :
+ lv_is_thin_pool(lv) ?
+ "thin-pool" :
+ lv_is_thin_type(lv) ?
+ "thin-related" :
+ seg_is_raid(first_seg(lv)) ?
+ "RAID" :
+ lv_is_raid_type(lv) ?
+ "RAID-related" :
+ lv_is_mirrored(lv) ?
+ "mirror" :
+ lv_is_mirror_type(lv) ?
+ "mirror-related" : "",
+ lv->name);
+ lv_skipped = 1;
+ continue;
+ }
+
seg = first_seg(lv);
if (seg_is_raid(seg) || seg_is_mirrored(seg) ||
lv_is_thin_volume(lv) || lv_is_thin_pool(lv)) {
10 years, 7 months
master - test: Fix a spurious failure in skip_if_mirror_recovery_broken.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7918217c754555...
Commit: 7918217c754555fc685851e7d80f86a8f6c8abcb
Parent: 848e8026d68e53dae078ed99fb5f3a47db3def2a
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Tue Sep 3 20:05:22 2013 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Tue Sep 3 20:06:24 2013 +0200
test: Fix a spurious failure in skip_if_mirror_recovery_broken.
---
test/lib/aux.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index bca709a..286fb96 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -605,7 +605,7 @@ api() {
}
skip_if_mirror_recovery_broken() {
- test `uname -r` = 3.3.4-5.fc17.i686 && skip
+ if test `uname -r` = 3.3.4-5.fc17.i686; then skip; fi
}
udev_wait() {
10 years, 7 months
master - TEST: pvmove-all-segtypes.sh should not be run in a cluster
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=848e8026d68e53...
Commit: 848e8026d68e53dae078ed99fb5f3a47db3def2a
Parent: 3b51f298bb505e5184b715032872e5cd1ce2d544
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Tue Sep 3 10:51:21 2013 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Tue Sep 3 10:54:42 2013 -0500
TEST: pvmove-all-segtypes.sh should not be run in a cluster
---
test/shell/pvmove-all-segtypes.sh | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/test/shell/pvmove-all-segtypes.sh b/test/shell/pvmove-all-segtypes.sh
index 13b8fba..8ea9d39 100644
--- a/test/shell/pvmove-all-segtypes.sh
+++ b/test/shell/pvmove-all-segtypes.sh
@@ -15,6 +15,7 @@ test_description="ensure pvmove works with all segment types"
which mkfs.ext2 || skip
which md5sum || skip
+test -e LOCAL_CLVMD && skip
# ---------------------------------------------------------------------
# Utilities
10 years, 7 months
master - reinstate: commit 82d83a01ce2cac77fec2e9b763061fbfb5f01ce8
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3b51f298bb505e...
Commit: 3b51f298bb505e5184b715032872e5cd1ce2d544
Parent: 008c33a21ba0e0fb27319b63c7bad8fb8136f804
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Sep 3 16:45:18 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Sep 3 16:49:21 2013 +0200
reinstate: commit 82d83a01ce2cac77fec2e9b763061fbfb5f01ce8
It now works as supposed. The source of the problem is fixed
by previous commit d2d6a9da52e04f28e1916bcea3f9fda356b6df29.
---
WHATS_NEW | 1 +
tools/pvscan.c | 20 +++++++++++++-------
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index c87bce1..8134714 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.101 -
===================================
+ Refresh existing VG before autoactivation (event retrigger/device reappeared).
Use pvscan -b in udev rules to avoid a deadlock on udev process count limit.
Add pvscan -b/--background for the command to be processed in the background.
Don't assume stdin file descriptor is readable.
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 96bbf6b..3f16b05 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -98,6 +98,7 @@ static int _auto_activation_handler(struct cmd_context *cmd,
struct volume_group *vg;
int consistent = 0;
struct id vgid_raw;
+ int r = 0;
/* TODO: add support for partial and clustered VGs */
if (partial)
@@ -106,24 +107,29 @@ static int _auto_activation_handler(struct cmd_context *cmd,
if (!id_read_format(&vgid_raw, vgid))
return_0;
- /* NB. This is safe because we know lvmetad is running and we won't hit
- * disk. */
+ /* NB. This is safe because we know lvmetad is running and we won't hit disk. */
if (!(vg = vg_read_internal(cmd, NULL, (const char *) &vgid_raw, 0, &consistent)))
return 1;
if (vg_is_clustered(vg)) {
- release_vg(vg);
- return 1;
+ r = 1; goto out;
+ }
+
+ if (!vg_refresh_visible(vg->cmd, vg)) {
+ log_error("%s: refresh before autoactivation failed.", vg->name);
+ goto out;
}
if (!vgchange_activate(vg->cmd, vg, activate)) {
log_error("%s: autoactivation failed.", vg->name);
- release_vg(vg);
- return 0;
+ goto out;
}
+ r = 1;
+
+out:
release_vg(vg);
- return 1;
+ return r;
}
static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv)
10 years, 7 months