master - cache: disallow cache lvs and cache pools in cluster vg
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=40e1d5b269fa76b839e3e8e2e7c9beb2bbbfed5e Commit: 40e1d5b269fa76b839e3e8e2e7c9beb2bbbfed5e Parent: 2e905d454058ef17bbb2b9758c59a5505d1c95be Author: David Teigland <[email protected]> AuthorDate: Fri Oct 31 15:50:09 2014 -0500 Committer: David Teigland <[email protected]> CommitterDate: Tue Dec 16 10:30:27 2014 -0600
cache: disallow cache lvs and cache pools in cluster vg
Disable this combination until problems are resolved.
--- lib/metadata/segtype.c | 8 ++++++++ lib/metadata/segtype.h | 2 ++ tools/lvconvert.c | 16 +++++++++++++++- tools/lvcreate.c | 6 ++++++ tools/vgchange.c | 12 ++++++++++++ 5 files changed, 43 insertions(+), 1 deletions(-)
lib/metadata/segtype.c +8 -0
@@ -34,3 +34,11 @@ struct segment_type *get_segtype_from_string(struct cmd_context *cmd,return segtype; } + +int segtype_allowed_in_cluster_vg (const struct segment_type *segtype) +{ +if (segtype_is_cache (segtype) ||segtype_is_cache_pool (segtype)) +return 0 ; + +return 1 ; +}
lib/metadata/segtype.h +2 -0
@@ -138,6 +138,8 @@ struct segtype_handler {struct segment_type *get_segtype_from_string (struct cmd_context *cmd,const char *str); +int segtype_allowed_in_cluster_vg (const struct segment_type *segtype); +struct segtype_library ;int lvm_register_segtype (struct segtype_library *seglib,struct segment_type *segtype);
tools/lvconvert.c +15 -1
@@ -3345,13 +3345,27 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv, return_ECMD_FAILED; } } +if (lp->merge) {if ((lv_is_thin_volume (lv) && !_lvconvert_merge_thin_snapshot (cmd, lv, lp)) || (!lv_is_thin_volume (lv) && !_lvconvert_merge_old_snapshot (cmd, lv, lp))) {log_print_unless_silent ("Unable to merge LV \"%s\" into its origin." , lv->name);return ECMD_FAILED ; } - }else if (lp->snapshot) { +return ECMD_PROCESSED ; + } + +/* +* Converting to a new type. +*/ + +if (vg_is_clustered (lv->vg) && !segtype_allowed_in_cluster_vg (lp->segtype)) { +log_error ("LV segtype %s is not allowed in a cluster VG." , + lp->segtype->name); +return ECMD_FAILED ; + } + +if (lp->snapshot) {if (!_lvconvert_snapshot (cmd, lv, lp)) return_ECMD_FAILED; }else if (segtype_is_pool (lp->segtype) || lp->thin || lp->cache) {
tools/lvcreate.c +6 -0
@@ -1450,6 +1450,12 @@ int lvcreate(struct cmd_context *cmd, int argc, char **argv)if (!_read_activation_params (cmd, vg, &lp)) goto_out; +if (vg_is_clustered (vg) && !segtype_allowed_in_cluster_vg (lp.segtype)) { +log_error ("LV segtype %s is not allowed in a cluster VG." , + lp.segtype->name); + goto_out; + } +/* Resolve segment types with opened VG */ if (lp.snapshot && lp.origin_name && !_determine_snapshot_type (vg, &lp, &lcp)) goto_out;
tools/vgchange.c +12 -0
@@ -299,6 +299,7 @@ static int _vgchange_resizeable(struct cmd_context *cmd,static int _vgchange_clustered (struct cmd_context *cmd,struct volume_group *vg) { +struct lv_list *lvl;int clustered =arg_int_value (cmd, clustered_ARG,0 );if (clustered && (vg_is_clustered (vg))) {
@@ -313,6 +314,17 @@ static int _vgchange_clustered(struct cmd_context *cmd,return 0 ; } +if (clustered) { + dm_list_iterate_items(lvl, &vg->lvs) { +if (!segtype_allowed_in_cluster_vg (first_seg (lvl->lv)->segtype)) { +log_error ("LV %s segtype %s is not allowed in cluster VG." , +display_lvname (lvl->lv), +first_seg (lvl->lv)->segtype->name); +return 0 ; + } + } + } +if (clustered && !arg_count (cmd, yes_ARG)) {if (!clvmd_is_running ()) { if (yes_no_prompt("LVM cluster daemon (clvmd) is not"