diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2014-09-17 14:27:46 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2014-09-17 14:41:42 +0200 |
commit | 98414ca7dd2682b64fec141ae58b4c8ed4367fc7 (patch) | |
tree | e788c625842af6c6b158d27616144c6308667af9 /tools/vgchange.c | |
parent | f90bc22ca532f5852aeaab92e0c40b36d65ef62d (diff) | |
download | lvm2-98414ca7dd2682b64fec141ae58b4c8ed4367fc7.tar.gz |
vgchange: support clustered conversion for active lv
If we want to support conversion of VG to clustered type,
we currently need to relock active LV to get proper DLM lock.
So add extra loop after change of VG clustered attribute
to exlusively activate all active top level LVs.
When doing change -cy -> -cn we should validate LVs are not
active on other cluster nodes - we could be sure about this only
when with local exclusive activation - for other types
we require user to deactivate volumes first.
As a workaround for this limitation there is always
locking_type = 0 which amongs other skip the detection
of active LVs.
FIXME:
clvmd should handle looks for cluster locking type all the time.
Diffstat (limited to 'tools/vgchange.c')
-rw-r--r-- | tools/vgchange.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/tools/vgchange.c b/tools/vgchange.c index 29e2d8a74..da0a05dca 100644 --- a/tools/vgchange.c +++ b/tools/vgchange.c @@ -479,7 +479,9 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name, struct volume_group *vg, void *handle __attribute__((unused))) { + int ret = ECMD_PROCESSED; unsigned i; + struct lv_list *lvl; static const struct { int arg; @@ -534,6 +536,31 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name, backup(vg); log_print_unless_silent("Volume group \"%s\" successfully changed", vg->name); + + /* FIXME: fix clvmd bug and take DLM lock for non clustered VGs. */ + if (arg_is_set(cmd, clustered_ARG) && + vg_is_clustered(vg) && /* just switched to clustered */ + locking_is_clustered() && + locking_supports_remote_queries()) + dm_list_iterate_items(lvl, &vg->lvs) { + if ((lv_lock_holder(lvl->lv) != lvl->lv) || + !lv_is_active(lvl->lv)) + continue; + + if (!activate_lv_excl_local(cmd, lvl->lv) || + !lv_is_active_exclusive_locally(lvl->lv)) { + log_error("Can't reactive logical volume %s, " + "please fix manually.", + display_lvname(lvl->lv)); + ret = ECMD_FAILED; + } + + if (lv_is_mirror(lvl->lv)) + /* Give hint for clustered mirroring */ + log_print_unless_silent("For clustered mirroring of %s " + "deactivation and activation is needed.", + display_lvname(lvl->lv)); + } } if (arg_count(cmd, activate_ARG)) { @@ -561,7 +588,7 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name, if (!_vgchange_background_polling(cmd, vg)) return_ECMD_FAILED; - return ECMD_PROCESSED; + return ret; } int vgchange(struct cmd_context *cmd, int argc, char **argv) |