1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00
lvm2/lib/format_text/archiver.h

67 lines
2.5 KiB
C
Raw Normal View History

/*
2004-03-30 23:35:44 +04:00
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
*
2004-03-30 23:35:44 +04:00
* This file is part of LVM2.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License v.2.1.
2004-03-30 23:35:44 +04:00
*
* You should have received a copy of the GNU Lesser General Public License
2004-03-30 23:35:44 +04:00
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _LVM_TOOL_ARCHIVE_H
#define _LVM_TOOL_ARCHIVE_H
#include "metadata-exported.h"
/*
* There are two operations that come under the general area of
* backups. 'Archiving' occurs just before a volume group
* configuration is changed. The user may configure when
* archived files are expired. Typically archives will be stored
* in /etc/lvm/archive.
*
* A 'backup' is a redundant copy of the *current* volume group
* configuration. As such it should be taken just after the
* volume group is changed. Only 1 backup file will exist.
* Typically backups will be stored in /etc/lvm/backups.
*/
int archive_init(struct cmd_context *cmd, const char *dir,
unsigned int keep_days, unsigned int keep_min,
int enabled);
void archive_exit(struct cmd_context *cmd);
void archive_enable(struct cmd_context *cmd, int flag);
int archive(struct volume_group *vg);
int archive_display(struct cmd_context *cmd, const char *vg_name);
int archive_display_file(struct cmd_context *cmd, const char *file);
int backup_init(struct cmd_context *cmd, const char *dir, int enabled);
void backup_exit(struct cmd_context *cmd);
void backup_enable(struct cmd_context *cmd, int flag);
int backup(struct volume_group *vg);
int backup_locally(struct volume_group *vg);
int backup_remove(struct cmd_context *cmd, const char *vg_name);
struct volume_group *backup_read_vg(struct cmd_context *cmd,
const char *vg_name, const char *file);
backup: backup_restore_vg: register PVs that need writing via vg->pvs_to_write list The backup_restore_vg is used directly for restoring the VG from backup. It's also used to do the VG conversions from one metadata format to another which means vgconvert calls backup_restore_vg too. When restoring VG from backup, we need to rewrite/write PV headers as PVs may have been orphans before and now they're becoming part of some VG - we need to write the PV_EXT_USED flag at least. When using the backup_restore_vg for vgconvert, we need to write completely new PV header in different format. Avoid the special "pv_write" call and handling that was used before this patch in vgconvert (vgconvert_single function to be more precise) and reuse existing internal interface to register PV header for writing (or rewriting) via vg->pvs_to_write list instead like we do it elsewhere in the code. This patch also resolves a problem in which PV headers with target format were written in the vgconvert_single fn as orphans and VG metadata were added later on - this was a tiny hack actually. We can't do this now - we need to write the PV as belonging to a VG because otherwise the PV_EXT_USED flag won't be written properly (if the PV header is written as orphan, the PV_EXT_USED is set to 0, of course, even though metadata are attached later). So this patch removes this tiny inconsistency which was passing just fine before because we didn't have any relation to the VG in PV header before. Now we have the PV_EXT_USED flag which says the "PV is used in some VG".
2015-03-26 16:20:46 +03:00
int backup_restore_vg(struct cmd_context *cmd, struct volume_group *vg,
int do_pvcreate, struct pv_create_args *pva);
int backup_restore_from_file(struct cmd_context *cmd, const char *vg_name,
const char *file, int force);
int backup_restore(struct cmd_context *cmd, const char *vg_name, int force);
int backup_to_file(const char *file, const char *desc, struct volume_group *vg);
void check_current_backup(struct volume_group *vg);
#endif