VG metadata file names appear twice while executing "vgcfgrestore"

Ranjith ML <[email protected]> Mon, 18 Dec 2023 17:25:31 +0530
Newsgroups dev.linux.lists.lvm-devel
Message-ID <CAGEzBDznnrBNrVKeLNEZrb6TQ-SvrJDAdRRQ1FDatcsX8bf4MA@mail.gmail.com>
Hi,

VG metadata file names appear twice while executing "vgcfgrestore" and
this patch fixes it by removing duplicate file name.

The modification in this patch updates the logging VG metadata file
name in the _display_archive function to print only the file path
(path) without including the additional file name (af->name).

---
$ cat 0118-vgcfgrestore.patch
diff -Nurp LVM2.2.03.14.org/lib/format_text/archive.c
LVM2.2.03.14/lib/format_text/archive.c
--- LVM2.2.03.14.org/lib/format_text/archive.c  2021-10-20
15:55:05.000000000 +0530
+++ LVM2.2.03.14/lib/format_text/archive.c  2023-12-14 00:56:16.108721142 +0530
@@ -313,7 +313,7 @@ static void _display_archive(struct cmd_
  }

  log_print(" ");
- log_print("File:\t\t%s/%s", path, af->name);
+ log_print("File:\t\t%s", path);
  tc.path_live = path;

  fic.type = FMT_INSTANCE_PRIVATE_MDAS;
---

Without the fix, vgcfgrestore incorrectly prints the VG metadata file path.

---
# vgcfgrestore -l rhel

  File:   /etc/lvm/archive/rhel_00000-1376411295.vg/rhel_00000-1376411295.vg
  <====
  VG name:      rhel
  Description:  Created *before* executing 'pvscan --cache --activate ay 252:2'
  Backup Time:  Wed Jul 19 15:44:51 2023


  File:   /etc/lvm/backup/rhel/rhel
  VG name:      rhel
  Description:  Created *after* executing 'pvscan --cache --activate ay 252:2'
  Backup Time:  Wed Jul 19 15:44:51 2023
---

With this fix, it prints correctly.

---
# vgcfgrestore -l rhel

  File:   /etc/lvm/archive/rhel_00000-1376411295.vg
  VG name:      rhel
  Description:  Created *before* executing 'pvscan --cache --activate ay 252:2'
  Backup Time:  Wed Jul 19 15:44:51 2023


  File:   /etc/lvm/backup/rhel
  VG name:      rhel
  Description:  Created *after* executing 'pvscan --cache --activate ay 252:2'
  Backup Time:  Wed Jul 19 15:44:51 2023
---

Regards,
Ranjith