mirror of
git://sourceware.org/git/lvm2.git
synced 2025-02-22 09:57:47 +03:00
archives: Preserve format type in file.
format_text processes both lvm2 on-disk metadata and metadata read from other sources such as backup files. Add original_fmt field to retain the format type of the original metadata. Before this patch, /etc/lvm/archives would contain backups of lvm1 metadata with format = "lvm2" unless the source was lvm1 on-disk metadata.
This commit is contained in:
parent
2477495922
commit
4e6f3e5162
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.117 -
|
Version 2.02.117 -
|
||||||
====================================
|
====================================
|
||||||
|
Preserve original format type field when processing backup files.
|
||||||
Implement status action for lvm2-monitor initscript to display monitored LVs.
|
Implement status action for lvm2-monitor initscript to display monitored LVs.
|
||||||
Allow lvchange -p to change kernel state only if metadata state differs.
|
Allow lvchange -p to change kernel state only if metadata state differs.
|
||||||
Fix incorrect persistent .cache after report with label fields only (2.02.106).
|
Fix incorrect persistent .cache after report with label fields only (2.02.106).
|
||||||
|
@ -393,6 +393,7 @@ static int _out_tags(struct formatter *f, struct dm_list *tagsl)
|
|||||||
static int _print_vg(struct formatter *f, struct volume_group *vg)
|
static int _print_vg(struct formatter *f, struct volume_group *vg)
|
||||||
{
|
{
|
||||||
char buffer[4096];
|
char buffer[4096];
|
||||||
|
const struct format_type *fmt = NULL;
|
||||||
|
|
||||||
if (!id_write_format(&vg->id, buffer, sizeof(buffer)))
|
if (!id_write_format(&vg->id, buffer, sizeof(buffer)))
|
||||||
return_0;
|
return_0;
|
||||||
@ -401,8 +402,12 @@ static int _print_vg(struct formatter *f, struct volume_group *vg)
|
|||||||
|
|
||||||
outf(f, "seqno = %u", vg->seqno);
|
outf(f, "seqno = %u", vg->seqno);
|
||||||
|
|
||||||
if (vg->fid && vg->fid->fmt)
|
if (vg->original_fmt)
|
||||||
outfc(f, "# informational", "format = \"%s\"", vg->fid->fmt->name);
|
fmt = vg->original_fmt;
|
||||||
|
else if (vg->fid)
|
||||||
|
fmt = vg->fid->fmt;
|
||||||
|
if (fmt)
|
||||||
|
outfc(f, "# informational", "format = \"%s\"", fmt->name);
|
||||||
|
|
||||||
if (!_print_flag_config(f, vg->status, VG_FLAGS))
|
if (!_print_flag_config(f, vg->status, VG_FLAGS))
|
||||||
return_0;
|
return_0;
|
||||||
|
@ -733,7 +733,7 @@ static struct volume_group *_read_vg(struct format_instance *fid,
|
|||||||
{
|
{
|
||||||
const struct dm_config_node *vgn;
|
const struct dm_config_node *vgn;
|
||||||
const struct dm_config_value *cv;
|
const struct dm_config_value *cv;
|
||||||
const char *str;
|
const char *str, *format_str;
|
||||||
struct volume_group *vg;
|
struct volume_group *vg;
|
||||||
struct dm_hash_table *pv_hash = NULL, *lv_hash = NULL;
|
struct dm_hash_table *pv_hash = NULL, *lv_hash = NULL;
|
||||||
unsigned scan_done_once = use_cached_pvs;
|
unsigned scan_done_once = use_cached_pvs;
|
||||||
@ -775,6 +775,13 @@ static struct volume_group *_read_vg(struct format_instance *fid,
|
|||||||
|
|
||||||
vgn = vgn->child;
|
vgn = vgn->child;
|
||||||
|
|
||||||
|
/* A backup file might be a backup of a different format */
|
||||||
|
if (dm_config_get_str(vgn, "format", &format_str) &&
|
||||||
|
!(vg->original_fmt = get_format_by_name(fid->fmt->cmd, format_str))) {
|
||||||
|
log_error("Unrecognised format %s for volume group %s.", format_str, vg->name);
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
|
|
||||||
if (dm_config_get_str(vgn, "system_id", &str))
|
if (dm_config_get_str(vgn, "system_id", &str))
|
||||||
strncpy(system_id, str, NAME_LEN);
|
strncpy(system_id, str, NAME_LEN);
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ struct volume_group {
|
|||||||
struct cmd_context *cmd;
|
struct cmd_context *cmd;
|
||||||
struct dm_pool *vgmem;
|
struct dm_pool *vgmem;
|
||||||
struct format_instance *fid;
|
struct format_instance *fid;
|
||||||
|
const struct format_type *original_fmt; /* Set when processing backup files */
|
||||||
struct lvmcache_vginfo *vginfo;
|
struct lvmcache_vginfo *vginfo;
|
||||||
struct dm_list *cmd_vgs;/* List of wanted/locked and opened VGs */
|
struct dm_list *cmd_vgs;/* List of wanted/locked and opened VGs */
|
||||||
uint32_t cmd_missing_vgs;/* Flag marks missing VG */
|
uint32_t cmd_missing_vgs;/* Flag marks missing VG */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user