From 3df50d822b8064c5536968556c466c50a9a3ace5 Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Wed, 18 Sep 2013 12:53:11 +0200 Subject: [PATCH] vgconvert: Do not call lvmetad_vg_remove (path shared with vgcfgbackup). --- lib/format_text/archiver.c | 6 +++--- lib/format_text/archiver.h | 2 +- tools/vgconvert.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/format_text/archiver.c b/lib/format_text/archiver.c index 752e93c24..e3e777733 100644 --- a/lib/format_text/archiver.c +++ b/lib/format_text/archiver.c @@ -308,7 +308,7 @@ struct volume_group *backup_read_vg(struct cmd_context *cmd, } /* ORPHAN and VG locks held before calling this */ -int backup_restore_vg(struct cmd_context *cmd, struct volume_group *vg) +int backup_restore_vg(struct cmd_context *cmd, struct volume_group *vg, int drop_lvmetad) { struct pv_list *pvl; struct format_instance *fid; @@ -351,7 +351,7 @@ int backup_restore_vg(struct cmd_context *cmd, struct volume_group *vg) if (!vg_write(vg)) return_0; - if (lvmetad_active()) { + if (drop_lvmetad && lvmetad_active()) { struct volume_group *vg_lvmetad = lvmetad_vg_lookup(cmd, vg->name, NULL); if (vg_lvmetad) { lvmetad_vg_remove(vg_lvmetad); @@ -397,7 +397,7 @@ int backup_restore_from_file(struct cmd_context *cmd, const char *vg_name, missing_pvs = vg_missing_pv_count(vg); if (missing_pvs == 0) - r = backup_restore_vg(cmd, vg); + r = backup_restore_vg(cmd, vg, 1); else log_error("Cannot restore Volume Group %s with %i PVs " "marked as missing.", vg->name, missing_pvs); diff --git a/lib/format_text/archiver.h b/lib/format_text/archiver.h index ddff687fc..bc756d5cf 100644 --- a/lib/format_text/archiver.h +++ b/lib/format_text/archiver.h @@ -51,7 +51,7 @@ 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); -int backup_restore_vg(struct cmd_context *cmd, struct volume_group *vg); +int backup_restore_vg(struct cmd_context *cmd, struct volume_group *vg, int drop_lvmetad); 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); diff --git a/tools/vgconvert.c b/tools/vgconvert.c index fbb1b4efc..86e30979e 100644 --- a/tools/vgconvert.c +++ b/tools/vgconvert.c @@ -184,7 +184,7 @@ static int vgconvert_single(struct cmd_context *cmd, const char *vg_name, log_verbose("Writing metadata for VG %s using format %s", vg_name, cmd->fmt->name); - if (!backup_restore_vg(cmd, vg)) { + if (!backup_restore_vg(cmd, vg, 0)) { log_error("Conversion failed for volume group %s.", vg_name); log_error("Use pvcreate and vgcfgrestore to repair from " "archived metadata.");