From mboxrd@z Thu Jan 1 00:00:00 1970 From: kupcevic@sourceware.org Date: 17 Jan 2007 14:41:16 -0000 Subject: [Cluster-devel] conga/ricci/modules/storage LVM.cpp Message-ID: <20070117144116.9531.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: conga Branch: RHEL5 Changes by: kupcevic at sourceware.org 2007-01-17 14:41:15 Modified files: ricci/modules/storage: LVM.cpp Log message: Fix for 222223 (deactivate LV before removal) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LVM.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.7.2.3&r2=1.7.2.4 --- conga/ricci/modules/storage/LVM.cpp 2006/12/12 13:26:24 1.7.2.3 +++ conga/ricci/modules/storage/LVM.cpp 2007/01/17 14:41:13 1.7.2.4 @@ -589,8 +589,8 @@ LVM::lvremove(const String& path) { vector args; - args.push_back("lvremove"); - args.push_back("--force"); + args.push_back("lvchange"); + args.push_back("-an"); args.push_back(path); String out, err; @@ -598,8 +598,28 @@ if (utils::execute(LVM_BIN_PATH, args, out, err, status, false)) throw command_not_found_error_msg(LVM_BIN_PATH); if (status != 0) - throw String("lvremove failed"); - utils::clear_cache(); + throw String("Unable to deactivate LV (might be in use by other cluster nodes)"); + + try { + args.clear(); + args.push_back("lvremove"); + args.push_back("--force"); + args.push_back(path); + + if (utils::execute(LVM_BIN_PATH, args, out, err, status, false)) + throw command_not_found_error_msg(LVM_BIN_PATH); + if (status != 0) + throw String("lvremove failed"); + utils::clear_cache(); + } catch ( ... ) { + args.clear(); + args.push_back("lvchange"); + args.push_back("-ay"); + args.push_back(path); + utils::execute(LVM_BIN_PATH, args, out, err, status, false); + utils::clear_cache(); + throw; + } } void