master - cache: handle policy_name separately
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e9e35b011e0846...
Commit: e9e35b011e084616f97ede9a31305259e70f883d
Parent: 86a4d47215570517804fa0e7acedf8d0473c5e07
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jul 15 11:06:40 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 15 13:10:22 2015 +0200
cache: handle policy_name separately
Keep policy name separate from policy settings and avoid
to mangling and demangling this string from same config tree.
Ensure policy_name is always defined.
---
WHATS_NEW | 1 +
lib/metadata/cache_manip.c | 28 +++++++++++++++-------------
lib/metadata/lv_manip.c | 5 +----
lib/metadata/metadata-exported.h | 6 ++++--
tools/lvchange.c | 14 ++++++++------
tools/lvconvert.c | 13 +++++++++++++
tools/lvcreate.c | 19 +++++++++----------
tools/toollib.c | 32 ++++++++++++--------------------
tools/toollib.h | 4 +++-
9 files changed, 66 insertions(+), 56 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index ca50a1e..43fa004 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.126 -
================================
+ Fix handling of cache policy name.
Set cache policy before with the first lvm2 cache pool metadata commit.
Fix detection of thin-pool overprovisioning (2.02.124).
Fix lvmpolld segfaults on 32 bit architectures.
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index 5a93031..91fcd3b 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -395,13 +395,13 @@ int lv_is_cache_origin(const struct logical_volume *lv)
return seg && lv_is_cache(seg->lv) && !lv_is_pending_delete(seg->lv) && (seg_lv(seg, 0) == lv);
}
-int lv_cache_setpolicy(struct logical_volume *lv, struct dm_config_tree *policy)
+int lv_cache_set_policy(struct logical_volume *lv, const char *name,
+ const struct dm_config_tree *settings)
{
- struct lv_segment *seg = first_seg(lv);
- const char *name;
struct dm_config_node *cn;
struct dm_config_tree *old = NULL, *new = NULL, *tmp = NULL;
int r = 0;
+ struct lv_segment *seg = first_seg(lv);
if (lv_is_cache(lv))
seg = first_seg(seg->pool_lv);
@@ -411,20 +411,21 @@ int lv_cache_setpolicy(struct logical_volume *lv, struct dm_config_tree *policy)
goto_out;
if (!(new = dm_config_create()))
goto_out;
- new->root = policy->root;
+ new->root = settings->root;
old->root = seg->policy_settings;
new->cascade = old;
- if (!(tmp = policy = dm_config_flatten(new)))
+ if (!(tmp = dm_config_flatten(new)))
goto_out;
}
- if ((cn = dm_config_find_node(policy->root, "policy_settings")) &&
+ if ((cn = dm_config_find_node((tmp) ? tmp->root : settings->root, "policy_settings")) &&
!(seg->policy_settings = dm_config_clone_node_with_mem(lv->vg->vgmem, cn, 0)))
goto_out;
- if ((name = dm_config_find_str(policy->root, "policy", NULL)) &&
- !(seg->policy_name = dm_pool_strdup(lv->vg->vgmem, name)))
- goto_out;
+ if (name && !(seg->policy_name = dm_pool_strdup(lv->vg->vgmem, name))) {
+ log_error("Failed to duplicate policy name.");
+ goto out;
+ }
restart: /* remove any 'default" nodes */
cn = seg->policy_settings ? seg->policy_settings->child : NULL;
@@ -439,12 +440,13 @@ restart: /* remove any 'default" nodes */
r = 1;
out:
- if (old)
- dm_config_destroy(old);
- if (new)
- dm_config_destroy(new);
if (tmp)
dm_config_destroy(tmp);
+ if (new)
+ dm_config_destroy(new);
+ if (old)
+ dm_config_destroy(old);
+
return r;
}
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index b2e5601..19d0ca7 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7245,7 +7245,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
if (seg_is_cache_pool(lp) || seg_is_cache(lp)) {
pool_lv = pool_lv ? : lv;
- if (!lv_cache_setpolicy(pool_lv, lp->cache_policy))
+ if (!lv_cache_set_policy(pool_lv, lp->policy_name, lp->policy_settings))
return_NULL; /* revert? */
first_seg(pool_lv)->chunk_size = lp->chunk_size;
first_seg(pool_lv)->feature_flags = lp->feature_flags;
@@ -7458,9 +7458,6 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
}
lv = tmp_lv;
- if (lp->cache_policy && !lv_cache_setpolicy(lv, lp->cache_policy))
- return NULL; /* revert? */
-
if (!lv_update_and_reload(lv)) {
/* FIXME Do a better revert */
log_error("Aborting. Manual intervention required.");
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 80e3ca3..7c1752a 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -902,7 +902,8 @@ struct lvcreate_params {
uint32_t max_recovery_rate; /* RAID */
uint64_t feature_flags; /* cache */
- struct dm_config_tree *cache_policy; /* cache */
+ const char *policy_name; /* cache */
+ struct dm_config_tree *policy_settings; /* cache */
const struct segment_type *segtype; /* all */
unsigned target_attr; /* all */
@@ -1164,7 +1165,8 @@ int validate_lv_cache_create_origin(const struct logical_volume *origin_lv);
struct logical_volume *lv_cache_create(struct logical_volume *pool,
struct logical_volume *origin);
int lv_cache_remove(struct logical_volume *cache_lv);
-int lv_cache_setpolicy(struct logical_volume *cache_lv, struct dm_config_tree *pol);
+int lv_cache_set_policy(struct logical_volume *cache_lv, const char *name,
+ const struct dm_config_tree *settings);
int wipe_cache_pool(struct logical_volume *cache_pool_lv);
/* -- metadata/cache_manip.c */
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 939614e..58e0fb2 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -680,25 +680,27 @@ static int _lvchange_persistent(struct cmd_context *cmd,
static int _lvchange_cachepolicy(struct cmd_context *cmd, struct logical_volume *lv)
{
- struct dm_config_tree *policy = NULL;
+ const char *name;
+ struct dm_config_tree *settings = NULL;
int r = 0;
if (!lv_is_cache(lv) && !lv_is_cache_pool(lv)) {
log_error("LV %s is not a cache LV.", lv->name);
log_error("Only cache or cache pool devices can have --cachepolicy set.");
- goto_out;
+ goto out;
}
- if (!(policy = get_cachepolicy_params(cmd)))
+ if (!get_cache_policy_params(cmd, &name, &settings))
goto_out;
- if (!lv_cache_setpolicy(lv, policy))
+ if (!lv_cache_set_policy(lv, name, settings))
goto_out;
if (!lv_update_and_reload(lv))
goto_out;
r = 1;
out:
- if (policy)
- dm_config_destroy(policy);
+ if (settings)
+ dm_config_destroy(settings);
+
return r;
}
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index e824e8c..e673f53 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -52,6 +52,8 @@ struct lvconvert_params {
uint32_t stripe_size;
uint32_t read_ahead;
uint64_t feature_flags; /* cache_pool */
+ const char *policy_name; /* cache */
+ struct dm_config_tree *policy_settings; /* cache */
const struct segment_type *segtype;
unsigned target_attr;
@@ -297,6 +299,11 @@ static int _read_pool_params(struct cmd_context *cmd, int *pargc, char ***pargv,
if (!set_cache_pool_feature(&lp->feature_flags, cachemode))
return_0;
+
+ if (!get_cache_policy_params(cmd, &lp->policy_name, &lp->policy_settings)) {
+ log_error("Failed to parse cache policy and/or settings.");
+ return 0;
+ }
} else {
if (arg_from_list_is_set(cmd, "is valid only with cache pools",
cachepool_ARG, cachemode_ARG, -1))
@@ -3053,6 +3060,10 @@ mda_write:
seg->zero_new_blocks = lp->zero ? 1 : 0;
seg->feature_flags = lp->feature_flags; /* cache-pool */
+ if ((lp->policy_name || lp->policy_settings) &&
+ !lv_cache_set_policy(seg->lv, lp->policy_name, lp->policy_settings))
+ return_0;
+
/* Rename deactivated metadata LV to have _tmeta suffix */
/* Implicit checks if metadata_lv is visible */
if (lp->pool_metadata_name &&
@@ -3523,6 +3534,8 @@ int lvconvert(struct cmd_context * cmd, int argc, char **argv)
} else
ret = lvconvert_single(cmd, &lp);
out:
+ if (lp.policy_settings)
+ dm_config_destroy(lp.policy_settings);
destroy_processing_handle(cmd, handle);
return ret;
}
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 4019b5d..2595130 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -578,6 +578,11 @@ static int _read_cache_params(struct cmd_context *cmd,
if (!set_cache_pool_feature(&lp->feature_flags, cachemode))
return_0;
+ if (!get_cache_policy_params(cmd, &lp->policy_name, &lp->policy_settings)) {
+ log_error("Failed to parse cache policy and/or settings.");
+ return 0;
+ }
+
return 1;
}
@@ -1036,13 +1041,6 @@ static int _lvcreate_params(struct cmd_context *cmd,
return 0;
}
- if ((arg_count(cmd, cachepolicy_ARG) || arg_count(cmd, cachesettings_ARG)) &&
- !(lp->cache_policy = get_cachepolicy_params(cmd)))
- {
- log_error("Failed to parse cache policy and/or settings.");
- return 0;
- }
-
dm_list_iterate_items(current_group, &cmd->arg_value_groups) {
if (!grouped_arg_is_set(current_group->arg_values, addtag_ARG))
continue;
@@ -1439,9 +1437,10 @@ static int _validate_internal_thin_processing(const struct lvcreate_params *lp)
static void _destroy_lvcreate_params(struct lvcreate_params *lp)
{
- if (lp->cache_policy)
- dm_config_destroy(lp->cache_policy);
- lp->cache_policy = NULL;
+ if (lp->policy_settings) {
+ dm_config_destroy(lp->policy_settings);
+ lp->policy_settings = NULL;
+ }
}
int lvcreate(struct cmd_context *cmd, int argc, char **argv)
diff --git a/tools/toollib.c b/tools/toollib.c
index 76fc63d..7bbe897 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1393,12 +1393,14 @@ int get_stripe_params(struct cmd_context *cmd, uint32_t *stripes, uint32_t *stri
return _validate_stripe_params(cmd, stripes, stripe_size);
}
-static int _validate_cachepool_params(struct dm_config_tree *tree)
+static int _validate_cachepool_params(const char *name,
+ const struct dm_config_tree *settings)
{
return 1;
}
-struct dm_config_tree *get_cachepolicy_params(struct cmd_context *cmd)
+int get_cache_policy_params(struct cmd_context *cmd, const char **name,
+ struct dm_config_tree **settings)
{
const char *str;
struct arg_value_group_list *group;
@@ -1406,12 +1408,13 @@ struct dm_config_tree *get_cachepolicy_params(struct cmd_context *cmd)
struct dm_config_node *cn;
int ok = 0;
+ *name = arg_str_value(cmd, cachepolicy_ARG, DEFAULT_CACHE_POOL_POLICY);
+
dm_list_iterate_items(group, &cmd->arg_value_groups) {
if (!grouped_arg_is_set(group->arg_values, cachesettings_ARG))
continue;
- current = dm_config_create();
- if (!current)
+ if (!(current = dm_config_create()))
goto_out;
if (prev)
current->cascade = prev;
@@ -1437,24 +1440,10 @@ struct dm_config_tree *get_cachepolicy_params(struct cmd_context *cmd)
result->root = cn;
}
- if (arg_count(cmd, cachepolicy_ARG)) {
- if (!(cn = dm_config_create_node(result, "policy")))
- goto_out;
-
- cn->sib = result->root;
- result->root = cn;
- if (!(cn->v = dm_config_create_value(result)))
- goto_out;
-
- cn->v->type = DM_CFG_STRING;
- cn->v->v.str = arg_str_value(cmd, cachepolicy_ARG, NULL);
- }
-
- if (!_validate_cachepool_params(result))
+ if (!_validate_cachepool_params(*name, result))
goto_out;
ok = 1;
-
out:
if (!ok && result) {
dm_config_destroy(result);
@@ -1465,7 +1454,10 @@ out:
dm_config_destroy(prev);
prev = current;
}
- return result;
+
+ *settings = result;
+
+ return ok;
}
/* FIXME move to lib */
diff --git a/tools/toollib.h b/tools/toollib.h
index 75eed87..c57cb84 100644
--- a/tools/toollib.h
+++ b/tools/toollib.h
@@ -190,7 +190,9 @@ int get_pool_params(struct cmd_context *cmd,
int get_stripe_params(struct cmd_context *cmd, uint32_t *stripes,
uint32_t *stripe_size);
-struct dm_config_tree *get_cachepolicy_params(struct cmd_context *cmd);
+int get_cache_policy_params(struct cmd_context *cmd,
+ const char **name,
+ struct dm_config_tree **settings);
int change_tag(struct cmd_context *cmd, struct volume_group *vg,
struct logical_volume *lv, struct physical_volume *pv, int arg);
7 years, 10 months
master - cache: move setting of cache policy
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=86a4d472155705...
Commit: 86a4d47215570517804fa0e7acedf8d0473c5e07
Parent: 4a33d5714341caf281f8e519b4b6c875d6eba292
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jul 14 09:57:34 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 15 13:10:21 2015 +0200
cache: move setting of cache policy
Set policy before saving 1st. metadata and avoid unnecessary reload.
Fixes problem when we stored cache-pool without cache-policy set.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 9 ++-------
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 3a8cd9e..ca50a1e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.126 -
================================
+ Set cache policy before with the first lvm2 cache pool metadata commit.
Fix detection of thin-pool overprovisioning (2.02.124).
Fix lvmpolld segfaults on 32 bit architectures.
Fix ignored --startstopservices option if running lvmconf with systemd.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 9decf32..b2e5601 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7245,6 +7245,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
if (seg_is_cache_pool(lp) || seg_is_cache(lp)) {
pool_lv = pool_lv ? : lv;
+ if (!lv_cache_setpolicy(pool_lv, lp->cache_policy))
+ return_NULL; /* revert? */
first_seg(pool_lv)->chunk_size = lp->chunk_size;
first_seg(pool_lv)->feature_flags = lp->feature_flags;
/* TODO: some calc_policy solution for cache ? */
@@ -7437,13 +7439,6 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
}
}
- if (lv_is_cache_pool(lv) && !origin_lv) {
- if (lp->cache_policy && !lv_cache_setpolicy(lv, lp->cache_policy))
- return NULL; /* revert? */
- if (!lv_update_and_reload(lv))
- return NULL; /* FIXME: revert */
- }
-
if (seg_is_cache(lp) || (origin_lv && lv_is_cache_pool(lv))) {
/* Finish cache conversion magic */
if (origin_lv) {
7 years, 10 months
master - thin: fix warning for overprovisioning
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4a33d5714341ca...
Commit: 4a33d5714341caf281f8e519b4b6c875d6eba292
Parent: 34a410994674f450564d6f221ff5ef0b16d37280
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 13 11:08:49 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 15 13:10:21 2015 +0200
thin: fix warning for overprovisioning
When lvm.conf is properly configure for auto resize of overprovisioned
thin-pool volume, avoid showing any warning (2.02.124).
---
WHATS_NEW | 1 +
lib/metadata/thin_manip.c | 2 ++
test/shell/lvextend-thin-metadata-dmeventd.sh | 3 ++-
3 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 4fd027c..3a8cd9e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.126 -
================================
+ Fix detection of thin-pool overprovisioning (2.02.124).
Fix lvmpolld segfaults on 32 bit architectures.
Fix ignored --startstopservices option if running lvmconf with systemd.
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index 181c72e..d0a5c55 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -303,6 +303,8 @@ int pool_check_overprovisioning(const struct logical_volume *lv)
/* There is some free space in VG, but it is not configured
* for growing - threshold is 100% or percent is 0% */
sz = poolsum;
+ else
+ sz = ~0; /* No warning */
if (sz != ~0) {
log_warn("WARNING: Sum of all thin volume sizes (%s) exceeds the "
diff --git a/test/shell/lvextend-thin-metadata-dmeventd.sh b/test/shell/lvextend-thin-metadata-dmeventd.sh
index 72cdb81..6897072 100644
--- a/test/shell/lvextend-thin-metadata-dmeventd.sh
+++ b/test/shell/lvextend-thin-metadata-dmeventd.sh
@@ -61,7 +61,8 @@ aux prepare_pvs 3 256
vgcreate -s 1M $vg $(cat DEVICES)
# Testing dmeventd autoresize
-lvcreate -L200M -V1G -n thin -T $vg/pool
+lvcreate -L200M -V500M -n thin -T $vg/pool 2>&1 | tee out
+not grep "WARNING: Sum" out
lvcreate -L2M -n $lv1 $vg
lvchange -an $vg/thin $vg/pool
7 years, 10 months
master - config: use find_config_tree_array for all arrays
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=34a410994674f4...
Commit: 34a410994674f450564d6f221ff5ef0b16d37280
Parent: 7e728fe1a164cc5d4f64e46fcfcbb224c22b2457
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jul 15 10:52:23 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Jul 15 10:52:23 2015 +0200
config: use find_config_tree_array for all arrays
Use find_config_tree_array for all config arrays. Also, add
INTERNAL_ERROR in case there should have been at least default
value defined for a setting but it was not returned for some
reason (either config_settings.h misconfiguration or other config
tree error printed by functions called by find_config_tree_array).
---
lib/commands/toolcontext.c | 16 ++++++++--------
lib/mm/memlock.c | 2 +-
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 002627b..3fe2bb2 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -245,8 +245,10 @@ static int _parse_debug_classes(struct cmd_context *cmd)
const struct dm_config_value *cv;
int debug_classes = 0;
- if (!(cn = find_config_tree_array(cmd, log_debug_classes_CFG, NULL)))
+ if (!(cn = find_config_tree_array(cmd, log_debug_classes_CFG, NULL))) {
+ log_error(INTERNAL_ERROR "Unable to find configuration for log/debug_classes.");
return -1;
+ }
for (cv = cn->v; cv; cv = cv->next) {
if (cv->type != DM_CFG_STRING) {
@@ -686,7 +688,7 @@ static int _process_config(struct cmd_context *cmd)
DEFAULT_RUN_DIR "/lvmetad.socket");
*/
lvmetad_set_socket(lvmetad_socket);
- cn = find_config_tree_node(cmd, devices_global_filter_CFG, NULL);
+ cn = find_config_tree_array(cmd, devices_global_filter_CFG, NULL);
lvmetad_set_token(cn ? cn->v : NULL);
if (find_config_tree_int(cmd, global_locking_type_CFG, NULL) == 3 &&
@@ -1015,11 +1017,9 @@ static int _init_dev_cache(struct cmd_context *cmd)
init_obtain_device_list_from_udev(device_list_from_udev);
- if (!(cn = find_config_tree_node(cmd, devices_scan_CFG, NULL))) {
- log_verbose("device/scan not in config file, "
- "using defaults.");
- if (!(cn = find_config_tree_array(cmd, devices_scan_CFG, NULL)))
- return_0;
+ if (!(cn = find_config_tree_array(cmd, devices_scan_CFG, NULL))) {
+ log_error(INTERNAL_ERROR "Unable to find configuration for devices/scan.");
+ return_0;
}
for (cv = cn->v; cv; cv = cv->next) {
@@ -1232,7 +1232,7 @@ static int _init_filters(struct cmd_context *cmd, unsigned load_persistent_cache
}
/* filter component 1 */
- if ((cn = find_config_tree_node(cmd, devices_filter_CFG, NULL))) {
+ if ((cn = find_config_tree_array(cmd, devices_filter_CFG, NULL))) {
if (!(filter_components[1] = regex_filter_create(cn->v)))
goto_bad;
/* we have two filter components - create composite filter */
diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
index 534aab3..60686ea 100644
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -347,7 +347,7 @@ static int _memlock_maps(struct cmd_context *cmd, lvmlock_t lock, size_t *mstats
}
line = _maps_buffer;
- cn = find_config_tree_node(cmd, activation_mlock_filter_CFG, NULL);
+ cn = find_config_tree_array(cmd, activation_mlock_filter_CFG, NULL);
while ((line_end = strchr(line, '\n'))) {
*line_end = '\0'; /* remove \n */
7 years, 10 months
master - config: add "defaulting to" message in case we fall back to defaults in find_config_tree_array
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7e728fe1a164cc...
Commit: 7e728fe1a164cc5d4f64e46fcfcbb224c22b2457
Parent: 96a883a4541211fc3af09f682854ed88e200c036
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jul 15 10:50:57 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Jul 15 10:50:57 2015 +0200
config: add "defaulting to" message in case we fall back to defaults in find_config_tree_array
---
lib/config/config.c | 38 ++++++++++++++++++++++++++++++++++++--
1 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index 6aaeef1..a447de7 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -1386,12 +1386,31 @@ static struct dm_config_node *_get_array_def_node(struct cmd_context *cmd,
return cn;
}
+struct _config_array_out_handle {
+ struct dm_pool *mem;
+ char *str;
+};
+
+static int _config_array_line(const struct dm_config_node *cn, const char *line, void *baton)
+{
+ struct _config_array_out_handle *handle = (struct _config_array_out_handle *) baton;
+
+ if (!(handle->str = dm_pool_strdup(handle->mem, line))) {
+ log_error("_config_array_line: dm_pool_strdup failed");
+ return 0;
+ }
+
+ return 1;
+}
+
const struct dm_config_node *find_config_tree_array(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
char path[CFG_PATH_MAX_LEN];
int profile_applied;
- const struct dm_config_node *cn;
+ const struct dm_config_node *cn, *cn_def = NULL;
+ struct _config_array_out_handle out_handle = { 0 };
+ struct dm_config_node_out_spec out_spec = { 0 };
profile_applied = _apply_local_profile(cmd, profile);
_cfg_def_make_path(path, sizeof(path), item->id, item, 0);
@@ -1401,7 +1420,22 @@ const struct dm_config_node *find_config_tree_array(struct cmd_context *cmd, int
if (_config_disabled(cmd, item, path) ||
!(cn = find_config_tree_node(cmd, id, profile)))
- cn = _get_array_def_node(cmd, item, profile);
+ cn_def = _get_array_def_node(cmd, item, profile);
+
+ if (cn_def) {
+ out_handle.mem = cmd->cft->mem;
+ out_spec.line_fn = _config_array_line;
+ dm_config_value_set_format_flags(cn_def->v,
+ DM_CONFIG_VALUE_FMT_COMMON_EXTRA_SPACES |
+ DM_CONFIG_VALUE_FMT_COMMON_ARRAY);
+ if (!dm_config_write_one_node_out(cn_def, &out_spec, &out_handle))
+ out_handle.mem = NULL;
+ log_very_verbose("%s not found in config: defaulting to %s",
+ path, out_handle.mem ? out_handle.str : "<unknown>");
+ if (out_handle.mem)
+ dm_pool_free(out_handle.mem, out_handle.str);
+ cn = cn_def;
+ }
if (profile_applied)
remove_config_tree_by_source(cmd, profile->source);
7 years, 10 months
master - metadata: change function name to _allow_extra_system_id
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=96a883a4541211...
Commit: 96a883a4541211fc3af09f682854ed88e200c036
Parent: 9ab6bdce01d7780a9c8f7194bc488032dbf3348f
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Jul 14 14:42:18 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Jul 14 14:43:16 2015 -0500
metadata: change function name to _allow_extra_system_id
The previous name was misleading since this is not the
primary system_id check, only the "extra" check.
---
lib/metadata/metadata.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 3ebcc2d..56ed3fb 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4707,7 +4707,7 @@ static struct volume_group *_recover_vg(struct cmd_context *cmd,
return (struct volume_group *)vg;
}
-static int _allow_system_id(struct cmd_context *cmd, const char *system_id)
+static int _allow_extra_system_id(struct cmd_context *cmd, const char *system_id)
{
const struct dm_config_node *cn;
const struct dm_config_value *cv;
@@ -4848,7 +4848,7 @@ static int _access_vg_systemid(struct cmd_context *cmd, struct volume_group *vg)
/*
* A host can access a VG if the VG's system_id is in extra_system_ids list.
*/
- if (cmd->system_id && _allow_system_id(cmd, vg->system_id))
+ if (cmd->system_id && _allow_extra_system_id(cmd, vg->system_id))
return 1;
/*
7 years, 10 months
master - vgchange: fix lock-start filtering and waiting
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9ab6bdce01d778...
Commit: 9ab6bdce01d7780a9c8f7194bc488032dbf3348f
Parent: 681f779a3cb711c32663e594242a3b28a64e9f27
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Jul 14 14:30:01 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Jul 14 14:39:34 2015 -0500
vgchange: fix lock-start filtering and waiting
Both lock_start filters were being skipped when any lock-opt
values were used. The "auto" lock-opt should cause the
auto_lock_start_list to be used. The lock_start_list should
always be used.
The behavior of lock_start_list/auto_lock_start_list are tested
and verified to behave like volume_list/auto_activation_volume_list.
Since the default was changed to wait for lock-start to finish,
the "wait" and "autowait" lock-opt values are not needed, but a
new "autonowait" is added to the existing "nowait" avoid the
default waiting.
---
tools/vgchange.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 0ed8fec..72a5c1e 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -834,10 +834,17 @@ static int _vgchange_lock_start(struct cmd_context *cmd, struct volume_group *vg
const char *start_opt = arg_str_value(cmd, lockopt_ARG, NULL);
int auto_opt = 0;
- if (!start_opt || arg_is_set(cmd, force_ARG))
+ if (!is_lockd_type(vg->lock_type))
+ return 1;
+
+ if (arg_is_set(cmd, force_ARG))
goto do_start;
- if (!strcmp(start_opt, "auto") || !strcmp(start_opt, "autowait"))
+ /*
+ * Recognize both "auto" and "autonowait" options.
+ * Any waiting is done at the end of vgchange.
+ */
+ if (start_opt && !strncmp(start_opt, "auto", 4))
auto_opt = 1;
if (!_passes_lock_start_filter(cmd, vg, activation_lock_start_list_CFG)) {
@@ -1201,12 +1208,12 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
lockd_gl(cmd, "un", 0);
- if (!start_opt || !strcmp(start_opt, "wait") || !strcmp(start_opt, "autowait")) {
+ if (!start_opt || !strcmp(start_opt, "auto")) {
log_print_unless_silent("Starting locking. Waiting until locks are ready...");
lockd_start_wait(cmd);
- } else if (!strcmp(start_opt, "nowait")) {
- log_print_unless_silent("Starting locking. VG is read-only until locks are ready.");
+ } else if (!strcmp(start_opt, "nowait") || !strcmp(start_opt, "autonowait")) {
+ log_print_unless_silent("Starting locking. VG can only be read until locks are ready.");
}
}
7 years, 10 months
master - lockd: fix error message after a failing to get lock
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=681f779a3cb711...
Commit: 681f779a3cb711c32663e594242a3b28a64e9f27
Parent: ac3143c0936d00a0a1f4a865192040d3791afd66
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Jul 14 11:36:04 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Jul 14 11:36:04 2015 -0500
lockd: fix error message after a failing to get lock
There are two different failure conditions detected in
access_vg_lock_type() that should have different error
messages. This adds another failure flag so the two
cases can be distinguished to avoid printing a misleading
error message.
---
lib/metadata/metadata-exported.h | 1 +
lib/metadata/metadata.c | 8 +++++---
tools/toollib.c | 14 +++++++++++---
3 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 03f959d..80e3ca3 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -181,6 +181,7 @@
#define FAILED_RECOVERY 0x00000200U
#define FAILED_SYSTEMID 0x00000400U
#define FAILED_LOCK_TYPE 0x00000800U
+#define FAILED_LOCK_MODE 0x00001000U
#define SUCCESS 0x00000000U
#define VGMETADATACOPIES_ALL UINT32_MAX
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index c4974de..3ebcc2d 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4747,7 +4747,7 @@ static int _access_vg_clustered(struct cmd_context *cmd, struct volume_group *vg
}
static int _access_vg_lock_type(struct cmd_context *cmd, struct volume_group *vg,
- uint32_t lockd_state)
+ uint32_t lockd_state, uint32_t *failure)
{
if (!is_real_vg(vg->name))
return 1;
@@ -4791,6 +4791,7 @@ static int _access_vg_lock_type(struct cmd_context *cmd, struct volume_group *vg
vg->name, vg->lock_type);
}
+ *failure |= FAILED_LOCK_TYPE;
return 0;
}
@@ -4804,6 +4805,7 @@ static int _access_vg_lock_type(struct cmd_context *cmd, struct volume_group *vg
if (lockd_state & LDST_FAIL) {
if (lockd_state & LDST_EX) {
log_error("Cannot access VG %s due to failed lock.", vg->name);
+ *failure |= FAILED_LOCK_MODE;
return 0;
} else {
log_warn("Reading VG %s without a lock.", vg->name);
@@ -4904,8 +4906,8 @@ static int _vg_access_permitted(struct cmd_context *cmd, struct volume_group *vg
return 0;
}
- if (!_access_vg_lock_type(cmd, vg, lockd_state)) {
- *failure |= FAILED_LOCK_TYPE;
+ if (!_access_vg_lock_type(cmd, vg, lockd_state, failure)) {
+ /* Either FAILED_LOCK_TYPE or FAILED_LOCK_MODE were set. */
return 0;
}
diff --git a/tools/toollib.c b/tools/toollib.c
index b0b2b01..76fc63d 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -221,14 +221,22 @@ static int _ignore_vg(struct volume_group *vg, const char *vg_name,
/*
* Accessing a lockd VG when lvmlockd is not used is similar
* to accessing a foreign VG.
+ * This is also the point where a command fails if it failed
+ * to acquire the necessary lock from lvmlockd.
+ * The two cases are distinguished by FAILED_LOCK_TYPE (the
+ * VG lock_type requires lvmlockd), and FAILED_LOCK_MODE (the
+ * command failed to acquire the necessary lock.)
*/
- if (read_error & FAILED_LOCK_TYPE) {
+ if (read_error & (FAILED_LOCK_TYPE | FAILED_LOCK_MODE)) {
if (arg_vgnames && str_list_match_item(arg_vgnames, vg->name)) {
- log_error("Cannot access VG %s with lock_type %s that requires lvmlockd.",
- vg->name, vg->lock_type);
+ if (read_error & FAILED_LOCK_TYPE)
+ log_error("Cannot access VG %s with lock type %s that requires lvmlockd.",
+ vg->name, vg->lock_type);
+ /* For FAILED_LOCK_MODE, the error is printed in vg_read. */
return 1;
} else {
read_error &= ~FAILED_LOCK_TYPE; /* Check for other errors */
+ read_error &= ~FAILED_LOCK_MODE;
log_verbose("Skipping volume group %s", vg_name);
*skip = 1;
}
7 years, 10 months
master - config: {thin, cache}_{check, repair}_options are never undefined
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ac3143c0936d00...
Commit: ac3143c0936d00a0a1f4a865192040d3791afd66
Parent: d41bab402805c8813bb8eb0b18f3da97bb79fdf7
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jul 14 10:03:19 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 14 10:13:41 2015 +0200
config: {thin,cache}_{check,repair}_options are never undefined
Require global/{thin,cache}_{check,repair}_options to be always defined.
If not defined directly by user in the configuration and if there's no
concrete default option to use, make "" (empty string) the default one -
it's then clearly visible in the "lvmconfig --type default" (and
generated lvm.conf) and also it makes its handling in the code more
straightforward so we don't need to handle undefined values.
This means, if there are no default values for these settings defined,
we end up with this generated now:
{thin,cache}_{check,repair}_options = [ "" ]
So the value is never undefined and if it is, it's an error.
(The cache_repair_options is actually not used in the code at the moment,
but once the code using this setting is in, it will follow the same logic
as used for thin_repair_options.)
---
conf/example.conf.in | 4 ++--
lib/activate/dev_manager.c | 6 ++++--
lib/config/config_settings.h | 8 ++++----
lib/config/defaults.h | 8 ++++----
tools/lvconvert.c | 6 ++++--
5 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 3207955..3900ad4 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -876,7 +876,7 @@ global {
# Configuration option global/thin_repair_options.
# List of options passed to the thin_repair command.
- # This configuration option does not have a default value defined.
+ # thin_repair_options = [ "" ]
# Configuration option global/thin_disabled_features.
# Features to not use in the thin driver.
@@ -924,7 +924,7 @@ global {
# Configuration option global/cache_repair_options.
# List of options passed to the cache_repair command.
- # This configuration option does not have a default value defined.
+ # cache_repair_options = [ "" ]
# Configuration option global/system_id_source.
# The method LVM uses to set the local system ID.
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 0e29bcd..101cd36 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1939,8 +1939,10 @@ static int _pool_callback(struct dm_tree_node *node,
if (!*argv[0])
return 1; /* Checking disabled */
- if (!(cn = find_config_tree_array(mlv->vg->cmd, data->opts, NULL)))
- return_0;
+ if (!(cn = find_config_tree_array(mlv->vg->cmd, data->opts, NULL))) {
+ log_error(INTERNAL_ERROR "Unable to find configuration for pool check options.");
+ return 0;
+ }
for (cv = cn->v; cv && args < 16; cv = cv->next) {
if (cv->type != DM_CFG_STRING) {
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 44f1e04..ce03b36 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -869,7 +869,7 @@ cfg(global_thin_repair_executable_CFG, "thin_repair_executable", global_CFG_SECT
"Also see thin_repair_options.\n"
"(For thin tools, see thin_check_executable.)\n")
-cfg_array(global_thin_check_options_CFG, "thin_check_options", global_CFG_SECTION, CFG_ALLOW_EMPTY | (DEFAULT_THIN_CHECK_OPTIONS_CONFIG ? CFG_DEFAULT_COMMENTED : CFG_DEFAULT_UNDEFINED), CFG_TYPE_STRING, DEFAULT_THIN_CHECK_OPTIONS_CONFIG, vsn(2, 2, 96), NULL, 0, NULL,
+cfg_array(global_thin_check_options_CFG, "thin_check_options", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_THIN_CHECK_OPTIONS_CONFIG, vsn(2, 2, 96), NULL, 0, NULL,
"List of options passed to the thin_check command.\n"
"With thin_check version 2.1 or newer you can add\n"
"--ignore-non-fatal-errors to let it pass through\n"
@@ -877,7 +877,7 @@ cfg_array(global_thin_check_options_CFG, "thin_check_options", global_CFG_SECTIO
"With thin_check version 3.2 or newer you should add\n"
"--clear-needs-check-flag.\n")
-cfg_array(global_thin_repair_options_CFG, "thin_repair_options", global_CFG_SECTION, CFG_ALLOW_EMPTY | (DEFAULT_THIN_REPAIR_OPTIONS_CONFIG ? CFG_DEFAULT_COMMENTED : CFG_DEFAULT_UNDEFINED), CFG_TYPE_STRING, DEFAULT_THIN_REPAIR_OPTIONS_CONFIG, vsn(2, 2, 100), NULL, 0, NULL,
+cfg_array(global_thin_repair_options_CFG, "thin_repair_options", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_THIN_REPAIR_OPTIONS_CONFIG, vsn(2, 2, 100), NULL, 0, NULL,
"List of options passed to the thin_repair command.\n")
cfg_array(global_thin_disabled_features_CFG, "thin_disabled_features", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 99), NULL, 0, NULL,
@@ -916,10 +916,10 @@ cfg(global_cache_repair_executable_CFG, "cache_repair_executable", global_CFG_SE
"Also see cache_repair_options.\n"
"(For cache tools, see cache_check_executable.)\n")
-cfg_array(global_cache_check_options_CFG, "cache_check_options", global_CFG_SECTION, CFG_ALLOW_EMPTY | (DEFAULT_CACHE_CHECK_OPTIONS_CONFIG ? CFG_DEFAULT_COMMENTED : CFG_DEFAULT_UNDEFINED), CFG_TYPE_STRING, DEFAULT_CACHE_CHECK_OPTIONS_CONFIG, vsn(2, 2, 108), NULL, 0, NULL,
+cfg_array(global_cache_check_options_CFG, "cache_check_options", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_CACHE_CHECK_OPTIONS_CONFIG, vsn(2, 2, 108), NULL, 0, NULL,
"List of options passed to the cache_check command.\n")
-cfg_array(global_cache_repair_options_CFG, "cache_repair_options", global_CFG_SECTION, CFG_ALLOW_EMPTY | (DEFAULT_CACHE_REPAIR_OPTIONS_CONFIG ? CFG_DEFAULT_COMMENTED : CFG_DEFAULT_UNDEFINED), CFG_TYPE_STRING, DEFAULT_CACHE_REPAIR_OPTIONS_CONFIG, vsn(2, 2, 108), NULL, 0, NULL,
+cfg_array(global_cache_repair_options_CFG, "cache_repair_options", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_CACHE_REPAIR_OPTIONS_CONFIG, vsn(2, 2, 108), NULL, 0, NULL,
"List of options passed to the cache_repair command.\n")
cfg(global_system_id_source_CFG, "system_id_source", global_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_SYSTEM_ID_SOURCE, vsn(2, 2, 117), NULL, 0, NULL,
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index c568340..5ee9b1c 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -88,8 +88,8 @@
# define DEFAULT_THIN_CHECK_OPTIONS_CONFIG "#S" DEFAULT_THIN_CHECK_OPTION1
#endif
-#define DEFAULT_THIN_REPAIR_OPTIONS ""
-#define DEFAULT_THIN_REPAIR_OPTIONS_CONFIG NULL
+#define DEFAULT_THIN_REPAIR_OPTION1 ""
+#define DEFAULT_THIN_REPAIR_OPTIONS_CONFIG "#S" DEFAULT_THIN_REPAIR_OPTION1
#define DEFAULT_THIN_POOL_METADATA_REQUIRE_SEPARATE_PVS 0
#define DEFAULT_THIN_POOL_MAX_METADATA_SIZE (16 * 1024 * 1024) /* KB */
#define DEFAULT_THIN_POOL_MIN_METADATA_SIZE 2048 /* KB */
@@ -111,8 +111,8 @@
# define DEFAULT_CACHE_CHECK_OPTIONS_CONFIG "#S" DEFAULT_CACHE_CHECK_OPTION1
#endif
-#define DEFAULT_CACHE_REPAIR_OPTIONS ""
-#define DEFAULT_CACHE_REPAIR_OPTIONS_CONFIG NULL
+#define DEFAULT_CACHE_REPAIR_OPTION1 ""
+#define DEFAULT_CACHE_REPAIR_OPTIONS_CONFIG "#S" DEFAULT_CACHE_REPAIR_OPTION1
#define DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS 0
#define DEFAULT_CACHE_POOL_CHUNK_SIZE 64 /* KB */
#define DEFAULT_CACHE_POOL_MIN_METADATA_SIZE 2048 /* KB */
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 1461f4a..e824e8c 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2351,8 +2351,10 @@ static int _lvconvert_pool_repair(struct cmd_context *cmd,
return 0;
}
- if (!(cn = find_config_tree_array(cmd, global_thin_repair_options_CFG, NULL)))
- return_0;
+ if (!(cn = find_config_tree_array(cmd, global_thin_repair_options_CFG, NULL))) {
+ log_error(INTERNAL_ERROR "Unable to find configuration for global/thin_repair_options");
+ return 0;
+ }
for (cv = cn->v; cv && args < 16; cv = cv->next) {
if (cv->type != DM_CFG_STRING) {
7 years, 10 months
master - man lvmlockd: update method for changing lock type
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d41bab402805c8...
Commit: d41bab402805c8813bb8eb0b18f3da97bb79fdf7
Parent: 3da88b89172b588bef69d62e18ed5db127b2c845
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Jul 13 16:33:58 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Jul 13 16:33:58 2015 -0500
man lvmlockd: update method for changing lock type
The old description did not work.
---
man/lvmlockd.8.in | 37 ++++++++++++++++++++++++++++++-------
1 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/man/lvmlockd.8.in b/man/lvmlockd.8.in
index 659fead..9318350 100644
--- a/man/lvmlockd.8.in
+++ b/man/lvmlockd.8.in
@@ -500,20 +500,43 @@ A small sanlock VG dedicated to holding the global lock can avoid the case
where the GL lock must be manually enabled after a vgremove.
-.SS changing lock type
+.SS changing a local VG to a lockd VG
+
+All LVs must be inactive to change the lock type.
+
+lvmlockd must be configured and running as described in USAGE.
+
+Change a local VG to a lockd VG with the command:
+.br
+vgchange \-\-lock\-type sanlock|dlm <vg_name>
+
+Start the VG on any hosts that need to use it:
+.br
+vgchange \-\-lock\-start <vg_name>
-To change a local VG to a lockd VG:
-vgchange --lock-type sanlock|dlm <vg_name>
+.SS changing a clvm VG to a lockd VG
All LVs must be inactive to change the lock type.
-To change a clvm VG to a lockd VG:
+1. Change the clvm VG to a local VG.
+
+Within a running clvm cluster, change a clvm VG to a local VG with the
+command:
+
+vgchange \-cn <vg_name>
+
+If the clvm cluster is no longer running on any nodes, then extra options
+can be used forcibly make the VG local. Caution: this is only safe if all
+nodes have stopped using the VG:
-vgchange --lock-type sanlock|dlm <vg_name>
+vgchange \-\-config 'global/locking_type=0 global/use_lvmlockd=0'
+.RS
+\-cn <vg_name>
+.RE
-Changing a lockd VG to a local VG is not yet generally allowed.
-(It can be done partially in certain recovery cases.)
+2. After the VG is local, follow the steps described in "changing a local
+VG to a lockd VG".
.SS vgremove and vgreduce with sanlock VGs
7 years, 10 months