mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Allow vgcfgrestore to list metadata backup files using -f
This commit is contained in:
parent
c221b0bc21
commit
944cac939c
@ -1,5 +1,6 @@
|
||||
Version 2.02.26 -
|
||||
=================================
|
||||
Allow vgcfgrestore to list metadata backup files using -f
|
||||
Add vg_check_status to consolidate vg status checks and error messages.
|
||||
Add pvdisplay --maps implementation.
|
||||
Fix vgcfgrestore man pg to show mandatory VG name and remove LVM1 options.
|
||||
|
@ -362,6 +362,22 @@ int archive_list(struct cmd_context *cmd, const char *dir, const char *vgname)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int archive_list_file(struct cmd_context *cmd, const char *file)
|
||||
{
|
||||
struct archive_file af;
|
||||
|
||||
af.path = (char *)file;
|
||||
|
||||
if (!path_exists(af.path)) {
|
||||
log_err("Archive file %s not found.", af.path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
_display_archive(cmd, &af);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int backup_list(struct cmd_context *cmd, const char *dir, const char *vgname)
|
||||
{
|
||||
struct archive_file af;
|
||||
|
@ -148,6 +148,17 @@ int archive_display(struct cmd_context *cmd, const char *vg_name)
|
||||
return r1 && r2;
|
||||
}
|
||||
|
||||
int archive_display_file(struct cmd_context *cmd, const char *file)
|
||||
{
|
||||
int r;
|
||||
|
||||
init_partial(1);
|
||||
r = archive_list_file(cmd, file);
|
||||
init_partial(0);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
int backup_init(struct cmd_context *cmd, const char *dir)
|
||||
{
|
||||
if (!(cmd->backup_params = dm_pool_zalloc(cmd->libmem,
|
||||
|
@ -38,6 +38,7 @@ 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);
|
||||
void backup_exit(struct cmd_context *cmd);
|
||||
|
@ -33,6 +33,7 @@ int archive_vg(struct volume_group *vg,
|
||||
* Displays a list of vg backups in a particular archive directory.
|
||||
*/
|
||||
int archive_list(struct cmd_context *cmd, const char *dir, const char *vgname);
|
||||
int archive_list_file(struct cmd_context *cmd, const char *file);
|
||||
int backup_list(struct cmd_context *cmd, const char *dir, const char *vgname);
|
||||
|
||||
/*
|
||||
|
@ -19,26 +19,27 @@ int vgcfgrestore(struct cmd_context *cmd, int argc, char **argv)
|
||||
{
|
||||
char *vg_name;
|
||||
|
||||
if (argc != 1) {
|
||||
if (argc == 1) {
|
||||
vg_name = skip_dev_dir(cmd, argv[0], NULL);
|
||||
if (!validate_name(vg_name)) {
|
||||
log_error("Volume group name \"%s\" is invalid", vg_name);
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
} else if (!(arg_count(cmd, list_ARG) && arg_count(cmd, file_ARG))) {
|
||||
log_err("Please specify a *single* volume group to restore.");
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
vg_name = skip_dev_dir(cmd, argv[0], NULL);
|
||||
|
||||
if (!validate_name(vg_name)) {
|
||||
log_error("Volume group name \"%s\" is invalid", vg_name);
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME: overloading the -l arg for now to display a
|
||||
* list of archive files for a particular vg
|
||||
*/
|
||||
if (arg_count(cmd, list_ARG)) {
|
||||
if (!archive_display(cmd, vg_name))
|
||||
if (!(arg_count(cmd,file_ARG) ?
|
||||
archive_display_file(cmd,
|
||||
arg_str_value(cmd, file_ARG, "")) :
|
||||
archive_display(cmd, vg_name)))
|
||||
return ECMD_FAILED;
|
||||
|
||||
return ECMD_PROCESSED;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user