]> sourceware.org Git - lvm2.git/commitdiff
Allow vgcfgrestore to list metadata backup files using -f
authorBryn M. Reeves <breeves@redhat.com>
Fri, 8 Jun 2007 22:38:48 +0000 (22:38 +0000)
committerBryn M. Reeves <breeves@redhat.com>
Fri, 8 Jun 2007 22:38:48 +0000 (22:38 +0000)
WHATS_NEW
lib/format_text/archive.c
lib/format_text/archiver.c
lib/format_text/archiver.h
lib/format_text/format-text.h
tools/vgcfgrestore.c

index f74610dc9ec8662a19361f3325fdf7db941a14af..9a5efd2af203963949f1e9c3a63e8bdceb383825 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -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.
index c42581c161714023965fdd757709668c768c5cbb..ca94c7424890d5a3631e3e517ac410c4b468eb99 100644 (file)
@@ -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;
index f99069fe56416699a7cceb948e9fbe74cebabc6c..f3aac657bc2618759ede82692daab5be5b316af1 100644 (file)
@@ -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,
index 1e45d9ad77d9e64e785cf237e2a222b978a737da..af7cfbd25fedc3af6939cd1f7917c868a1c31797 100644 (file)
@@ -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);
index c38b88e45faa713c285fce2f9eb630293da4a2ad..2a690454ee71c13081cb0b9ab3b520cabf57def1 100644 (file)
@@ -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);
 
 /*
index 3dd1c676bf32bbebbd289251ed1cb617328aa308..83b42f094c2a5da0309954bd361600b112d9f562 100644 (file)
@@ -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;
        }
 
This page took 0.040815 seconds and 5 git commands to generate.