From 7d0e6e800e41fd13a5dc51ef05de8298b30b7432 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Mon, 11 Feb 2002 15:42:34 +0000 Subject: o Support locking with local lock files o Disable control-c during updates (except if blocked waiting for a lock) --- tools/vgexport.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'tools/vgexport.c') diff --git a/tools/vgexport.c b/tools/vgexport.c index e74db3c8..05fdb781 100644 --- a/tools/vgexport.c +++ b/tools/vgexport.c @@ -34,7 +34,7 @@ int vgexport(int argc, char **argv) return ECMD_FAILED; } - return process_each_vg(argc, argv, &vgexport_single); + return process_each_vg(argc, argv, LCK_READ, &vgexport_single); } static int vgexport_single(const char *vg_name) @@ -43,36 +43,39 @@ static int vgexport_single(const char *vg_name) if (!(vg = fid->ops->vg_read(fid, vg_name))) { log_error("Unable to find volume group \"%s\"", vg_name); - return ECMD_FAILED; + goto error; } if (vg->status & EXPORTED_VG) { log_error("Volume group \"%s\" is already exported", vg_name); - return ECMD_FAILED; + goto error; } if (!(vg->status & LVM_WRITE)) { log_error("Volume group \"%s\" is read-only", vg_name); - return ECMD_FAILED; + goto error; } if (lvs_in_vg_activated(vg)) { log_error("Volume group \"%s\" has active logical volumes", vg_name); - return ECMD_FAILED; + goto error; } if (!archive(vg)) - return ECMD_FAILED; + goto error; vg->status |= EXPORTED_VG; if (!fid->ops->vg_write(fid,vg)) - return ECMD_FAILED; + goto error; backup(vg); log_print("Volume group \"%s\" successfully exported", vg->name); return 0; + + error: + return ECMD_FAILED; } -- cgit