From mboxrd@z Thu Jan 1 00:00:00 1970 From: kupcevic@sourceware.org Date: 12 Dec 2006 13:26:29 -0000 Subject: [Cluster-devel] conga ./conga.spec.in.in luci/cluster/form-mac ... Message-ID: <20061212132629.29463.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 2006-12-12 13:26:24 Modified files: . : conga.spec.in.in luci/cluster : form-macros luci/site/luci/Extensions: ricci_bridge.py ricci/common : File.cpp ricci/docs : storage_api.html ricci/modules/storage: LV.cpp LVM.cpp LVM.h PV.cpp StorageModule.cpp VG.cpp Added files: ricci/test_suite/storage: disable_clustered_lvm.xml enable_clustered_lvm.xml Log message: Fixed bz217703 (clustered vg creation fails) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.45.2.10&r2=1.45.2.11 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.90.2.8&r2=1.90.2.9 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_bridge.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.30.2.12&r2=1.30.2.13 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/File.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.2&r2=1.1.2.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/docs/storage_api.html.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.5&r2=1.5.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LV.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.6&r2=1.6.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LVM.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.7.2.2&r2=1.7.2.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LVM.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4&r2=1.4.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/PV.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4&r2=1.4.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/StorageModule.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.5&r2=1.5.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/VG.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.8&r2=1.8.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test_suite/storage/disable_clustered_lvm.xml.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.1.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/test_suite/storage/enable_clustered_lvm.xml.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.1.2.1 --- conga/conga.spec.in.in 2006/12/12 05:21:34 1.45.2.10 +++ conga/conga.spec.in.in 2006/12/12 13:26:23 1.45.2.11 @@ -297,6 +297,7 @@ - Fixed bz218040 (luci reports "unknown" as cluster name if cluster creation fails) - Fixed bz218941 (Conga/luci - cannot add node to cluster via luci web app) - Fixed bz219156 (Errors in performing node-specific tasks due to ricci outage not reflected in luci display) +- Fixed bz217703 (clustered vg creation fails) * Thu Nov 16 2006 Stanko Kupcevic 0.8-25 - Fix build issues (D-BUS detection) --- conga/luci/cluster/form-macros 2006/12/11 23:57:59 1.90.2.8 +++ conga/luci/cluster/form-macros 2006/12/12 13:26:23 1.90.2.9 @@ -45,8 +45,7 @@ [cluster node rebooted] - + [cluster node configured] --- conga/luci/site/luci/Extensions/ricci_bridge.py 2006/12/11 23:58:00 1.30.2.12 +++ conga/luci/site/luci/Extensions/ricci_bridge.py 2006/12/12 13:26:23 1.30.2.13 @@ -43,15 +43,16 @@ return (-1, err_msg) def addClusterNodeBatch(os_str, - cluster_name, - install_base, - install_services, - install_shared_storage, - install_LVS, - upgrade_rpms): - + cluster_name, + install_base, + install_services, + install_shared_storage, + install_LVS, + upgrade_rpms): + batch = '' batch += '' + batch += '' batch += '' batch += '' @@ -61,9 +62,7 @@ else: batch += 'false' batch += '"/>' - batch += '' - if install_base or install_services or install_shared_storage: batch += '' if install_services: @@ -72,45 +71,42 @@ batch += '' if install_LVS: batch += '' - batch += '' batch += '' batch += '' batch += '' - + + batch += '' + batch += '' + batch += '' + batch += '' + if install_base or install_services or install_shared_storage: + batch += '' + if install_services: + batch += '' + if install_shared_storage: + batch += '' + if install_LVS: + batch += '' + batch += '' + batch += '' + batch += '' + batch += '' + need_reboot = install_base or install_services or install_shared_storage or install_LVS if need_reboot: - batch += '' - batch += '' - batch += '' - batch += '' - if os_str == 'rhel4': - batch += '' - batch += '' - batch += '' - batch += '' - batch += '' - batch += '' - batch += '' batch += '' batch += '' batch += '' batch += '' else: - # need 2 placeholders instead of disable services / reboot batch += '' batch += '' batch += '' batch += '' batch += '' - - batch += '' - batch += '' - batch += '' - batch += '' - batch += '' - + batch += '' batch += '' batch += '' @@ -127,27 +123,20 @@ batch += '' batch += '' batch += '' - - if need_reboot: - batch += '' + + if install_shared_storage: + batch += '' batch += '' - batch += '' - batch += '' - if os_str == 'rhel4': - batch += '' - batch += '' - batch += '' - batch += '' + batch += '' batch += '' batch += '' else: - # placeholder instead of enable services batch += '' batch += '' batch += '' batch += '' batch += '' - + batch += '' batch += '' batch += '' @@ -157,18 +146,19 @@ return minidom.parseString(batch).firstChild -def createClusterBatch( os_str, - cluster_name, - cluster_alias, - nodeList, - install_base, - install_services, - install_shared_storage, - install_LVS, - upgrade_rpms): - +def createClusterBatch(os_str, + cluster_name, + cluster_alias, + nodeList, + install_base, + install_services, + install_shared_storage, + install_LVS, + upgrade_rpms): + batch = '' batch += '' + batch += '' batch += '' batch += '' @@ -179,7 +169,6 @@ batch += 'false' batch += '"/>' batch += '' - if install_base or install_services or install_shared_storage: batch += '' if install_services: @@ -192,40 +181,38 @@ batch += '' batch += '' batch += '' - + + batch += '' + batch += '' + batch += '' + batch += '' + if install_base or install_services or install_shared_storage: + batch += '' + if install_services: + batch += '' + if install_shared_storage: + batch += '' + if install_LVS: + batch += '' + batch += '' + batch += '' + batch += '' + batch += '' + need_reboot = install_base or install_services or install_shared_storage or install_LVS if need_reboot: - batch += '' - batch += '' - batch += '' - batch += '' - if os_str == 'rhel4': - batch += '' - batch += '' - batch += '' - batch += '' - batch += '' - batch += '' - batch += '' batch += '' batch += '' batch += '' batch += '' else: - # need 2 placeholders instead of disable services / reboot batch += '' batch += '' batch += '' batch += '' batch += '' - - batch += '' - batch += '' - batch += '' - batch += '' - batch += '' - + batch += '' batch += '' batch += '' @@ -233,9 +220,7 @@ batch += '' batch += '' batch += '' - batch += '' - x = 1 for i in nodeList: if os_str == "rhel4": @@ -243,14 +228,11 @@ else: batch += '' x = x + 1 - batch += '' - if len(nodeList) == 2: batch += '' else: batch += '' - batch += '' batch += '' batch += '' @@ -258,27 +240,20 @@ batch += '' batch += '' batch += '' - - if need_reboot: - batch += '' + + if install_shared_storage: + batch += '' batch += '' - batch += '' - batch += '' - if os_str == 'rhel4': - batch += '' - batch += '' - batch += '' - batch += '' + batch += '' batch += '' batch += '' else: - # placeholder instead of enable services batch += '' batch += '' batch += '' batch += '' batch += '' - + batch += '' batch += '' batch += '' --- conga/ricci/common/File.cpp 2006/10/24 21:57:36 1.1.2.2 +++ conga/ricci/common/File.cpp 2006/12/12 13:26:23 1.1.2.3 @@ -51,7 +51,7 @@ bool rw) { if (access(filepath.c_str(), R_OK)) - throw String("missing file ") + filepath; + throw String("unable to read file ") + filepath; ios_base::openmode mode = ios_base::in; if (rw) mode |= ios_base::out; --- conga/ricci/docs/storage_api.html 2006/10/16 20:26:48 1.5 +++ conga/ricci/docs/storage_api.html 2006/12/12 13:26:24 1.5.2.1 @@ -374,6 +374,30 @@ especially unmount error if content fails to unmount

+
  • enable_clustered_lvm

    +
      +

      Enable LVM's cluster locking. + It is an error to call this function if lvm2-cluster + is not installed. +

      +

      No input variables. +

      +

      No output variables.

      +

      On failure:
      - No special errors defined, only generic ones + might get returned.

      +
    +
  • disable_clustered_lvm

    +
      +

      Disable LVM's cluster locking. + It is an error to call this function if lvm2-cluster + is not installed. +

      +

      No input variables. +

      +

      No output variables.

      +

      On failure:
      - No special errors defined, only generic ones + might get returned.

      +



    --- conga/ricci/modules/storage/LV.cpp 2006/09/26 01:16:13 1.6 +++ conga/ricci/modules/storage/LV.cpp 2006/12/12 13:26:24 1.6.2.1 @@ -45,7 +45,7 @@ // if VG is marked as clustered, but cluster locking is not available, throw - if (!LVM::clustered_available() && + if (!LVM::clustered_enabled() && bd_temp.props.get("clustered").get_bool()) throw ClvmdError(); @@ -183,7 +183,7 @@ { // if VG is marked as clustered, but cluster locking is not available, throw if (_props.get("clustered").get_bool() && - !LVM::clustered_available()) + !LVM::clustered_enabled()) throw ClvmdError(); // snapshots neither resize nor replace content, see LV() @@ -247,7 +247,7 @@ { // if VG is marked as clustered, but cluster locking is not available, throw if (_props.get("clustered").get_bool() && - !LVM::clustered_available()) + !LVM::clustered_enabled()) throw ClvmdError(); content->remove(); --- conga/ricci/modules/storage/LVM.cpp 2006/11/29 18:26:53 1.7.2.2 +++ conga/ricci/modules/storage/LVM.cpp 2006/12/12 13:26:24 1.7.2.3 @@ -83,6 +83,9 @@ +static String LVMCONF_PATH("/usr/sbin/lvmconf"); + + // pvs static String PVS_OPTIONS = "pv_name,vg_name,pv_size,pv_free,pv_attr,pv_fmt,pv_uuid,vg_extent_size"; static unsigned int PVS_NAME_IDX = 0; @@ -437,7 +440,7 @@ const list& pv_paths) { if (clustered && - !clustered_available()) + !clustered_enabled()) throw ClvmdError(); vector args; @@ -520,7 +523,7 @@ bool clustered) { if (clustered && - !clustered_available()) + !clustered_enabled()) throw ClvmdError(); vector args; @@ -642,12 +645,39 @@ bool -LVM::clustered_available() +LVM::clustered_enabled() { String locking_type = get_locking_type(); return (locking_type == "2" || locking_type == "3"); } +void +LVM::enable_clustered() +{ + String out, err; + int status; + vector args; + args.push_back("--enable-cluster"); + if (utils::execute(LVMCONF_PATH, args, out, err, status, false)) + throw command_not_found_error_msg(LVMCONF_PATH); + if (status != 0) + throw String("Failed to enable LVM's clustered locking"); +} + +void +LVM::disable_clustered() +{ + String out, err; + int status; + vector args; + args.push_back("--disable-cluster"); + if (utils::execute(LVMCONF_PATH, args, out, err, status, false)) + throw command_not_found_error_msg(LVMCONF_PATH); + if (status != 0) + throw String("Failed to disable LVM's clustered locking"); +} + + bool cluster_quorate() { @@ -714,7 +744,7 @@ void LVM::check_locking() { - if (clustered_available()) { + if (clustered_enabled()) { if (!cluster_quorate()) throw ClusterNotQuorateError(); --- conga/ricci/modules/storage/LVM.h 2006/08/10 22:53:09 1.4 +++ conga/ricci/modules/storage/LVM.h 2006/12/12 13:26:24 1.4.2.1 @@ -73,9 +73,11 @@ static void lvreduce(const String& path, long long new_size); static void lvextend(const String& path, long long new_size); - static void check_locking(); - static bool clustered_available(); static bool vg_clustered(const String& vgname); + static void check_locking(); + static bool clustered_enabled(); + static void enable_clustered(); + static void disable_clustered(); }; --- conga/ricci/modules/storage/PV.cpp 2006/08/10 22:53:09 1.4 +++ conga/ricci/modules/storage/PV.cpp 2006/12/12 13:26:24 1.4.2.1 @@ -94,7 +94,7 @@ // if VG is marked as clustered, but cluster locking is not available, throw - if (!LVM::clustered_available() && + if (!LVM::clustered_enabled() && LVM::vg_clustered(vgname)) throw ClvmdError(); @@ -121,7 +121,7 @@ // if VG is marked as clustered, but cluster locking is not available, throw - if (!LVM::clustered_available() && + if (!LVM::clustered_enabled() && (LVM::vg_clustered(vgname_old) || LVM::vg_clustered(vgname_new))) throw ClvmdError(); @@ -153,7 +153,7 @@ // if VG is marked as clustered, but cluster locking is not available, throw - if (!LVM::clustered_available() && + if (!LVM::clustered_enabled() && LVM::vg_clustered(vgname)) throw ClvmdError(); --- conga/ricci/modules/storage/StorageModule.cpp 2006/10/16 20:26:48 1.5 +++ conga/ricci/modules/storage/StorageModule.cpp 2006/12/12 13:26:24 1.5.2.1 @@ -24,6 +24,7 @@ #include "StorageModule.h" #include "MapperFactory.h" #include "BDFactory.h" +#include "LVM.h" using namespace std; @@ -47,6 +48,9 @@ static VarMap modify_bd(const VarMap& args); static VarMap remove_bd(const VarMap& args); +static VarMap enable_clustered_lvm(const VarMap& args); +static VarMap disable_clustered_lvm(const VarMap& args); + static ApiFcnMap build_fcn_map(); @@ -80,6 +84,9 @@ api_1_0["modify_bd"] = modify_bd; api_1_0["remove_bd"] = remove_bd; + api_1_0["enable_clustered_lvm"] = enable_clustered_lvm; + api_1_0["disable_clustered_lvm"] = disable_clustered_lvm; + ApiFcnMap api_fcn_map; api_fcn_map["1.0"] = api_1_0; @@ -463,3 +470,21 @@ return temp_list; } + +VarMap +enable_clustered_lvm(const VarMap& args) +{ + LVM::enable_clustered(); + + VarMap ret; + return ret; +} + +VarMap +disable_clustered_lvm(const VarMap& args) +{ + LVM::disable_clustered(); + + VarMap ret; + return ret; +} --- conga/ricci/modules/storage/VG.cpp 2006/10/16 15:32:25 1.8 +++ conga/ricci/modules/storage/VG.cpp 2006/12/12 13:26:24 1.8.2.1 @@ -207,7 +207,7 @@ { // if VG is marked as clustered, but cluster locking is not available, throw if (_props.get("clustered").get_bool() && - !LVM::clustered_available()) + !LVM::clustered_enabled()) throw ClvmdError(); String vgname; @@ -252,7 +252,7 @@ { // if VG is marked as clustered, but cluster locking is not available, throw if (_props.get("clustered").get_bool() && - !LVM::clustered_available()) + !LVM::clustered_enabled()) throw ClvmdError(); String vgname = _props.get("vgname").get_string(); @@ -278,7 +278,7 @@ bool clustered = temp.props.get("clustered").get_bool(); if (clustered && - !LVM::clustered_available()) + !LVM::clustered_enabled()) throw ClvmdError(); try { /cvs/cluster/conga/ricci/test_suite/storage/disable_clustered_lvm.xml,v --> standard output revision 1.1.2.1 --- conga/ricci/test_suite/storage/disable_clustered_lvm.xml +++ - 2006-12-12 13:26:29.527944000 +0000 @@ -0,0 +1,13 @@ + + + + + + + + + + + + + /cvs/cluster/conga/ricci/test_suite/storage/enable_clustered_lvm.xml,v --> standard output revision 1.1.2.1 --- conga/ricci/test_suite/storage/enable_clustered_lvm.xml +++ - 2006-12-12 13:26:29.742621000 +0000 @@ -0,0 +1,13 @@ + + + + + + + + + + + + +