1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

vgcfgrestore: Remove VG rom lvmetad later, to better deal with errors.

This commit is contained in:
Petr Rockai 2013-09-18 11:22:49 +02:00
parent a6af611ae1
commit 054cf25b5f
2 changed files with 13 additions and 9 deletions

View File

@ -18,6 +18,7 @@
#include "format-text.h"
#include "lvm-string.h"
#include "lvmcache.h"
#include "lvmetad.h"
#include "toolcontext.h"
#include "locking.h"
@ -347,7 +348,18 @@ int backup_restore_vg(struct cmd_context *cmd, struct volume_group *vg)
vg->extent_size = tmp;
}
if (!vg_write(vg) || !vg_commit(vg))
if (!vg_write(vg))
return_0;
if (lvmetad_active()) {
struct volume_group *vg_lvmetad = lvmetad_vg_lookup(cmd, vg->name, NULL);
if (vg_lvmetad) {
lvmetad_vg_remove(vg_lvmetad);
release_vg(vg_lvmetad);
}
}
if (!vg_commit(vg))
return_0;
return 1;

View File

@ -57,14 +57,6 @@ int vgcfgrestore(struct cmd_context *cmd, int argc, char **argv)
return ECMD_FAILED;
}
if (lvmetad_active()) {
struct volume_group *vg = lvmetad_vg_lookup(cmd, vg_name, NULL);
if (vg) {
lvmetad_vg_remove(vg);
release_vg(vg);
}
}
cmd->handles_unknown_segments = 1;
if (!(arg_count(cmd, file_ARG) ?