From d0efeb7e67af08b8e4a3db12737e9a39231502d9 Mon Sep 17 00:00:00 2001 From: jacob Date: Thu, 4 Aug 2005 18:06:06 +0000 Subject: [PATCH] b=7165 b=7224 - initial support for creating clumanager xml files from lustre xml - support for using lustre init script from clumanager - more changes to init scripts from scripps --- lustre/scripts/lustre | 34 ++++++-- lustre/scripts/lustrefs | 2 +- lustre/utils/lconf | 203 +++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 230 insertions(+), 9 deletions(-) diff --git a/lustre/scripts/lustre b/lustre/scripts/lustre index 72a744d..60b1bda 100755 --- a/lustre/scripts/lustre +++ b/lustre/scripts/lustre @@ -10,18 +10,18 @@ # pidfile: /var/run/lustre.pid ### BEGIN INIT INFO # Provides: lustre -# Required-Start: $network +# Required-Start: $network +sshd # Required-Stop: $network # Should-Start: # Should-Stop: # Default-Start: -# Default-Stop: 0 1 2 6 +# Default-Stop: 0 1 2 3 4 5 6 # Short-Description: Lustre Lite network File System. # Description: This starts both Lustre client and server functions. ### END INIT INFO -SERVICE=lustre +SERVICE=${0##*/} LOCK=/var/lock/subsys/$SERVICE : ${LUSTRE_CFG:=/etc/lustre/lustre.cfg} @@ -30,10 +30,19 @@ LOCK=/var/lock/subsys/$SERVICE : ${LUSTRE_CONFIG_XML:=/etc/lustre/config.xml} : ${LCONF:=/usr/sbin/lconf} -: ${LCONF_START_ARGS:="${LUSTRE_CONFIG_XML}"} -: ${LCONF_STOP_ARGS:="--force --cleanup ${LUSTRE_CONFIG_XML}"} : ${LCTL:=/usr/sbin/lctl} +case "$SERVICE" in + lustre) + : ${LCONF_START_ARGS:="${LUSTRE_CONFIG_XML}"} + : ${LCONF_STOP_ARGS:="--force --cleanup ${LUSTRE_CONFIG_XML}"} + ;; + *) + : ${LCONF_START_ARGS:="--group ${SERVICE} --select ${SERVICE}=${HOSTNAME} ${LUSTRE_CONFIG_XML}"} + : ${LCONF_STOP_ARGS:="--group ${SERVICE} --select ${SERVICE}=${HOSTNAME} --failover --cleanup ${LUSTRE_CONFIG_XML}"} + ;; +esac + # Source function library. if [ -f /etc/init.d/functions ] ; then . /etc/init.d/functions @@ -66,6 +75,21 @@ check_start_stop() { } start() { + if [ -x "/usr/sbin/clustat" -a "${SERVICE}" = "lustre" ] ; then + if [ ! -f "/etc/lustre/start-despite-clumanager" ] ; then + cat >&2 < 8: + panic("CluManager only supports 8 nodes per failover \"cluster.\"") + + new_services = [] + for node_uuid in new_nodes: + node_db = lustreDB.lookup(node_uuid) + if not node_db: + panic("No node entry for " + node_uuid + " was found.") + + new_services += add_clumanager_node(node_db, nodes, services) + + print """ + + + + + + + + + """ % (our_host, config.rawprimary, config.rawsecondary) + + nodekeys = nodes.keys() + nodekeys.sort() + + servicekeys = services.keys() + servicekeys.sort() + + i = 0 + for node in nodekeys: + nodedb = lustreDB.lookup(node) + print " " % (i, nodedb.getName()) + i += 1 + + print " \n " + + i = 0 + for service in servicekeys: + svcdb = lustreDB.lookup(service) + print " " % (i, svcdb.getName()) + i += 1 + + j = 0 + active_uuid = get_active_target(svcdb) + for svc_uuid in [active_uuid] + services[service]: + if svc_uuid == active_uuid and j > 0: + continue + svcdb = lustreDB.lookup(svc_uuid) + + svc_node_uuid = svcdb.get_first_ref('node') + svc_nodedb = lustreDB.lookup(svc_node_uuid) + + print " " % (j, svc_nodedb.getName()) + j += 1 + + print " " + + print " \n " + + i = 0 + for service in servicekeys: + svcdb = lustreDB.lookup(service) + active_uuid = get_active_target(svcdb) + activedb = lustreDB.lookup(active_uuid) + + svc_node_uuid = activedb.get_first_ref('node') + svc_nodedb = lustreDB.lookup(svc_node_uuid) + + print " " \ + % ( svcdb.getName(), i, svcdb.getName(), config.service_scripts, svcdb.getName()) + print " \n " + i += 1 + + print " \n" + def doRecovery(lustreDB, lctl, tgt_uuid, client_uuid, nid_uuid): tgt = lustreDB.lookup(tgt_uuid) if not tgt: @@ -3080,6 +3269,11 @@ lconf_options = [ ('gdb_script', "Fullname of gdb debug script", PARAM, default_gdb_script()), ('debug_path', "Path to save debug dumps", PARAM, default_debug_path()), ('allow_unprivileged_port', "Allow connections from unprivileged ports"), + ('clumanager', "Generate CluManager config file for this node's cluster"), + ('rawprimary', "For clumanager, device of the primary quorum", PARAM, "/dev/raw/raw1"), + ('rawsecondary', "For clumanager, device of the secondary quorum", PARAM, "/dev/raw/raw2"), + ('service_scripts', "For clumanager, directory containing per-service scripts", PARAM, "/etc/lustre/services"), + ('make_service_scripts', "Create per-service symlinks for use with clumanager"), # Client recovery options ('recover', "Recover a device"), ('group', "The group of devices to configure or cleanup", PARAM), @@ -3200,7 +3394,10 @@ def main(): lctl.clear_log(config.record_device, config.record_log) lctl.record(config.record_device, config.record_log) - doHost(lustreDB, node_list) + if config.clumanager: + doClumanager(lustreDB, node_list) + else: + doHost(lustreDB, node_list) if config.record: lctl.end_record() -- 1.8.3.1