master - metadata: add support for storing profile name in metadata (during vgcreate/lvcreate)
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e21e38cf740b5b174e59fe400663bf6847f2f547 Commit: e21e38cf740b5b174e59fe400663bf6847f2f547 Parent: d6a91da4be08aa59bfabd626bdb599030db6e8f1 Author: Peter Rajnoha <[email protected]> AuthorDate: Tue Jun 25 12:32:09 2013 +0200 Committer: Peter Rajnoha <[email protected]> CommitterDate: Tue Jul 2 15:19:09 2013 +0200
metadata: add support for storing profile name in metadata (during vgcreate/lvcreate)
If "vgcreate/lvcreate --profile <profile_name>" is used, the profile name is automatically stored in metadata for making it possible to load it automatically next time the VG/LV is used.
--- lib/format_text/export.c | 7 +++++++ lib/format_text/format-text.c | 2 +- lib/metadata/lv_manip.c | 3 +++ lib/metadata/metadata-exported.h | 1 + tools/vgcreate.c | 3 +++ 5 files changed, 15 insertions(+), 1 deletions(-)
lib/format_text/export.c +7 -0
@@ -418,6 +418,10 @@ static int _print_vg(struct formatter *f, struct volume_group *vg)outf (f,"allocation_policy = \"%s\"" ,get_alloc_string (vg->alloc)); } + +if (vg->profile) +outf (f,"profile = \"%s\"" , vg->profile->name); +outf (f,"metadata_copies = %u" , vg->mda_copies);return 1 ;
@@ -623,6 +627,9 @@ static int _print_lv(struct formatter *f, struct logical_volume *lv)outf (f,"allocation_policy = \"%s\"" ,get_alloc_string (lv->alloc)); +if (lv->profile) +outf (f,"profile = \"%s\"" , lv->profile->name); +switch (lv->read_ahead) {case DM_READ_AHEAD_NONE :outfc (f,"# None" ,"read_ahead = -1" );
lib/format_text/format-text.c +1 -1
@@ -2411,7 +2411,7 @@ struct format_type *create_text_format(struct cmd_context *cmd) fmt->orphan_vg_name =ORPHAN_VG_NAME (FMT_TEXT_NAME ); fmt->features =FMT_SEGMENTS |FMT_MDAS |FMT_TAGS |FMT_PRECOMMIT |FMT_UNLIMITED_VOLS |FMT_RESIZE_PV | -FMT_UNLIMITED_STRIPESIZE |FMT_BAS ; +FMT_UNLIMITED_STRIPESIZE |FMT_BAS |FMT_CONFIG_PROFILE ;if (!(mda_lists =dm_malloc (sizeof (struct mda_lists )))) {log_error ("Failed to allocate dir_list" );
lib/metadata/lv_manip.c +3 -0
@@ -4651,6 +4651,9 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l status, lp->alloc, vg))) return_NULL; +if (vg->fid->fmt->features &FMT_CONFIG_PROFILE ) + lv->profile = vg->cmd->profile_params->global_profile; +if (lp->read_ahead != lv->read_ahead) {log_verbose ("Setting read ahead sectors" ); lv->read_ahead = lp->read_ahead;
lib/metadata/metadata-exported.h +1 -0
@@ -112,6 +112,7 @@#define FMT_UNLIMITED_STRIPESIZE 0x00000100U/* Unlimited stripe size? */ #define FMT_RESTRICTED_READAHEAD 0x00000200U/* Readahead restricted to 2-120? */ #define FMT_BAS 0x000000400U/* Supports bootloader areas? */ +#define FMT_CONFIG_PROFILE 0x000000800U/* Supports configuration profiles? */ /* Mirror conversion type flags */ #define MIRROR_BY_SEG 0x00000001U/* segment-by-segment mirror */
tools/vgcreate.c +3 -0
@@ -62,6 +62,9 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)return ECMD_FAILED ; } +if (vg->fid->fmt->features &FMT_CONFIG_PROFILE ) + vg->profile = vg->cmd->profile_params->global_profile; + if (!vg_set_extent_size(vg, vp_new.extent_size) || !vg_set_max_lv(vg, vp_new.max_lv) || !vg_set_max_pv(vg, vp_new.max_pv) ||