conga/ricci/modules/storage LVM.cpp
CVSROOT: /cvs/cluster
Module name: conga
Changes by: kupcevic at sourceware.org 2007-01-16 17:05:27
Modified files:
ricci/modules/storage: LVM.cpp
Log message:
Fix for 222223 (deactivate LV before removal)
ricci/modules/storage/LVM.cpp +24 -4
@@ -589,8 +589,8 @@ LVM::lvremove(const String& path) { vector<String> 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