summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2016-06-21 11:40:42 -0500
committerDavid Teigland <teigland@redhat.com>2016-06-21 11:40:42 -0500
commit6c269e639a121329fc035685f944816a763b23cf (patch)
tree6de9a244343a3b5608c1fe8ddd950dee21b6cd00
parentf96de674905cd9f109cd19e03ba5e92ac84104b8 (diff)
downloadlvm2-6c269e639a121329fc035685f944816a763b23cf.tar.gz
vgcfgrestore: rescan to reenable lvmetad on error path
In commit 6ae22125, vgcfgrestore began disabling lvmetad while running, and rescanned to enable it again at the end, but missed the rescanning/enabling in the error case.
-rw-r--r--tools/vgcfgrestore.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/vgcfgrestore.c b/tools/vgcfgrestore.c
index 54e382cbc..77c007c0a 100644
--- a/tools/vgcfgrestore.c
+++ b/tools/vgcfgrestore.c
@@ -20,6 +20,7 @@ int vgcfgrestore(struct cmd_context *cmd, int argc, char **argv)
{
const char *vg_name = NULL;
int lvmetad_rescan = 0;
+ int ret;
if (argc == 1) {
vg_name = skip_dev_dir(cmd, argv[0], NULL);
@@ -83,20 +84,24 @@ int vgcfgrestore(struct cmd_context *cmd, int argc, char **argv)
unlock_vg(cmd, VG_ORPHANS);
unlock_vg(cmd, vg_name);
log_error("Restore failed.");
- return ECMD_FAILED;
+ ret = ECMD_FAILED;
+ goto rescan;
}
+ ret = ECMD_PROCESSED;
log_print_unless_silent("Restored volume group %s", vg_name);
unlock_vg(cmd, VG_ORPHANS);
unlock_vg(cmd, vg_name);
-
+rescan:
if (lvmetad_rescan) {
if (!lvmetad_connect(cmd)) {
log_warn("WARNING: Failed to connect to lvmetad.");
log_warn("WARNING: Update lvmetad with pvscan --cache.");
goto out;
}
+ if (!refresh_filters(cmd))
+ stack;
if (!lvmetad_pvscan_all_devs(cmd, 1)) {
log_warn("WARNING: Failed to scan devices.");
log_warn("WARNING: Update lvmetad with pvscan --cache.");
@@ -104,5 +109,5 @@ int vgcfgrestore(struct cmd_context *cmd, int argc, char **argv)
}
}
out:
- return ECMD_PROCESSED;
+ return ret;
}