diff options
author | Alasdair Kergon <agk@redhat.com> | 2002-04-24 18:20:51 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2002-04-24 18:20:51 +0000 |
commit | 25b733809adcd2f6a8f288c100085068094dcc8a (patch) | |
tree | de7aea488a1c717d589134b324c664ba4aa505a7 /tools/vgcfgbackup.c | |
parent | f06bdc437d7eab9569f80ba40cbfca55ffa27104 (diff) | |
download | lvm2-25b733809adcd2f6a8f288c100085068094dcc8a.tar.gz |
Merge with text format branch.
Lots of changes/very little testing so far => there'll be bugs!
Use 'vgcreate -M text' to create a volume group with its metadata stored
in text files. Text format metadata changes should be reasonably atomic,
with a (basic) automatic recovery mechanism if the system crashes while a
change is in progress.
Add a metadata section to lvm.conf to specify multiple directories if
you want (recommended) to keep multiple copies of the metadata (eg on
different filesystems).
e.g. metadata {
dirs = ["/etc/lvm/metadata1","/usr/local/lvm/metadata2"]
}
Plenty of refinements still in the pipeline.
Diffstat (limited to 'tools/vgcfgbackup.c')
-rw-r--r-- | tools/vgcfgbackup.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tools/vgcfgbackup.c b/tools/vgcfgbackup.c index 93f65a179..b7419a201 100644 --- a/tools/vgcfgbackup.c +++ b/tools/vgcfgbackup.c @@ -12,17 +12,21 @@ static int _backup_to_file(const char *file, struct volume_group *vg) { int r; struct format_instance *tf; + void *context; - if (!(tf = text_format_create(vg->cmd, file, vg->cmd->um, - vg->cmd->cmd_line))) { + if (!(context = create_text_context(vg->cmd->fmtt, file, + vg->cmd->cmd_line)) || + !(tf = vg->cmd->fmtt->ops->create_instance(vg->cmd->fmtt, NULL, + context))) { log_error("Couldn't create backup object."); return 0; } - if (!(r = tf->ops->vg_write(tf, vg))) + if (!(r = tf->fmt->ops->vg_write(tf, vg, context)) || + !(r = tf->fmt->ops->vg_commit(tf, vg, context))) stack; - tf->ops->destroy(tf); + tf->fmt->ops->destroy_instance(tf); return r; } @@ -31,7 +35,7 @@ static int vg_backup_single(struct cmd_context *cmd, const char *vg_name) struct volume_group *vg; log_verbose("Checking for volume group \"%s\"", vg_name); - if (!(vg = cmd->fid->ops->vg_read(cmd->fid, vg_name))) { + if (!(vg = vg_read(cmd, vg_name))) { log_error("Volume group \"%s\" not found", vg_name); return ECMD_FAILED; } |