mirror of
git://sourceware.org/git/lvm2.git
synced 2025-04-29 18:50:41 +03:00
metadata: read VG/LV profile name from metadata if it exists and load it
This is per VG/LV profile loading on demand. The profile itself is saved in struct volume_group/logical_volume as "profile" field so we can reference it whenever needed.
This commit is contained in:
parent
bfde83eb34
commit
c5e6bc393e
@ -525,7 +525,7 @@ static int _read_lvnames(struct format_instance *fid __attribute__((unused)),
|
||||
{
|
||||
struct dm_pool *mem = vg->vgmem;
|
||||
struct logical_volume *lv;
|
||||
const char *lv_alloc;
|
||||
const char *str;
|
||||
const struct dm_config_value *cv;
|
||||
const char *hostname;
|
||||
uint64_t timestamp = 0;
|
||||
@ -565,14 +565,25 @@ static int _read_lvnames(struct format_instance *fid __attribute__((unused)),
|
||||
}
|
||||
|
||||
lv->alloc = ALLOC_INHERIT;
|
||||
if (dm_config_get_str(lvn, "allocation_policy", &lv_alloc)) {
|
||||
lv->alloc = get_alloc_from_string(lv_alloc);
|
||||
if (dm_config_get_str(lvn, "allocation_policy", &str)) {
|
||||
lv->alloc = get_alloc_from_string(str);
|
||||
if (lv->alloc == ALLOC_INVALID) {
|
||||
log_warn("WARNING: Ignoring unrecognised allocation policy %s for LV %s", lv_alloc, lv->name);
|
||||
log_warn("WARNING: Ignoring unrecognised allocation policy %s for LV %s", str, lv->name);
|
||||
lv->alloc = ALLOC_INHERIT;
|
||||
}
|
||||
}
|
||||
|
||||
if (dm_config_get_str(lvn, "profile", &str)) {
|
||||
log_debug_metadata("Adding profile configuration %s for LV %s/%s.",
|
||||
str, vg->name, lv->name);
|
||||
lv->profile = add_profile(vg->cmd, str);
|
||||
if (!lv->profile) {
|
||||
log_error("Failed to add configuration profile %s for LV %s/%s",
|
||||
str, vg->name, lv->name);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_read_int32(lvn, "read_ahead", &lv->read_ahead))
|
||||
/* If not present, choice of auto or none is configurable */
|
||||
lv->read_ahead = vg->cmd->default_settings.read_ahead;
|
||||
@ -789,6 +800,15 @@ static struct volume_group *_read_vg(struct format_instance *fid,
|
||||
}
|
||||
}
|
||||
|
||||
if (dm_config_get_str(vgn, "profile", &str)) {
|
||||
log_debug_metadata("Adding profile configuration %s for VG %s.", str, vg->name);
|
||||
vg->profile = add_profile(vg->cmd, str);
|
||||
if (!vg->profile) {
|
||||
log_error("Failed to add configuration profile %s for VG %s", str, vg->name);
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_read_uint32(vgn, "metadata_copies", &vg->mda_copies)) {
|
||||
vg->mda_copies = DEFAULT_VGMETADATACOPIES;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ struct logical_volume {
|
||||
|
||||
uint64_t status;
|
||||
alloc_policy_t alloc;
|
||||
struct profile *profile;
|
||||
uint32_t read_ahead;
|
||||
int32_t major;
|
||||
int32_t minor;
|
||||
|
@ -58,6 +58,7 @@ struct volume_group {
|
||||
struct volume_group *vg_ondisk;
|
||||
|
||||
alloc_policy_t alloc;
|
||||
struct profile *profile;
|
||||
uint64_t status;
|
||||
|
||||
struct id id;
|
||||
|
Loading…
x
Reference in New Issue
Block a user