From e53cfc6a88d7acafde6ba3fa293bcf15b9a033bc Mon Sep 17 00:00:00 2001 From: David Teigland Date: Wed, 13 Jun 2018 15:30:28 -0500 Subject: [PATCH] lvmlockd: update method for changing clustered VG The previous method for forcibly changing a clustered VG to a local VG involved using -cn and locking_type 0. Since those options are deprecated, replace it with the same command used for other forced lock type changes: vgchange --locktype none --lockopt force. --- lib/commands/toolcontext.h | 1 + lib/metadata/metadata.c | 9 +++++++++ man/lvmlockd.8_main | 9 +++------ tools/vgchange.c | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h index baecfbd12..9849e5ff3 100644 --- a/lib/commands/toolcontext.h +++ b/lib/commands/toolcontext.h @@ -153,6 +153,7 @@ struct cmd_context { unsigned include_shared_vgs:1; /* report/display cmds can reveal lockd VGs */ unsigned include_active_foreign_vgs:1; /* cmd should process foreign VGs with active LVs */ unsigned vg_read_print_access_error:1; /* print access errors from vg_read */ + unsigned force_access_clustered:1; unsigned lockd_gl_disable:1; unsigned lockd_vg_disable:1; unsigned lockd_lv_disable:1; diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 40854de15..113c87caa 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -4689,6 +4689,15 @@ int vg_flag_write_locked(struct volume_group *vg) static int _access_vg_clustered(struct cmd_context *cmd, const struct volume_group *vg) { if (vg_is_clustered(vg)) { + /* + * force_access_clustered is only set when forcibly + * converting a clustered vg to lock type none. + */ + if (cmd->force_access_clustered) { + log_debug("Allowing forced access to clustered vg %s", vg->name); + return 1; + } + if (!cmd->ignore_clustered_vgs) log_error("Skipping clustered volume group %s", vg->name); else diff --git a/man/lvmlockd.8_main b/man/lvmlockd.8_main index cf4c52ed5..6411c0153 100644 --- a/man/lvmlockd.8_main +++ b/man/lvmlockd.8_main @@ -814,8 +814,8 @@ dlm), first change it to a local VG, then to the new type. All LVs must be inactive to change the lock type. -First change the clvm VG to a local VG. Within a running clvm cluster, -change a clvm VG to a local VG with the command: +First change the clvm/clustered VG to a local VG. Within a running clvm +cluster, change a clustered VG to a local VG with the command: vgchange -cn @@ -823,10 +823,7 @@ If the clvm cluster is no longer running on any nodes, then extra options can be used to forcibly make the VG local. Caution: this is only safe if all nodes have stopped using the VG: -vgchange --config 'global/locking_type=0 global/use_lvmlockd=0' -.RS --cn -.RE +vgchange --lock-type none --lock-opt force After the VG is local, follow the steps described in "changing a local VG to a lockd VG". diff --git a/tools/vgchange.c b/tools/vgchange.c index b427a81bd..891f22a14 100644 --- a/tools/vgchange.c +++ b/tools/vgchange.c @@ -1039,6 +1039,7 @@ int vgchange_locktype_cmd(struct cmd_context *cmd, int argc, char **argv) cmd->lockd_vg_disable = 1; cmd->lockd_lv_disable = 1; cmd->handles_missing_pvs = 1; + cmd->force_access_clustered = 1; goto process; } -- 2.43.5