1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

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.
This commit is contained in:
Peter Rajnoha 2013-06-25 12:32:09 +02:00
parent d6a91da4be
commit e21e38cf74
5 changed files with 15 additions and 1 deletions

View File

@ -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");

View File

@ -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");

View File

@ -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;

View File

@ -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 */

View File

@ -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) ||