diff options
author | Martin Schwenke <martin@meltin.net> | 2018-10-02 15:39:04 +1000 |
---|---|---|
committer | Martin Schwenke <martin@meltin.net> | 2019-03-25 16:52:25 +1100 |
commit | acab4ff108c902fec404582e9a6fb50cc81a2c04 (patch) | |
tree | b94507f4f95f15140a446961ca048b5d074b2340 | |
parent | 5cc52f23c345faf13daf579c3e8eaafb5a08a56c (diff) | |
download | autocluster-acab4ff108c902fec404582e9a6fb50cc81a2c04.tar.gz autocluster-acab4ff108c902fec404582e9a6fb50cc81a2c04.tar.xz autocluster-acab4ff108c902fec404582e9a6fb50cc81a2c04.zip |
Remove bash autocluster script and supporting files
Signed-off-by: Martin Schwenke <martin@meltin.net>
117 files changed, 2 insertions, 7211 deletions
@@ -89,8 +89,7 @@ clusters generated by autocluster. If you're still running RHEL5.4, you have lots of time, you have lots of disk space, and you like complexity, then see the - sections below on "iSCSI shared disks" and "Raw IDE system - disks". :-) + section below on "Raw IDE system disks". :-) * Fedora @@ -433,7 +432,7 @@ Keep it simple * The NODES configuration variable controls the types of nodes that are created. At the time of writing, the default value is: - NODES="nas:0-3 rhel_base:4" + NODES="nas:0-3 base:4" This means that you get 4 clustered NAS nodes, at IP offsets 0, 1, 2, & 3 from FIRSTIP, all part of the CTDB cluster. You also get an @@ -455,39 +454,6 @@ the system disk, try using IDE system disks: SYSTEM_DISK_TYPE=ide -iSCSI shared disks -================== - -The RHEL5 version of KVM does not support the SCSI block device -emulation. Therefore, you can use either virtio or iSCSI shared -disks. Unfortunately, in RHEL5.4 and early versions of RHEL5.5, -virtio block devices are not supported by the version of multipath in -RHEL5. So this leaves iSCSI as the only choice. - -The main configuration options you need for iSCSI disks are: - - SHARED_DISK_TYPE=iscsi - NICMODEL=virtio # Recommended for performance - add_extra_package iscsi-initiator-utils - -Note that SHARED_DISK_PREFIX and SHARED_DISK_CACHE are ignored for -iSCSI shared disks because KVM doesn't (need to) know about them. - -You will need to install the scsi-target-utils package on the host -system. After creating a cluster, autocluster will print a message -that points you to a file tmp/iscsi.$CLUSTER - you need to run the -commands in this file (probably via: sh tmp/iscsi.$CLUSTER) before -booting your cluster. This will remove any old target with the same -ID, and create the new target, LUNs and ACLs. - -You can use the following command to list information about the -target: - - tgtadm --lld iscsi --mode target --op show - -If you need multiple clusters using iSCSI on the same host then each -cluster will need to have a different setting for ISCSI_TID. - Raw IDE system disks ==================== @@ -520,11 +486,6 @@ need these settings: SYSTEM_DISK_FORMAT=raw BASE_FORMAT=raw -Note that if you're testing cluster creation with iSCSI shared disks -then you should find a way of switching off raw disks. This avoids -every iSCSI glitch costing you a lot of time while raw disks are -copied. - DEVELOPMENT HINTS ================= diff --git a/autocluster b/autocluster deleted file mode 100755 index d086009..0000000 --- a/autocluster +++ /dev/null @@ -1,1639 +0,0 @@ -#!/bin/bash -# main autocluster script -# -# Copyright (C) Andrew Tridgell 2008 -# Copyright (C) Martin Schwenke 2008 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see <http://www.gnu.org/licenses/>. - -##BEGIN-INSTALLDIR-MAGIC## -# There are better ways of doing this but not if you still want to be -# able to run straight out of a git tree. :-) -if [ -f "$0" ]; then - autocluster="$0" -else - autocluster=$(which "$0") -fi -if [ -L "$autocluster" ] ; then - autocluster=$(readlink "$autocluster") -fi -installdir=$(dirname "$autocluster") -##END-INSTALLDIR-MAGIC## - -#################### -# show program usage -usage () -{ - cat <<EOF -Usage: autocluster [OPTION] ... <COMMAND> - options: - -c <file> specify config file (default is "config") - -e <expr> execute <expr> and exit - -E <expr> execute <expr> and continue - -x enable script debugging - --dump dump config settings and exit - - configuration options: -EOF - - usage_config_options - - cat <<EOF - - commands: - base [ create | boot ] ... - - cluster [ build | - destroy | undefine | - create | update_hosts | boot | setup ] ... - - create base - create a base image - - create cluster [ CLUSTERNAME ] - create a full cluster - - create node CLUSTERNAME IP_OFFSET - (re)create a single cluster node - - mount DISK - mount a qemu disk on mnt/ - - unmount | umount - unmount a qemu disk from mnt/ - - bootbase - boot the base image -EOF - exit 1 -} - -############################### - -die () { - if [ "$no_sanity" = 1 ] ; then - fill_text 0 "WARNING: $*" >&2 - else - fill_text 0 "ERROR: $*" >&2 - exit 1 - fi -} - -announce () -{ - echo "######################################################################" - printf "# %-66s #\n" "$*" - echo "######################################################################" - echo "" -} - -waitfor () -{ - local file="$1" - local msg="$2" - local timeout="$3" - - local tmpfile=$(mktemp) - - cat <<EOF >"$tmpfile" -spawn tail -n 10000 -f $file -expect -timeout $timeout -re "$msg" -EOF - - export LANG=C - expect "$tmpfile" - rm -f "$tmpfile" - - if ! grep -E "$msg" "$file" > /dev/null; then - echo "Failed to find \"$msg\" in \"$file\"" - return 1 - fi - - return 0 -} - -############################### - -# Indirectly call a function named by ${1}_${2} -call_func () { - local func="$1" ; shift - local type="$1" ; shift - - local f="${func}_${type}" - if type -t "$f" >/dev/null && ! type -P "$f" >/dev/null ; then - "$f" "$@" - else - f="${func}_DEFAULT" - if type -t "$f" >/dev/null && ! type -P "$f" >/dev/null ; then - "$f" "$type" "$@" - else - die "No function defined for \"${func}\" \"${type}\"" - fi - fi -} - -# Note that this will work if you pass "call_func f" because the first -# element of the node tuple is the node type. Nice... :-) -for_each_node () -{ - local n - for n in $NODES ; do - "$@" $(IFS=: ; echo $n) || return 1 - done -} - -node_is_ctdb_node_DEFAULT () -{ - echo 0 -} - -hack_one_node_with () -{ - local filter="$1" ; shift - - local node_type="$1" - local ip_offset="$2" - local name="$3" - local ctdb_node="$4" - - $filter - - local item="${node_type}:${ip_offset}${name:+:}${name}${ctdb_node:+:}${ctdb_node}" - nodes="${nodes}${nodes:+ }${item}" -} - -# This also gets used for non-filtering iteration. -hack_all_nodes_with () -{ - local filter="$1" - - local nodes="" - for_each_node hack_one_node_with "$filter" - NODES="$nodes" -} - -list_all_cluster_nodes () -{ - # Local function only defined in subshell - ( - print_node_name () - { - echo "$3" - } - for_each_node print_node_name - ) | sort -} - -list_all_virsh_domains () -{ - local pattern="${CLUSTER_PATTERN:-${CLUSTER}[a-z]*[0-9]}" - - local domains=$(virsh list --all | awk '{print $2}' | tail -n +3) - local d - for d in $domains ; do - case "$d" in - ($pattern) echo "$d" ;; - esac - done | sort -} - -virsh_cluster () -{ - local command="$1" - shift - - local nodes=$(list_all_cluster_nodes) - local domains=$(list_all_virsh_domains) - - if [ "$nodes" != "$domains" ] ; then - echo "WARNING: Found matching virsh domains that are not part of this cluster!" - echo - fi - - local ret=0 - local n - for n in $nodes ; do - virsh "$command" "$n" "$@" 2>&1 || ret=$? - done - - return $ret -} - -register_hook () -{ - local hook_var="$1" - local new_hook="$2" - - eval "$hook_var=\"${!hook_var}${!hook_var:+ }${new_hook}\"" -} - -run_hooks () -{ - local hook_var="$1" - shift - - local i - for i in ${!hook_var} ; do - $i "$@" - done -} - -# Use with care, since this may clear some autocluster defaults.! -clear_hooks () -{ - local hook_var="$1" - - eval "$hook_var=\"\"" -} - -############################## - -# These hooks are intended to customise the value of $DISK. They have -# access to 1 argument ("base", "system", "shared") and the variables -# $VIRTBASE, $CLUSTER, $BASENAME (for "base"), $NAME (for "system"), -# $SHARED_DISK_NUM (for "shared"). A hook must be deterministic and -# should not be stateful, since they can be called multiple times for -# the same disk. -hack_disk_hooks="" - -create_node_DEFAULT () -{ - local type="$1" - local ip_offset="$2" - local name="$3" - local ctdb_node="$4" - - echo "Creating node \"$name\" (of type \"${type}\")" - - create_node_COMMON "$name" "$ip_offset" "$type" -} - -# common node creation stuff -create_node_COMMON () -{ - local NAME="$1" - local ip_offset="$2" - local type="$3" - local template_file="${4:-$NODE_TEMPLATE}" - - if [ "$SYSTEM_DISK_FORMAT" != "qcow2" -a "$BASE_FORMAT" = "qcow2" ] ; then - die "Error: if BASE_FORMAT is \"qcow2\" then SYSTEM_DISK_FORMAT must also be \"qcow2\"." - fi - - local IPNUM=$(($FIRSTIP + $ip_offset)) - make_network_map - - # Determine base image name. We use $DISK temporarily to allow - # the path to be hacked. - local DISK="${VIRTBASE}/${BASENAME}.${BASE_FORMAT}" - if [ "$BASE_PER_NODE_TYPE" = "yes" ] ; then - DISK="${VIRTBASE}/${BASENAME}-${type}.${BASE_FORMAT}" - fi - run_hooks hack_disk_hooks "base" - local base_disk="$DISK" - - # Determine the system disk image name. - DISK="${VIRTBASE}/${CLUSTER}/${NAME}.${SYSTEM_DISK_FORMAT}" - run_hooks hack_disk_hooks "system" - - local di="$DISK" - if [ "$DISK_FOLLOW_SYMLINKS" = "yes" -a -L "$DISK" ] ; then - di=$(readlink "$DISK") - fi - rm -f "$di" - local di_dirname="${di%/*}" - mkdir -p "$di_dirname" - - case "$SYSTEM_DISK_FORMAT" in - qcow2) - echo "Creating the disk..." - qemu-img create -b "$base_disk" -f qcow2 "$di" - create_node_configure_image "$DISK" "$type" - ;; - raw) - echo "Creating the disk..." - cp -v --sparse=always "$base_disk" "$di" - create_node_configure_image "$DISK" "$type" - ;; - reflink) - echo "Creating the disk..." - cp -v --reflink=always "$base_disk" "$di" - create_node_configure_image "$DISK" "$type" - ;; - mmclone) - echo "Creating the disk (using mmclone)..." - local base_snap="${base_disk}.snap" - [ -f "$base_snap" ] || mmclone snap "$base_disk" "$base_snap" - mmclone copy "$base_snap" "$di" - create_node_configure_image "$DISK" "$type" - ;; - none) - echo "Skipping disk image creation as requested" - ;; - *) - die "Error: unknown SYSTEM_DISK_FORMAT=\"${SYSTEM_DISK_FORMAT}\"." - esac - - # Pull the UUID for this node out of the map. - UUID=$(awk "\$1 == $ip_offset {print \$2}" $uuid_map) - - mkdir -p tmp - - echo "Creating $NAME.xml" - substitute_vars $template_file tmp/$NAME.xml - - # install the XML file - $VIRSH undefine $NAME > /dev/null 2>&1 || true - $VIRSH define tmp/$NAME.xml -} - -create_node_configure_image () -{ - local disk="$1" - local type="$2" - - diskimage mount "$disk" - setup_base "$type" - diskimage unmount -} - -hack_network_map_hooks="" - -# Uses: CLUSTER, NAME, NETWORKS, FIRSTIP, ip_offset -make_network_map () -{ - network_map="tmp/network_map.$NAME" - - if [ -n "$CLUSTER" ] ; then - local md5=$(echo "$CLUSTER" | md5sum) - local nh=$(printf "%02x" $ip_offset) - local mac_prefix="02:${md5:0:2}:${md5:2:2}:00:${nh}:" - else - local mac_prefix="02:42:42:00:00:" - fi - - local n - local count=1 - for n in $NETWORKS ; do - local ch=$(printf "%02x" $count) - local mac="${mac_prefix}${ch}" - - set -- ${n//,/ } - local ip_bits="$1" ; shift - local dev="$1" ; shift - local opts="$*" - - local net="${ip_bits%/*}" - local netname="acnet_${net//./_}" - - local ip="${net%.*}.${IPNUM}/${ip_bits#*/}" - - local ipv6="fc00:${net//./:}::${IPNUM}/64" - - # This can be used to override the variables in the echo - # statement below. The hook can use any other variables - # available in this function. - run_hooks hack_network_map_hooks - - echo "${netname} ${dev} ${ip} ${ipv6} ${mac} ${opts}" - count=$(($count + 1)) - done >"$network_map" -} - -############################## - -expand_nodes () -{ - # Expand out any abbreviations in NODES. - local ns="" - local n - for n in $NODES ; do - local t="${n%:*}" - local ips="${n#*:}" - case "$ips" in - *,*) - local i - for i in ${ips//,/ } ; do - ns="${ns}${ns:+ }${t}:${i}" - done - ;; - *-*) - local i - for i in $(seq ${ips/-/ }) ; do - ns="${ns}${ns:+ }${t}:${i}" - done - ;; - *) - ns="${ns}${ns:+ }${n}" - esac - done - NODES="$ns" - - # Check IP addresses for duplicates. - local ip_offsets=":" - # This function doesn't modify anything... - get_ip_offset () - { - [ "${ip_offsets/${ip_offset}}" != "$ip_offsets" ] && \ - die "Duplicate IP offset in NODES - ${node_type}:${ip_offset}" - ip_offsets="${ip_offsets}${ip_offset}:" - } - hack_all_nodes_with get_ip_offset - - # Determine node names and whether they're in the CTDB cluster - declare -A node_count - _get_name_ctdb_node () - { - local count=$((${node_count[$node_type]:-0} + 1)) - node_count[$node_type]=$count - name=$(call_func node_name_format "$node_type" "$CLUSTER" $count) || { - echo "ERROR: Node type \"${node_type}\" not defined!" - echo "Valid node types are:" - set | sed -n 's@^node_name_format_\(.*\) ().*@ \1@p' - exit 1 - } - ctdb_node=$(call_func node_is_ctdb_node "$node_type") - } - hack_all_nodes_with _get_name_ctdb_node -} - -############################## - -sanity_check_cluster_name () -{ - [ -z "${CLUSTER//[A-Za-z0-9]}" ] || \ - die "Cluster names should be restricted to the characters A-Za-z0-9. \ -Some cluster filesystems have problems with other characters." -} - -hosts_file= - -cluster_nodelist_hacking () -{ - # Rework the NODES list - expand_nodes - - # Build /etc/hosts and hack the names of the ctdb nodes - hosts_line_hack_name () - { - local sname="" - local hosts_line - local ip_addr="${NETWORK_PRIVATE_PREFIX}.$(($FIRSTIP + $ip_offset))" - - # Primary name for CTDB nodes is <CLUSTER>n<num> - if [ "$ctdb_node" = 1 ] ; then - num_ctdb_nodes=$(($num_ctdb_nodes + 1)) - sname="${CLUSTER}n${num_ctdb_nodes}" - hosts_line="$ip_addr ${sname}.${ld} ${name}.${ld} $name $sname" - name="$sname" - else - hosts_line="$ip_addr ${name}.${ld} $name" - fi - - # This allows you to add a function to your configuration file - # to modify hostnames (and other aspects of nodes). This - # function can access/modify $name (the existing name), - # $node_type and $ctdb_node (1, if the node is a member of the - # CTDB cluster, 0 otherwise). - if [ -n "$HOSTNAME_HACKING_FUNCTION" ] ; then - local old_name="$name" - $HOSTNAME_HACKING_FUNCTION - if [ "$name" != "$old_name" ] ; then - hosts_line="$ip_addr ${name}.${ld} $name" - fi - fi - - echo "$hosts_line" - } - hosts_file="tmp/hosts.$CLUSTER" - { - local num_ctdb_nodes=0 - local ld=$(echo $DOMAIN | tr A-Z a-z) - echo "# autocluster $CLUSTER" - hack_all_nodes_with hosts_line_hack_name - echo - } >$hosts_file - - # Build /etc/ctdb/nodes - ctdb_nodes_line () - { - [ "$ctdb_node" = 1 ] || return 0 - echo "${NETWORK_PRIVATE_PREFIX}.$(($FIRSTIP + $ip_offset))" - num_nodes=$(($num_nodes + 1)) - } - nodes_file="tmp/nodes.$CLUSTER" - local num_nodes=0 - hack_all_nodes_with ctdb_nodes_line >$nodes_file - - # Build /etc/ctdb/nodes.ipv6 - ctdb_nodes_line_ipv6 () - { - [ "$ctdb_node" = 1 ] || return 0 - echo "fc00:${NETWORK_PRIVATE_PREFIX//./:}::$(($FIRSTIP + $ip_offset))" - num_nodes=$(($num_nodes + 1)) - } - nodes_file_ipv6="tmp/nodes.$CLUSTER.ipv6" - local num_nodes=0 - hack_all_nodes_with ctdb_nodes_line_ipv6 >$nodes_file_ipv6 - - # Build UUID map - uuid_map="tmp/uuid_map.$CLUSTER" - uuid_map_line () - { - echo "${ip_offset} $(uuidgen) ${node_type}" - } - hack_all_nodes_with uuid_map_line >$uuid_map -} - -create_cluster_hooks= -cluster_created_hooks= - -cluster_create () -{ - # Use $1. If not set then use value from configuration file. - CLUSTER="${1:-${CLUSTER}}" - announce "cluster create \"${CLUSTER}\"" - [ -n "$CLUSTER" ] || die "\$CLUSTER not set" - - sanity_check_cluster_name - - mkdir -p $VIRTBASE/$CLUSTER $KVMLOG tmp - - # Run hooks before doing anything else. - run_hooks create_cluster_hooks - - for_each_node call_func create_node - - echo "Cluster $CLUSTER created" - echo "" - - run_hooks cluster_created_hooks -} - -cluster_created_hosts_message () -{ - echo "You may want to add this to your /etc/hosts file:" - cat $hosts_file -} - -register_hook cluster_created_hooks cluster_created_hosts_message - -cluster_destroy () -{ - announce "cluster destroy \"${CLUSTER}\"" - [ -n "$CLUSTER" ] || die "\$CLUSTER not set" - - virsh_cluster destroy || true -} - -cluster_undefine () -{ - announce "cluster undefine \"${CLUSTER}\"" - [ -n "$CLUSTER" ] || die "\$CLUSTER not set" - - virsh_cluster undefine --managed-save || true -} - -cluster_update_hosts () -{ - announce "cluster update_hosts \"${CLUSTER}\"" - [ -n "$CLUSTER" ] || die "\$CLUSTER not set" - - [ -n "$hosts_file" ] || hosts_file="tmp/hosts.${CLUSTER}" - [ -r "$hosts_file" ] || die "Missing hosts file \"${hosts_file}\"" - - # Building a general node name regexp is a bit cumbersome. :-) - local name_regexp="(" - for i in $(set | sed -n -e "s@^\(node_name_format_.*\) ().*@\1@p") ; do - # Format node name with placeholders (remembering that "_" is - # not valid in a real cluster name) - local t=$("$i" "_" "0") - # now replace the placeholders with regexps - order is - # important here, since the cluster name can contain digits - t=$(sed -r -e "s@[[:digit:]]+@[[:digit:]]+@" -e "s@_@${CLUSTER}@" <<<"$t") - # add to the regexp - name_regexp="${name_regexp}${t}|" - done - name_regexp="${name_regexp}${CLUSTER}n[[:digit:]]+)" - - local pat="# autocluster ${CLUSTER}\$|[[:space:]]${name_regexp}" - - local t="/etc/hosts.${CLUSTER}" - grep -E "$pat" /etc/hosts >"$t" || true - if diff -B "$t" "$hosts_file" >/dev/null ; then - rm "$t" - return - fi - - local old=/etc/hosts.old.autocluster - cp /etc/hosts "$old" - local new=/etc/hosts.new - grep -Ev "$pat" "$old" | - cat -s - "$hosts_file" >"$new" - - mv "$new" /etc/hosts - - echo "Made these changes to /etc/hosts:" - diff -u "$old" /etc/hosts || true -} - -cluster_boot () -{ - announce "cluster boot \"${CLUSTER}\"" - [ -n "$CLUSTER" ] || die "\$CLUSTER not set" - - virsh_cluster start || return $? - - local nodes=$(list_all_cluster_nodes) - - # Wait for each node - local i - for i in $nodes ; do - waitfor "${KVMLOG}/serial.$i" "login:" 300 || { - vircmd destroy "$CLUSTER_PATTERN" - die "Failed to create cluster" - } - done - - # Move past the last line of log output - echo "" -} - -cluster_setup_tasks_DEFAULT () -{ - local stage="$1" - - # By default nodes have no tasks - case "$stage" in - install_packages) echo "" ;; - setup_clusterfs) echo "" ;; - setup_node) echo "" ;; - setup_cluster) echo "" ;; - esac -} - -cluster_setup () -{ - announce "cluster setup \"${CLUSTER}\"" - [ -n "$CLUSTER" ] || die "\$CLUSTER not set" - - local ssh="ssh -n -o StrictHostKeyChecking=no" - local setup_clusterfs_done=false - local setup_cluster_done=false - - _cluster_setup_do_stage () - { - local stage="$1" - local type="$2" - local ip_offset="$3" - local name="$4" - local ctdb_node="$5" - - local tasks=$(call_func cluster_setup_tasks "$type" "$stage") - - if [ -n "$tasks" ] ; then - # These tasks are only done on 1 node - case "$stage" in - setup_clusterfs) - if $setup_clusterfs_done ; then - return - else - setup_clusterfs_done=true - fi - ;; - setup_cluster) - if $setup_cluster_done ; then - return - else - setup_cluster_done=true - fi - ;; - esac - - $ssh "$name" ./scripts/cluster_setup.sh "$stage" $tasks - fi - - } - - local stages="install_packages setup_clusterfs setup_node setup_cluster" - local stage - for stage in $stages ; do - for_each_node _cluster_setup_do_stage "$stage" || \ - die "task $stage failed" - done -} - -create_one_node () -{ - CLUSTER="$1" - local single_node_ip_offset="$2" - - sanity_check_cluster_name - - mkdir -p $VIRTBASE/$CLUSTER $KVMLOG tmp - - for n in $NODES ; do - set -- $(IFS=: ; echo $n) - [ $single_node_ip_offset -eq $2 ] || continue - call_func create_node "$@" - - echo "Requested node created" - echo "" - echo "You may want to update your /etc/hosts file:" - cat $hosts_file - - break - done -} - -############################### -# test the proxy setup -test_proxy() { - export http_proxy=$WEBPROXY - wget -O /dev/null $INSTALL_SERVER || \ - die "Your WEBPROXY setting \"$WEBPROXY\" is not working" - echo "Proxy OK" -} - -################### - -kickstart_floppy_create_hooks= - -guess_install_network () -{ - # Figure out IP address to use during base install. Default to - # the IP address of the 1st (private) network. If a gateway is - # specified then use the IP address associated with it. - INSTALL_IP="" - INSTALL_GW="" - local netname dev ip ipv6 mac opts - while read netname dev ip ipv6 mac opts; do - local o - for o in $opts ; do - case "$o" in - gw\=*) - INSTALL_GW="${o#gw=}" - INSTALL_IP="$ip" - esac - done - [ -n "$INSTALL_IP" ] || INSTALL_IP="$ip" - done <"$network_map" -} - -# create base image -base_create() -{ - local NAME="$BASENAME" - local DISK="${VIRTBASE}/${NAME}.${BASE_FORMAT}" - run_hooks hack_disk_hooks "base" - - mkdir -p $KVMLOG - - echo "Testing WEBPROXY $WEBPROXY" - test_proxy - - local di="$DISK" - if [ "$DISK_FOLLOW_SYMLINKS" = "yes" -a -L "$DISK" ] ; then - di=$(readlink "$DISK") - fi - rm -f "$di" - local di_dirname="${di%/*}" - mkdir -p "$di_dirname" - - echo "Creating the disk" - qemu-img create -f $BASE_FORMAT "$di" $DISKSIZE - - rm -rf tmp - mkdir -p mnt tmp tmp/ISO - - setup_timezone - - IPNUM=$FIRSTIP - make_network_map - - guess_install_network - - echo "Creating kickstart file from template" - substitute_vars "$KICKSTART" "tmp/ks.cfg" - - # $ISO gets $ISO_DIR prepended if it doesn't start with a leading '/'. - case "$ISO" in - (/*) : ;; - (*) ISO="${ISO_DIR}/${ISO}" - esac - - echo "Creating kickstart floppy" - dd if=/dev/zero of=tmp/floppy.img bs=1024 count=1440 - mkdosfs -n KICKSTART tmp/floppy.img - mount -o loop -t msdos tmp/floppy.img mnt - cp tmp/ks.cfg mnt - mount -o loop,ro $ISO tmp/ISO - - echo "Setting up bootloader" - cp tmp/ISO/isolinux/isolinux.bin tmp - cp tmp/ISO/isolinux/vmlinuz tmp - cp tmp/ISO/isolinux/initrd.img tmp - - run_hooks kickstart_floppy_create_hooks - - umount tmp/ISO - umount mnt - - UUID=`uuidgen` - - substitute_vars $INSTALL_TEMPLATE tmp/$NAME.xml - - rm -f $KVMLOG/serial.$NAME - - # boot the install CD - $VIRSH create tmp/$NAME.xml - - echo "Waiting for install to start" - sleep 2 - - # wait for the install to finish - if ! waitfor $KVMLOG/serial.$NAME "$KS_DONE_MESSAGE" $CREATE_BASE_TIMEOUT ; then - $VIRSH destroy $NAME - die "Failed to create base image ${DISK} after waiting for ${CREATE_BASE_TIMEOUT} seconds. -You may need to increase the value of CREATE_BASE_TIMEOUT. -Alternatively, the install might have completed but KS_DONE_MESSAGE -(currently \"${KS_DONE_MESSAGE}\") -may not have matched anything at the end of the kickstart output." - fi - - $VIRSH destroy $NAME - - ls -l $DISK - cat <<EOF - -Install finished, base image $DISK created - -You may wish to run - chcon -t virt_content_t $DISK - chattr +i $DISK -To ensure that this image does not change - -Note that the root password has been set to $ROOTPASSWORD - -EOF -} - -############################### -# boot the base disk -base_boot() { - rm -rf tmp - mkdir -p tmp - - NAME="$BASENAME" - DISK="${VIRTBASE}/${NAME}.${BASE_FORMAT}" - - IPNUM=$FIRSTIP - - make_network_map - - CLUSTER="base" - - diskimage mount $DISK - setup_base - diskimage unmount - - UUID=`uuidgen` - - echo "Creating $NAME.xml" - substitute_vars $BOOT_TEMPLATE tmp/$NAME.xml - - # boot the base system - $VIRSH create tmp/$NAME.xml -} - -###################################################################### - -# Updating a disk image... - -diskimage () -{ - local func="$1" - shift - call_func diskimage_"$func" "$SYSTEM_DISK_ACCESS_METHOD" "$@" -} - -# setup the files from $BASE_TEMPLATES/, substituting any variables -# based on the config -copy_base_dir_substitute_templates () -{ - local dir="$1" - - local d="$BASE_TEMPLATES/$dir" - [ -d "$d" ] || return 0 - - local f - for f in $(cd "$d" && find . \! -name '*~' \( -type d -name .svn -prune -o -print \) ) ; do - f="${f#./}" # remove leading "./" for clarity - if [ -d "$d/$f" ]; then - # Don't chmod existing directory - if diskimage is_directory "/$f" ; then - continue - fi - diskimage mkdir_p "/$f" - else - echo " Install: $f" - diskimage substitute_vars "$d/$f" "/$f" - fi - diskimage chmod_reference "$d/$f" "/$f" - done -} - -setup_base_hooks= - -setup_base_ssh_keys () -{ - # this is needed as git doesn't store file permissions other - # than execute - # Note that we protect the wildcards from the local shell. - diskimage chmod 600 "/etc/ssh/*key" "/root/.ssh/*" - diskimage chmod 700 "/etc/ssh" "/root/.ssh" "/root" - if [ -r "$HOME/.ssh/id_rsa.pub" ]; then - echo "Adding $HOME/.ssh/id_rsa.pub to ssh authorized_keys" - diskimage append_text_file "$HOME/.ssh/id_rsa.pub" "/root/.ssh/authorized_keys" - fi - if [ -r "$HOME/.ssh/id_dsa.pub" ]; then - echo "Adding $HOME/.ssh/id_dsa.pub to ssh authorized_keys" - diskimage append_text_file "$HOME/.ssh/id_dsa.pub" "/root/.ssh/authorized_keys" - fi -} - -register_hook setup_base_hooks setup_base_ssh_keys - -setup_base_grub_conf () -{ - echo "Adjusting grub.conf" - local o="$EXTRA_KERNEL_OPTIONS" # For readability. - local grub_configs="/boot/grub/grub.conf" - if ! diskimage is_file "$grub_configs" ; then - grub_configs="/etc/default/grub /boot/grub2/grub.cfg" - fi - local c - for c in $grub_configs ; do - diskimage sed "$c" \ - -e "s/console=ttyS0,19200/console=ttyS0,115200/" \ - -e "s/ console=tty1//" -e "s/ rhgb/ norhgb/" \ - -e "s/ nodmraid//" -e "s/ nompath//" \ - -e "s/quiet/noapic divider=10${o:+ }${o}/g" - done -} - -register_hook setup_base_hooks setup_base_grub_conf - -setup_base() -{ - local type="$1" - - umask 022 - echo "Copy base files" - copy_base_dir_substitute_templates "all" - if [ -n "$type" ] ; then - copy_base_dir_substitute_templates "$type" - fi - - run_hooks setup_base_hooks -} - -ipv4_prefix_to_netmask () -{ - local prefix="$1" - - local div=$(($prefix / 8)) - local mod=$(($prefix % 8)) - - local octet - for octet in 1 2 3 4 ; do - if [ $octet -le $div ] ; then - echo -n "255" - elif [ $mod -ne 0 -a $octet -eq $(($div + 1)) ] ; then - local shift=$((8 - $mod)) - echo -n $(( (255 >> $shift << $shift) )) - else - echo -n 0 - fi - if [ $octet -lt 4 ] ; then - echo -n '.' - fi - done - - echo -} - -# setup various networking components -setup_network() -{ - # This avoids doing anything when we're called from boot_base(). - if [ -z "$hosts_file" ] ; then - echo "Skipping network-related setup" - return - fi - - echo "Setting up networks" - diskimage append_text_file "$hosts_file" "/etc/hosts" - - echo "Setting up /etc/ctdb/nodes" - diskimage mkdir_p "/etc/ctdb" - if [ "$NETWORK_STACK" = "ipv4" ] ; then - diskimage put "$nodes_file" "/etc/ctdb/nodes" - elif [ "$NETWORK_STACK" = "ipv6" ] ; then - diskimage put "$nodes_file_ipv6" "/etc/ctdb/nodes" - elif [ "$NETWORK_STACK" = "dual" ] ; then - diskimage put "$nodes_file" "/etc/ctdb/nodes.ipv4" - diskimage put "$nodes_file_ipv6" "/etc/ctdb/nodes.ipv6" - diskimage put "$nodes_file" "/etc/ctdb/nodes" - else - die "Error: Invalid NETWORK_STACK value \"$NETWORK_STACK\"." - fi - - [ "$WEBPROXY" = "" ] || { - diskimage append_text "export http_proxy=$WEBPROXY" "/etc/bashrc" - } - - if [ -n "$NFSSHARE" -a -n "$NFS_MOUNTPOINT" ] ; then - echo "Enabling nfs mount of $NFSSHARE" - diskimage mkdir_p "$NFS_MOUNTPOINT" - diskimage append_text "$NFSSHARE $NFS_MOUNTPOINT nfs nfsvers=3,intr 0 0" "/etc/fstab" - fi - - diskimage mkdir_p "/etc/yum.repos.d" - echo '@@@YUM_TEMPLATE@@@' | diskimage substitute_vars - "/etc/yum.repos.d/autocluster.repo" - - diskimage rm_rf "/etc/udev/rules.d/70-persistent-net.rules" - - echo "Setting up network interfaces: " - local netname dev ip ipv6 mac opts - while read netname dev ip ipv6 mac opts; do - echo " $dev" - - local o gw addr mask - gw="" - for o in $opts ; do - case "$o" in - gw\=*) - gw="${o#gw=}" - esac - done - - addr=${ip%/*} - mask=$(ipv4_prefix_to_netmask ${ip#*/}) - - cat <<EOF | \ - diskimage put - "/etc/sysconfig/network-scripts/ifcfg-${dev}" -DEVICE=$dev -ONBOOT=yes -TYPE=Ethernet -IPADDR=$addr -NETMASK=$mask -HWADDR=$mac -IPV6INIT=yes -IPV6ADDR=$ipv6 -${gw:+GATEWAY=}${gw} -EOF - - # This goes to 70-persistent-net.rules - cat <<EOF -# Generated by autocluster -SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="${mac}", ATTR{type}=="1", KERNEL=="eth*", NAME="${dev}" - -EOF - done <"$network_map" | - diskimage put - "/etc/udev/rules.d/70-persistent-net.rules" -} - -register_hook setup_base_hooks setup_network - -setup_base_cluster_setup_config () -{ - local f - { - echo "# Generated by autocluster" - echo - # This is a bit of a hack. Perhaps these script belong - # elsewhere, since they no longer have templates? - for f in $(find "${BASE_TEMPLATES}/all/root/scripts" -type f | - xargs grep -l '^#config:') ; do - - b=$(basename "$f") - echo "# $b" - local vs v - vs=$(sed -n 's@^#config: *@@p' "$f") - for v in $vs ; do - # This could substitute the values in directly using - # ${!v} but then no sanity checking is done to make - # sure variables are set. - echo "${v}=\"@@${v}@@\"" - done - echo - done - } | diskimage substitute_vars - "/root/scripts/cluster_setup.config" -} - -register_hook setup_base_hooks setup_base_cluster_setup_config - -setup_timezone() { - [ -z "$TIMEZONE" ] && { - [ -r /etc/timezone ] && { - TIMEZONE=`cat /etc/timezone` - } - [ -r /etc/sysconfig/clock ] && { - . /etc/sysconfig/clock - TIMEZONE="$ZONE" - } - TIMEZONE="${TIMEZONE// /_}" - } - [ -n "$TIMEZONE" ] || \ - die "Unable to determine TIMEZONE - please set in config" -} - -# substite a set of variables of the form @@XX@@ for the shell -# variables $XX in a file. -# -# Indirect variables @@@XX@@@ (3 ats) specify that the variable should -# contain a filename whose contents are substituted, with variable -# substitution applied to those contents. If filename starts with '|' -# it is a command instead - however, quoting is extremely fragile. -substitute_vars() {( - infile="${1:-/dev/null}" # if empty then default to /dev/null - outfile="$2" # optional - - tmp_out=$(mktemp) - cat "$infile" >"$tmp_out" - - # Handle any indirects by looping until nothing changes. - # However, only handle 10 levels of recursion. - count=0 - while : ; do - if ! _substitute_vars "$tmp_out" "@@@" ; then - rm -f "$tmp_out" - die "Failed to expand template $infile" - fi - - # No old version of file means no changes made. - if [ ! -f "${tmp_out}.old" ] ; then - break - fi - - rm -f "${tmp_out}.old" - - count=$(($count + 1)) - if [ $count -ge 10 ] ; then - rm -f "$tmp_out" - die "Recursion too deep in $infile - only 10 levels allowed!" - fi - done - - # Now regular variables. - if ! _substitute_vars "$tmp_out" "@@" ; then - rm -f "$tmp_out" - die "Failed to expand template $infile" - fi - rm -f "${tmp_out}.old" - - if [ -n "$outfile" ] ; then - mv "$tmp_out" "$outfile" - else - cat "$tmp_out" - rm -f "$tmp_out" - fi -)} - - -# Delimiter @@ means to substitute contents of variable. -# Delimiter @@@ means to substitute contents of file named by variable. -# @@@ supports leading '|' in variable value, which means to excute a -# command. -_substitute_vars() {( - tmp_out="$1" - delimiter="${2:-@@}" - - # Get the list of variables used in the template. The grep - # gets rid of any blank lines and lines with extraneous '@'s - # next to template substitutions. - VARS=$(sed -n -e "s#[^@]*${delimiter}\([A-Z0-9_][A-Z0-9_]*\)${delimiter}[^@]*#\1\n#gp" "$tmp_out" | - grep '^[A-Z0-9_][A-Z0-9_]*$' | - sort -u) - - tmp=$(mktemp) - for v in $VARS; do - # variable variables are fun ..... - [ "${!v+x}" ] || { - rm -f $tmp - die "No substitution given for ${delimiter}$v${delimiter} in $infile" - } - s=${!v} - - if [ "$delimiter" = "@@@" ] ; then - f=${s:-/dev/null} - c="${f#|}" # Is is a command, signified by a leading '|'? - if [ "$c" = "$f" ] ; then - # No leading '|', cat file. - s=$(cat -- "$f") - [ $? -eq 0 ] || { - rm -f $tmp - die "Could not substitute contents of file $f" - } - else - # Leading '|', execute command. - # Quoting problems here - using eval "$c" doesn't help. - s=$($c) - [ $? -eq 0 ] || { - rm -f $tmp - die "Could not execute command $c" - } - fi - fi - - # escape some pesky chars - # This first one can be too slow if done using a bash - # variable pattern subsitution. - s=$(echo -n "$s" | tr '\n' '\001' | sed -e 's/\o001/\\n/g') - s=${s//#/\\#} - s=${s//&/\\&} - echo "s#${delimiter}${v}${delimiter}#${s}#g" - done > $tmp - - # Get the in-place sed to make a backup of the old file. - # Remove the backup if it is the same as the resulting file - - # this acts as a flag to the caller that no changes were made. - sed -i.old -f $tmp "$tmp_out" - if cmp -s "${tmp_out}.old" "$tmp_out" ; then - rm -f "${tmp_out}.old" - fi - - rm -f $tmp -)} - -check_command() { - which $1 > /dev/null || die "Please install $1 to continue" -} - -# Set a variable if it isn't already set. This allows environment -# variables to override default config settings. -defconf() { - local v="$1" - local e="$2" - - [ "${!v+x}" ] || eval "$v=\"$e\"" -} - -load_config () { - local i - - for i in "${installdir}/config.d/"*.defconf ; do - . "$i" - done -} - -# Print the list of config variables defined in config.d/. -get_config_options () {( # sub-shell for local declaration of defconf() - local options= - defconf() { options="$options $1" ; } - load_config - echo $options -)} - -# Produce a list of long options, suitable for use with getopt, that -# represent the config variables defined in config.d/. -getopt_config_options () { - local x=$(get_config_options | tr 'A-Z_' 'a-z-') - echo "${x// /:,}:" -} - -# Unconditionally set the config variable associated with the given -# long option. -setconf_longopt () { - local longopt="$1" - local e="$2" - - local v=$(echo "${longopt#--}" | tr 'a-z-' 'A-Z_') - # unset so defconf will set it - eval "unset $v" - defconf "$v" "$e" -} - -# Dump all of the current config variables. -dump_config() { - local o - for o in $(get_config_options) ; do - echo "${o}=\"${!o}\"" - done - exit 0 -} - -# $COLUMNS is set in interactive bash shells. It probably isn't set -# in this shell, so let's set it if it isn't. -: ${COLUMNS:=$(stty size 2>/dev/null | sed -e 's@.* @@')} -: ${COLUMNS:=80} -export COLUMNS - -# Print text assuming it starts after other text in $startcol and -# needs to wrap before $COLUMNS - 2. Subsequent lines start at $startcol. -# Long "words" will extend past $COLUMNS - 2. -fill_text() { - local startcol="$1" - local text="$2" - - local width=$(($COLUMNS - 2 - $startcol)) - [ $width -lt 0 ] && width=$((78 - $startcol)) - - local out="" - - local padding - if [ $startcol -gt 0 ] ; then - padding=$(printf "\n%${startcol}s" " ") - else - padding=" -" - fi - - while [ -n "$text" ] ; do - local orig="$text" - - # If we already have output then arrange padding on the next line. - [ -n "$out" ] && out="${out}${padding}" - - # Break the text at $width. - out="${out}${text:0:${width}}" - text="${text:${width}}" - - # If we have left over text then the line break may be ugly, - # so let's check and try to break it on a space. - if [ -n "$text" ] ; then - # The 'x's stop us producing a special character like '(', - # ')' or '!'. Yuck - there must be a better way. - if [ "x${text:0:1}" != "x " -a "x${text: -1:1}" != "x " ] ; then - # We didn't break on a space. Arrange for the - # beginning of the broken "word" to appear on the next - # line but not if it will make us loop infinitely. - if [ "${orig}" != "${out##* }${text}" ] ; then - text="${out##* }${text}" - out="${out% *}" - else - # Hmmm, doing that would make us loop, so add the - # rest of the word from the remainder of the text - # to this line and let it extend past $COLUMNS - 2. - out="${out}${text%% *}" - if [ "${text# *}" != "$text" ] ; then - # Remember the text after the next space for next time. - text="${text# *}" - else - # No text after next space. - text="" - fi - fi - else - # We broke on a space. If it will be at the beginning - # of the next line then remove it. - text="${text# }" - fi - fi - done - - echo "$out" -} - -# Display usage text, trying these approaches in order. -# 1. See if it all fits on one line before $COLUMNS - 2. -# 2. See if splitting before the default value and indenting it -# to $startcol means that nothing passes $COLUMNS - 2. -# 3. Treat the message and default value as a string and just us fill_text() -# to format it. -usage_display_text () { - local startcol="$1" - local desc="$2" - local default="$3" - - local width=$(($COLUMNS - 2 - $startcol)) - [ $width -lt 0 ] && width=$((78 - $startcol)) - - default="(default \"$default\")" - - if [ $((${#desc} + 1 + ${#default})) -le $width ] ; then - echo "${desc} ${default}" - else - local padding=$(printf "%${startcol}s" " ") - - if [ ${#desc} -lt $width -a ${#default} -lt $width ] ; then - echo "$desc" - echo "${padding}${default}" - else - fill_text $startcol "${desc} ${default}" - fi - fi -} - -# Display usage information for long config options. -usage_smart_display () {( # sub-shell for local declaration of defconf() - local startcol=33 - - defconf() { - local local longopt=$(echo "$1" | tr 'A-Z_' 'a-z-') - - printf " --%-25s " "${longopt}=${3}" - - usage_display_text $startcol "$4" "$2" - } - - "$@" -)} - - -# Display usage information for long config options. -usage_config_options (){ - usage_smart_display load_config -} - -actions_init () -{ - actions="" -} - -actions_add () -{ - actions="${actions}${actions:+ }$*" -} - -actions_run () -{ - [ -n "$actions" ] || usage - - local a - for a in $actions ; do - $a - done -} - -###################################################################### - -post_config_hooks= - -###################################################################### - -load_config - -############################ -# parse command line options -long_opts=$(getopt_config_options) -getopt_output=$(getopt -n autocluster -o "c:e:E:xh" -l help,dump -l "$long_opts" -- "$@") -[ $? != 0 ] && usage - -use_default_config=true - -# We do 2 passes of the options. The first time we just handle usage -# and check whether -c is being used. -eval set -- "$getopt_output" -while true ; do - case "$1" in - -c) shift 2 ; use_default_config=false ;; - -e) shift 2 ;; - -E) shift 2 ;; - --) shift ; break ;; - --dump|-x) shift ;; - -h|--help) usage ;; # Usage should be shown here for real defaults. - --*) shift 2 ;; # Assume other long opts are valid and take an arg. - *) usage ;; # shouldn't happen, so this is reasonable. - esac -done - -config="./config" -$use_default_config && [ -r "$config" ] && . "$config" - -eval set -- "$getopt_output" - -while true ; do - case "$1" in - -c) - b=$(basename $2) - # force at least ./local_file to avoid accidental file - # from $PATH - . "$(dirname $2)/${b}" - # If $CLUSTER is unset then try to base it on the filename - if [ ! -n "$CLUSTER" ] ; then - case "$b" in - *.autocluster) - CLUSTER="${b%.autocluster}" - esac - fi - shift 2 - ;; - -e) no_sanity=1 ; run_hooks post_config_hooks ; eval "$2" ; exit ;; - -E) eval "$2" ; shift 2 ;; - -x) set -x; shift ;; - --dump) no_sanity=1 ; run_hooks post_config_hooks ; dump_config ;; - --) shift ; break ;; - -h|--help) usage ;; # Redundant. - --*) - # Putting --opt1|opt2|... into a variable and having case - # match against it as a pattern doesn't work. The | is - # part of shell syntax, so we need to do this. Look away - # now to stop your eyes from bleeding! :-) - x=",${long_opts}" # Now each option is surrounded by , and : - if [ "$x" != "${x#*,${1#--}:}" ] ; then - # Our option, $1, surrounded by , and : was in $x, so is legal. - setconf_longopt "$1" "$2"; shift 2 - else - usage - fi - ;; - *) usage ;; # shouldn't happen, so this is reasonable. - esac -done - -run_hooks post_config_hooks - -# catch errors -set -e -set -E -trap 'es=$?; - echo ERROR: failed in function \"${FUNCNAME}\" at line ${LINENO} of ${BASH_SOURCE[0]} with code $es; - exit $es' ERR - -# check for needed programs -check_command expect - -[ $# -lt 1 ] && usage - -t="$1" -shift - -case "$t" in - base) - actions_init - for t in "$@" ; do - case "$t" in - create|boot) actions_add "base_${t}" ;; - *) usage ;; - esac - done - actions_run - ;; - - cluster) - actions_init - for t in "$@" ; do - case "$t" in - destroy|undefine|create|update_hosts|boot|setup) - actions_add "cluster_${t}" ;; - build) - for t in destroy undefine create update_hosts boot setup ; do - actions_add "cluster_${t}" - done - ;; - *) usage ;; - esac - done - cluster_nodelist_hacking - actions_run - ;; - - create) - t="$1" - shift - case "$t" in - base) - [ $# != 0 ] && usage - base_create - ;; - cluster) - [ $# != 1 ] && usage - cluster_create "$1" - ;; - node) - [ $# != 2 ] && usage - create_one_node "$1" "$2" - ;; - *) - usage; - ;; - esac - ;; - mount) - [ $# != 1 ] && usage - diskimage mount "$1" - ;; - unmount|umount) - [ $# != 0 ] && usage - diskimage unmount - ;; - bootbase) - base_boot; - ;; - *) - usage; - ;; -esac diff --git a/base/all/etc/chrony.conf b/base/all/etc/chrony.conf deleted file mode 100644 index b7eb8ac..0000000 --- a/base/all/etc/chrony.conf +++ /dev/null @@ -1,41 +0,0 @@ -server @@KVMHOST@@ iburst - -# Ignore stratum in source selection. -stratumweight 0 - -# Record the rate at which the system clock gains/losses time. -driftfile /var/lib/chrony/drift - -# Enable kernel RTC synchronization. -rtcsync - -# In first three updates step the system clock instead of slew -# if the adjustment is larger than 10 seconds. -makestep 10 3 - -# Allow NTP client access from local network. -#allow 192.168/16 - -# Listen for commands only on localhost. -bindcmdaddress 127.0.0.1 -bindcmdaddress ::1 - -# Serve time even if not synchronized to any NTP server. -#local stratum 10 - -keyfile /etc/chrony.keys - -# Specify the key used as password for chronyc. -commandkey 1 - -# Generate command key if missing. -generatecommandkey - -# Disable logging of client accesses. -noclientlog - -# Send a message to syslog if a clock adjustment is larger than 0.5 seconds. -logchange 0.5 - -logdir /var/log/chrony -#log measurements statistics tracking diff --git a/base/all/etc/hostname b/base/all/etc/hostname deleted file mode 100644 index d55105e..0000000 --- a/base/all/etc/hostname +++ /dev/null @@ -1 +0,0 @@ -@@NAME@@.@@DOMAIN@@ diff --git a/base/all/etc/hosts b/base/all/etc/hosts deleted file mode 100644 index 4d7acd6..0000000 --- a/base/all/etc/hosts +++ /dev/null @@ -1,5 +0,0 @@ -127.0.0.1 localhost - -@@@HOSTS_STATIC_ENTRIES@@@ - -@@KVMHOST@@ kvmhost diff --git a/base/all/etc/init.d/iscsimultipath b/base/all/etc/init.d/iscsimultipath deleted file mode 100755 index f11c5d2..0000000 --- a/base/all/etc/init.d/iscsimultipath +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/sh -# -# chkconfig: 345 14 88 -# description: Runs "multipath" when designated number of SCSI disks available. -# -# Source function library. -. /etc/init.d/functions - -# Note that you should not run *chkconfig* to enable this initscript -# on nodes where you do not expect to see autocluster iSCSI devices. -# Doing so will merely annoy you by slowing down system boot by -# waiting for phantom devices to appear. - -PATH=/sbin:/bin:/usr/sbin:/usr/bin - -RETVAL=0 - -npaths=$((@@SHAREDDISK_COUNT@@ * @@SHARED_DISK_MULTIPATH_NUMPATHS@@)) - -correct_number_of_devices () -{ - _glob="$1" - _num_desired=$2 - - _n=$(grep AUTCLSTR $_glob 2>/dev/null | wc -l) - - [ "$_n" = "$_num_desired" ] -} - -wait_for_devices () -{ - _glob="$1" - _num_desired=$2 - _timeout="${3:-60}" - - _count=0 - while : ; do - if correct_number_of_devices "$_glob" $_num_desired ; then - return 0 - fi - - if [ $_count -ge $_timeout ] ; then - echo "TIMEOUT (iscsi)" - return 1 - fi - - _count=$(($_count + 1)) - sleep 1 - done -} - -sd_pat='/sys/block/sd*/device/vendor' -slave_pat='/sys/block/dm-*/slaves/*/device/vendor' - -start() -{ - echo -n "Setting up multipath for iSCSI devices:" - - if wait_for_devices "$sd_pat" $npaths ; then - _c=0 - while : ; do - multipath - if correct_number_of_devices "$slave_pat" $npaths ; then - break - fi - if [ $_c -ge 30 ] ; then - echo "TIMEOUT (multipath)" - failure - RETVAL=1 - break - fi - multipath -F - _c=$(($_c + 1)) - sleep 1 - done - - success - echo - else - RETVAL=1 - failure - fi -} - -stop() -{ - echo -n "Flushing multipath devices:" - - if multipath -F && \ - wait_for_devices "$slave_pat" 0 ; then - success - else - RETVAL=1 - failure - fi -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - *) - echo $"Usage: $0 {start|stop|restart}" - exit 1 -esac -exit $RETVAL diff --git a/base/all/etc/multipath.conf b/base/all/etc/multipath.conf deleted file mode 100644 index 5f5bc32..0000000 --- a/base/all/etc/multipath.conf +++ /dev/null @@ -1,8 +0,0 @@ -defaults { -@@RHEL_MULTIPATH_MAGIC@@ - user_friendly_names yes -} - -blacklist { - devnode "^@@SYSTEM_DISK_PREFIX@@a[0-9]*" -} diff --git a/base/all/etc/ntp.conf b/base/all/etc/ntp.conf deleted file mode 100644 index f00a5e7..0000000 --- a/base/all/etc/ntp.conf +++ /dev/null @@ -1,3 +0,0 @@ -server @@KVMHOST@@ burst iburst minpoll 4 maxpoll 5 -driftfile /var/lib/ntp/drift -logfile /var/log/ntp diff --git a/base/all/etc/resolv.conf b/base/all/etc/resolv.conf deleted file mode 100644 index 81f217d..0000000 --- a/base/all/etc/resolv.conf +++ /dev/null @@ -1,3 +0,0 @@ -domain @@DOMAIN@@ -search @@DNSSEARCH@@ -nameserver @@NAMESERVER@@ diff --git a/base/all/etc/rsyslog.d/autocluster.conf b/base/all/etc/rsyslog.d/autocluster.conf deleted file mode 100644 index 6478b45..0000000 --- a/base/all/etc/rsyslog.d/autocluster.conf +++ /dev/null @@ -1,14 +0,0 @@ -# Select a high precision time format. This allows accurate merging -# of logs from multiple cluster nodes for easier CTDB debugging. -$ActionFileDefaultTemplate RSYSLOG_FileFormat - -# Turn off rate-limiting. Why would we want to lose messages by -# default? -$SystemLogRateLimitInterval 0 -$SystemLogRateLimitBurst 0 - -# Turn on UDP listener to be able to take advantage of CTDB's new -# direct-to-syslog-on-UDP feature. -$ModLoad imudp -$UDPServerAddress 127.0.0.1 -$UDPServerRun 514 diff --git a/base/all/etc/ssh/ssh_host_dsa_key b/base/all/etc/ssh/ssh_host_dsa_key deleted file mode 100644 index 6e39156..0000000 --- a/base/all/etc/ssh/ssh_host_dsa_key +++ /dev/null @@ -1,12 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBuwIBAAKBgQDTH5zgb1vZnizu+Fqlotm8u9IqiQcRYyuyEkawjSps7ZvZh4Ax -x7ldgrgCmFu00+uUSMYBbbK+f0ElC9ID2KTYfT+RIdXrvmKQ4HDxwC0mZD0XN7zd -N93ErHwQmqgfe5Bb0Lh3BwohgQ8vxm/mTJIeBfkCmSf0YBlw0Flb5a0TSwIVAOzs -ta8M9YH993nZkvRBQNKCw2PbAoGAAQiMOGZSVi553IA0+2VyFzkPLG86mznpN2wv -0+iqnq7cGi1SVsUcK1M66h1Qiw3u/xvGrKEnyAlR1xaPRwU5+YcRBfkdhpd43Ps2 -ul40Q6gEvrzc3zWelEcoi+Vo7K0atXbJ4eOLxKWn6hReQOyP4ntiqVyGhek444bI -2NQRp0sCgYEAqwHjDznoTOl+88JIOc9BFfeSKlxvZwDChMrakQbFAL4ZqQzs26fA -SkiSMxOvTRA4hBKGqSnpvF6SW0eI/i+m3slVWGy9xkUWxTT34v+lqgCtECcAGGSc -2iFkAIzLU2gS9q9sRhoMxgu8HOo+/NuUnJjdy0XeR221xrmdNKU3bWQCFHS/MVQ3 -/dXNQ3xI5h4mc0ti9rVY ------END DSA PRIVATE KEY----- diff --git a/base/all/etc/ssh/ssh_host_dsa_key.pub b/base/all/etc/ssh/ssh_host_dsa_key.pub deleted file mode 100644 index 80d97eb..0000000 --- a/base/all/etc/ssh/ssh_host_dsa_key.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-dss AAAAB3NzaC1kc3MAAACBANMfnOBvW9meLO74WqWi2by70iqJBxFjK7ISRrCNKmztm9mHgDHHuV2CuAKYW7TT65RIxgFtsr5/QSUL0gPYpNh9P5Eh1eu+YpDgcPHALSZkPRc3vN033cSsfBCaqB97kFvQuHcHCiGBDy/Gb+ZMkh4F+QKZJ/RgGXDQWVvlrRNLAAAAFQDs7LWvDPWB/fd52ZL0QUDSgsNj2wAAAIABCIw4ZlJWLnncgDT7ZXIXOQ8sbzqbOek3bC/T6KqertwaLVJWxRwrUzrqHVCLDe7/G8asoSfICVHXFo9HBTn5hxEF+R2Gl3jc+za6XjRDqAS+vNzfNZ6URyiL5WjsrRq1dsnh44vEpafqFF5A7I/ie2KpXIaF6TjjhsjY1BGnSwAAAIEAqwHjDznoTOl+88JIOc9BFfeSKlxvZwDChMrakQbFAL4ZqQzs26fASkiSMxOvTRA4hBKGqSnpvF6SW0eI/i+m3slVWGy9xkUWxTT34v+lqgCtECcAGGSc2iFkAIzLU2gS9q9sRhoMxgu8HOo+/NuUnJjdy0XeR221xrmdNKU3bWQ= diff --git a/base/all/etc/ssh/ssh_host_key b/base/all/etc/ssh/ssh_host_key Binary files differdeleted file mode 100644 index 8f60797..0000000 --- a/base/all/etc/ssh/ssh_host_key +++ /dev/null diff --git a/base/all/etc/ssh/ssh_host_key.pub b/base/all/etc/ssh/ssh_host_key.pub deleted file mode 100644 index b8bd0e6..0000000 --- a/base/all/etc/ssh/ssh_host_key.pub +++ /dev/null @@ -1 +0,0 @@ -2048 35 20252980202451949958905786764725313337742591059018852581799593004941325731099310714327202947858566997656146334485077099525517223738033871191442081516672845641770572839575436988988777429454947081523157988216378740189731911355159730114936525355069526884937750841011367193826321599742549827295523785672838108611230353132749687084270785046597241545461991807234914364306051793068637504425015601877571406092530975305081565479877615925977535784796919203701058205383547479053396551719443610956448558745988295246817729671537317690830738776230483972636404621684936576793340010515147961813822714986992626803617790163957578719817 diff --git a/base/all/etc/ssh/ssh_host_rsa_key b/base/all/etc/ssh/ssh_host_rsa_key deleted file mode 100644 index 5cb1b98..0000000 --- a/base/all/etc/ssh/ssh_host_rsa_key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAxfDl15K5niEx5c8uv0EGkht929UuC4BEz4CuNpaVBx/dUJiY -bs6umHEovq0CKTh9J+WfDY+/ACVJxkCn8erx+gWOqj2FbtXtfBqml8LJKfdnfI9a -EEtzsXV+b5bTFZTuovAom77y3rfwjq1Y/GigvtLC96YABXU6UMqwye5r0A+jBAmG -J9o4+GVpl6LoFAsH1KiJR+Q3h4oXOL5smuq6FTW9rZnPSIRWffsVVFRL7Up+Imf3 -e1zIaXrsZKtmTn00h2HhNquGLboWHIDQbKvcdCUZgFkTl+Ed1FAogi1RpRR+uepe -1HUz4ZAYsi9SBAXMfOQpRMoZcM073bwTJvfWTwIBIwKCAQEAh7shQ11MFKkMRc/l -inW7XN+mwqDPHdRMcQfH6urp2P/oN0QQwQLA3Y9sZX3y2m/gyuaY81tBJKva0RZk -iKEa9JYYr0Ag+4thBKSPfgHpBtWIynDtTQCJ2MWYhwhWOq9EjPxznf9HdCZbz4zP -Tf6aHHND3QQdRZI2nczQ/37q187+rSLLYVmbDUri+LxWAjlwoLcRNhDgtnR7wx1v -3fn226zAuEmgdKZv78jSU9bms+03HV1dBEQKBPRqJvF75+R1XaR4w7VejWC8jBmB -RLF1uPRM/VPpuw7KDFjbWK6oMLWIxrXrU5k6F0KTqg4IgKjZidNx0FnH1ZDW/ENX -V9BCiwKBgQD7UNEBn8Wo8lLG1EKtq9bX2RDQBqhyakW4uxwS5kq4AWsAHFkEeMVl -SoOChmg8l897PISWe/3dHRnLXStQF01acQhRVIvhWb4R4S0udaLtRGOUVuMNNpGa -DrWRfs5l2Sb2fpcG9T0cw64qt4J7UcSiU4okO0lXfl7qkBaCZg8uHwKBgQDJoWXG -mhyN6AVtGKLnpPXBETdq0mMoEy/Uq8IWkOjPaMQkhIAWJaGN9cgKvlKpjxZn2xCO -rnuyBSdbjrVBhQKu7cm1Ggx68Hmb7wPFctt4110/jVum2y9HyO5XIgrhL492GYoL -WqNNEUuBTVhfoUrs6wWpuah+haXCcxixYNjx0QKBgBWKlZJsx8ynDmjQXXyZs1RU -byfGDnA0/qlvH6nZOZq+SwACbgeylJOnTRnRAZ7LLwqQKJ8vMwRS85UWnVAB/1Dl -HfhXtDfjHuuW9T5/HJf+jDFJRqlccuFRt8qkeBdbwYLXpouRXQJ3LC+MEn+ZS15e -7pVkKtudHhQa+p12dlRpAoGBAJuLIqCFg73tgIdcJeXlp6OQ8Dx2ab/USXgsukvs -IU+LVXtBpKNe27anqPJYTmWLo5HyIrc2JOhqYDCv6ulmm6uEPIRkjUjlZSCFLsuE -fWvZVpAclyjyOmqTsIxcFwV8dfwFErhNPCWCXtF2Ljskp4OQuznJvH7cIMk0N57H -DcHbAoGBAMdOYhDiui3vqEuwPdftu25hcAWZQtcM/8aL0oLdxdyiCwQuKkh1Xz4w -/m814QW6xAXvd8Q7apFHC1jNKtjW49qLdbNFId+20bIYbZSph1+ij6PStGyTM92e -A/I1EIfzb4uu4g7iLdRFeKNnAJSYeE0Eb6W+QOthflmIUgIT6kAj ------END RSA PRIVATE KEY----- diff --git a/base/all/etc/ssh/ssh_host_rsa_key.pub b/base/all/etc/ssh/ssh_host_rsa_key.pub deleted file mode 100644 index b1a4157..0000000 --- a/base/all/etc/ssh/ssh_host_rsa_key.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxfDl15K5niEx5c8uv0EGkht929UuC4BEz4CuNpaVBx/dUJiYbs6umHEovq0CKTh9J+WfDY+/ACVJxkCn8erx+gWOqj2FbtXtfBqml8LJKfdnfI9aEEtzsXV+b5bTFZTuovAom77y3rfwjq1Y/GigvtLC96YABXU6UMqwye5r0A+jBAmGJ9o4+GVpl6LoFAsH1KiJR+Q3h4oXOL5smuq6FTW9rZnPSIRWffsVVFRL7Up+Imf3e1zIaXrsZKtmTn00h2HhNquGLboWHIDQbKvcdCUZgFkTl+Ed1FAogi1RpRR+uepe1HUz4ZAYsi9SBAXMfOQpRMoZcM073bwTJvfWTw== diff --git a/base/all/etc/sysconfig/network b/base/all/etc/sysconfig/network deleted file mode 100644 index 482aa15..0000000 --- a/base/all/etc/sysconfig/network +++ /dev/null @@ -1,5 +0,0 @@ -NETWORKING=yes -NETWORKING_IPV6=no -HOSTNAME=@@NAME@@.@@DOMAIN@@ -PEERDNS=no -NOZEROCONF=yes diff --git a/base/all/etc/sysconfig/prelink b/base/all/etc/sysconfig/prelink deleted file mode 100644 index 9558f36..0000000 --- a/base/all/etc/sysconfig/prelink +++ /dev/null @@ -1,3 +0,0 @@ -# we don't want prelinking on virtual machines, as it just chews -# CPU and disk space -PRELINKING=no diff --git a/base/all/root/.ssh/authorized_keys b/base/all/root/.ssh/authorized_keys deleted file mode 100644 index 3b2e069..0000000 --- a/base/all/root/.ssh/authorized_keys +++ /dev/null @@ -1,3 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAqb5/Xec12KIY7PiIEs9xEAL2VSgGyJ0aaYU/pd/Fe9GB9wTVH02We8fGHcbB19S0S8W4P6nyadSmVlkUflGVfs6UbFV2IZF1DYnwmTmlP98g9Em25tTcSmr1Mo2GcPJ38t7JQF28SC3hioxtXJlfqG8vi4RiFk6ujHKacPcHRgMJVruqaohqXN49Zlb6m2dfM8QkbsPzUDYksUDGXBWrDAQ7ZsTEYZVaWZ5n6qSvZ54hzZy/h71P0nTsuF4tC91LIs6L8Y1Qga3zfa+ZZZRYvBeEhmhqlUxPzVrd/MDA1CNLUApSRNZpgKMdUT8w+fw2wimwsEWyVByOM31hsqqVNQ== root@localhost -ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEApxKsDbKMflPJp17OLG39v+VtTliqSMmy0C4ipgHLwlRwWTPQoPv0r2yTP03f4O7DABdeNwo+Hz0LxR2QNuMuZBOdri7PH27vshGBGn9OLJI4otw3Aq1m63htQxWXBEhBjZPRZ6PvSOm4RVhHviCL9rW+D3xfZYQtRTp5qDFci4ElNF7x+Z1bwZ1NVsyefcATr3vm+7KfoEqjUQ9QfuNJH0TuTTAcTjz2jQEB7gZsZ7PSpXmMK7vRSuZpf/iRLnCEPSj4nJqsMPEctedq/bKWEWggAsPvKCjr3wvpJdnPH+2zAv6IvaFzWTrLtVY/NBuGosIyXZW84LpplgPym6Z50f04yowKUBSb0vDSq5X3VwiwBdzvEiMSrz9z7fli9vcKUQWUBAAwVbhWDwOOMC2kf0KTSmVNmVMMmorjlUkGafYlUh4SYW+CRrBXi5xVGyw/7uzEWUA26UDDNanptFduAYV8DMlJXaoCDbJbmyLyQ8RJYho8KiNFLYaaZqbZq5O+NQWGcNTGAmqRjy5QD2lTUepCAiY0P24k1HHncj83b8kb8Vx3I6yfZ57y3wwKUbdlljJs+FVegScPAiMutovIeuu0G/InwjGzTAFJju5K2z1IK+CWJMokQRmuPwRcep+X3AUhnzGn6+S5FYefoLOi+8jqs3IJWO6Qk47MVSzt6Rs= -ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxE5h7j+/TFLXXgQTBr8A5n05Uvz/C7qVAwVKk39qQM6AiGX0GSX17ugnq7FMFLWsIC/jVjY/r494iWnoZC3Ec4nMmGYMOloNJarW88N6Mk1XRWklORkZ+R+e/twGF9JfMph3aSUNSxZWJlYCVxwn22lu7WCC31TCmCVSzXe/FVTSVgjXlgJoGqksfkZ/rWSrEhXMQsuRW65aQ8IUH7oR9ZDQTiUfdJqYOSbeXQkABHLaVGrVCEkm6y+7uA9AvM/iadmBL8M+dBuS1DZmUWf+ZhiUmBRv99nYUuxjLl2mdhkqlaPkVEWkvbxOhC/kyDI8LXRsuudQIMBw8OWje29jVQ== root@localhost diff --git a/base/all/root/.ssh/config b/base/all/root/.ssh/config deleted file mode 100644 index 04971cb..0000000 --- a/base/all/root/.ssh/config +++ /dev/null @@ -1,4 +0,0 @@ -CheckHostIP no -KeepAlive no -Cipher blowfish -StrictHostKeyChecking=no diff --git a/base/all/root/.ssh/id_rsa b/base/all/root/.ssh/id_rsa deleted file mode 100644 index 0dba5d0..0000000 --- a/base/all/root/.ssh/id_rsa +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEogIBAAKCAQEAqb5/Xec12KIY7PiIEs9xEAL2VSgGyJ0aaYU/pd/Fe9GB9wTV -H02We8fGHcbB19S0S8W4P6nyadSmVlkUflGVfs6UbFV2IZF1DYnwmTmlP98g9Em2 -5tTcSmr1Mo2GcPJ38t7JQF28SC3hioxtXJlfqG8vi4RiFk6ujHKacPcHRgMJVruq -aohqXN49Zlb6m2dfM8QkbsPzUDYksUDGXBWrDAQ7ZsTEYZVaWZ5n6qSvZ54hzZy/ -h71P0nTsuF4tC91LIs6L8Y1Qga3zfa+ZZZRYvBeEhmhqlUxPzVrd/MDA1CNLUApS -RNZpgKMdUT8w+fw2wimwsEWyVByOM31hsqqVNQIBIwKCAQA6Mq9TZTcIchcsrPt0 -Kd2fFvVfBmi5z3bFF74M/EO1bGcS3RXe2MXhS87lozslbX+k81UdJFMc+HOLUb3i -Kpmn0cx86hnfn5XYwZRRyp8OlaTmCqUb8TWV24dEiEtZ7LtpNnDi3k8usKUZjztw -NJXTWVIhNLPqZB6WjbFLTWGUWEEPB5Ft2j0h0gCjcu6rtGWgY2tFjCnb8sQF/GfP -xAdCy1RAkSucPhfodigzrTWcPfTKsFlSTuAk7mo23EkAISQSUuJMJvEnvZDjt2c3 -Ci8kmZ/duy4DmBC/HPPcjv2LZT8XbCib2I+HABelc6l4SQj2OIvJugWY73Ra4BBg -mQ4LAoGBANE2J2PRmoCLovteOQW6IgGDPUmowLOrYhIxOub7zDPUS36F82kyvgXO -N7a+Pz3Y8N/gOlVn2heVLQBdr/d0gELCFBagPZZAvMpTxsIJ4uLdmiBTrobsVFfP -IzqsyyrPyaLRwbsKCvfFJePC4qavScu7hMd6eq8+0UIugQcTt5wZAoGBAM+0vjPD -MWIulsArZBIXId/yD4yQf8WN+qwZOwXs+GIKPQckf0anIjl6uLvrAZUxozfzirrv -0n/RkIvlVmCsUbSAngvzM3riXZfnEepQfmxeZ/yWrUgefHHQzdwMqd0tx7B598t0 -PnnHEknryzFWiBDjKqbUFx1skONRRCraieV9AoGBAI91l1pj16iaQ9+RESh/okou -G2W1i3PjO+83s1yPZ3P/SbXYMeG8ZQtLk+sGHLyyBEG+U+LK3rEV1bcbq9ziLBCF -FRbUR3z5MP/Eawi2Um+t5geJ1sLrMoVa1lQetzNMp4WXJcIVg90ZeRE1LbQgbR38 -7VWV0HgrEyYRQoiCjIhLAoGAZOLCyK9D3zszR2WIYI7kkVhQsf0K3ExGjhriJ3MZ -jrSECsiVl1h+Vm7Owayo/1KfvBc0wTKoEjKWqllzGQM9oNDBy0o9k3VDZwnVgHA9 -Z9YVQCvtw/GM5tMiKQ13E6iFkDs919lgLIVDZbur1iK3HiUx+UJxoJPRWHft6O3N -8x8CgYEAr7fVluta4hlbdmwSynJ+mOGcOesEURZisYTBV4ffGT7d1bojbT8GtHn9 -xoJ0l9TXjYnFMzEx2qI75AXD4So1VshsNPThMCpYW00posTitDdIdrsZMLffr7ql -EY+ZJPit72q38GyGokGBSPtmlX2F4C4FUHqzM7ceLeoqpktLljU= ------END RSA PRIVATE KEY----- - diff --git a/base/all/root/.ssh/id_rsa.pub b/base/all/root/.ssh/id_rsa.pub deleted file mode 100644 index 8fae277..0000000 --- a/base/all/root/.ssh/id_rsa.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAqb5/Xec12KIY7PiIEs9xEAL2VSgGyJ0aaYU/pd/Fe9GB9wTVH02We8fGHcbB19S0S8W4P6nyadSmVlkUflGVfs6UbFV2IZF1DYnwmTmlP98g9Em25tTcSmr1Mo2GcPJ38t7JQF28SC3hioxtXJlfqG8vi4RiFk6ujHKacPcHRgMJVruqaohqXN49Zlb6m2dfM8QkbsPzUDYksUDGXBWrDAQ7ZsTEYZVaWZ5n6qSvZ54hzZy/h71P0nTsuF4tC91LIs6L8Y1Qga3zfa+ZZZRYvBeEhmhqlUxPzVrd/MDA1CNLUApSRNZpgKMdUT8w+fw2wimwsEWyVByOM31hsqqVNQ== root@localhost diff --git a/base/all/root/scripts/cluster_configure/.gitignore b/base/all/root/scripts/cluster_configure/.gitignore deleted file mode 100644 index da25447..0000000 --- a/base/all/root/scripts/cluster_configure/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.pyc -t/ diff --git a/base/all/root/scripts/cluster_configure/README b/base/all/root/scripts/cluster_configure/README deleted file mode 100644 index caa75e3..0000000 --- a/base/all/root/scripts/cluster_configure/README +++ /dev/null @@ -1,168 +0,0 @@ -WHAT? ------ - -This is a templated-based configuration utility for clusters. It -allows CTDB and various services (Samba, NFS, vsftpd, ...) to be -configured. It should be installed/run on each node after relevant -packages are installed or after any master configuration/template -change. - -WHY? ----- - -This is meant to be flexible and allow subsets of services to be -configured. - -HOW? ----- - -Run like this to test template expansion into a staging subdirectory -"t/": - - ./cluster-configure.py -vv -n -t templates/rhel -s t example.conf - -Or without -n but as root to test actual installation of files and -reload of services. - -Try --help to see the options. - -Notes - this sounds complex, but it isn't... see the example -configuration file and templates. Run the above command with the "-n" -option and check out the files in the staging area... :-) - -* Master configuration file - - The master configuration file is parsed by Python's ConfigParser - module. Therefore, it is subject to any restrictions of that - module. For example, older versions do not allow identation of - settings. - -* Template structure - - Each subdirectory of templates directory is a package name, with a - 2-digit-plus-dot prefix used to order the processing of packages. - If, according to the system's package manager, that package is not - installed on the system then no further processing is done. - - A package subdirectory should have one or more version - subdirectories that are matched to the version of the package - reported by the package manager. A version subdirectory is named as - <min>#<max> with a literal '#' as the separator. A missing limit - implies no limit, so a version subdirectory of "#" matches all - version. Comparisons with <min> use <= and comparisons with <max> - use <. This allows simple ranges like "3.0#4.0" to work sensibly - with "4.0#". The highest matching version is used, so the above - could just be written "3.0#" and "4.0#". - - A "files" subdirectory of a version subdirectory contains a - directory tree of configuration files that have template - substitution done and are then installed into the root filesystem. - A file is only actually installed if, after substitutions, it is - different to the currently/previously installed file. - - An "events" subdirectory of a version subdirectory can contain "pre" - and "post" files. If any configuration files are (to be) installed - the "pre" is run before installation of these files and "post" is - run afterwards. - - For example, consider the following: - - templates/rhel/60.nfs-utils/1.0#/files/etc/exports - templates/rhel/60.nfs-utils/1.0#/files/etc/sysconfig/nfs - templates/rhel/60.nfs-utils/1.0#/events/post - - If nfs-utils with a version >= 1.0 is installed then: - - 1. Template substitution is done on both files the /etc/exports and - /etc/sysconfig/nfs files, and each resulting file is installed if - it is different to the already installed corresponding file. - - 2. If a file was installed then "post" is run. This tells NFS to - reload its configuration. - -* Template substitutions - - !!variable!! - - The template format is !!variable!!. @@variable@@ has been avoided - so that you can install a configuration and templates with - autocluster. - - !!|expr!! - - Apart from simple variables, templates can contain expression - evaluations. !!|expr!! causes expr to be processed with Python's - eval() function and the *return value* (not the output) is - substituted for the template expression. - - !!%plugin.func(args)!! - - Plugin expressions are an extension to expression evaluations. If a - plugin called "export.py" contains a function called "format" then a - template can contain: - - !!%export.format(REST)!! - - and this will cause the return value the following to be substituted: - - export.format(config, self.name, ... REST ...) - - where: - - - config is the global configuration object - - - self.name is the name of the current package being processed - - - ... REST ... is usually a printf-style format string followed by a - list of configuration keys who's values should be substituted into - the - - Note that, for robustness, plugins don't actually get imported into - the regular namespace so plugin expressions are quite useful... even - though they might look confusing at first. - - An example is illustrative... - - Assuming that export.py contains: - - def format(config, package, format, items): - ... - - In config (the master configuration file), several exports may be - defined for the given package. Each will be of the form: - - [export:nfs-utils:data] - share = data - fsid = 834258092 - - This will inherit the directory and other options from the share - "data": - - [share:data] - directory = /srv/xyz123/data - filesystem = /srv/xyz123 - permissions = 0777 - comment = An example share - - To create export defintions for NFS, something like this can be - used: - - !!%export:format("\"%s\" *(rw,fsid=%s)\n", ["directory", "fsid"])!! - - This produces a line of output for each export, substituting the - values for "directory" and "fsid" appropriately. In the above case, - the output would be: - - "/srv/xyz123/data" *(rw,fsid=834258092) - -WHERE? ------- - -This is part of autocluster, so you can get it from: - - git://git.samba.org/autocluster.git - -WHO? ----- - -Martin Schwenke <martin@meltin.net> diff --git a/base/all/root/scripts/cluster_configure/TODO b/base/all/root/scripts/cluster_configure/TODO deleted file mode 100644 index ab81087..0000000 --- a/base/all/root/scripts/cluster_configure/TODO +++ /dev/null @@ -1,3 +0,0 @@ -* Integration with CTDB is wonky. cluster_configure probably - shouldn't restart/reconfigure services itself but should ask CTDB to - do it. diff --git a/base/all/root/scripts/cluster_configure/cluster-configure.py b/base/all/root/scripts/cluster_configure/cluster-configure.py deleted file mode 100755 index e94579e..0000000 --- a/base/all/root/scripts/cluster_configure/cluster-configure.py +++ /dev/null @@ -1,452 +0,0 @@ -#!/usr/bin/env python - -# Configure clustered Samba nodes - -# Copyright (C) Martin Schwenke 2010 - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, see <http://www.gnu.org/licenses/>. - -import os -import sys -import optparse # Newer argparse not yet in RHEL5/EPEL. -import ConfigParser -import logging -import re -import subprocess -import errno -import filecmp -import shutil -import glob -import string - -lib_dir = "lib" -sys.path.append(lib_dir) - -import logging - -def process_args(): - usage = "usage: %prog [options] configfile" - - parser = optparse.OptionParser(usage=usage) - - parser.add_option("-t", "--templates", - action="store", dest="templates", - default="templates/rhel", - help="directory containing templates") - parser.add_option("-f", "--force", - action="store_true", dest="force", - default=False, - help="install configuration files even if unchanged",) - parser.add_option("-r", "--no-reload", - action="store_true", dest="no_reload", - default=False, - help="""don't run the "reload" script for -services - this is usually done to make services reload their configuration -after any changes""") - parser.add_option("-n", "--simulate", - action="store_true", dest="simulate", - default=False, - help="""don't actually install configuration -files - this will leave the configuration files in the temporary staging -area - implies -r""") - parser.add_option("-s", "--staging", - action="store", dest="staging", - default="staging", - help="directory to stage the files to be installed") - parser.add_option("-v", "--verbose", - action="count", dest="verbose", - default=0, - help="print information and actions taken to stdout") - parser.add_option("-l", "--log-file", - action="store", dest="log_file", default=None, - metavar="FILE", - help="append information and actions taken to FILE") - (options, args) = parser.parse_args() - - if len(args) != 1: - parser.error("configuration file must be specified") - - options.config = args[0] - - return options - -def setup_logging(): - - global options - - logger = logging.getLogger("cluster-configure") - logger.setLevel(logging.ERROR) - - sh = logging.StreamHandler(sys.stderr) - sh.handleError = lambda x : (logging.shutdown(), sys.exit()) - logger.addHandler(sh) - - if options.verbose == 1: - logger.setLevel(logging.WARNING) - elif options.verbose == 2: - logger.setLevel(logging.INFO) - elif options.verbose >= 3: - logger.setLevel(logging.DEBUG) - - if options.log_file is not None: - fh = logging.FileHandler(options.log_file) - # The formatting option %(funcName)s would be useful here but - # it only appeared in Python 2.5 and this script will be run - # on Python 2.4. - formatter = logging.Formatter( - "%(asctime)s - %(name)s - %(levelname)s - %(message)s") - fh.setFormatter(formatter) - logger.addHandler(fh) - - return logger - -def _rpm_parse_version(v): - ret = [] - for x in re.split("[^A-Za-z0-9]", v): - try: - ret.append(int(x)) - except ValueError: - ret.append(x) - return ret - -config = None -options = None -logger = None - -class Package(object): - def __init__(self, config, directory): - self.config = config - self.directory = directory - self.version = None - self.platform = None - self.version_dir = None - self.files = list() - self.files_to_install = list() - - m = re.match("\d\d\.(.*)", directory) - if m is None: - raise RuntimeError, \ - ("invalid template package directory %s" % directory) - self.name = m.group(1) - self.stage = os.path.join(options.staging, self.name) - - def _get_version(self): - if os.path.exists("/etc/redhat-release"): - p = subprocess.Popen(["rpm", "-q", self.name], - stdout=subprocess.PIPE) - out = p.communicate()[0] - status = p.wait() - if status == 0: - out.replace(self.name + "-", "") - self.version = string.strip(out) - self.platform = "rpm" - logger.debug("_get_version: package %s has version %s", - self.name, self.version) - return True - elif os.path.exists("/etc/debian_version"): - p = subprocess.Popen(["dpkg-query", "-W", "-f", "${Version}", - self.name], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - out = p.communicate()[0] - status = p.wait() - if status == 0 and len(out) > 0: - self.version = string.strip(out) - self.platform = "deb" - logger.debug("_get_version: package %s has version %s", - self.name, self.version) - return True - - logger.info("_get_version: package %s is not installed", self.name) - return False - - # Currently Red Hat specific... - def _check_version(self, min=None, max=None): - v = _rpm_parse_version(self.version) - return min is None or \ - (_rpm_parse_version(min) <= v and \ - (max is None or v < _rpm_parse_version(max))) - - def find_version_dir(self): - if self._get_version(): - pdir = os.path.join(options.templates, self.directory) - versions = sorted(os.listdir(pdir)) - # FIXME: filter out any without #, since they're meaningless. - versions.reverse() # bare "#" comes last since it is the default - - for i in versions: - try: - (min, max) = map(lambda x: len(x) and x or None, i.split("#")) - except ValueError: - logger.warn("_find_version_dir: skipping invalid version subdirectory %s" % i) - continue - - if self._check_version(min, max): - self.version_dir = os.path.join(pdir, i) - logger.info("_find_version_dir: found version directory %s" % self.version_dir) - return True - return False - - def _find_template_files(self, fdir): - """Find the available templates in the given file directory fdir.""" - for (root, dirs, files) in os.walk(fdir): - for f in files: - # os.path.relpath is not available in older Python - frel = os.path.join(root, f).replace(fdir + "/", "", 1) - logger.debug("_find_template_files: add template file %s" % frel) - self.files.append(frel) - - def _substitute_template(self, contents): - """Expand the given template fdir/file into the staging area.""" - - logger.debug("_expand_template: subsitute variables into %s", file) - - # Find variables in template and substitute values. - variables = sorted(set(re.findall("!!((\w+)((=)([^!]*))?)!!", - contents))) - # r is the default replacement value for v. - for (a, v, x, e, r) in variables: - try: - r = self.config.get("package:" + self.name, v) - except (ConfigParser.NoSectionError, ConfigParser.NoOptionError), s: - # This is the equals sign. if it is there then we have default. - if e == "": - raise - - contents = contents.replace("!!%s!!" % a, r) - - # Find plugin expressions in template and subsitute values. - exprs = re.findall("!!%([^!]+)!!", contents) - for e in exprs: - (m, f, rest) = re.split("[:(]", e, 2) - foo = 'plugins["%s"].%s(config, "%s", %s' % (m, f, self.name, rest) - r = eval(foo) - if r is None: - return None - contents = contents.replace("!!%%%s!!" % e, r) - - # Find general python expressions in template and subsitute values. - exprs = re.findall("!!\|([^!]+)!!", contents) - for e in exprs: - r = eval(e) - if r is None: - return None - contents = contents.replace("!!|%s!!" % e, r) - - return contents - - def _expand_template(self, fdir, file): - """Expand the given template fdir/file into the staging area.""" - - logger.debug("_expand_template: subsitute variables into %s", file) - - # Read input file. - src = os.path.join(fdir, file) - f = open(src) - contents = f.read() - f.close() - - contents = self._substitute_template(contents) - - # Ensure output directory exists in staging area. - dst = os.path.join(self.stage, file) - try: - os.makedirs(os.path.dirname(dst)) - except OSError, exc: - if exc.errno == errno.EEXIST: - pass - else: raise - - # Write output file into staging area, unless it is None, - # which means to remove the file if it exists. - if contents is not None: - f = open(dst, "w") - f.write(contents) - f.close() - else: - try: - os.remove(dst) - except OSError, exc: - if exc.errno == errno.ENOENT: - pass - else: raise - - def _would_install_file(self, file): - """Check if a file should be installed from the staging area - because it is different to the currently installed file (or if - there is no installed file).""" - - src = os.path.join(self.stage, file) - dst = os.path.join("/", file) - - if not os.path.exists(src) and not os.path.exists(dst): - logger.debug("_would_install_file: skip install of %s (missing)", dst) - return False - - try: - if not options.force and filecmp.cmp(src, dst, shallow=False): - logger.debug("_would_install_file: skip install of %s (unchanged)", dst) - return False - except OSError, exc: - if exc.errno == errno.ENOENT: - pass - else: raise - - logger.info("_would_install_file: would install file %s", dst) - return True - - def would_install_files(self): - """For the templates in our packages files area, expand each - template into the staging area and check if it would be - installed due to a change. Return True if any files would be - installed, False otherwise.""" - - fdir = os.path.join(self.version_dir, "files") - - shutil.rmtree(self.stage, ignore_errors=True) - - self._find_template_files(fdir) - for f in self.files: - self._expand_template(fdir, f) - - for f in self.files: - if self._would_install_file(f): - self.files_to_install.append(f) - - return self.files_to_install - - def _install_file(self, file): - """Install file from the staging area .""" - - src = os.path.join(self.stage, file) - dst = os.path.join("/", file) - - if os.path.exists(src): - logger.info("_install_file: install file %s", dst) - shutil.copy2(src, dst) - else: - logger.info("_install_file: remove file %s", dst) - try: - os.remove(dst) - except OSError, exc: - if exc.errno == errno.ENOENT: - pass - else: raise - - def install_files(self): - """Install the list of files from self.files_to_install.""" - - for f in self.files_to_install: - self._install_file(f) - - def run_event(self, event): - """Run the given event script for the service, if present.""" - es = os.path.join(self.version_dir, "events", event) - if os.path.exists(es) and os.access(es, os.X_OK): - p = subprocess.Popen([es], - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) - out = p.communicate()[0] - status = p.wait() - if status == 0: - logger.info("_run_event: successfully ran event script %s", es) - else: - logger.error("""_run_event: error running event script "%s": -"%s" """, - es , string.strip(out)) - else: - logger.debug("_run_event: no event script %s in %s", event, - self.version_dir) - - -plugins = {} - -def load_plugins(): - global plugins - - plugin_dir = "plugins" - - sys.path.append(plugin_dir) - for f in map(lambda x: os.path.splitext(os.path.basename(x))[0], - glob.glob(os.path.join(plugin_dir, "*.py"))): - - plugins[f] = __import__(f) - -def ctdb_socket(): - - ret = os.getenv('CTDB_SOCKET') - - if ret is None: - ctdb = '/usr/bin/ctdb' - if os.path.exists(ctdb): - cmd = "strings " + ctdb + " | grep -E '/ctdbd?\.socket$'" - p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) - out = p.communicate()[0] - status = p.wait() - if status == 0: - ret = string.rstrip(out) - else: - logger.warning('Failed to find socket path in "' + ctdb + - '" - falling back to default') - else: - logger.warning('Failed to find "' + ctdb + - '" - falling back to default') - if ret is None: - ret = '/var/run/ctdb/ctdbd.socket' - - return ret - -def main(): - global config, options, logger - - options = process_args() - - logger = setup_logging() - - load_plugins() - - os.environ["PATH"] = os.getcwd() + ":" + os.environ["PATH"] - - logger.debug("main: read configuration from %s", options.config) - config = ConfigParser.SafeConfigParser() - config.readfp(open(options.config)) - - # Run the check function in every plugin that defines it. - config_status = True - for p in plugins.iterkeys(): - func = getattr(plugins[p], "check", None) - if callable(func): - if not func(config): - config_status = False - if not config_status: - logger.error("main: exiting due to previous configuration errors") - return 1 - - # Process templates. - for d in sorted(os.listdir(options.templates)): - try: - p = Package(config, d) - if p.find_version_dir(): - if p.would_install_files() and not options.simulate: - p.run_event("pre") - p.install_files() - p.run_event("post") - except RuntimeError, s: - logger.info("main: ignoring %s", s) - - logging.shutdown() - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/base/all/root/scripts/cluster_configure/example.conf b/base/all/root/scripts/cluster_configure/example.conf deleted file mode 100644 index 3bb461e..0000000 --- a/base/all/root/scripts/cluster_configure/example.conf +++ /dev/null @@ -1,55 +0,0 @@ -[DEFAULT] -cluster = foobar -domain = foobar.local -chroot_parent = /var/lib/nas-chroot -scp_chroot = %(chroot_parent)s/scp -clusterfs_default_mountpoint = /clusterfs - -[filesystem:0] -type = gpfs -mountpoint = %(clusterfs_default_mountpoint)s - -[share:data] -directory = %(clusterfs_default_mountpoint)s/data -filesystem = %(clusterfs_default_mountpoint)s -permissions = 0777 -comment = An example share - -[package:ctdb] -deterministic_ips = 0 - -[package:vsftpd] -chroot_dir = %(chroot_parent)s/ftp - -[export:vsftpd:data] -share = data - -[package:httpd] -# This section left intentionally empty. - -[export:httpd:data] -share = data - -[package:nfs-utils] -nfs_hostname = %(cluster)s - -[export:nfs-utils:data] -share = data -fsid = 834258092 - -[package:samba] -workgroup = %(cluster)s -realm = %(domain)s -chroot_dir = %(scp_chroot)s - -[export:samba:data] -share = data - -[package:openssh-server] -chroot_dir = %(scp_chroot)s - -[export:openssh-server:data] -share = data - -[package:rssh] -chroot_dir = %(scp_chroot)s diff --git a/base/all/root/scripts/cluster_configure/lib/util.py b/base/all/root/scripts/cluster_configure/lib/util.py deleted file mode 100644 index b270c38..0000000 --- a/base/all/root/scripts/cluster_configure/lib/util.py +++ /dev/null @@ -1,37 +0,0 @@ -# Configure clustered Samba nodes - -# Utility functions. - -# Copyright (C) Martin Schwenke 2010 - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, see <http://www.gnu.org/licenses/>. - -def names(config, prefix): - """Given a config object, return the names sections starting - with "prefix:" but strip that from each one.""" - - t = prefix + ":" - - return map(lambda y: str.replace(y, t, "", 1), - filter(lambda x: str.find(x, t) == 0, - config.sections())) - -def retrieve(config, prefix): - """Given a config, retrieve all the information about shares. The - result is a dictionary with share names (minus "<prefix>:") as - keys where each value is a dictionary for the section.""" - - return dict(map(lambda s: (s, dict(config.items(prefix + ":" + s))), - names(config, prefix))) - diff --git a/base/all/root/scripts/cluster_configure/mkchroot.sh b/base/all/root/scripts/cluster_configure/mkchroot.sh deleted file mode 100755 index 1f2bb0a..0000000 --- a/base/all/root/scripts/cluster_configure/mkchroot.sh +++ /dev/null @@ -1,196 +0,0 @@ -#!/bin/sh - -set -e - -# Make a simple chroot for vsftpd and scp. - -# Note that for the base chroot this attempts to use read-only bind -# mounts. These will be silently readable on older kernels. If -# you're using this for anything except simple testing then PLEASE -# TEST the chroot's security! - -usage () -{ - cat <<EOF -usage: $0 { create | destroy } chroot_dir - $0 mount src_dir dst_dir - $0 umount dst_dir -EOF - exit 1 -} - -[ $# -ge 1 ] || usage - -action="$1" -shift -case "$action" in - create|destroy|umount) - : - ;; - mount) - [ $# -ge 2 ] || usage - ;; - *) - usage -esac - -do_mount () -{ - _src="$1" - _dst="$2" - - if [ -f "$_dst" ] ; then - return 0 - fi - - if [ -f "$_src" ] ; then - mkdir -vp $(dirname "$_dst") - touch "$_dst" - else - mkdir -vp "$_dst" - fi - - mount -v --bind "$_src" "$_dst" -} - -do_umount () -{ - _dst="$1" - - _out=$(awk "\$2 == \"$_dst\" {print \$2}" /proc/mounts) - if [ -n "$_out" ] ; then - _is_file=false - if [ -f "$_dst" ] ; then - _is_file=true - fi - umount -v "$_dst" - if $_is_file ; then - rm -vf "$_dst" - rmdir --ignore-fail-on-non-empty -vp $(dirname "$_dst") - else - rmdir --ignore-fail-on-non-empty -vp "$_dst" - fi - fi -} - -first_ro_mount=true -can_remount_ro=true - -do_mount_ro () -{ - _src="$1" - _dst="$2" - - if [ -f "$_dst" ] ; then - return 0 - fi - - do_mount "$_src" "$_dst" - - if $first_ro_mount ; then - if ! mount -v -o remount,ro "$_dst"; then - cat <<EOF -Unable to remount $_dst read-only. Won't try this again. - -WARNING: Your chroot may be less secure than you think! - -EOF - can_remount_ro=false - else - if f=$(mktemp -p "$_dst" >/dev/null 2>&1) ; then - rm -f "$f" - cat <<EOF -WARNING: Bind mounts don't really look to be read-only! -EOF - fi - fi - else - if $can_remount_ro ; then - mount -v -o remount,ro "$_dst" - fi - fi - - first_ro_mount=false -} - -sftp_server="" -for d in /usr/libexec/openssh /usr/lib/openssh ; do - f="$d/sftp-server" - if [ -x "$f" ] ; then - sftp_server="$f" - break - fi -done -if [ -z "$sftp_server" ] ; then - echo "$0: error - could not find location of sftp_server" - exit 2 -fi - -case $(uname -m) in - x86_64) - lib="lib64" - ;; - *) - lib="lib" -esac - -mounts="\ -/usr/$lib \ -/$lib \ -/etc/nsswitch.conf \ -/etc/resolv.conf \ -$sftp_server \ -/usr/bin/scp \ -" - -do_create () -{ - chroot_dir="$1" - - mkdir -p "$chroot_dir" - - fake="${chroot_dir}/.mkchroot" - touch "$fake" - ls -l "$fake" - - d="$chroot_dir/dev" - mkdir -vp "$d" - cp -va /dev/null /dev/zero "$d/" - - for s in $mounts ; do - f="$chroot_dir$s" - do_mount_ro "$s" "$f" - done - - d="$chroot_dir/etc/passwd" - touch "$d" - ls -l "$d" -} - -do_destroy () -{ - chroot_dir="$1" - - rm -vf "$chroot_dir/etc/passwd" - - for i in "null" "zero" ; do - rm -vf "$chroot_dir/dev/$i" - done - rmdir -v "$chroot_dir/dev" - - # Reverse the list 1st. - rmounts= - for s in $mounts ; do - rmounts="$s${rmounts:+ }${rmounts}" - done - - for s in $rmounts ; do - do_umount "${chroot_dir}$s" - done - - fake="${chroot_dir}/.mkchroot" - rm -vf "$fake" - rmdir -v "$chroot_dir" -} - -"do_$action" "$@" diff --git a/base/all/root/scripts/cluster_configure/plugins/ctdb.py b/base/all/root/scripts/cluster_configure/plugins/ctdb.py deleted file mode 100644 index d326b19..0000000 --- a/base/all/root/scripts/cluster_configure/plugins/ctdb.py +++ /dev/null @@ -1,51 +0,0 @@ -# Configure clustered Samba nodes - -# Module for handling addresses. - -# Copyright (C) Amitay Isaacs 2012 - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, see <http://www.gnu.org/licenses/>. - -import logging - -import package - -def gen_public_addresses(config, pkg, req_ips): - """Given a config object, return the formatted public addresses.""" - - stack = package.get(config, pkg, "network_stack") - out = [] - out6 = [] - foo = package.get(config, pkg, "public_addresses") - for tmp in foo.split(): - (startip, num_addrs, iface) = tmp.split(',') - (a,b,c,d) = startip.split('.') - for i in xrange(int(num_addrs)): - octet = int(d) + i - if stack == 'ipv4' and req_ips == 'default': - out.append('%s.%s.%s.%d/24 %s\n' % (a, b, c, octet, iface)) - elif stack == 'ipv6' and req_ips == 'default': - out6.append('fc00:%s:%s:%s::%s/64 %s\n' % (a, b, c, octet, iface)) - elif stack == 'dual': - if req_ips in ['ipv4', 'dual', 'default']: - out.append('%s.%s.%s.%d/24 %s\n' % (a, b, c, octet, iface)) - if req_ips in ['ipv6', 'dual', 'default']: - out6.append('fc00:%s:%s:%s::%s/64 %s\n' % (a, b, c, octet, iface)) - - # Special case: if the file would be empty then it should be there... - ret = "".join(out) + "".join(out6) - if ret: - return ret - else: - return None diff --git a/base/all/root/scripts/cluster_configure/plugins/export.py b/base/all/root/scripts/cluster_configure/plugins/export.py deleted file mode 100755 index 63e8b18..0000000 --- a/base/all/root/scripts/cluster_configure/plugins/export.py +++ /dev/null @@ -1,102 +0,0 @@ -# Configure clustered Samba nodes - -# Module for handling exports. - -# Copyright (C) Martin Schwenke 2010 - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, see <http://www.gnu.org/licenses/>. - -import logging - -import util -import share -import package - -_export_prefix = "export" - -def names(config): - """Given a config, return the names of all exports.""" - - return util.names(config, _export_prefix) - -def retrieve(config, package): - """Given a config, retrieve all the information about exports for - package. The result is a dictionary with export names as keys - where each value is a dictionary for the section.""" - - return util.retrieve(config, _export_prefix + ":" + package) - -def _check(config, package): - """Given a config sanity check the exports for the package.""" - - exports = retrieve(config, package) - shares = share.retrieve(config) - - for e in exports.keys(): - s = exports[e].get("share", e) - if not s in shares: - raise KeyError, \ - "export:%s:%s requires share:%s" % (package, e, s) - -def check(config): - """Given a config sanity check all of the exports.""" - - logger = logging.getLogger("cluster-configure") - - status = True - - for p in package.names(config): - try: - _check(config, p) - except KeyError, str: - logger.error("configuration error: %s", str) - status= False - - return status - -def format(config, package, format, items): - """Given a config object, return the formatted exports for - package. Use format string and apply it to the export fields in - the order specified in items. Before formatting, the dictionary - for each export is augmented with the options for the - corresponding share. If there's a collision in an option name - then it is prefixed with "share:".""" - - # Get export and share info. - exports = retrieve(config, package) - shares = share.retrieve(config) - - out = [] - - for e in exports.keys(): - # Add name. - exports[e]["name"] = e - - # Add share config. - s = exports[e].get("share", e) - for (k,v) in shares[s].iteritems(): - if k in exports[e]: - exports[e]["share:" + k] = v - else: - exports[e][k] = v - - def get_val(k): - ret = exports[e].get(k) - if ret is None: - raise ValueError("No option '%s' for package:%s" % (k, package)) - return ret - - out.append(format % tuple(map(get_val, items))) - - return "".join(out) diff --git a/base/all/root/scripts/cluster_configure/plugins/package.py b/base/all/root/scripts/cluster_configure/plugins/package.py deleted file mode 100644 index 179269c..0000000 --- a/base/all/root/scripts/cluster_configure/plugins/package.py +++ /dev/null @@ -1,41 +0,0 @@ -# Configure clustered Samba nodes - -# Module for handling package configuration. - -# Copyright (C) Martin Schwenke 2010 - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, see <http://www.gnu.org/licenses/>. - -import util - -_package_prefix = "package" - -def names(config): - """Given a config, return the names of all packages.""" - - return util.names(config, _package_prefix) - -def get(config, package, key): - """Given a config, return the the value of specify key - for the package.""" - - return config.get(_package_prefix + ":" + package, key) - -def retrieve(config, package): - """Given a config, retrieve all the configuration information - about package. The result is a dictionary representing the - package's configuration file section.""" - - return util.retrieve(config, _package_prefix + ":" + package) - diff --git a/base/all/root/scripts/cluster_configure/plugins/share.py b/base/all/root/scripts/cluster_configure/plugins/share.py deleted file mode 100644 index ae328f8..0000000 --- a/base/all/root/scripts/cluster_configure/plugins/share.py +++ /dev/null @@ -1,57 +0,0 @@ -# Configure clustered Samba nodes - -# Module for handling shares. - -# Copyright (C) Martin Schwenke 2010 - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, see <http://www.gnu.org/licenses/>. - -import util - -_share_prefix = "share" - -def names(config): - """Given a config, return the names of all shares.""" - - return util.names(config, _share_prefix) - -def retrieve(config): - """Given a config, retrieve all the information about shares. The - result is a dictionary with share names (minus "share:") as keys - where each value is a dictionary for the section.""" - - return util.retrieve(config, _share_prefix) - -def format(config, package, format, items): - """Given a config object, return the formatted shares. Use format - string and apply it to the share fields in the order specified in - items. Argument package is ignored but is present for consistency.""" - - shares = retrieve(config) - - out = [] - - for e in shares.keys(): - # Add name. - shares[e]["name"] = e - - def get_val(k): - ret = shares[e].get(k) - if ret is None: - raise ValueError("No option '%s'" % k) - return ret - - out.append(format % tuple(map(get_val, items))) - - return "".join(out) diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/1.2.4#/events/post b/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/1.2.4#/events/post deleted file mode 100755 index 1777cff..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/1.2.4#/events/post +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -set -e - -. /etc/sysconfig/ctdb -if [ -n "$CTDB_RECOVERY_LOCK" ] ; then - d=$(dirname "$CTDB_RECOVERY_LOCK") - mkdir -p "$d" -fi - -exec service ctdb restart diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/1.2.4#/files/etc/ctdb/public_addresses b/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/1.2.4#/files/etc/ctdb/public_addresses deleted file mode 100644 index e2053a7..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/1.2.4#/files/etc/ctdb/public_addresses +++ /dev/null @@ -1 +0,0 @@ -!!%ctdb:gen_public_addresses('default')!! diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/1.2.4#/files/etc/ctdb/public_addresses.dual b/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/1.2.4#/files/etc/ctdb/public_addresses.dual deleted file mode 100644 index 9aecdac..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/1.2.4#/files/etc/ctdb/public_addresses.dual +++ /dev/null @@ -1 +0,0 @@ -!!%ctdb:gen_public_addresses('dual')!! diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/1.2.4#/files/etc/ctdb/public_addresses.ipv4 b/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/1.2.4#/files/etc/ctdb/public_addresses.ipv4 deleted file mode 100644 index 3ab0921..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/1.2.4#/files/etc/ctdb/public_addresses.ipv4 +++ /dev/null @@ -1 +0,0 @@ -!!%ctdb:gen_public_addresses('ipv4')!! diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/1.2.4#/files/etc/ctdb/public_addresses.ipv6 b/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/1.2.4#/files/etc/ctdb/public_addresses.ipv6 deleted file mode 100644 index 4a67496..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/1.2.4#/files/etc/ctdb/public_addresses.ipv6 +++ /dev/null @@ -1 +0,0 @@ -!!%ctdb:gen_public_addresses('ipv6')!! diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/1.2.4#/files/etc/sysconfig/ctdb b/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/1.2.4#/files/etc/sysconfig/ctdb deleted file mode 100644 index 0b01efa..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/1.2.4#/files/etc/sysconfig/ctdb +++ /dev/null @@ -1,20 +0,0 @@ -# Core -CTDB_PUBLIC_ADDRESSES=/etc/ctdb/public_addresses -CTDB_RECOVERY_LOCK=@@CLUSTERFS_DEFAULT_MOUNTPOINT@@/.ctdb/recovery.lock - -# Services managed -CTDB_MANAGES_SAMBA=yes -CTDB_MANAGES_WINBIND=!!|"yes" if self.config.get("package:ctdb", "auth_method") == "winbind" else "no"!! -CTDB_MANAGES_NFS=yes -CTDB_MANAGES_HTTPD=yes -CTDB_MANAGES_VSFTPD=yes - -# System -ulimit -n 1048576 -DAEMON_COREFILE_LIMIT="unlimited" - -# Logging -CTDB_LOGGING="syslog" -CTDB_SYSLOG="yes" # backward compatibility -CTDB_DEBUGLEVEL=NOTICE -CTDB_LOG_RINGBUF_SIZE=500000 diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/events/post b/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/events/post deleted file mode 100755 index 1777cff..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/events/post +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -set -e - -. /etc/sysconfig/ctdb -if [ -n "$CTDB_RECOVERY_LOCK" ] ; then - d=$(dirname "$CTDB_RECOVERY_LOCK") - mkdir -p "$d" -fi - -exec service ctdb restart diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/ctdb/ctdb.conf b/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/ctdb/ctdb.conf deleted file mode 100644 index 159df0f..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/ctdb/ctdb.conf +++ /dev/null @@ -1,6 +0,0 @@ -[logging] - location = syslog - log level = NOTICE - -[cluster] - recovery lock = @@CLUSTERFS_DEFAULT_MOUNTPOINT@@/.ctdb/recovery.lock diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/ctdb/public_addresses b/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/ctdb/public_addresses deleted file mode 100644 index e2053a7..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/ctdb/public_addresses +++ /dev/null @@ -1 +0,0 @@ -!!%ctdb:gen_public_addresses('default')!! diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/ctdb/public_addresses.dual b/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/ctdb/public_addresses.dual deleted file mode 100644 index 9aecdac..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/ctdb/public_addresses.dual +++ /dev/null @@ -1 +0,0 @@ -!!%ctdb:gen_public_addresses('dual')!! diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/ctdb/public_addresses.ipv4 b/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/ctdb/public_addresses.ipv4 deleted file mode 100644 index 3ab0921..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/ctdb/public_addresses.ipv4 +++ /dev/null @@ -1 +0,0 @@ -!!%ctdb:gen_public_addresses('ipv4')!! diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/ctdb/public_addresses.ipv6 b/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/ctdb/public_addresses.ipv6 deleted file mode 100644 index 4a67496..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/ctdb/public_addresses.ipv6 +++ /dev/null @@ -1 +0,0 @@ -!!%ctdb:gen_public_addresses('ipv6')!! diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/ctdb/script.options b/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/ctdb/script.options deleted file mode 100644 index 092c53d..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/ctdb/script.options +++ /dev/null @@ -1,8 +0,0 @@ -# These could be in per-event-script files but this is more convenient -# for now - -CTDB_MANAGES_SAMBA=yes -CTDB_MANAGES_WINBIND=!!|"yes" if self.config.get("package:ctdb", "auth_method") == "winbind" else "no"!! -CTDB_MANAGES_NFS=yes -CTDB_MANAGES_HTTPD=yes -CTDB_MANAGES_VSFTPD=yes diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/sysconfig/ctdb b/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/sysconfig/ctdb deleted file mode 100644 index 384cdd1..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/00.ctdb/4.9.0#/files/etc/sysconfig/ctdb +++ /dev/null @@ -1,20 +0,0 @@ -# Core -CTDB_PUBLIC_ADDRESSES=/etc/ctdb/public_addresses -CTDB_RECOVERY_LOCK=@@CLUSTERFS_DEFAULT_MOUNTPOINT@@/.ctdb/recovery.lock - -# Services managed -CTDB_MANAGES_SAMBA=yes -CTDB_MANAGES_WINBIND=!!|"yes" if self.config.get("package:ctdb", "auth_method") == "winbind" else "no"!! -CTDB_MANAGES_NFS=yes -CTDB_MANAGES_HTTPD=yes -CTDB_MANAGES_VSFTPD=yes - -# System -ulimit -n 1048576 -ulimit -c unlimited - -# Logging -CTDB_LOGGING="syslog" -CTDB_SYSLOG="yes" # backward compatibility -CTDB_DEBUGLEVEL=NOTICE -CTDB_LOG_RINGBUF_SIZE=500000 diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/01.gpfs.base/3.3#/events/post b/base/all/root/scripts/cluster_configure/templates/rhel/01.gpfs.base/3.3#/events/post deleted file mode 100755 index 2ddc918..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/01.gpfs.base/3.3#/events/post +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -. /etc/sysconfig/gpfs - -for i in $GPFS_SHARES ; do - d="${i%:*}" - p="${i#*:}" - - mkdir -p "$d" - chmod "$p" "$d" -done diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/01.gpfs.base/3.3#/files/etc/sysconfig/gpfs b/base/all/root/scripts/cluster_configure/templates/rhel/01.gpfs.base/3.3#/files/etc/sysconfig/gpfs deleted file mode 100644 index 20ced8b..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/01.gpfs.base/3.3#/files/etc/sysconfig/gpfs +++ /dev/null @@ -1 +0,0 @@ -GPFS_SHARES='!!%share:format("%s:%s ", ["directory", "permissions"])!!' diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/40.vsftpd/2.0#/events/post b/base/all/root/scripts/cluster_configure/templates/rhel/40.vsftpd/2.0#/events/post deleted file mode 100755 index e7ae37c..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/40.vsftpd/2.0#/events/post +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -set -e - -. /etc/vsftpd/vsftpd.conf -. /etc/sysconfig/vsftpd - -mkdir -p "$local_root" - -export_dir="${local_root}/exports" - -for i in $FTP_EXPORTS ; do - e="${i%:*}" - s="${i#*:}" - d="${export_dir}/${e}" - if [ ! -d "$d" ] ; then - mkchroot.sh mount "$s" "$d" - fi -done - -service vsftpd start diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/40.vsftpd/2.0#/events/pre b/base/all/root/scripts/cluster_configure/templates/rhel/40.vsftpd/2.0#/events/pre deleted file mode 100755 index 60acf05..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/40.vsftpd/2.0#/events/pre +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -set -e - -if service vsftpd status ; then - service vsftpd stop -fi - -. /etc/vsftpd/vsftpd.conf -. /etc/sysconfig/vsftpd - -export_dir="${local_root}/exports" - -for i in $FTP_EXPORTS ; do - e="${i%:*}" - d="${export_dir}/${e}" - if [ -d "$d" ] ; then - mkchroot.sh umount "$d" || true - fi -done - -rmdir -p "$local_root" diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/40.vsftpd/2.0#/files/etc/pam.d/vsftpd b/base/all/root/scripts/cluster_configure/templates/rhel/40.vsftpd/2.0#/files/etc/pam.d/vsftpd deleted file mode 100644 index 8abc181..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/40.vsftpd/2.0#/files/etc/pam.d/vsftpd +++ /dev/null @@ -1,10 +0,0 @@ -#%PAM-1.0 -session optional pam_keyinit.so force revoke -auth required pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed -#auth required pam_shells.so -!!|"" if self.config.get("package:vsftpd", "auth_method") == "winbind" else "#"!!auth sufficient pam_winbind.so -auth include system-auth -!!|"" if self.config.get("package:vsftpd", "auth_method") == "winbind" else "#"!!account sufficient pam_winbind.so -account include system-auth -session include system-auth -session required pam_loginuid.so diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/40.vsftpd/2.0#/files/etc/sysconfig/vsftpd b/base/all/root/scripts/cluster_configure/templates/rhel/40.vsftpd/2.0#/files/etc/sysconfig/vsftpd deleted file mode 100644 index 38e33a1..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/40.vsftpd/2.0#/files/etc/sysconfig/vsftpd +++ /dev/null @@ -1 +0,0 @@ -FTP_EXPORTS='!!%export:format("%s:%s ", ["name", "directory"])!!' diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/40.vsftpd/2.0#/files/etc/vsftpd/vsftpd.conf b/base/all/root/scripts/cluster_configure/templates/rhel/40.vsftpd/2.0#/files/etc/vsftpd/vsftpd.conf deleted file mode 100644 index abfb4bf..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/40.vsftpd/2.0#/files/etc/vsftpd/vsftpd.conf +++ /dev/null @@ -1,22 +0,0 @@ -# no anon access -anonymous_enable=NO -# put locks onto the files currently transferred -lock_upload_files=YES -# enable write access -write_enable=YES -# prevent changing access rights – ACLs get screwed otherwise -chmod_enable=NO -# enable that user is able to see the root of gpfs -chroot_local_user=YES -# allow local user access -local_enable=YES -listen=YES -pam_service_name=vsftpd -# set the ftp root directory users can see when they connect to the FTP -local_root=!!chroot_dir!! -log_ftp_protocol=YES -syslog_enable=YES -#show user/groupnames instead of only numeric IDs -text_userdb_names=YES -# make vsftpd work -connect_from_port_20=YES diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/41.httpd/2.2#/events/post b/base/all/root/scripts/cluster_configure/templates/rhel/41.httpd/2.2#/events/post deleted file mode 100755 index 060b997..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/41.httpd/2.2#/events/post +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec service httpd reload diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/41.httpd/2.2#/files/etc/httpd/conf.d/shares.config b/base/all/root/scripts/cluster_configure/templates/rhel/41.httpd/2.2#/files/etc/httpd/conf.d/shares.config deleted file mode 100644 index 2c3907b..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/41.httpd/2.2#/files/etc/httpd/conf.d/shares.config +++ /dev/null @@ -1 +0,0 @@ -!!%export:format("ScriptAlias \"/%s\" \"/var/www/cgi-bin/browse.cgi\"\nRewriteRule ^/%s(/(.*)$|$) - [E=CGIBROWSE_PREFIX:%s]\n", ("name", "name", "directory"))!! diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/42.rssh/2.3.2#/files/etc/rssh.conf b/base/all/root/scripts/cluster_configure/templates/rhel/42.rssh/2.3.2#/files/etc/rssh.conf deleted file mode 100644 index 4ad7e95..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/42.rssh/2.3.2#/files/etc/rssh.conf +++ /dev/null @@ -1,4 +0,0 @@ -allowscp -allowsftp -chrootpath=!!chroot_dir!! -logfacility=LOG_USER diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/43.openssh-server/4.3#/events/post b/base/all/root/scripts/cluster_configure/templates/rhel/43.openssh-server/4.3#/events/post deleted file mode 100755 index f34dd56..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/43.openssh-server/4.3#/events/post +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -set -e - -. /etc/sysconfig/sshd - -if [ ! -d "$SCP_CHROOT" ] ; then - mkchroot.sh create "$SCP_CHROOT" -fi - -export_dir="${SCP_CHROOT}/exports" - -for i in $FTP_EXPORTS ; do - b=$(basename "$i") - d="${export_dir}/${b}" - if [ -d "$d" ] ; then - mkchroot.sh mount "$i" "$d" - fi -done - -service sshd start diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/43.openssh-server/4.3#/events/pre b/base/all/root/scripts/cluster_configure/templates/rhel/43.openssh-server/4.3#/events/pre deleted file mode 100755 index 7b89c97..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/43.openssh-server/4.3#/events/pre +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -set -e - -if service sshd status ; then - service sshd stop -fi - -. /etc/sysconfig/sshd - -export_dir="${SCP_CHROOT}/exports" - -for i in $SCP_EXPORTS ; do - b=$(basename "$i") - d="${export_dir}/${b}" - if [ -d "$d" ] ; then - mkchroot.sh umount "$d" - fi -done - -if [ -d "$SCP_CHROOT" ] ; then - mkchroot.sh destroy "$SCP_CHROOT" -fi diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/43.openssh-server/4.3#/files/etc/sysconfig/sshd b/base/all/root/scripts/cluster_configure/templates/rhel/43.openssh-server/4.3#/files/etc/sysconfig/sshd deleted file mode 100644 index 40c8dd9..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/43.openssh-server/4.3#/files/etc/sysconfig/sshd +++ /dev/null @@ -1,2 +0,0 @@ -SCP_CHROOT=!!chroot_dir!! -SCP_EXPORTS='!!%export:format("%s ", ["directory"])!!' diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/50.samba/3.4#/files/etc/samba/smb.conf b/base/all/root/scripts/cluster_configure/templates/rhel/50.samba/3.4#/files/etc/samba/smb.conf deleted file mode 100644 index 4f8f8d0..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/50.samba/3.4#/files/etc/samba/smb.conf +++ /dev/null @@ -1,53 +0,0 @@ -[global] - # enable clustering - clustering=yes - ctdb:registry.tdb=yes - ctdbd socket = !!|ctdb_socket()!! - - security = !!|"ADS" if self.config.get("package:samba", "auth_method") == "winbind" else "USER"!! - auth methods = guest sam !!|"winbind" if self.config.get("package:samba", "auth_method") == "winbind" else ""!! - - netbios name = !!cluster!! - workgroup = !!workgroup!! - realm = !!realm!! - server string = "Clustered Samba" - disable netbios = yes - disable spoolss = yes - fileid:mapping = fsname - use mmap = yes - gpfs:sharemodes = yes - gpfs:leases = yes - passdb backend = tdbsam - preferred master = no - !!|"" if self.config.get("package:samba", "auth_method") == "winbind" else "#"!!idmap backend = tdb2 - !!|"" if self.config.get("package:samba", "auth_method") == "winbind" else "#"!!idmap:cache = no - !!|"" if self.config.get("package:samba", "auth_method") == "winbind" else "#"!!idmap gid = 10000000-11000000 - !!|"" if self.config.get("package:samba", "auth_method") == "winbind" else "#"!!idmap uid = 10000000-11000000 - kernel oplocks = yes - syslog = 1 - host msdfs = no - notify:inotify = no - vfs objects = shadow_copy2 syncops gpfs fileid - shadow:snapdir = .snapshots - shadow:fixinodes = yes - wide links = no - smbd:backgroundqueue = False - read only = no - use sendfile = yes - strict locking = yes - posix locking = yes - large readwrite = yes - force unknown acl user = yes - nfs4:mode = special - nfs4:chown = yes - nfs4:acedup = merge - nfs4:sidmap = /etc/samba/sidmap.tdb - map readonly = no - ea support = yes - !!|"" if self.config.get("package:samba", "auth_method") == "winbind" else "#"!!groupdb:backend = tdb - !!|"" if self.config.get("package:samba", "auth_method") == "winbind" else "#"!!winbind:online check timeout = 30 - !!|"" if self.config.get("package:samba", "auth_method") == "winbind" else "#"!!template shell = /usr/bin/rssh - !!|"" if self.config.get("package:samba", "auth_method") == "winbind" else "#"!!template homedir = !!chroot_dir!! - dmapi support = no - -!!%export:format("[%s]\n\tpath = %s\n\tcomment = %s\n\tguest ok = yes\n\tread only = no\n\tbrowseable = yes\n\n", ["name", "directory", "comment"])!! diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/60.nfs-utils/1.0#/events/post b/base/all/root/scripts/cluster_configure/templates/rhel/60.nfs-utils/1.0#/events/post deleted file mode 100755 index 371fcfd..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/60.nfs-utils/1.0#/events/post +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec service nfs reload diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/60.nfs-utils/1.0#/files/etc/exports b/base/all/root/scripts/cluster_configure/templates/rhel/60.nfs-utils/1.0#/files/etc/exports deleted file mode 100644 index 8f5822b..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/60.nfs-utils/1.0#/files/etc/exports +++ /dev/null @@ -1 +0,0 @@ -!!%export:format("\"%s\" *(rw,no_root_squash,subtree_check,fsid=%s)\n", ["directory", "fsid"])!! diff --git a/base/all/root/scripts/cluster_configure/templates/rhel/60.nfs-utils/1.0#/files/etc/sysconfig/nfs b/base/all/root/scripts/cluster_configure/templates/rhel/60.nfs-utils/1.0#/files/etc/sysconfig/nfs deleted file mode 100644 index dce3ce7..0000000 --- a/base/all/root/scripts/cluster_configure/templates/rhel/60.nfs-utils/1.0#/files/etc/sysconfig/nfs +++ /dev/null @@ -1,9 +0,0 @@ -STATD_PORT=32765 -STATD_OUTGOING_PORT=32766 -MOUNTD_PORT=32767 -RQUOTAD_PORT=32768 -LOCKD_UDPPORT=32769 -LOCKD_TCPPORT=32769 -NFS_HOSTNAME="!!nfs_hostname!!" -STATD_HOSTNAME="$NFS_HOSTNAME -H /etc/ctdb/statd-callout " -RPCNFSDARGS="-N 4" diff --git a/base/all/root/scripts/cluster_setup.sh b/base/all/root/scripts/cluster_setup.sh deleted file mode 100755 index 6a32c13..0000000 --- a/base/all/root/scripts/cluster_setup.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh - -#config: CLUSTERFS_TYPE - -set -e - -stage="$1" ; shift - -prefix="$stage" -case "$stage" in - install_packages) - prefix="install" - # Always do the extra packages task - set -- "extra_packages" "$@" - ;; -esac - -dn=$(dirname $0) - -config="${dn}/cluster_setup.config" -if [ ! -r "$config" ] ; then - echo "Can not local configuration file \"${config}\"" -fi -. "$config" - -for task ; do - case "$task" in - clusterfs) - type="$CLUSTERFS_TYPE" - file="${prefix%_clusterfs}_clusterfs_${type}.sh" - ;; - *) - file="${prefix}_${task}.sh" - esac - - path="${dn}/tasks/${file}" - - if [ ! -r "$path" ] ; then - echo "Unable to find script \"${file}\" for stage \"${stage}\" task \"${task}\"" - exit 1 - fi - - echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" - printf "%% %-66s %%\n" "Stage \"${stage}\", task \"${task}\" on host ${HOSTNAME%%.*}" - echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" - set -- # pass no arguments - . "$path" -done diff --git a/base/all/root/scripts/nas.conf b/base/all/root/scripts/nas.conf deleted file mode 100644 index d3bef51..0000000 --- a/base/all/root/scripts/nas.conf +++ /dev/null @@ -1,59 +0,0 @@ -[DEFAULT] -cluster = @@CLUSTER@@ -domain = @@DOMAIN@@ -workgroup = @@WORKGROUP@@ -kdc = @@KDC_NAME@@ -chroot_parent = /var/lib/nas-chroot -scp_chroot = %(chroot_parent)s/scp -clusterfs_default_mountpoint = @@CLUSTERFS_DEFAULT_MOUNTPOINT@@ -auth_method = @@AUTH_METHOD@@ -network_stack = @@NETWORK_STACK@@ - -[filesystem:0] -type = @@CLUSTERFS_TYPE@@ -mountpoint = %(clusterfs_default_mountpoint)s - -[share:data] -directory = %(clusterfs_default_mountpoint)s/data -filesystem = %(clusterfs_default_mountpoint)s -permissions = 0777 -comment = An example share - -[package:ctdb] -deterministic_ips = 0 -public_addresses = @@@PUBLIC_ADDRESSES@@@ - -[package:vsftpd] -chroot_dir = %(chroot_parent)s/ftp - -[export:vsftpd:data] -share = data - -[package:httpd] -# This section left intentionally empty. - -[export:httpd:data] -share = data - -[package:nfs-utils] -nfs_hostname = %(cluster)s - -[export:nfs-utils:data] -share = data -fsid = 834258092 - -[package:samba] -realm = %(domain)s -chroot_dir = %(scp_chroot)s - -[export:samba:data] -share = data - -[package:openssh-server] -chroot_dir = %(scp_chroot)s - -[export:openssh-server:data] -share = data - -[package:rssh] -chroot_dir = %(scp_chroot)s diff --git a/base/all/root/scripts/setup_segv_handler.sh b/base/all/root/scripts/setup_segv_handler.sh deleted file mode 100755 index 763f22d..0000000 --- a/base/all/root/scripts/setup_segv_handler.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash -# a script to setup a segmentation fault handler on a SoFS cluster -# tridge@samba.org July 2008 - -set -e - -echo "Creating source file" -mkdir -p /usr/local/src - -cat <<EOFSOURCE > /usr/local/src/segv_handler.c -#define _GNU_SOURCE -#include <signal.h> -#include <stdlib.h> -#include <stdio.h> -#include <unistd.h> -#include <string.h> -#include <dlfcn.h> - -static int segv_handler(int sig) -{ - char cmd[100]; - char progname[100]; - char *p; - int n; - - n = readlink("/proc/self/exe",progname,sizeof(progname)); - progname[n] = 0; - - p = strrchr(progname, '/'); - *p = 0; - - snprintf(cmd, sizeof(cmd), "/usr/local/bin/backtrace %d 2>&1 | tee /var/log/segv/segv_%s.%d.out > /dev/console", - (int)getpid(), p+1, (int)getpid()); - system(cmd); - signal(SIGSEGV, SIG_DFL); - return 0; -} - -static void segv_init() __attribute__((constructor)); -void segv_init(void) -{ - signal(SIGSEGV, (sighandler_t) segv_handler); - signal(SIGBUS, (sighandler_t) segv_handler); -} -EOFSOURCE - -mkdir -p /usr/local/bin -cat <<EOFSOURCE > /usr/local/bin/backtrace -#!/bin/sh - -# we want everything on stderr, so the program is not disturbed -exec 1>&2 - -PID=\$1 -TMPFILE=/tmp/gdb.\$\$ -cat << EOF > \$TMPFILE -set height 0 -bt full -thread apply all bt full -quit -EOF -gdb -batch -x \$TMPFILE --pid \$PID < /dev/null -/bin/rm -f \$TMPFILE - -EOFSOURCE - -chmod +x /usr/local/bin/backtrace - -mkdir -p /var/log/segv - -echo "Compiling 64 bit shared library" -mkdir -p /usr/local/lib -gcc -m64 -shared -fPIC -o /usr/local/lib/segv_handler64.so /usr/local/src/segv_handler.c - -echo "Compiling 32 bit shared library" -mkdir -p /usr/local/lib -gcc -m32 -shared -fPIC -o /usr/local/lib/segv_handler32.so /usr/local/src/segv_handler.c - -echo "Modifying /lib/ld-2.5.so for LD_PRELO32" -sed -e 's@/etc/ld.so.preload@/etc/ld.so.prelo32@g' -i.orig /lib/ld-2.5.so -# we need to remove the original to stop ldconfig enabling it -rm -f /lib/ld-2.5.so.orig - -echo "Creating /etc/ld.so.prelo32" -echo "/usr/local/lib/segv_handler32.so" > /etc/ld.so.prelo32 - -echo "Creating /etc/ld.so.preload" -echo "/usr/local/lib/segv_handler64.so" >> /etc/ld.so.preload -sort -u < /etc/ld.so.preload > /etc/ld.so.preload.$$ -mv /etc/ld.so.preload.$$ /etc/ld.so.preload - -echo "Copying install to other nodes" -onnode -p all rsync $HOSTNAME:/usr/local/bin/backtrace /usr/local/bin/ -onnode -p all rsync $HOSTNAME:/usr/local/lib/segv_handler*so /usr/local/lib -onnode -p all rsync $HOSTNAME:/etc/ld.so.preload /etc/ -onnode -p all rsync $HOSTNAME:/etc/ld.so.prelo32 /etc/ -onnode -p all rsync $HOSTNAME:/lib/ld-2.5.so /lib/ -onnode -p all mkdir -p /var/log/segv -onnode -p all chmod a+rwx /var/log/segv - -cat <<EOF -segv_handler installed. To take full effect you must restart your daemons -or reboot -EOF diff --git a/base/all/root/scripts/setup_tsm_client.sh b/base/all/root/scripts/setup_tsm_client.sh deleted file mode 100755 index 792edbe..0000000 --- a/base/all/root/scripts/setup_tsm_client.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/bin/bash - -# catch errors -set -e -set -E -trap 'es=$?; - echo ERROR: failed in function \"${FUNCNAME}\" at line ${LINENO} of ${BASH_SOURCE[0]} with code $es; - exit $es' ERR - -# Setup things up so that TSM_SERVER is the first tsm_server node and -# any nas nodes are listed in the TSM server configuration as clients. -NODES="@@NODES@@" -TSM_SERVER="" -TSM_CLIENTS="" - -for n in $NODES ; do - case "$n" in - nas:*) - t="${n%:*}" - # comma separated - TSM_CLIENTS="${TSM_CLIENTS}${TSM_CLIENTS:+,}${t##*:}" - ;; - tsm_server:*) - [ -n "$TSM_SERVER" ] && continue - t="${n%:*}" - TSM_SERVER="${t##*:}" - esac -done - -if [ -z "$TSM_SERVER" ] ; then - echo "ERROR: No tsm_server nodes in this cluster!" - exit 1 -fi - -################################ - -mmgetstate | grep active > /dev/null || { - echo "GPFS must be running to setup TSM client" - exit 1 -} - -################################ -# wait for GPFS to become active -gpfs_wait_active() { - echo "Waiting for gpfs to become active" - while ! mmgetstate | grep active > /dev/null; do - echo -n "."; - sleep 1; - done - echo -} - -######################## -# wait for GPFS to mount -gpfs_wait_mount() { - gpfs_wait_active - echo "Waiting for gpfs to mount (can take a while)" - while ! mount | grep /dev/gpfs0 > /dev/null; do - sleep 2; - mmmount gpfs0 -a 2> /dev/null || true - done -} - - -###################################### -# run the given command on all of the $TSM_CLIENTS -run_on_client_nodes() { - onnode -n -qp "$TSM_CLIENTS" "$@" -} - -# install the SoFS toolset first so that gpfsready is put into place -# and the HSM packages will not touch it any more -run_on_client_nodes yum -y install sofs-toolset -run_on_client_nodes yum -y install TIVsm-BA TIVsm-HSM TIVsm-API expect - -echo "Setting up dsm.sys" -cat <<EOF > /opt/tivoli/tsm/client/ba/bin/dsm.sys -SErvername $TSM_SERVER - COMMMethod TCPip - TCPPort 1500 - TCPServeraddress $TSM_SERVER - PASSWORDACCESS generate - EXCLUDE.DIR /.../.snapshots - EXCLUDE /.../.snapshots/* - EXCLUDE.DIR /.../.SpaceMan - EXCLUDE /.../.SpaceMan/* - EXCLUDE.DIR /.../.ctdb - EXCLUDE /.../.ctdb/* - ERRORLOGName /var/log/dsmerror.log - ASNODENAME @@TSMNAME@@ -EOF -run_on_client_nodes rsync $HOSTNAME:/opt/tivoli/tsm/client/ba/bin/dsm.sys /opt/tivoli/tsm/client/ba/bin - -echo "Setting up dsm.opt" -cat <<EOF > /opt/tivoli/tsm/client/ba/bin/dsm.opt -servername $TSM_SERVER -dateformat 2 -EOF -run_on_client_nodes rsync $HOSTNAME:/opt/tivoli/tsm/client/ba/bin/dsm.opt /opt/tivoli/tsm/client/ba/bin - -run_on_client_nodes "preprpnode `hostname -s`" -mkrpdomain -F /etc/ctdb/nodes SoFS - -echo "Setting TSM password" -cat <<EOF > /tmp/tsmpwd -spawn dsmsetpw -expect "enter password" -send "admin -" -sleep 2 -EOF -run_on_client_nodes "rsync $HOSTNAME:/tmp/tsmpwd /tmp/; expect /tmp/tsmpwd" -run_on_client_nodes rm -f /tmp/tsmpwd - -# we have to use a rather torturous procedure ... -echo "Killing ctdb" -run_on_client_nodes killall ctdbd || true - -echo "temporarily disabling automount of gpfs0" -mmchfs gpfs0 -A no - -echo "Shutting down gpfs" -mmshutdown -a - -echo "Starting up gpfs again" -mmstartup -a - -gpfs_wait_active - -echo "Enabling DMAPI in gpfs" -mmchfs gpfs0 -z yes - -echo "Enabling LOWSPACE events in GPFS" -mmchconfig enableLowspaceEvents=yes - -echo "enabling automount of gpfs0" -mmchfs gpfs0 -A yes - -echo "Restarting GPFS" -mmshutdown -a -mmstartup -a - -gpfs_wait_mount - -echo "Adding space management to /gpfs" -dsmmigfs add /gpfs -LT=100 -HT=100 - -echo "Enabling failover" -run_on_client_nodes dsmmigfs ENABLEFailover - -echo "Restarting gpfs" -mmshutdown -a -mmstartup -a - -gpfs_wait_mount - -cat <<EOF -TSM client setup complete on $TSM_CLIENTS -You should reboot the nodes before using HSM -EOF diff --git a/base/all/root/scripts/setup_tsm_server.sh b/base/all/root/scripts/setup_tsm_server.sh deleted file mode 100755 index 30bd92e..0000000 --- a/base/all/root/scripts/setup_tsm_server.sh +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/bash - -# catch errors -set -e -set -E -trap 'es=$?; - echo ERROR: failed in function \"${FUNCNAME}\" at line ${LINENO} of ${BASH_SOURCE[0]} with code $es; - exit $es' ERR - - -# Setup things up so that TSM_SERVER is the first tsm_server node and -# any nas nodes are listed in the TSM server configuration as -# clients. -NODES="@@NODES@@" -TSM_SERVER="" -TSM_CLIENTS="" - -for n in $NODES ; do - case "$n" in - nas:*) - t="${n%:*}" - TSM_CLIENTS="${TSM_CLIENTS}${TSM_CLIENTS:+ }${t##*:}" - ;; - tsm_server:*) - [ -n "$TSM_SERVER" ] && continue - t="${n%:*}" - TSM_SERVER="${t##*:}" - esac -done - -if [ -z "$TSM_SERVER" ] ; then - echo "ERROR: No tsm_server nodes in this cluster!" - exit 1 -fi - -if [ -z "$TSM_CLIENTS" ] ; then - echo "ERROR: No nas nodes in this cluster!" - exit 1 -fi - -yum -y install TIVsm-BA TIVsm-HSM TIVsm-API TIVsm-server - -echo "Ensuring multipath is disabled on this disk" -chkconfig multipathd off || true -service multipathd stop || true -multipath -F || true -cat <<EOF >> /etc/multipath.conf -blacklist { - "^@@SYSTEM_DISK_PREFIX@@b" -} -EOF - -echo "Disabling multipath at boot" -sed -e 's/rhgb/rhgb nompath/g' -i.orig /boot/grub/grub.conf - -mkfs.ext3 -F /dev/@@SYSTEM_DISK_PREFIX@@b -mkdir -p /tsmdiskpool -cat <<EOF >> /etc/fstab -/dev/@@SYSTEM_DISK_PREFIX@@b /tsmdiskpool ext3 defaults 1 1 -EOF -mount /tsmdiskpool - -ln -sf /opt/tivoli/tsm/server/bin/dsmserv.rc /etc/init.d/dsmserv -ln -sf /etc/init.d/dsmserv /etc/rc3.d/S99dsmserv -/etc/init.d/dsmserv start - -echo "Setting up dsm.sys" -cat <<EOF > /opt/tivoli/tsm/client/ba/bin/dsm.sys -SErvername $TSM_SERVER - COMMMethod TCPip - TCPPort 1500 - TCPServeraddress $TSM_SERVER - ASNODENAME @@TSMNAME@@ - PASSWORDACCESS generate - EXCLUDE.DIR /.../.snapshots - ERRORLOGName /var/log/dsmerror.log -EOF - -echo "Setting up dsm.opt" -cat <<EOF > /opt/tivoli/tsm/client/ba/bin/dsm.opt -servername $TSM_SERVER -dateformat 2 -EOF - - - -{ - cat <<EOF -copy domain STANDARD ALLTODISK -upd mg ALLTODISK STANDARD STANDARD migrequiresbkup=no SPACEMGTECHnique=selective -activate pol ALLTODISK STANDARD -register node @@TSMNAME@@ admin domain=ALLTODISK userid=none backdel=yes -EOF - - AGENTS="" - for c in $TSM_CLIENTS ; do - echo "register node ${c}.@@DOMAIN@@ admin domain=ALLTODISK userid=none backdel=yes" - AGENTS="${AGENTS}${AGENTS:+,}${c}.@@DOMAIN@@" - done - - cat <<EOF -grant proxynode target=@@TSMNAME@@ agent=$AGENTS -def dbvol /tsmdiskpool/db1.dsm format=@@TSM_DB_SIZE@@ wait=yes -del dbv /opt/tivoli/tsm/server/bin/db.dsm wait=yes -extend db `expr @@TSM_DB_SIZE@@ - 16` wait=yes -set logmode rollf -def vol spacemgpool /tsmdiskpool/vol01.dsm format=@@TSM_SPACE_MGMT_SIZE@@ wait=yes -def vol backuppool /tsmdiskpool/backup1.dsm format=@@TSM_BACKUP_POOL_SIZE@@ wait=yes -del vol /opt/tivoli/tsm/server/bin/backup.dsm wait=yes -def vol archivepool /tsmdiskpool/archive1.dsm format=@@TSM_ARCHIVE_POOL_SIZE@@ wait=yes -del vol /opt/tivoli/tsm/server/bin/archive.dsm wait=yes -upd stgpool archivepool next=spacemgpool -upd stgpool backuppool next=spacemgpool -EOF -} | dsmadmc -id=admin -password=admin -noconfirm || true - -echo "TSM server setup complete" -exit 0 diff --git a/base/all/root/scripts/tasks/install_ad.sh b/base/all/root/scripts/tasks/install_ad.sh deleted file mode 100755 index 5560d35..0000000 --- a/base/all/root/scripts/tasks/install_ad.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -set -e - -echo "Installing Samba4 packages" -yum -y install samba4-dc samba4-python samba4-winbind diff --git a/base/all/root/scripts/tasks/install_build.sh b/base/all/root/scripts/tasks/install_build.sh deleted file mode 100755 index cc67d58..0000000 --- a/base/all/root/scripts/tasks/install_build.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# Setup RPM development -echo "Installing RPM developing and setting up rpm build" -yum -y install rpmdevtools - -# Install the performance co-pilot packages to allow building of the -# CTDB pmda code. It is OK if this fails (these packages are only -# available in EPEL) since this script will continue... -echo "Installing PCP development libraries - this may fail" -yum -y install pcp-libs pcp-libs-devel || true - -# Packages required for samba development -echo "Installing Samba build dependencies" -yum -y install readline-devel libacl-devel e2fsprogs-devel \ - libxslt docbook-utils docbook-style-xsl dbus-devel \ - libaio-devel libcap-devel quota-devel \ - perl-Parse-Yapp perl-ExtUtils-MakeMaker - -exit 0 diff --git a/base/all/root/scripts/tasks/install_clusterfs_gpfs.sh b/base/all/root/scripts/tasks/install_clusterfs_gpfs.sh deleted file mode 100755 index f12473d..0000000 --- a/base/all/root/scripts/tasks/install_clusterfs_gpfs.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -#config: GPFS_BASE_VERSION RHEL_ARCH - -# Must force the base GPFS package first, due to the way GPFS updates -# work. -echo "Installing GPFS base" -yum -y install "gpfs.base-${GPFS_BASE_VERSION}.${RHEL_ARCH}" - -echo "Updating GPFS base" -yum -y update - -echo "Installing remaining GPFS packages" -yum -y install gpfs.docs gpfs.gpl gpfs.msg.en_US gpfs.gskit - -echo "Adding GPFS's bin to PATH" -cat >/etc/profile.d/gpfs-autocluster.sh <<EOF -# Added by autocluster -pathmunge /usr/lpp/mmfs/bin -EOF - -echo "Rebuilding the GPFS modules" -(cd /usr/lpp/mmfs/src && make Autoconfig World InstallImages) diff --git a/base/all/root/scripts/tasks/install_extra_packages.sh b/base/all/root/scripts/tasks/install_extra_packages.sh deleted file mode 100755 index 39140da..0000000 --- a/base/all/root/scripts/tasks/install_extra_packages.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -#config: CONFIG_EXTRA_PACKAGES - -echo "Updating from YUM repositories" -yum -y update - -extra_packages="$CONFIG_EXTRA_PACKAGES" -if [ -n "$extra_packages" ] ; then - echo "Installing extra packages" - yum -y install $extra_packages -fi diff --git a/base/all/root/scripts/tasks/install_nas.sh b/base/all/root/scripts/tasks/install_nas.sh deleted file mode 100755 index 30210cc..0000000 --- a/base/all/root/scripts/tasks/install_nas.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -echo "Installing tdb tools packages" -yum -y install tdb-tools - -echo "Installing ctdb packages" -yum -y install ctdb ctdb-debuginfo ctdb-devel ctdb-tests - -echo "Installing samba packages" -yum -y install \ - samba samba-client samba-doc \ - samba-winbind samba-winbind-clients -yum -y install samba-vfs-gpfs || true - -echo "Installing rssh" -yum -y install rssh diff --git a/base/all/root/scripts/tasks/setup_cluster_nas.sh b/base/all/root/scripts/tasks/setup_cluster_nas.sh deleted file mode 100755 index d584e5a..0000000 --- a/base/all/root/scripts/tasks/setup_cluster_nas.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -#config: AD_ADMIN_PASS - -# Configure a simple NAS cluster as generated by autocluster.. - -set -e - -conf_file="/root/scripts/nas.conf" - -ad_admin_pass="$AD_ADMIN_PASS" -domain_auth="administrator${ad_admin_pass:+%}${ad_admin_pass}" - -wait_until_healthy () -{ - local timeout="${1:-120}" - - echo -n "Wait until healthy [<${timeout}] " - - local count=0 - while [ $count -lt $timeout ] ; do - if ctdb nodestatus all >/dev/null ; then - echo "[${count}]" - return 0 - fi - echo -n "." - count=$(($count + 1)) - sleep 1 - done - - echo "[TIMEOUT]" - return 1 -} - -auth_type=$(sed -r -n -e 's@^auth_method[[:space:]]*=[[:space:]]*(files|winbind)[[:space:]]*$@\1@p' "$conf_file") - -case "$auth_type" in - winbind) - echo "Joining domain" - for i in $(seq 1 5) ; do - status=0 - timeout 10 net ads join -U"$domain_auth" || status=$? - echo " status = $status" - if [ $status -eq 0 ] ; then - break - fi - sleep 1 - done - ;; -esac - -echo "Restarting ctdb (up to 5 times)" -# Just in case the cluster doesn't become healthy the first time, -# repeat a few times... -for i in $(seq 1 5) ; do - onnode -p all "service ctdb restart" - if wait_until_healthy ; then - echo "NAS cluster setup complete" - exit 0 - fi -done - -exit 1 diff --git a/base/all/root/scripts/tasks/setup_clusterfs_gpfs.sh b/base/all/root/scripts/tasks/setup_clusterfs_gpfs.sh deleted file mode 100755 index 8cf5e9b..0000000 --- a/base/all/root/scripts/tasks/setup_clusterfs_gpfs.sh +++ /dev/null @@ -1,208 +0,0 @@ -#!/bin/sh - -#config: CLUSTER CLUSTERFS_DEFAULT_MOUNTPOINT GPFS_DEFAULT_NSDS -#config: NODES_STORAGE_GPFS SHARED_DISK_IDS - -# Automatically setup GPFS. This is a quick way to get setup with an -# autocluster system. It finds NSDs, does various pieces of GPFS -# configuration, creates a filesystem and mounts it. - -set -e - -gpfs_num_nsds="$GPFS_DEFAULT_NSDS" -cluster_name="$CLUSTER" -mountpoint="$CLUSTERFS_DEFAULT_MOUNTPOINT" -nodes_storage_gpfs="$NODES_STORAGE_GPFS" -shared_disk_ids="$SHARED_DISK_IDS" - -dir=$(dirname "$0") - -################################################## - -# If there are "storage_gpfs" nodes in the cluster (meaning that "nas" -# nodes will not have direct-attached storage) then scripts that -# include this snippet must be run on one of the storage nodes. -# Therefore, in the case, this snippet tries to determine if it is -# running on the 1st GPFS storage node and, if not, attempts to run -# the script there. -if [ -n "$nodes_storage_gpfs" -a \ - "${HOSTNAME%%.*}" != "${nodes_storage_gpfs%%[.,]*}" ] ; then - if [ "${0#/}" != "$0" ] ; then - script="$0" - else - script="${PWD}/${0}" - fi - re_exec_node="${nodes_storage_gpfs%%[.,]*}" - echo - echo "Creating NSDs on node \"${re_exec_node}\"" - exec ssh "$re_exec_node" "$script" "$@" -fi - -################################################## - -# Uses: cluster_name -gpfs_setup () -{ - _domain=$(dnsdomainname) - _nodes=$(onnode -q all hostname | grep -i "$_domain" | tr 'A-Z\012' 'a-z\040') - - _first="${_nodes%% *}" - - # Determine primary and secondary nodes. Give preference to GPFS - # storage nodes, falling back to regular nodes if there aren't any - # or aren't enough. - if [ -n "$nodes_storage_gpfs" ] ; then - _primary="${nodes_storage_gpfs%%,*}" - _rest="${nodes_storage_gpfs#*,}" - _secondary="${_rest%%,*}" - fi - if [ -z "$_primary" ] ; then - _primary="$_first" - _rest="${_nodes#* }" - _secondary="${_rest%% *}" - elif [ -z "$_secondary" ] ; then - _secondary="$_first" - fi - - # Create the node description file for mmcrcluster. If there are - # dedicated storage nodes then they are quorum nodes, along with - # the first node. If there are no dedicated storage nodes then - # all nodes are quorum nodes. - _nodefile="${dir}/gpfs_nodes.${cluster_name}" - { - for _n in $_nodes ; do - if [ "$_n" = "$_first" ] ; then - echo "${_n}:manager-quorum:" - elif [ -n "$nodes_storage_gpfs" ] ; then - echo "${_n}:manager:" - else - echo "${_n}:manager-quorum:" - fi - done - for _n in $(echo "$nodes_storage_gpfs" | sed -e 's@,@ @g') ; do - echo "${_n}:manager-quorum:" - done - } >"$_nodefile" - - echo "Creating cluster" - # Don't quote secondary, since it might not exist - mmcrcluster -N "$_nodefile" \ - -p "$_primary" ${_secondary:+-s} $_secondary \ - -r /usr/bin/ssh -R /usr/bin/scp -C "${cluster_name}.${_domain}" - - # GPFS >= 3.3 needs this. Earlier versions don't have - # mmchlicense, so be careful. - if type mmchlicense >/dev/null 2>&1 ; then - echo - echo "Attempting to set server license mode for all nodes" - mmchlicense server --accept -N all - fi - - echo - echo "Attempting to set adminMode=allToAll" - mmchconfig adminMode=allToAll </dev/null || true - - echo - echo "Generating auth key" - mmauth genkey new - - echo - echo "Setting GPFS config options" - mmchconfig autoload=yes,leaseRecoveryWait=3,maxFilesToCache=20000,failureDetectionTime=10,maxMBpS=500,unmountOnDiskFail=yes,pagepool=64M,allowSambaCaseInsensitiveLookup=no - mmchconfig cipherList=AUTHONLY - - echo "Starting gpfs" - mmstartup -a - - echo "Waiting for gpfs to become active" - _count=0 - while mmgetstate -a | tail -n +4 | grep -v " active" > /dev/null; do - echo -n "." - _count=$(($_count + 1)) - if [ $_count -gt 60 ] ; then - echo "TIMEOUT: gpfs didn't become active" - exit 1 - fi - sleep 1 - done - echo -} - -nsdfile="${dir}/gpfs_nsds_all.${cluster_name}" - -# Uses: nodes_storage_gpfs -# Sets: nsdfile -gpfs_mknsd () -{ - echo - echo "Setting up NSDs" - - # Create an extended regexp that matches any of the IDs - pat=$(echo "$shared_disk_ids" | sed -e 's@ *@|@g') - - # Now get devices and names from multipath - multipath -dl | - sed -r -n -e "s@^[^[:space:]]+[[:space:]]+\(($pat)\)[[:space:]](dm-[^[:space:]]+).*@\1 \2@p" | - while read _name _disk ; do - _name=$(echo "$_name" | tr -d -c '[:alnum:]') - echo "${_disk}:${nodes_storage_gpfs}::dataAndMetadata:1:${_name}:" - done >"$nsdfile" - - mmcrnsd -F "$nsdfile" - mmlsnsd -m -} - -# Uses: mountpoint, gpfs_num_nsds, nsdfile -gpfs_mkfs () -{ - echo - echo "Creating filesystem" - - if [ ! -r "$nsdfile" ] ; then - echo "ERROR: missing NSD file \"${nsdfile}\"" - exit 1 - fi - - mkdir -p "${mountpoint}/automountdir" - - nsdfile2="${dir}/gpfs_nsds_defaultfs.${cluster_name}" - if [ -n "$gpfs_num_nsds" ] ; then - head -n $(($gpfs_num_nsds * 2)) - else - cat - fi <"$nsdfile" >"$nsdfile2" - - chattr +i "$mountpoint" - - mmcrfs gpfs0 -F "$nsdfile2" \ - -A yes -Q yes -D nfs4 -B 64k -k nfs4 -n 32 -E yes -S no \ - -T "$mountpoint" -i 512 - - rm -f "$nsdfile2" -} - -gpfs_mount () -{ - echo - echo "Mounting filesystem" - mmmount gpfs0 -a - - echo "Waiting for gpfs to mount" - while ! findmnt "$mountpoint" ; do - echo -n "." - sleep 1 - done - - echo -} - -gpfs_complete () -{ - echo "GPFS setup complete" -} - -[ -n "$1" ] || set -- setup mknsd mkfs mount complete - -for action ; do - gpfs_$action -done diff --git a/base/all/root/scripts/tasks/setup_node_ad.sh b/base/all/root/scripts/tasks/setup_node_ad.sh deleted file mode 100755 index a3855ad..0000000 --- a/base/all/root/scripts/tasks/setup_node_ad.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh - -#config: AD_ADMIN_PASS AD_DNS_FORWARDER AD_FUNCTION_LEVEL AD_NETBIOS_NAME -#config: DOMAIN IPNUM NETWORK_PRIVATE_PREFIX WORKGROUP - -set -e - -# Remove samba3 configuration file -rm -f /etc/samba/smb.conf - -# Create AD instance -echo "Provisioning Samba4 AD domain: ${DOMAIN}" -hostip="${NETWORK_PRIVATE_PREFIX}.${IPNUM}" -samba-tool domain provision \ - --realm="$DOMAIN" \ - --domain="$WORKGROUP" \ - --host-ip="$hostip" \ - --host-name="$AD_NETBIOS_NAME" \ - --server-role="domain controller" \ - --function-level="$AD_FUNCTION_LEVEL" \ - --dns-backend="SAMBA_INTERNAL" - -# Add samba configuration parameters -sed -i -e '/server services/a\ - allow dns updates = True\ - nsupdate command = nsupdate\ - dns forwarder = ${AD_DNS_FORWARDER}\ - dns recursive queries = Yes' /etc/samba/smb.conf - -# Add users/groups -echo "Adding users and groups" -samba-tool domain passwordsettings set --min-pwd-length=3 -samba-tool domain passwordsettings set --complexity=off -samba-tool user setexpiry --noexpiry Administrator -samba-tool user setpassword administrator --newpassword="$AD_ADMIN_PASS" -samba-tool group add group1 -samba-tool group add group2 -samba-tool user add user1 "$AD_ADMIN_PASS" -samba-tool group addmembers group1 user1 -samba-tool user setexpiry --noexpiry user1 -samba-tool user add user2 "$AD_ADMIN_PASS" -samba-tool group addmembers group2 user2 -samba-tool user setexpiry --noexpiry user2 - -# Samba start-up -cat >> /etc/rc.d/rc.local <<EOF - -# Start SAMBA AD server -/usr/sbin/samba -EOF -mkdir /var/run/samba - -# Add NetBIOS name to hosts -echo "${hostip} ${AD_NETBIOS_NAME}.${DOMAIN} ${AD_NETBIOS_NAME}" >>/etc/hosts - -# Update DNS configuration -echo "Updating /etc/resolv.conf" -sed -i -e 's@^\(nameserver.*\)@#\1@' /etc/resolv.conf -echo "nameserver $hostip" >> /etc/resolv.conf - -# Start SAMBA -/usr/sbin/samba diff --git a/base/all/root/scripts/tasks/setup_node_build.sh b/base/all/root/scripts/tasks/setup_node_build.sh deleted file mode 100755 index 04d18b6..0000000 --- a/base/all/root/scripts/tasks/setup_node_build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -echo "Running rpmdev-setuptree" -rpmdev-setuptree - -echo "Removing .rpmmacros" -rm -vf /root/.rpmmacros diff --git a/base/all/root/scripts/tasks/setup_node_nas.sh b/base/all/root/scripts/tasks/setup_node_nas.sh deleted file mode 100755 index 65fd966..0000000 --- a/base/all/root/scripts/tasks/setup_node_nas.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -# Per-node NAS cluster configuration steps - -set -e - -conf_file="/root/scripts/nas.conf" - -auth_type=$(sed -r -n -e 's@^auth_method[[:space:]]*=[[:space:]]*(files|winbind)[[:space:]]*$@\1@p' "$conf_file") - -case "$auth_type" in - winbind|files) : ;; - *) - echo "Unsupported authentication type \"${auth_type}\"" - usage -esac - -domain=$(sed -r -n -e 's@^domain[[:space:]]*=[[:space:]]*([^ ]*)[[:space:]]*$@\1@p' "$conf_file" | tr '[a-z]' '[A-Z]') - -kdc=$(sed -r -n -e 's@^kdc[[:space:]]*=[[:space:]]*([^ ]*)[[:space:]]*$@\1@p' "$conf_file") - -case "$auth_type" in - winbind) - echo "Setting up NSS, PAM, KRB5..." - authconfig --update --nostart \ - --enablewinbindauth --enablewinbind \ - --disablekrb5 --krb5kdc=$kdc.$domain --krb5realm=$domain - ;; - files) - echo "Setting up NSS, PAM, KRB5..." - authconfig --update --nostart \ - --disablewinbindauth --disablewinbind \ - --disablekrb5 --krb5kdc=$kdc.$domain --krb5realm=$domain - ;; -esac - -echo "Configuring services..." -(cd scripts/cluster_configure && \ - ./cluster-configure.py -t "templates/rhel/" -vv "$conf_file") diff --git a/base/all/sbin/scsi_id_autocluster.sh b/base/all/sbin/scsi_id_autocluster.sh deleted file mode 100755 index d1293a2..0000000 --- a/base/all/sbin/scsi_id_autocluster.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# get scsi ID assuming disks setup by autocluster -/bin/dd if=/dev/$1 bs=1 count=64 2>/dev/null | head -n 1 | cat -v diff --git a/base/rhel_base/etc/hosts b/base/rhel_base/etc/hosts deleted file mode 100644 index 4d7acd6..0000000 --- a/base/rhel_base/etc/hosts +++ /dev/null @@ -1,5 +0,0 @@ -127.0.0.1 localhost - -@@@HOSTS_STATIC_ENTRIES@@@ - -@@KVMHOST@@ kvmhost diff --git a/config.d/00base.defconf b/config.d/00base.defconf deleted file mode 100644 index 5b78545..0000000 --- a/config.d/00base.defconf +++ /dev/null @@ -1,546 +0,0 @@ -# Hey Emacs, this is a -*- shell-script -*- !!! - -###################################################################### - -# Cluster - -defconf CLUSTERFS_TYPE "gpfs" \ - "<gpfs|?>" "type of cluster filesystem to use" - -defconf CLUSTERFS_DEFAULT_MOUNTPOINT "/clusterfs" \ - "<directory>" "mountpoint for default cluster filesystem" - -defconf NODES "nas:0-3 rhel_base:4" \ - "<nodes>" "list of node types to create, with associated IP offsets" - -# a directory on the host which will be mounted via NFS onto the nodes -# as $NFS_MOUNTPOINT, giving a nice common area independent of the -# cluster filesystem. This is useful for compiles, RPMs, devel -# scripts etc you need to add this to your /etc/exports and run -# exportfs -av yourself on the virtualisation host -defconf NFSSHARE "@uto" \ - "<mnt>" "NFS share to mount on each node" - -defconf NFS_MOUNTPOINT "/home" \ - "<dir>" "mount point for NFS share" - -###################################################################### - -# Directories and files - -# these are the default autocluster config options -# please override with your own options in your own config file - -defconf VIRTBASE /virtual \ - "<path>" "virtual machine directory for this host" - -# the name of the base RHEL install image that the nodes will be based on -# a kvm image called $VIRTBASE/$BASENAME.img will be created -# that will form the basis file for the images for each of the nodes -defconf BASENAME "ac-base" \ - "<file>" "filename for cluster base image" - -defconf BASE_PER_NODE_TYPE "no" \ - "<yes|no>" "Use per-node-type base images" - -defconf DISK_FOLLOW_SYMLINKS "no" \ - "<yes|no>" "If disk images use symlinks then follow them to overwrite" - -###################################################################### - -# Virtualisation - -defconf VIRSH "virsh -c qemu:///system" \ - "<cmd>" "how to invoke virsh" - -defconf KVM "@uto" \ - "<file>" "location of KVM executable" - -defconf KVMLOG "/var/log/kvm" \ - "<dir>" "directory for serial logs" - -defconf NODE_TEMPLATE "$installdir/templates/node.xml" \ - "<file>" "libvirt template for nodes" - -defconf INSTALL_TEMPLATE "$installdir/templates/install.xml" \ - "<file>" "libvirt template for initial install" - -defconf INSTALL_KERNEL_OPTIONS "@uto" \ - "<options>" "installer kernel command-line options" - -defconf BOOT_TEMPLATE "$installdir/templates/bootbase.xml" \ - "<file>" "libvirt template for \"bootbase\" command" - -defconf BASE_TEMPLATES "$installdir/base" \ - "<dir>" "directory containing base templates" - -defconf BASE_FORMAT "qcow2" \ - "<fmt>" "format to use for the qemu base images" - -defconf SYSTEM_DISK_TYPE "virtio" \ - "scsi|ide|virtio" "type of disks to use in nodes" - -rhel_disk_prefix () -{ - case "$1" in - (scsi|iscsi) echo "sd" ;; - (virtio) echo "vd" ;; - ide) - case "$RHEL_VERSION" in - (5.*) echo "hd" ;; - ([67].*) echo "sd" ;; - (*) die "Unknown RHEL_VERSION in rhel_disk_prefix" ;; - esac - ;; - (*) die "Unknown disk type \"$1\" in rhel_disk_prefix" ;; - - esac -} - -defconf SYSTEM_DISK_PREFIX "@uto" \ - "sd|hd|vd" "system disk device prefix" - -defconf SYSTEM_DISK_CACHE "writeback" \ - "default|none|writeback|writethrough" "system disk cache type" - -defconf SYSTEM_DISK_FORMAT "qcow2" \ - "qcow2|raw|reflink|mmclone|none" "system disk image format" - -defconf SYSTEM_DISK_ACCESS_METHOD "@uto" \ - "loopback|guestfish|guestmount" "how to setup up disk images" - -system_disk_access_method_hook () -{ - if [ "$SYSTEM_DISK_ACCESS_METHOD" = "@uto" ] ; then - if [ "$SYSTEM_DISK_FORMAT" = "qcow2" ] ; then - if which guestmount >/dev/null 2>&1 ; then - SYSTEM_DISK_ACCESS_METHOD="guestmount" - elif which guestfish >/dev/null 2>&1 ; then - SYSTEM_DISK_ACCESS_METHOD="guestfish" - elif which qemu-nbd nbd-client >/dev/null 2>&1 ; then - SYSTEM_DISK_ACCESS_METHOD="loopback" - else - die "Can't determine SYSTEM_DISK_ACCESS_METHOD. Need guestfish or qemu-nbd + nbd-client." - fi - else - SYSTEM_DISK_ACCESS_METHOD="loopback" - fi - fi -} - -register_hook post_config_hooks system_disk_access_method_hook - -system_disk_mounts () -{ - # We could call a function using call_func(). However, we want - # the options listed in the documentation for - # SYSTEM_DISK_ACCESS_METHOD, so they need to be hardcoded... so - # we might as well hardcode this function (for now). - case "$SYSTEM_DISK_ACCESS_METHOD" in - loopback) - case "$RHEL_VERSION" in - (5.*) echo "/:32256" ;; - ([67].*) echo "/:1048576" ;; - (*) die "Unknown RHEL_VERSION in system_disk_mounts" ;; - esac - ;; - (guestfish|guestmount) : ;; - (*) die "Unknown SYSTEM_DISK_ACCESS_METHOD in system_disk_mounts" ;; - esac -} - -defconf SYSTEM_DISK_MOUNTS "@uto" \ - "<list>" "list of mountpoints and offsets/devices for mount_disk()" - -###################################################################### - -# Node - -# what timezone to put the nodes in -# leave this empty to base the timezone on the zone that -# this host is in -defconf TIMEZONE "" \ - "<tz>" "timezone for each node" - -# how much disk space to use on each node -# note that it will only use what is actually occupied, -# so start this larger than you think you'll need -defconf DISKSIZE "20G" \ - "<n>G" "maximum disk size for each node" - -defconf ROOTSIZE 15000 \ - "<n>" "size of root partition in MB" - -defconf SWAPSIZE 2000 \ - "<n>" "size of swap partition in MB" - -rhel_default_mem () -{ - case "$RHEL_VERSION" in - (5.*) echo "262144" ;; - ([67].*) echo "512000" ;; - (*) die "Unknown RHEL_VERSION in rhel_default_mem" ;; - esac -} - -defconf MEM "@uto" \ - "<n>" "memory allocated for each node" - -defconf NICMODEL "e1000" \ - "<module>" "choice of KVM network adapter" - -defconf ROOTPASSWORD "password" \ - "<string>" "initial root password for each node" - -defconf NUMCPUS 2 \ - "<n>" "number of virtual CPUs per node" - -# Some machines need "clocksource=jiffies" -defconf EXTRA_KERNEL_OPTIONS "" \ - "<string>" "extra kernel options for nodes" - -defconf HOSTNAME_HACKING_FUNCTION "" \ - "<string>" "function to modify node hostnames, see the code for details" - -defconf HOSTS_STATIC_ENTRIES "/dev/null" \ - "<file>" "a file containing extra static entries to add to /etc/hosts" - -###################################################################### - -# Networking - -defconf DOMAIN "EXAMPLE.COM" \ - "<dom>" "Windows(TM) domain name for each node" - -defconf WORKGROUP "EXAMPLE" \ - "<grp>" "Windows(TM) workgroup for node" - -defconf NAMESERVER "@uto" \ - "<ip>" "DNS server for each node" - -defconf DNSSEARCH "$DOMAIN" \ - "<dom>" "extra domains for DNS search list" - -# Networks: -# * First network is private and contains the CTDB node addresses. -# * Items look like: net/bits,dev[,nat|bridge=host_iface][,gw=gateway_ip] - -defconf NETWORKS "10.0.0.0/24,eth0,gw=10.0.0.1 10.0.1.0/24,eth1 10.0.2.0/24,eth2" \ - "<list>" "description of IP networks" - -defconf NETWORK_STACK "ipv4" \ - "ipv4|dual|ipv6" "Configure IPv4/IPv6 stacks" - -make_public_addresses() -{ - local firstip="${1:-$[${FIRSTIP} + ${PUBLIC_IP_OFFSET}]}" - local num_addrs="$2" - - # By default the number of addresses on each public network is - # the same as the number of nodes - if [ -z "$num_addrs" ] ; then - num_addrs=0 - _count_ctdb_nodes () - { - if [ "$4" = "1" ] ; then - num_addrs=$(($num_addrs + 1)) - fi - } - for_each_node _count_ctdb_nodes - fi - - if [ $(( $firstip + $num_addrs - 1 )) -gt 254 ]; then - die "make_public_addresses: last octet > 254 - change PUBLIC_IP_OFFSET" - fi - - local n - for n in $NETWORKS_PUBLIC ; do - local dev="${n#*,}" # Strip address, comma - dev="${dev%,*}" # Strip comma, interface - echo -ne "${n%.*}.${firstip},${num_addrs},${dev} " - done - echo -} - -networks_post_config_hook () -{ - [ -z "$IPBASE" -a -z "$IPNET0" -a -z "$IPNET1" -a -z "$IPNET2" ] || \ - die "Configuration variables IPBASE, IPNET0/1/2 unsupported - please use NETWORKS" - - # Convenience variables - set -- $NETWORKS - NETWORK_PRIVATE="$1" ; shift - local t="${NETWORK_PRIVATE%%,*}" - NETWORK_PRIVATE_PREFIX="${t%.*}" - NETWORKS_PUBLIC="$*" -} - -register_hook post_config_hooks networks_post_config_hook - -defconf NETWORK_TEMPLATE "|network_template" \ - "<file>" "libvirt template fragment for networks" - -network_template () -{ - local netname dev ip ipv6 mac opts - while read netname dev ip ipv6 mac opts ; do - cat <<EOF - <interface type='network'> - <mac address='${mac}'/> - <model type='@@NICMODEL@@'/> - <source network='${netname}'/> - </interface> -EOF - done <"$network_map" -} - - -# the nodes will get IPs starting at this number -# the TSM server will get $FIRSTIP, then the first node will get -# the next IP etc -# so if the private network is 10.0.0.0/24,eth0 and FIRSTIP is 20 then -# you will get nodes like this: -# tsmserver 10.0.0.20 -# 1st node 10.0.0.21 -# 2nd node 10.0.0.22 -# etc etc -defconf FIRSTIP "20" \ - "<n>" "final octet for the 1st IP of the cluster" - -# Public addresses managed by CTDB. -defconf PUBLIC_IP_OFFSET 100 \ - "<n>" "offset from FIRSTIP of public IP addresses" - -defconf PUBLIC_ADDRESSES "|make_public_addresses" \ - "<cmd>" "template for public address entry in nas.conf" - -# a caching web proxy that can get to the install server from the -# nodes. If you don't have one on the local network then look in -# host_setup/etc/squid for an example setup you can install on the kvm -# host. The web proxy must cache large objects, and have room for -# several G of cache You can choose to have no web proxy at all, in -# which case set it to the empty string, and hope you have a fast -# network connection to the install server -defconf WEBPROXY "" \ - "<url>" "URL of a caching web proxy" - -defconf KVMHOST "10.0.0.1" \ - "<ip>" "KVM host - provides things like NTP, iSCSI targets, ..." - -defconf KDC_NAME "example-ad" \ - "<name>" "prefix of the name of the KDC" - -###################################################################### - -# RHEL - -rhel_print_iso () -{ - # Uses: RHEL_VERSION, RHEL_ARCH - # Prints: a value for ISO - - local datever - - case "$RHEL_VERSION" in - (5.1) datever="20071017.0";; - (5.2) datever="20080430.0";; - (5.3) datever="20090106.0";; - (5.4) datever="20090819.0";; - (5.5) datever="20100322.0";; - (5.6) datever="20110106.0";; - (5.7) datever="20110711.5";; - (5.8) datever="20120202.0";; - (6.0) datever="20100922.1";; - (6.1) datever="20110510.1";; - (6.2) datever="20111117.0";; - (6.3) datever="20120613.2";; - (6.4) datever="20130130.0";; - (6.5) datever="20131111.0";; - (6.6) datever="20140926.0";; - (6.7) datever="20150702.0";; - (6.8) datever="20160414.0";; - (6.9) datever="20170309.0";; - (6.10) datever="20180525.0";; - (7.0) datever="20140507.0";; - (7.1) datever="20150219.1";; - (7.2) datever="20151030.0";; - (7.3) datever="20161019.0";; - (7.4) datever="20170711.0";; - (7.5) datever="20180322.0";; - (*) die "Unknown RHEL_VERSION in rhel_print_iso" ;; - esac - - case "$RHEL_VERSION" in - (5.*) echo "RHEL${RHEL_VERSION}-Server-${datever}-${RHEL_ARCH}-DVD.iso" ;; - (6.[0-5]) echo "RHEL${RHEL_VERSION}-${datever}-Server-${RHEL_ARCH}-DVD1.iso" ;; - ([67].*) echo "RHEL-${RHEL_VERSION}-${datever}-Server-${RHEL_ARCH}-dvd1.iso" ;; - esac -} - -# yum repo infrastructure -_YUM_TEMPLATE="$installdir/templates/RHEL.repo" # Private - used below! -rhel_gen_yum_repos () -{ - echo "# Generated by autocluster." - - for repo ; do -# Repo IDs can not contain slashes, so replace slashes with dashes. -cat <<EOF -[${repo//\//-}] -name=${repo} -baseurl=@@INSTALL_SERVER@@/${repo} -enabled=1 -gpgcheck=0 - -EOF - done - -cat <<EOF -@@@_YUM_TEMPLATE@@@ -EOF -} - -get_kvm_path () -{ - local t - - if t=$(which qemu-kvm 2>/dev/null) ; then - echo "$t" - elif t=$(which kvm 2>/dev/null) ; then - echo "$t" - elif [ -x "/usr/libexec/qemu-kvm" ] ; then - echo "/usr/libexec/qemu-kvm" - else - die "Could not find KVM executable" - fi - -} - -rhel_get_install_kernel_options () -{ - case "$RHEL_VERSION" in - (7.*) echo "ks=hd:LABEL=KICKSTART inst.stage2=hd:LABEL=RHEL-${RHEL_VERSION}\\\\x20Server.${RHEL_ARCH}" ;; - (*) echo "ks=floppy" ;; - esac -} - -rhel_get_install_ks_device_xml () -{ - if [ ${RHEL_VERSION%%.*} -le 6 ] ; then - cat <<EOF - <disk type='file' device='floppy'> - <source file='@@PWD@@/tmp/floppy.img'/> - <target dev='fda'/> - <readonly/> - </disk> -EOF - else - cat <<EOF - <disk type='file' device='disk'> - <source file='@@PWD@@/tmp/floppy.img'/> - <target dev='@@SYSTEM_DISK_PREFIX@@b' bus='@@SYSTEM_DISK_TYPE@@'/> - <driver name='qemu' type='raw'/> - </disk> -EOF - fi -} - -rhel_get_multipath_magic () -{ - if [ ${RHEL_VERSION%%.*} -le 6 ] ; then - cat <<EOF - udev_dir /dev - getuid_callout "$SHARED_DISK_MULTIPATH_CALLOUT" -EOF - fi -} - -rhel_post_config_hook () -{ - if [ "$ISO" = "@uto" ] ; then - ISO=$(rhel_print_iso) || exit $? - fi - - if [ "$SYSTEM_DISK_MOUNTS" = "@uto" ] ; then - SYSTEM_DISK_MOUNTS=$(system_disk_mounts) || exit $? - fi - - if [ "$MEM" = "@uto" ] ; then - MEM=$(rhel_default_mem) || exit $? - fi - - if [ "$SYSTEM_DISK_PREFIX" = "@uto" ] ; then - SYSTEM_DISK_PREFIX=$(rhel_disk_prefix $SYSTEM_DISK_TYPE) || exit $? - fi - - if [ "$KVM" = "@uto" ] ; then - KVM=$(get_kvm_path) || exit $? - fi - - if [ "$INSTALL_KERNEL_OPTIONS" = "@uto" ] ; then - INSTALL_KERNEL_OPTIONS=$(rhel_get_install_kernel_options) || exit $? - fi - - if [ "$INSTALL_KS_DEVICE_TEMPLATE" = "@uto" ] ; then - INSTALL_KS_DEVICE_TEMPLATE=$(rhel_get_install_ks_device_xml) || exit $? - fi - - if [ "$RHEL_MULTIPATH_MAGIC" = "@uto" ] ; then - RHEL_MULTIPATH_MAGIC=$(rhel_get_multipath_magic) || exit $? - fi - - if [ "$NAMESERVER" = "@uto" ] ; then - NAMESERVER="$KVMHOST" - fi - - if [ "$INSTALL_SERVER" = "@uto" ] ; then - INSTALL_SERVER="http://${KVMHOST}/mediasets" - fi - - if [ "$NFSSHARE" = "@uto" ] ; then - NFSSHARE="10.0.0.1:/home" - fi -} - -register_hook post_config_hooks rhel_post_config_hook - -defconf RHEL_ARCH "x86_64" \ - "<arch>" "The RHEL operating system architecture to configure" - -defconf RHEL_VERSION "6.2" \ - "<version>" "version of Red Hat Enterprise Linux to configure" - -defconf RHEL_MULTIPATH_MAGIC "@uto" - -defconf ISO_DIR "/virtual/ISO" \ - "<dir>" "directory for ISO images, prepended to $ISO if not absolute" - -defconf ISO "@uto" \ - "<file>" "ISO image for base image creation" - -# the install server where we will get local packages from -defconf INSTALL_SERVER "@uto" \ - "<url>" "URL of install server" - -defconf CONFIG_EXTRA_PACKAGES "" \ - "<packages>" "list of extra packages to install at configuration time" - -# the yum repositories to use. Choose the one appropriate for the -# system you are installing -defconf YUM_TEMPLATE "$_YUM_TEMPLATE" \ - "<file>" "location of template for yum repositories" - -defconf INSTALL_KS_DEVICE_TEMPLATE "@uto" - -############################## - -defconf CREATE_BASE_TIMEOUT 3600 \ - "<seconds>" "time to wait for base image install before aborting" - -############################## - -# Authentication method -defconf AUTH_METHOD "files" \ - "files|winbind" "authentication method" - -############################## diff --git a/config.d/02kickstart.defconf b/config.d/02kickstart.defconf deleted file mode 100644 index 61c0fcf..0000000 --- a/config.d/02kickstart.defconf +++ /dev/null @@ -1,47 +0,0 @@ -# Hey Emacs, this is a -*- shell-script -*- !!! - -defconf KICKSTART "$installdir/templates/nas-kickstart.cfg" \ - "<file>" "choice of kickstart file" - -defconf KS_KEYBOARD "us" \ - "<kbd>" "keyboard layout for each node" - -defconf KS_LANGUAGE "${LANG:-en_US.UTF-8}" \ - "<locale>" "locale for installer to use" - -defconf KS_RHEL_PACKAGES "@uto" - -defconf KS_RHEL_SERVICES "@uto" - -# any extra packages to install. List one on each line. To force a package -# not to be installed, list it with a leading - -defconf KS_EXTRA_PACKAGES '' \ - "<list>" "extra packages for kickstart to install" - -defconf KS_EXTRA_CHKCONFIGS "" \ - "<chkconfigs>" "extra chkconfig commands to run in post-install" - -defconf KS_STANDARD_POSTINSTALL "$installdir/templates/basic-postinstall.sh" \ - "<file>" "standard kickstart postinstall script - change with care" - -defconf KS_POSTINSTALL_TEMPLATE "" \ - "<file>" "extra script to be incorporated into kickstart post-install" - -defconf KS_KERNEL_OPTS "rhgb console=tty1 console=ttyS0,19200 nodmraid nompath" \ - "<opts>" "options passed by kickstart to the kernel" - -defconf KS_DONE_MESSAGE "you may safely reboot your system|System halted.|Power down." \ - "<string>" "string indicating kickstart install is complete" - -ks_post_config_hook () -{ - if [ "$KS_RHEL_PACKAGES" = "@uto" ] ; then - KS_RHEL_PACKAGES="$installdir/templates/RHEL${RHEL_VERSION%%.*}.packages" - fi - - if [ "$KS_RHEL_SERVICES" = "@uto" ] ; then - KS_RHEL_SERVICES="$installdir/templates/RHEL${RHEL_VERSION%%.*}.services" - fi -} - -register_hook post_config_hooks ks_post_config_hook diff --git a/config.d/05diskimage_guestfish.defconf b/config.d/05diskimage_guestfish.defconf deleted file mode 100644 index 7944430..0000000 --- a/config.d/05diskimage_guestfish.defconf +++ /dev/null @@ -1,193 +0,0 @@ -# Hey Emacs, this is a -*- shell-script -*- !!! - -# This file provides functions to implement access/update of disk -# images via guestfish. - -###################################################################### - -diskimage_mount_guestfish () -{ - echo "Using guestfish to update disk image ${disk}..." - - local mount_args="" - local m d - for m in $SYSTEM_DISK_MOUNTS ; do - d="${m#*:}" # Device is after colon - m="${m%:*}" # Mountpoint is before colon - mount_args="${mount_args}${mount_args:+ } --mount ${d}:${m}" - echo " mount ${m} from device ${d} configured" - done - [ -n "$mount_args" ] || mount_args="-i" - - eval $(guestfish --listen -a "$1" $mount_args) - - guestfish --remote ping-daemon || \ - die "Failed to initialise guestfish session" - - diskimage is_directory "/root" || { - echo "Mounted directory does not look like a root filesystem" - guestfish --remote ll / - exit 1 - } - - echo $GUESTFISH_PID > tmp/guestfish.pid - echo "To attach to guestfish image" - echo " export GUESTFISH_PID=$GUESTFISH_PID" - echo " guestfish --remote" -} - -# unmount a qemu image -diskimage_unmount_guestfish () -{ - read GUESTFISH_PID < tmp/guestfish.pid - export GUESTFISH_PID - - echo "Unmounting disk" - guestfish --remote sync - guestfish --remote exit -} - -diskimage_mkdir_p_guestfish () -{ - local t=$(guestfish --remote is-dir "$1/.") - if [ "$t" = "false" ] ; then - guestfish --remote mkdir-p "$1" - fi -} - -diskimage_substitute_vars_guestfish () -{ - local t=$(mktemp) - substitute_vars "$1" "$t" - guestfish --remote upload "$t" "$2" - rm "$t" -} - -diskimage_chmod_guestfish () -{ - local mode="$1" ; shift - - # For guestfish, octal mode must start with '0'. - case "$mode" in - (0*) : ;; - (*) mode="0${mode}" ;; - esac - - local i - for i ; do - guestfish --remote glob chmod "$mode" "$i" - done -} - -diskimage_chmod_reference_guestfish () -{ - local mode=$(printf "%o\n" $(( 0x$(stat -c "%f" "$1") )) ) - mode="0${mode: -3}" - shift - - local i - for i ; do - guestfish --remote glob chmod "$mode" "$i" - done -} - -diskimage_is_file_guestfish () -{ - local t=$(guestfish --remote is-file "$1") - [ "$t" = "true" ] -} - -diskimage_is_directory_guestfish () -{ - local t=$(guestfish --remote is-dir "$1/.") - [ "$t" = "true" ] -} - -diskimage_append_text_file_guestfish () -{ - local t=$(mktemp) - guestfish --remote download "$2" "$t" - cat "$1" >> "$t" - guestfish --remote upload "$t" "$2" - rm "$t" -} - -diskimage_append_text_guestfish () -{ - local t=$(mktemp) - guestfish --remote download "$2" "$t" - echo "$1" >> "$t" - guestfish --remote upload "$t" "$2" - rm "$t" -} - -diskimage_sed_guestfish () -{ - local file="$1" ; shift - - local t=$(mktemp) - guestfish --remote download "$file" "$t" - sed -i "$@" "$t" - guestfish --remote upload "$t" "$file" - rm "$t" -} - -diskimage_grep_guestfish () -{ - local file="$1" ; shift - - # guestfish's grep doesn't support options like -f, so don't use it. - local ret - local t=$(mktemp) - guestfish --remote download "$file" "$t" - grep "$@" "$t" - ret=$? - rm "$t" - - return $ret -} - -diskimage_put_guestfish () -{ - if [ "$1" = "-" ] ; then - local t=$(mktemp) - cat > "$t" - guestfish --remote upload "$t" "$2" - rm "$t" - else - guestfish --remote upload "$1" "$2" - fi -} - -diskimage_ln_s_guestfish () -{ - guestfish --remote ln-s "$1" "$2" -} - -diskimage_command_guestfish () -{ - # Yes, I mean "$*" and not "$@". The command passed must be a - # single string... and, yes, quoting is lost. - guestfish --remote command "$*" -} - -diskimage_mv_guestfish () -{ - guestfish --remote mv "$1" "$2" -} - -diskimage_rm_rf_guestfish () -{ - guestfish --remote rm-rf "$1" -} - -###################################################################### - -diskimage_guestfish_sanity_check () -{ - if [ "$SYSTEM_DISK_ACCESS_METHOD" = "guestfish" ] ; then - check_command guestfish - fi -} - -register_hook post_config_hooks diskimage_guestfish_sanity_check diff --git a/config.d/05diskimage_guestmount.defconf b/config.d/05diskimage_guestmount.defconf deleted file mode 100644 index 4c17575..0000000 --- a/config.d/05diskimage_guestmount.defconf +++ /dev/null @@ -1,150 +0,0 @@ -# Hey Emacs, this is a -*- shell-script -*- !!! - -# This file provides functions to implement access/update of disk -# images via guestmount. - -###################################################################### - -diskimage_mount_guestmount () -{ - local disk="$1" - - echo "Using guestmount to update disk image ${disk}..." - - local mount_args="" - local m d - for m in $SYSTEM_DISK_MOUNTS ; do - d="${m#*:}" # Device is after colon - m="${m%:*}" # Mountpoint is before colon - mount_args="${mount_args}${mount_args:+ } --mount ${d}:${m}" - echo " mount ${m} from device ${d} configured" - done - [ -n "$mount_args" ] || mount_args="-i" - - mkdir -p mnt - guestmount -a "$disk" $mount_args mnt || \ - die "Failed to mount $disk using guestmount" - - - [ -d "mnt/root" ] || { - echo "Mounted directory does not look like a root filesystem" - ls -latr mnt - exit 1 - } -} - -# unmount a qemu image -diskimage_unmount_guestmount () -{ - echo "Unmounting disk" - sync; sync; - - fusermount -u mnt -} - -# These are all the same as loopback. We could do something cleverer, -# but this will suffice for now. - -diskimage_mkdir_p_guestmount () -{ - mkdir -p "mnt$1" -} - -diskimage_substitute_vars_guestmount () -{ - substitute_vars "$1" "mnt$2" -} - -diskimage_chmod_guestmount () -{ - local mode="$1" ; shift - local i - for i ; do - # this should handle wildcards - eval chmod "$mode" "mnt$i" - done -} - -diskimage_chmod_reference_guestmount () -{ - local ref="$1" ; shift - local i - for i ; do - # this should handle wildcards - eval chmod --reference="$ref" "mnt$i" - done -} - -diskimage_is_file_guestmount () -{ - [ -f "mnt$1" ] -} - -diskimage_is_directory_guestmount () -{ - [ -d "mnt$1" ] -} - -diskimage_append_text_file_guestmount () -{ - cat "$1" >> "mnt$2" -} - -diskimage_append_text_guestmount () -{ - echo "$1" >> "mnt$2" -} - -diskimage_sed_guestmount () -{ - local file="$1" ; shift - sed -i.org "$@" "mnt$file" -} - -diskimage_grep_guestmount () -{ - local file="$1" ; shift - grep "$@" "mnt$file" -} - -diskimage_put_guestmount () -{ - if [ "$1" = "-" ] ; then - cat >"mnt$2" - else - cp "$1" "mnt$2" - fi -} - -diskimage_ln_s_guestmount () -{ - ln -s "$1" "mnt$2" -} - -diskimage_command_guestmount () -{ - chroot mnt "$@" -} - -diskimage_mv_guestmount () -{ - mv "mnt$1" "mnt$2" -} - -diskimage_rm_rf_guestmount () -{ - rm -rf "mnt$1" -} - -###################################################################### - -diskimage_guestmount_sanity_check () -{ - if [ "$SYSTEM_DISK_FORMAT" = "qcow2" -a \ - "$SYSTEM_DISK_ACCESS_METHOD" = "guestmount" ] ; then - check_command guestmount - check_command fusermount - fi -} - -register_hook post_config_hooks diskimage_guestmount_sanity_check diff --git a/config.d/05diskimage_loopback.defconf b/config.d/05diskimage_loopback.defconf deleted file mode 100644 index 2a261a0..0000000 --- a/config.d/05diskimage_loopback.defconf +++ /dev/null @@ -1,237 +0,0 @@ -# Hey Emacs, this is a -*- shell-script -*- !!! - -# This file provides functions and options to implement loopback -# mounting and access/update of disk images, either via qemu-nbd/nbd -# (for qcow2 images) or via loopback (for raw (or reflink) images). - -defconf QEMU_NBD "qemu-nbd" \ - "<cmd>" "qemu-nbd command to run - might be kvm-nbd on some systems" - -defconf NBD_DEVICE "/dev/nbd0" \ - "<dev>" "NBD device node to use" - -###################################################################### - -diskimage_mount_loopback () -{ - local disk="$1" - - local device extra_mount_options - - _setup_image "$disk" - - echo "Mounting disk ${disk}..." - local m o - for m in $SYSTEM_DISK_MOUNTS ; do - local mount_ok=0 - o="${m#*:}" # Offset is after colon - m="${m%:*}" # Mountpoint is before colon - echo " mount ${m} from offset ${o}" - local i - for i in $(seq 1 5); do - mount -o offset=${o}${extra_mount_options} $device "mnt${m}" && { - mount_ok=1 - break - } - umount mnt 2>/dev/null || true - sleep 1 - done - [ $mount_ok = 1 ] || die "Failed to mount $disk" - done - - [ -d "mnt/root" ] || { - echo "Mounted directory does not look like a root filesystem" - ls -latr mnt - exit 1 - } -} - -# unmount a qemu image -diskimage_unmount_loopback () -{ - echo "Unmounting disk" - sync; sync; - - # umounts are done in reverse. Be lazy and construct a reverse - # list, since the shell will handle any strange whitespace for - # us... ;-) - local umounts="" - local m - for m in $SYSTEM_DISK_MOUNTS ; do - umounts="${m%:*}${umounts:+ }${umounts}" - done - for m in $umounts ; do - echo " umount ${m}" - umount "mnt${m}" || umount "mnt${m}" || true - done - _cleanup_image -} - -diskimage_mkdir_p_loopback () -{ - mkdir -p "mnt$1" -} - -diskimage_substitute_vars_loopback () -{ - substitute_vars "$1" "mnt$2" -} - -diskimage_chmod_loopback () -{ - local mode="$1" ; shift - local i - for i ; do - # this should handle wildcards - eval chmod "$mode" "mnt$i" - done -} - -diskimage_chmod_reference_loopback () -{ - local ref="$1" ; shift - local i - for i ; do - # this should handle wildcards - eval chmod --reference="$ref" "mnt$i" - done -} - -diskimage_is_file_loopback () -{ - [ -f "mnt$1" ] -} - -diskimage_is_directory_loopback () -{ - [ -d "mnt$1" ] -} - -diskimage_append_text_file_loopback () -{ - cat "$1" >> "mnt$2" -} - -diskimage_append_text_loopback () -{ - echo "$1" >> "mnt$2" -} - -diskimage_sed_loopback () -{ - local file="$1" ; shift - sed -i.org "$@" "mnt$file" -} - -diskimage_grep_loopback () -{ - local file="$1" ; shift - grep "$@" "mnt$file" -} - -diskimage_put_loopback () -{ - if [ "$1" = "-" ] ; then - cat >"mnt$2" - else - cp "$1" "mnt$2" - fi -} - -diskimage_ln_s_loopback () -{ - ln -s "$1" "mnt$2" -} - -diskimage_command_loopback () -{ - chroot mnt "$@" -} - -diskimage_mv_loopback () -{ - mv "mnt$1" "mnt$2" -} - -diskimage_rm_rf_loopback () -{ - rm -rf "mnt$1" -} - -###################################################################### - -diskimage_loopback_sanity_check () -{ - if [ "$SYSTEM_DISK_FORMAT" = "qcow2" -a \ - "$SYSTEM_DISK_ACCESS_METHOD" = "loopback" ] ; then - check_command $QEMU_NBD - check_command nbd-client - fi -} - -register_hook post_config_hooks diskimage_loopback_sanity_check - -###################################################################### - -# Private functions - -# mount a qemu image via nbd -_connect_nbd() { - echo "Connecting nbd to $1" - mkdir -p mnt - modprobe nbd - killall -9 -q $QEMU_NBD || true - $QEMU_NBD -p 1300 $1 & - sleep 1 - [ -r $NBD_DEVICE ] || { - mknod $NBD_DEVICE b 43 0 - } - umount mnt 2> /dev/null || true - nbd-client -d $NBD_DEVICE > /dev/null 2>&1 || true - killall -9 -q nbd-client || true - nbd-client localhost 1300 $NBD_DEVICE > /dev/null 2>&1 || true & - sleep 1 -} - -# disconnect nbd -_disconnect_nbd() { - echo "Disconnecting nbd" - sync; sync - nbd-client -d $NBD_DEVICE > /dev/null 2>&1 || true - killall -9 -q nbd-client || true - killall -q $QEMU_NBD || true -} - -_setup_image () -{ - local disk="$1" - - case "$SYSTEM_DISK_FORMAT" in - qcow2) - _connect_nbd "$disk" - device=$NBD_DEVICE - extra_mount_options="" - ;; - raw|reflink) - device="$disk" - extra_mount_options=",loop" - ;; - *) - die "Error: unknown SYSTEM_DISK_FORMAT=${SYSTEM_DISK_FORMAT}." - esac -} - -_cleanup_image () -{ - case "$SYSTEM_DISK_FORMAT" in - qcow2) - _disconnect_nbd - ;; - raw|reflink) - : - ;; - *) - die "Error: unknown SYSTEM_DISK_FORMAT=${SYSTEM_DISK_FORMAT}." - esac -} - diff --git a/config.d/10shareddisk.defconf b/config.d/10shareddisk.defconf deleted file mode 100644 index 7a66ebd..0000000 --- a/config.d/10shareddisk.defconf +++ /dev/null @@ -1,311 +0,0 @@ -# Hey Emacs, this is a -*- shell-script -*- !!! - -###################################################################### - -defconf SHAREDDISKSIZE "10G" \ - "<n>G" "size of the 3 shared disks" - -defconf SHAREDDISK_COUNT "3" \ - "<n>" "the number of shared disks" - -defconf SHAREDDISK_TEMPLATE "|shared_disk_template" \ - "<file>" "libvirt template fragment for shared disks" - -defconf SHARED_DISK_TYPE "virtio" \ - "scsi|ide|virtio|iscsi" "type of disks to use for shared disks" - -defconf SHARED_DISK_PREFIX "@uto" \ - "sd|hd|vd" "shared disk device prefix" - -defconf SHARED_DISK_CACHE "default" \ - "default|none|writeback|writethrough" "shared disk cache type" - -defconf SHARED_DISK_FIRST_SUFFIX "" \ - "|a|b|..." "override for 1st shared disk suffix - usually calculated by shared_disk_template()" - -defconf SHARED_DISK_MULTIPATH_NUMPATHS "2" \ - "<n>" "number of paths to create for each shared disk" - -defconf SHARED_DISK_MULTIPATH_CALLOUT "/sbin/scsi_id_autocluster.sh %n" \ - "<command>" "" - -defconf SHARED_DISK_ID_GEN "shared_disk_id_default" \ - "<command>" "function/command for creating shared disk ids" - -########## - -defconf ISCSI_HOST "$KVMHOST" \ - "<ip-addr>" "host machine serving our iSCSI targets" - -defconf ISCSI_PORT "3260" \ - "<port>" "port serving our iSCSI targets" - -defconf ISCSI_IQN "iqn.1969-08" \ - "<string>" "iSCSI qualified name for targets" - -defconf ISCSI_TID "1" \ - "<num>" "iSCSI target ID" - -defconf ISCSI_DEFAULT_TEMPLATE "$installdir/templates/iSCSI-default" \ - "<file>" "template for iSCSI default file" - -defconf ISCSI_ST_CONFIG_TEMPLATE "$installdir/templates/iSCSI-st_config" \ - "<file>" "template for iSCSI st_config file" - - -############################## - -shared_disk_template () -{ - # Don't do anything for iSCSI. - [ "$SHARED_DISK_TYPE" != "iscsi" ] || return 0 - - local paths="${1:-${SHARED_DISK_MULTIPATH_NUMPATHS}}" - local first="${2:-${SHARED_DISK_FIRST_SUFFIX}}" - - if [ -z "$first" ] ; then - if [ "$SYSTEM_DISK_PREFIX" = "$SHARED_DISK_PREFIX" ] ; then - first="b" - else - first="a" - fi - fi - - local -a devices=($(eval echo {${first}..z} {a..z}{a..z})) - - local p SHARED_DISK_NUM - local n=0 - for SHARED_DISK_NUM in $(seq 1 $SHAREDDISK_COUNT) ; do - local DISK="${VIRTBASE}/${CLUSTER}/shared${SHARED_DISK_NUM}" - run_hooks hack_disk_hooks "shared" - local serial=$(awk "{ print \$${SHARED_DISK_NUM} }" <<<"$SHARED_DISK_IDS") - for p in $(seq 1 $paths) ; do - local dev="${devices[$n]}" - [ -n "$dev" ] || die "Too many shared disks! The function shared_disk_template needs to be hacked to allow more shared disks..." - cat <<EOF - <disk type='file' device='disk'> - <driver name='qemu' cache='@@SHARED_DISK_CACHE@@'/> - <source file='${DISK}'/> - <target dev='@@SHARED_DISK_PREFIX@@${dev}' bus='@@SHARED_DISK_TYPE@@'/> - <serial>${serial}</serial> - <shareable/> - </disk> -EOF - n=$(($n + 1)) - done - done -} - -############################## - -shared_disk_post_config_hook() -{ - if [ "$SHARED_DISK_PREFIX" = "@uto" ] ; then - SHARED_DISK_PREFIX=$(rhel_disk_prefix $SHARED_DISK_TYPE) - fi -} - -register_hook post_config_hooks shared_disk_post_config_hook - -register_hook create_cluster_hooks shared_disk_setup - -shared_disk_setup () -{ - SHARED_DISK_IDS="" - _SHARED_DISK_TEMPLATE="" - - # Early exit if no shared disks - have_shared_disks || return 0 - - if [ "$SHARED_DISK_TYPE" = "iscsi" ] ; then - iscsi_out="tmp/iscsi.${CLUSTER}" # Global, not local. - - cat <<EOF >"$iscsi_out" -tgt-admin --delete tid=${ISCSI_TID} --force -tgtadm --lld iscsi --mode target --op new \ - --tid ${ISCSI_TID} -T ${ISCSI_IQN}.${CLUSTER}:tgtd -EOF - local uc=$(echo "$CLUSTER" | tr a-z A-Z) - fi - - echo "Creating ${SHAREDDISK_COUNT} shared disks" - local SHARED_DISK_NUM - for SHARED_DISK_NUM in $(seq 1 $SHAREDDISK_COUNT); do - local DISK="$VIRTBASE/$CLUSTER/shared${SHARED_DISK_NUM}" - run_hooks hack_disk_hooks "shared" - local di="$DISK" - if [ "$DISK_FOLLOW_SYMLINKS" = "yes" -a -L "$DISK" ] ; then - di=$(readlink "$DISK") - fi - rm -f "$di" - local di_dirname="${di%/*}" - mkdir -p "$di_dirname" - - if [ "$SHARED_DISK_TYPE" = "iscsi" ] ; then - dd if=/dev/zero seek=$SHAREDDISKSIZE bs=1 count=1 of="$di" - - local paths=$SHARED_DISK_MULTIPATH_NUMPATHS # readability - local zc=$(printf "%03d" $SHARED_DISK_NUM) - local p - for p in $(seq 1 $paths) ; do - local lun=$(($paths * ($SHARED_DISK_NUM - 1) + $p)) - # vendor_id AUTCLSTR used by /etc/init.d/iscsimultipath - cat <<EOF >>"$iscsi_out" -tgtadm --lld iscsi --mode logicalunit --op new \ - --tid ${ISCSI_TID} --lun ${lun} \ - -b ${DISK} -tgtadm --lld iscsi --mode logicalunit --op update \ - --tid ${ISCSI_TID} --lun ${lun} \ - --params vendor_id=AUTCLSTR,product_id=${uc},product_rev=0001,scsi_sn=SHARE${zc} -EOF - done - else - qemu-img create -f raw "$di" $SHAREDDISKSIZE - fi - # setup a nice ID at the start of the disk - "$SHARED_DISK_ID_GEN" "$SHARED_DISK_NUM" > tmp/diskid - dd if=tmp/diskid of="$di" conv=notrunc bs=1 > /dev/null 2>&1 - local this_id=$(head -n 1 tmp/diskid) - SHARED_DISK_IDS="${SHARED_DISK_IDS}${SHARED_DISK_IDS:+ }${this_id}" - done - echo - - if [ "$SHARED_DISK_TYPE" = "iscsi" ] ; then - register_hook cluster_created_hooks iscsi_cluster_created - fi - register_hook setup_base_hooks shared_disk_setup_base -} - -shared_disk_id_default () -{ - # Disk number argument is ignored - local t="AUTO-$(uuidgen)" - # Length of 13 bytes is historical - echo "${t:0:13}" -} - -shared_disk_setup_base () -{ - node_has_shared_disks "$type" || return 0 - - if [ "$SHARED_DISK_TYPE" = "iscsi" ] ; then - shared_disk_iscsi_setup_base - else - _SHARED_DISK_TEMPLATE="$SHAREDDISK_TEMPLATE" - fi -} - -########## - -node_has_shared_disks_DEFAULT () -{ - false -} - -node_has_shared_disks () -{ - local node_type="$1" - - call_func node_has_shared_disks "$node_type" -} - -have_shared_disks () -{ - [ -n "$SHAREDDISKSIZE" -a -n "$SHAREDDISK_TEMPLATE" -a \ - -n "$SHAREDDISK_COUNT" -a "$SHAREDDISK_COUNT" != 0 ] || \ - return 1 - - local ret=false - - _check () - { - if node_has_shared_disks "$1" ; then - ret=true - fi - } - - for_each_node _check - - $ret -} - -is_dedicated_storage_node_DEFAULT () -{ - false -} - -have_dedicated_storage_nodes () -{ - local ret=false - - _check () - { - if call_func is_dedicated_storage_node "$1" ; then - ret=true - fi - } - - for_each_node _check - - $ret -} - -########## - -# Override this if you use a different scheme for IP addresses. -shared_disk_iscsi_setup_base_get_ip () -{ - echo "${NETWORK_PRIVATE_PREFIX}.${IPNUM}" -} - -shared_disk_iscsi_setup_base () -{ - echo "Setting up iSCSI for shared disks" - - # This simulates what happens when you do something like: - # iscsiadm --mode discovery --type sendtargets --portal 10.0.0.1 - # provided only 1 target is accessible.. - - local idir="/var/lib/iscsi" - - local dd="${idir}/nodes/${ISCSI_IQN}.${CLUSTER}:tgtd/${ISCSI_HOST},${ISCSI_PORT},1" - local d="${dd}/default" - diskimage mkdir_p "${dd}" - diskimage substitute_vars "$ISCSI_DEFAULT_TEMPLATE" "$d" - diskimage chmod 600 "$d" - - local sd="${idir}/send_targets/${ISCSI_HOST},${ISCSI_PORT}" - local s="${sd}/st_config" - diskimage mkdir_p "${sd}" - diskimage substitute_vars "$ISCSI_ST_CONFIG_TEMPLATE" "$s" - diskimage chmod 600 "$s" - - diskimage ln_s "$dd" "/${sd}/${ISCSI_IQN}.${ISCSI_IQN}.${CLUSTER}:tgtd,${ISCSI_HOST},${ISCSI_PORT},1,default" - - # After the iscsi initscript is run, new devices for multipath - # don't seem to be noticed anymore. This enables an initscript - # that ensures that multipath is run when the desired number of - # shared disk paths are available. - diskimage command /sbin/chkconfig --add iscsimultipath - - local ip_addr=$(shared_disk_iscsi_setup_base_get_ip) - cat <<EOF >>"$iscsi_out" -tgtadm --lld iscsi --op bind --mode target --tid ${ISCSI_TID} -I ${ip_addr} -EOF -} - -iscsi_cluster_created () -{ - cat <<EOF - -This cluster uses iSCSI shared disks for the cluster file system. The -commands to configure the iSCSI on the host machine are in the file -"${iscsi_out}". You should now run this file on host $ISCSI_HOST -using "sh ${iscsi_out}". The first command, which deletes an existing -iSCSI target, may fail if there is no existing iSCSI configuration. -However, all other commands should succeed. - -You may also want to copy these commands somewhere so they are run -when $ISCSI_HOST boots (e.g. /etc/rc.local). -EOF -} diff --git a/config.d/40gpfs.defconf b/config.d/40gpfs.defconf deleted file mode 100644 index 5153df3..0000000 --- a/config.d/40gpfs.defconf +++ /dev/null @@ -1,8 +0,0 @@ -# Hey Emacs, this is a -*- shell-script -*- !!! - -defconf GPFS_BASE_VERSION "3.2.0-0" \ - "<version>" "The base version of GPFS to install" - -defconf GPFS_DEFAULT_NSDS "" \ - "<n>" "number of NSDs used by default GPFS filesystem, empty => all" - diff --git a/config.d/50node_nas.defconf b/config.d/50node_nas.defconf deleted file mode 100644 index 2b19b56..0000000 --- a/config.d/50node_nas.defconf +++ /dev/null @@ -1,29 +0,0 @@ -# Hey Emacs, this is a -*- shell-script -*- !!! - -node_name_format_nas () -{ - local cluster="$1" - local index="$2" - - printf '%snas%d' "$cluster" "$index" -} - -node_is_ctdb_node_nas () -{ - echo 1 -} - -node_has_shared_disks_nas () -{ - ! have_dedicated_storage_nodes -} - -cluster_setup_tasks_nas () -{ - case "$1" in - install_packages) echo "clusterfs nas" ;; - setup_clusterfs) echo "clusterfs" ;; - setup_node) echo "nas" ;; - setup_cluster) echo "nas" ;; - esac -} diff --git a/config.d/51node_rhel_base.defconf b/config.d/51node_rhel_base.defconf deleted file mode 100644 index 65e98d3..0000000 --- a/config.d/51node_rhel_base.defconf +++ /dev/null @@ -1,9 +0,0 @@ -# Hey Emacs, this is a -*- shell-script -*- !!! - -node_name_format_rhel_base () -{ - local cluster="$1" - local index="$2" - - printf '%sbase%d' "$cluster" "$index" -} diff --git a/config.d/52node_build.defconf b/config.d/52node_build.defconf deleted file mode 100644 index 632fdc7..0000000 --- a/config.d/52node_build.defconf +++ /dev/null @@ -1,19 +0,0 @@ -# Hey Emacs, this is a -*- shell-script -*- !!! - -node_name_format_build () -{ - local cluster="$1" - local index="$2" - - printf '%sbuild%d' "$cluster" "$index" -} - -cluster_setup_tasks_build () -{ - case "$1" in - install_packages) echo "build" ;; - setup_clusterfs) echo "" ;; - setup_node) echo "build" ;; - setup_cluster) echo "" ;; - esac -} diff --git a/config.d/53node_cbuild.defconf b/config.d/53node_cbuild.defconf deleted file mode 100644 index b8bea12..0000000 --- a/config.d/53node_cbuild.defconf +++ /dev/null @@ -1,19 +0,0 @@ -# Hey Emacs, this is a -*- shell-script -*- !!! - -node_name_format_cbuild () -{ - local cluster="$1" - local index="$2" - - printf '%sbuild%d' "$cluster" "$index" -} - -cluster_setup_tasks_cbuild () -{ - case "$1" in - install_packages) echo "clusterfs build" ;; - setup_clusterfs) echo "" ;; - setup_node) echo "build" ;; - setup_cluster) echo "" ;; - esac -} diff --git a/config.d/55node_storage_gpfs.defconf b/config.d/55node_storage_gpfs.defconf deleted file mode 100644 index fb4bfc5..0000000 --- a/config.d/55node_storage_gpfs.defconf +++ /dev/null @@ -1,45 +0,0 @@ -# Hey Emacs, this is a -*- shell-script -*- !!! - -NODES_STORAGE_GPFS= - -node_name_format_storage_gpfs () -{ - local cluster="$1" - local index="$2" - - printf '%sstorage%d' "$cluster" "$index" -} - -create_node_storage_gpfs () -{ - local ip_offset="$1" - local name="$2" - local ctdb_node="$3" - - local ld=$(echo $DOMAIN | tr 'A-Z' 'a-z') - NODES_STORAGE_GPFS="${NODES_STORAGE_GPFS}${NODES_STORAGE_GPFS:+,}${name}.${ld}" - - echo "Creating node \"${name}\" (of type \"storage_gpfs\")" - - create_node_COMMON "$name" "$ip_offset" "$type" -} - -node_has_shared_disks_storage_gpfs () -{ - true -} - -is_dedicated_storage_node_storage_gpfs () -{ - true -} - -cluster_setup_tasks_storage_gpfs () -{ - case "$1" in - install_packages) echo "clusterfs" ;; - setup_clusterfs) echo "clusterfs" ;; - setup_node) echo "" ;; - setup_cluster) echo "" ;; - esac -} diff --git a/config.d/57node_ad.defconf b/config.d/57node_ad.defconf deleted file mode 100644 index 607c970..0000000 --- a/config.d/57node_ad.defconf +++ /dev/null @@ -1,39 +0,0 @@ -# Hey Emacs, this is a -*- shell-script -*- !!! - -defconf AD_ADMIN_PASS "p@ssw0rd" \ - "<pass>" "Administrator password" - -defconf AD_FUNCTION_LEVEL "2008" \ - "<2003|2008|2008_R2>" "Domain and Forest function level" - -defconf AD_NETBIOS_NAME "samba4" \ - "<string>" "NetBIOS name to use for AD server" - -defconf AD_DNS_FORWARDER "@uto" \ - "<ip>" "DNS server for AD server to forward to" - -ad_post_config_hook () -{ - if [ "$AD_DNS_FORWARDER" = "@uto" ] ; then - AD_DNS_FORWARDER="$KVMHOST" - fi -} -register_hook post_config_hooks ad_post_config_hook - -node_name_format_ad () -{ - local cluster="$1" - local index="$2" - - printf '%sad%d' "$cluster" "$index" -} - -cluster_setup_tasks_ad () -{ - case "$1" in - install_packages) echo "ad" ;; - setup_clusterfs) echo "" ;; - setup_node) echo "ad" ;; - setup_cluster) echo "" ;; - esac -} diff --git a/config.d/60tsm.defconf b/config.d/60tsm.defconf deleted file mode 100644 index 2dd6dc5..0000000 --- a/config.d/60tsm.defconf +++ /dev/null @@ -1,63 +0,0 @@ -# Hey Emacs, this is a -*- shell-script -*- !!! - -defconf TSMDISKSIZE "50G" \ - "<n>G" "size of the TSM storage disk" - -defconf TSMNAME "TSM01" \ - "<name>" "name used by nodes to talk to TSM server" - -defconf TSM_DB_SIZE 100 \ - "<n>" "size of TSM database" - -defconf TSM_SPACE_MGMT_SIZE 1024 \ - "<n>" "size of TSM space management pool" - -defconf TSM_BACKUP_POOL_SIZE 100 \ - "<n>" "size of TSM backup pool" - -defconf TSM_ARCHIVE_POOL_SIZE 100 \ - "<n>" "size of TSM archive pool" - -defconf TSM_TEMPLATE "$installdir/templates/tsmserver.xml" \ - "<file>" "libvirt template for TSM server" - -############################## - -# TSM server node type - -node_name_format_tsm () -{ - local cluster="$1" - local index="$2" - - # If only 1 tsm_server node then don't number it. - if [ "${NODES/tsm_server:/}" = "${NODES//tsm_server:/}" ] ; then - printf '%stsm' "$cluster" - else - printf '%stsm%d' "$cluster" "$index" - fi -} - -create_node_tsm_server () -{ - local ip_offset="$1" - local name="$2" - local ctdb_node="$3" - - # This must be before defined create_node_COMMON because the - # template needs the value of TSMDISK. - TSMDISK="${VIRTBASE}/${CLUSTER}/${name}storage.qcow2" - - echo "Creating node \"${name}\" (of type \"tsm_server\"" - create_node_COMMON "$name" "$ip_offset" "$type" "$TSM_TEMPLATE" - - local di="$TSMDISK" - if [ "$DISK_FOLLOW_SYMLINKS" = "yes" -a -L "$TSMDISK" ] ; then - di=$(readlink "$TSMDISK") - fi - - echo "Creating TSM disk" - qemu-img create -f qcow2 "$di" $TSMDISKSIZE - - echo -} diff --git a/examples/example.autocluster b/examples/example.autocluster deleted file mode 100644 index e2ffe24..0000000 --- a/examples/example.autocluster +++ /dev/null @@ -1,19 +0,0 @@ -# Please run "autocluster --dump" to see default options, then -# override options in your own config file - -# For example, a simple config might be: - -# FIRSTIP=30 -# YUM_TEMPLATE="|rhel_gen_yum_repos myrepo" -# BASENAME="mybase" -# NODES="nas:0-3 rhel_base:4,5" - -# When using an active directory server, you probably want to set -# these too... - -# DOMAIN="lindom.example.local" -# WORKGROUP="LINDOM" -# DNSSEARCH="lindom.example.local" -# NAMESERVER="10.0.0.50" -# KDC_NAME="a0n1" -# AUTH_METHOD="winbind" diff --git a/host_setup/etc/bind/named.conf.local b/host_setup/etc/bind/named.conf.local deleted file mode 100644 index 7c0368b..0000000 --- a/host_setup/etc/bind/named.conf.local +++ /dev/null @@ -1,23 +0,0 @@ -// -// Do any local configuration here -// - -// Consider adding the 1918 zones here, if they are not used in your -// organization -//include "/etc/bind/zones.rfc1918"; - - -// point these to the windows domain controller for your virtual cluster -zone "example.com" IN { - type forward; - forwarders { - 10.0.0.100; - }; -}; - -zone "0.10.in-addr.arpa" { - type forward; - forwarders { - 10.0.0.100; - }; -}; diff --git a/host_setup/etc/squid/squid.conf b/host_setup/etc/squid/squid.conf deleted file mode 100644 index 081564d..0000000 --- a/host_setup/etc/squid/squid.conf +++ /dev/null @@ -1,40 +0,0 @@ -# this is a basic squid config to allow the virtual nodes -# to connect to the install server via a cache - -http_port 3128 -hierarchy_stoplist cgi-bin ? - -acl QUERY urlpath_regex cgi-bin \? -cache deny QUERY -acl apache rep_header Server ^Apache -broken_vary_encoding allow apache - -# we need to allow caching of large objects (for ISOs, RPMs etc) -maximum_object_size 4096 MB - -# a nice big cache - 50G in this case -cache_dir ufs /var/spool/squid 50000 16 256 - -access_log /var/log/squid/access.log squid -hosts_file /etc/hosts -refresh_pattern . 0 20% 4320 -acl all src 0.0.0.0/0.0.0.0 -acl manager proto cache_object -acl localhost src 127.0.0.1/255.255.255.255 - -acl our_networks src 10.0.0.0/8 -http_access allow our_networks -http_access allow localhost - -http_access deny all -icp_access allow all -visible_hostname sofs - -coredump_dir /var/spool/squid -extension_methods REPORT MERGE MKACTIVITY CHECKOUT - -# use this to go via some other cache upstream to IBM -#cache_peer upstream.example.com parent 3128 7 no-query -# -#acl ibm dst 9.0.0.0/8 -#never_direct allow ibm diff --git a/host_setup/setup_networks.sh b/host_setup/setup_networks.sh deleted file mode 100755 index 65c19fb..0000000 --- a/host_setup/setup_networks.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/bash - -dry_run=false -if [ "$1" = "-n" ] ; then - dry_run=true - shift -fi - -if [ $# -ne 1 ]; then - echo "Usage: $0 [ -n ] <autocluster-config>" - exit 1 -fi - -die () -{ - echo "ERROR: $*" >&2 - exit 1 -} - -gen_xml () -{ - local netname="$1" - local ip="$2" - local ipv6="$3" - local opts="$4" - - local uuid=$(uuidgen) - - cat <<EOF -<network> - <name>${netname}</name> - <uuid>${uuid}</uuid> -EOF - - local o bridge_iface - bridge_iface="" - for o in $opts ; do - case "$o" in - bridge\=*) - bridge_iface="${o#bridge=}" - esac - done - - if [ -z "$bridge_iface" ] ; then - cat <<EOF - <forward mode='nat'/> -EOF - else - cat <<EOF - <forward dev='${bridge_iface}' mode='route'> - <interface dev='${bridge_iface}'/> - </forward> -EOF - fi - - ip_addr=${ip%/*} - ip_mask=${ip#*/} - - ipv6_addr=${ipv6%/*} - ipv6_mask=${ipv6#*/} - - cat <<EOF - <bridge name='${netname}' stp='on' forwardDelay='0' /> - <ip address='${ip_addr}' prefix='${ip_mask}' /> - <ip family='ipv6' address='${ipv6_addr}' prefix='${ipv6_mask}' /> -</network> -EOF -} - -base_dir=$(cd -P $(dirname $0) ; cd .. ; echo $PWD) -autocluster="$base_dir/autocluster" -if [ ! -x "$autocluster" ]; then - autocluster="autocluster" -fi - -# Run autocluster to determine desired network configuration. -network_map=$(NAME=setup_networks IPNUM=1 \ - "$autocluster" "${1:+-c}" "$1" \ - -e 'make_network_map ; echo $network_map' 2>/dev/null) - -if [ $? -ne 0 -o -z "$network_map" ]; then - die "autocluster command failed to generate network list" -fi - - -while read netname dev ip ipv6 mac opts ; do - echo "Setting up network \"${netname}\"" - t=$(mktemp) - gen_xml "$netname" "$ip" "$ipv6" "$opts" >"$t" - if $dry_run ; then - cat "$t" - else - virsh net-define "$t" && \ - virsh net-start "$netname" && \ - virsh net-autostart "$netname" - fi - rm -f "$t" -done <"$network_map" diff --git a/templates/RHEL.repo b/templates/RHEL.repo deleted file mode 100644 index 94799fa..0000000 --- a/templates/RHEL.repo +++ /dev/null @@ -1,13 +0,0 @@ -[RHEL@@RHEL_VERSION@@] -name=Red Hat Enterprise Linux @@RHEL_VERSION@@ -baseurl=@@INSTALL_SERVER@@/RHEL@@RHEL_VERSION@@/@@RHEL_ARCH@@/ -enabled=1 -gpgcheck=0 -exclude=samba*,libsmbclient*,ctdb* - -[RHEL@@RHEL_VERSION@@-updates] -name=Red Hat Enterprise Linux @@RHEL_VERSION@@ - updates -baseurl=@@INSTALL_SERVER@@/RHEL@@RHEL_VERSION@@-updates/@@RHEL_ARCH@@/ -enabled=0 -gpgcheck=0 -exclude=samba*,libsmbclient*,ctdb* diff --git a/templates/RHEL5-desktop.packages b/templates/RHEL5-desktop.packages deleted file mode 100644 index ae3f86b..0000000 --- a/templates/RHEL5-desktop.packages +++ /dev/null @@ -1,83 +0,0 @@ -@base -@admin-tools -@base-x -@core -@development-libs -@development-tools -@editors -@java -@x-software-development -@development-libs -@development-tools -@legacy-software-support -@legacy-software-development - -openldap-devel -cups-devel -firefox -kernel -kernel-devel -kernel-doc -e2fsprogs -# All kinds of X-Fonts for the STAT-Gui -xorg-x11-font-utils -xorg-x11-fonts-100dpi -xorg-x11-fonts-75dpi -xorg-x11-fonts-ISO8859-1-100dpi -xorg-x11-fonts-ISO8859-1-75dpi -xorg-x11-fonts-ISO8859-14-100dpi -xorg-x11-fonts-ISO8859-14-75dpi -xorg-x11-fonts-ISO8859-15-100dpi -xorg-x11-fonts-ISO8859-15-75dpi -xorg-x11-fonts-ISO8859-2-100dpi -xorg-x11-fonts-ISO8859-2-75dpi -xorg-x11-fonts-ISO8859-9-100dpi -xorg-x11-fonts-ISO8859-9-75dpi -xorg-x11-fonts-Type1 -xorg-x11-fonts-base -xorg-x11-fonts-misc -xorg-x11-fonts-truetype -device-mapper-multipath -httpd -vsftpd -xinetd -screen -mod_authz_ldap -libXp.i386 -openldap-clients -sysstat -mod_ssl -distcache -lsscsi -# scsi-target-utils does require a suited RHEL license key; required for iSCSI usage -#scsi-target-utils -# ipvsadm required for LVS configuration -#ipvsadm -nss-devel -nspr-devel -emacs - -#The Following Packages shall not be installed!!! --xen --samba --office --libicu --boost --boost-devel --autofs --compat-openldap --libXfont-devel --libxml2-devel --libxslt-devel --xmlsec1-devel --anacron --pcsc --pcsc-lite --pcsc-lite-devel --coolkey --coolkey-devel --ccid --ifd-egate --xulrunner-devel --xorg-x11-drivers --xorg-x11-server-Xorg diff --git a/templates/RHEL5.packages b/templates/RHEL5.packages deleted file mode 100644 index 4c5caec..0000000 --- a/templates/RHEL5.packages +++ /dev/null @@ -1,25 +0,0 @@ -@base -@core - -kernel -e2fsprogs -device-mapper-multipath -xinetd -screen -mod_authz_ldap -openldap-clients -emacs-nox - -#The Following Packages shall not be installed!!! --xen --samba --office --libicu --autofs --compat-openldap --anacron --pcsc --pcsc-lite --coolkey --ccid --ifd-egate diff --git a/templates/RHEL5.services b/templates/RHEL5.services deleted file mode 100644 index c74db84..0000000 --- a/templates/RHEL5.services +++ /dev/null @@ -1,33 +0,0 @@ -echo "Turn off some services..." -chkconfig atd off -chkconfig avahi-daemon off -chkconfig avahi-dnsconfd off -chkconfig bluetooth off -chkconfig cpuspeed off -chkconfig cups off -chkconfig dhcdbd off -chkconfig dund off -chkconfig firstboot off -chkconfig haldaemon off -chkconfig hidd off -chkconfig ip6tables off -chkconfig ipmi off -chkconfig iptables off -chkconfig irda off -chkconfig kudzu off -chkconfig nscd off -chkconfig pand off -chkconfig pcscd off -chkconfig restorecond off -chkconfig rhnsd off -chkconfig sendmail off -chkconfig setroubleshoot off -chkconfig smartd off -chkconfig xfs off -chkconfig yum-updatesd off -chkconfig gpm off - -echo "Turn on some services..." -chkconfig multipathd on -chkconfig nfslock on -chkconfig ntpd on diff --git a/templates/RHEL6-desktop.packages b/templates/RHEL6-desktop.packages deleted file mode 100644 index a163c19..0000000 --- a/templates/RHEL6-desktop.packages +++ /dev/null @@ -1,82 +0,0 @@ -@base -@general-desktop -@x11 -@core -@additional-devel -@development -@emacs -@java-platform -@desktop-platform-devel -@compat-libraries - -openldap-devel -cups-devel -firefox -kernel -kernel-devel -kernel-doc -e2fsprogs -# All kinds of X-Fonts for the STAT-Gui -xorg-x11-font-utils -xorg-x11-fonts-100dpi -xorg-x11-fonts-75dpi -xorg-x11-fonts-ISO8859-1-100dpi -xorg-x11-fonts-ISO8859-1-75dpi -xorg-x11-fonts-ISO8859-14-100dpi -xorg-x11-fonts-ISO8859-14-75dpi -xorg-x11-fonts-ISO8859-15-75dpi -xorg-x11-fonts-ISO8859-2-100dpi -xorg-x11-fonts-ISO8859-2-75dpi -xorg-x11-fonts-ISO8859-9-100dpi -xorg-x11-fonts-ISO8859-9-75dpi -xorg-x11-fonts-Type1 -xorg-x11-fonts-misc -device-mapper-multipath -httpd -vsftpd -xinetd -screen -mod_authz_ldap -openldap-clients -sysstat -mod_ssl -lsscsi -# scsi-target-utils does require a suited RHEL license key; required for iSCSI usage -#scsi-target-utils -# ipvsadm required for LVS configuration -#ipvsadm -nss-devel -nspr-devel -pam-devel -rsh -ksh -libuuid-devel -krb5-workstation -python-devel -nfs-utils -openssl-devel - -#The Following Packages shall not be installed!!! --xen --samba --office --libicu --boost --boost-devel --autofs --compat-openldap --libXfont-devel --libxml2-devel --libxslt-devel --xmlsec1-devel --anacron --pcsc --pcsc-lite --pcsc-lite-devel --coolkey --coolkey-devel --ccid --ifd-egate --xulrunner-devel --xorg-x11-drivers --xorg-x11-server-Xorg diff --git a/templates/RHEL6.packages b/templates/RHEL6.packages deleted file mode 100644 index 4bdec93..0000000 --- a/templates/RHEL6.packages +++ /dev/null @@ -1,58 +0,0 @@ -@base -@core -#@additional-devel -@development -@compat-libraries - -openldap-devel -cups-devel -kernel -kernel-devel -kernel-doc -e2fsprogs -device-mapper-multipath -httpd -vsftpd -xinetd -screen -mod_authz_ldap -openldap-clients -sysstat -mod_ssl -lsscsi -# scsi-target-utils does require a suited RHEL license key; required for iSCSI usage -#scsi-target-utils -# ipvsadm required for LVS configuration -#ipvsadm -nss-devel -nspr-devel -pam-devel -emacs-nox -libuuid-devel -krb5-workstation -python-devel -nfs-utils -openssl-devel - -#The Following Packages shall not be installed!!! --xen --samba --office --libicu --boost --boost-devel --autofs --compat-openldap --libXfont-devel --libxml2-devel --libxslt-devel --xmlsec1-devel --anacron --pcsc --pcsc-lite --pcsc-lite-devel --coolkey --coolkey-devel --ccid --ifd-egate --xulrunner-devel diff --git a/templates/RHEL6.services b/templates/RHEL6.services deleted file mode 100644 index ff50157..0000000 --- a/templates/RHEL6.services +++ /dev/null @@ -1,32 +0,0 @@ -echo "Turn off some services..." -chkconfig atd off -chkconfig avahi-daemon off -chkconfig avahi-dnsconfd off -chkconfig bluetooth off -chkconfig cpuspeed off -chkconfig cups off -chkconfig dhcdbd off -chkconfig dund off -chkconfig firstboot off -chkconfig haldaemon off -chkconfig hidd off -chkconfig ip6tables off -chkconfig ipmi off -chkconfig iptables off -chkconfig irda off -chkconfig kudzu off -chkconfig nscd off -chkconfig pand off -chkconfig pcscd off -chkconfig restorecond off -chkconfig rhnsd off -chkconfig sendmail off -chkconfig setroubleshoot off -chkconfig smartd off -chkconfig xfs off -chkconfig yum-updatesd off -chkconfig gpm off - -echo "Turn on some services..." -chkconfig multipathd on -chkconfig ntpd on diff --git a/templates/RHEL7.packages b/templates/RHEL7.packages deleted file mode 100644 index 20bbfb9..0000000 --- a/templates/RHEL7.packages +++ /dev/null @@ -1,55 +0,0 @@ -@base -@core -@development -@compat-libraries - -openldap-devel -cups-devel -kernel -kernel-devel -e2fsprogs -device-mapper-multipath -httpd -vsftpd -xinetd -screen -openldap-clients -sysstat -mod_ssl -lsscsi -# scsi-target-utils does require a suited RHEL license key; required for iSCSI usage -#scsi-target-utils -# ipvsadm required for LVS configuration -#ipvsadm -nss-devel -nspr-devel -pam-devel -emacs-nox -libuuid-devel -krb5-workstation -python-devel -nfs-utils -openssl-devel - -#The Following Packages shall not be installed!!! --xen --samba --office --libicu --boost --boost-devel --autofs --compat-openldap --libXfont-devel --libxml2-devel --libxslt-devel --xmlsec1-devel --anacron --pcsc --pcsc-lite --pcsc-lite-devel --coolkey --coolkey-devel --ccid --ifd-egate --xulrunner-devel diff --git a/templates/RHEL7.services b/templates/RHEL7.services deleted file mode 100644 index 36908f0..0000000 --- a/templates/RHEL7.services +++ /dev/null @@ -1,19 +0,0 @@ -echo "Turn off some services..." - -while read s ; do - systemctl disable "${s}.service" -done <<EOF -atd -avahi-daemon -EOF - -chkconfig rhnsd off - -echo "Turn on some services..." - -while read s ; do - systemctl enable "${s}.service" -done <<EOF -chronyd -multipathd -EOF diff --git a/templates/basic-postinstall.sh b/templates/basic-postinstall.sh deleted file mode 100644 index f630b70..0000000 --- a/templates/basic-postinstall.sh +++ /dev/null @@ -1,62 +0,0 @@ -################################################## -# BEGIN basic-postinstall.sh -# -[ "@@WEBPROXY@@" = "" ] || { - http_proxy=@@WEBPROXY@@ - export http_proxy -} - -echo "Using web proxy: \$http_proxy" - -# Force up the network, as kickstart may not have started it. Modern -# RHEL/Fedora renames network interfaces to "well-known" names that -# are hard to know in this script. So find the 1st ethernet interface -# and use it. -rm -f /etc/sysconfig/network-scripts/ifcfg-eth* -rm -f /etc/sysconfig/network-scripts/ifcfg-en* - -dev=$(ip link show | - awk '/^[[:digit:]]/ { dev=gensub(/:/, "", "", $2) } \\ - /^[[:space:]]*link\\/ether/ { print dev ; exit}') -echo "Forcing up network interface \"$dev\"" - -ip link set $dev up -ip addr add @@INSTALL_IP@@ dev $dev -if [ -n "@@INSTALL_GW@@" ] ; then - ip route add default via @@INSTALL_GW@@ -fi -ip addr show -ip route show - -cat << EOF > /etc/resolv.conf -domain @@DOMAIN@@ -search @@DNSSEARCH@@ -nameserver @@NAMESERVER@@ -EOF - -echo "Setting up YUM repositories" - -cat << EOF > /etc/yum.repos.d/autocluster.repo -@@@YUM_TEMPLATE@@@ -EOF - -# CentOS has some weird plugins that slow thing down -echo "Switching off YUM plugins" - -sed -i -e 's@^plugins=1@plugins=0@' /etc/yum.conf - -echo "Updating from YUM repositories" -yum clean all -yum -y update -# Leave things in a state that forces any nodes based on this base -# image fetch all of the repo data next time an update is done. -yum clean all - -# This stops NICs with fake MAC addresses being carried forward from -# the base install. -rm -f /etc/udev/rules.d/70-persistent-net.rules - -sync -# -# END basic-postinstall.sh -################################################## diff --git a/templates/bootbase.xml b/templates/bootbase.xml deleted file mode 100644 index 3824c50..0000000 --- a/templates/bootbase.xml +++ /dev/null @@ -1,34 +0,0 @@ -<!-- used when booting the base disk for base changes --> -<domain type='kvm'> - <name>@@NAME@@</name> - <uuid>@@UUID@@</uuid> - <memory>@@MEM@@</memory> - <currentMemory>@@MEM@@</currentMemory> - <vcpu>@@NUMCPUS@@</vcpu> - <os> - <type>hvm</type> - <boot dev='hd'/> - </os> - <features> - <acpi/> - </features> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>destroy</on_crash> - <devices> - <emulator>@@KVM@@</emulator> - <disk type='file' device='disk'> - <source file='@@DISK@@'/> - <target dev='@@SYSTEM_DISK_PREFIX@@a' bus='@@SYSTEM_DISK_TYPE@@'/> - <driver name='qemu' type='@@SYSTEM_DISK_FORMAT@@' cache='@@SYSTEM_DISK_CACHE@@'/> - </disk> -@@@NETWORK_TEMPLATE@@@ - <input type='mouse' bus='ps2'/> - <graphics type='vnc' port='-1' listen='127.0.0.1'/> - <serial type="file"> - <source path="@@KVMLOG@@/serial.@@CLUSTER@@"/> - <target port="1"/> - </serial> - </devices> -</domain> diff --git a/templates/iSCSI-default b/templates/iSCSI-default deleted file mode 100644 index 9d1fea0..0000000 --- a/templates/iSCSI-default +++ /dev/null @@ -1,44 +0,0 @@ -# BEGIN RECORD 2.0-871 -node.name = @@ISCSI_IQN@@.@@CLUSTER@@:tgtd -node.tpgt = 1 -node.startup = automatic -iface.iscsi_ifacename = default -iface.transport_name = tcp -node.discovery_address = @@ISCSI_HOST@@ -node.discovery_port = @@ISCSI_PORT@@ -node.discovery_type = send_targets -node.session.initial_cmdsn = 0 -node.session.initial_login_retry_max = 8 -node.session.xmit_thread_priority = -20 -node.session.cmds_max = 128 -node.session.queue_depth = 32 -node.session.auth.authmethod = None -node.session.timeo.replacement_timeout = 120 -node.session.err_timeo.abort_timeout = 15 -node.session.err_timeo.lu_reset_timeout = 20 -node.session.err_timeo.host_reset_timeout = 60 -node.session.iscsi.FastAbort = Yes -node.session.iscsi.InitialR2T = No -node.session.iscsi.ImmediateData = Yes -node.session.iscsi.FirstBurstLength = 262144 -node.session.iscsi.MaxBurstLength = 16776192 -node.session.iscsi.DefaultTime2Retain = 0 -node.session.iscsi.DefaultTime2Wait = 2 -node.session.iscsi.MaxConnections = 1 -node.session.iscsi.MaxOutstandingR2T = 1 -node.session.iscsi.ERL = 0 -node.conn[0].address = @@ISCSI_HOST@@ -node.conn[0].port = 3260 -node.conn[0].startup = manual -node.conn[0].tcp.window_size = 524288 -node.conn[0].tcp.type_of_service = 0 -node.conn[0].timeo.logout_timeout = 15 -node.conn[0].timeo.login_timeout = 15 -node.conn[0].timeo.auth_timeout = 45 -node.conn[0].timeo.noop_out_interval = 5 -node.conn[0].timeo.noop_out_timeout = 5 -node.conn[0].iscsi.MaxRecvDataSegmentLength = 262144 -node.conn[0].iscsi.HeaderDigest = None -node.conn[0].iscsi.IFMarker = No -node.conn[0].iscsi.OFMarker = No -# END RECORD diff --git a/templates/iSCSI-st_config b/templates/iSCSI-st_config deleted file mode 100644 index b619ef2..0000000 --- a/templates/iSCSI-st_config +++ /dev/null @@ -1,12 +0,0 @@ -# BEGIN RECORD 2.0-871 -discovery.startup = manual -discovery.type = sendtargets -discovery.sendtargets.address = @@ISCSI_HOST@@ -discovery.sendtargets.port = @@ISCSI_PORT@@ -discovery.sendtargets.auth.authmethod = None -discovery.sendtargets.timeo.login_timeout = 15 -discovery.sendtargets.reopen_max = 5 -discovery.sendtargets.timeo.auth_timeout = 45 -discovery.sendtargets.timeo.active_timeout = 30 -discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768 -# END RECORD diff --git a/templates/install.xml b/templates/install.xml deleted file mode 100644 index 437bc26..0000000 --- a/templates/install.xml +++ /dev/null @@ -1,42 +0,0 @@ -<!-- template for initial install of base image --> -<domain type='kvm'> - <name>@@NAME@@</name> - <uuid>@@UUID@@</uuid> - <memory>@@MEM@@</memory> - <currentMemory>@@MEM@@</currentMemory> - <vcpu>1</vcpu> - <os> - <type>hvm</type> - <kernel>@@PWD@@/tmp/vmlinuz</kernel> - <initrd>@@PWD@@/tmp/initrd.img</initrd> - <cmdline>console=ttyS0,115200 selinux=0 @@INSTALL_KERNEL_OPTIONS@@</cmdline> - </os> - <features> - <acpi/> - </features> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>destroy</on_crash> - <devices> - <emulator>@@KVM@@</emulator> - <disk type='file' device='disk'> - <source file='@@DISK@@'/> - <target dev='@@SYSTEM_DISK_PREFIX@@a' bus='@@SYSTEM_DISK_TYPE@@'/> - <driver name='qemu' type='@@BASE_FORMAT@@' cache='@@SYSTEM_DISK_CACHE@@'/> - </disk> - <disk type='file' device='cdrom'> - <source file='@@ISO@@'/> - <target dev='hdc' bus='ide'/> - <readonly/> - </disk> -@@INSTALL_KS_DEVICE_TEMPLATE@@ -@@@NETWORK_TEMPLATE@@@ - <input type='mouse' bus='ps2'/> - <graphics type='vnc' port='-1' listen='127.0.0.1'/> - <serial type="file"> - <source path="@@KVMLOG@@/serial.@@NAME@@"/> - <target port="1"/> - </serial> - </devices> -</domain> diff --git a/templates/nas-kickstart.cfg b/templates/nas-kickstart.cfg deleted file mode 100644 index 8eaf33f..0000000 --- a/templates/nas-kickstart.cfg +++ /dev/null @@ -1,122 +0,0 @@ -# Merged kickstart. Minor bugfixes come for free bug features should -# be configured for the correct version. -install -cdrom -#ignoredisk --drives=[sdb,sdc,sdd,sde,sdf,sdg,sdh,sdi,sdj,sdk,sdl,sdm,sdn,sdo,sdp,sdq,sdr,sds,sdt,sdu,sdv,sdw,sdx,sdy,sdz,sdaa] -lang @@KS_LANGUAGE@@ -keyboard @@KS_KEYBOARD@@ -skipx -text -network --device eth0 --bootproto dhcp -rootpw @@ROOTPASSWORD@@ -firewall --disabled -selinux --disabled -authconfig --enableshadow --enablemd5 -timezone --utc @@TIMEZONE@@ -poweroff -# if you want to have quiet boots add option 'quiet' to the next line -# For debugging purposes or in case of trouble boot messages are very helpful -bootloader --location=mbr --driveorder=@@SYSTEM_DISK_PREFIX@@a --append="@@KS_KERNEL_OPTS@@" - -# The following is the partition information you requested -# Note that any partitions you deleted are not expressed -# here so unless you clear all partitions first, this is -# not guaranteed to work -zerombr -clearpart --linux --initlabel -part / --ondisk=@@SYSTEM_DISK_PREFIX@@a --fstype="ext4" --size=@@ROOTSIZE@@ -part swap --ondisk=@@SYSTEM_DISK_PREFIX@@a --size=@@SWAPSIZE@@ - - - -#The following Part lists all the packages that are needed for the Installation -%packages - -@@@KS_RHEL_PACKAGES@@@ - -@@KS_EXTRA_PACKAGES@@ - -%end - -%post - -( -set -x - -@@@KS_RHEL_SERVICES@@@ - -for i in @@KS_EXTRA_CHKCONFIGS@@ ; do - chkconfig ${i%:*} ${i#*:} -done - -### -f="/etc/sysconfig/network" -echo "Switching off IPv6 in ${f}..." -sed -i.orig -e 's/NETWORKING_IPV6=yes/NETWORKING_IPV6=no/g' "$f" - -### -echo "Changing device scanning filter settings in lvm.conf to reduce boot time..." -x1='filter = \[ "a/\.\*/" \]' -y1='filter = \[ "a|\^/dev/mapper/\.\*|", "a|\^/dev/sda\.\*|", "r|\.\*|" ]' -x2='# By default we accept every block device:' -y2='# Exclude some block devices:' -sed -i.orig -e "s@${x1}@${y1}@" -e "s@${x2}@${y2}@" /etc/lvm/lvm.conf - -### -echo "Setting the value of max opened files..." -cat >/etc/security/limits.d/autocluster.cfg <<EOF -# Added by autocluster -* soft nofile 50000 -* hard nofile 50000 -* soft core unlimited -EOF - -### -echo "Set sshd_config to allow more connections..." -cat >>/etc/ssh/sshd_config <<EOF -# Added by autocluster -MaxStartups 1024 -EOF - -### -echo "Disabling prelinking in /etc/sysconfig/prelink ..." -sed -i.orig -e 's/PRELINKING=yes/# Modified by autocluster\n#&\nPRELINKING=no/' /etc/sysconfig/prelink - -### -echo "Disabling some modules..." -mkdir -p /etc/modprobe.d -cat >>/etc/modprobe.d/z-autocluster.conf <<EOF - -# Added by autocluster -alias pcspkr off -alias lp off -alias parport off -alias parport_pc off -alias joydev off -alias bluetooth off -alias l2cap off -alias rfcomm off -alias video off -alias backlight off -alias button off -alias battery off -alias net-pf-10 off -EOF - -### -echo "Enabling core dumps logging for multipathd..." -cat >>/etc/sysconfig/multipathd <<EOF -# Added by autocluster -DAEMON_COREFILE_LIMIT="unlimited" -EOF - -@@@KS_STANDARD_POSTINSTALL@@@ - -@@@KS_POSTINSTALL_TEMPLATE@@@ - -sync - -) 2>&1 | tee /var/log/ks-postinstall.log > /dev/console - -%end - diff --git a/templates/node.xml b/templates/node.xml deleted file mode 100644 index 2bfe338..0000000 --- a/templates/node.xml +++ /dev/null @@ -1,35 +0,0 @@ -<!-- template for initial install of cluster nodes --> -<domain type='kvm'> - <name>@@NAME@@</name> - <uuid>@@UUID@@</uuid> - <memory>@@MEM@@</memory> - <currentMemory>@@MEM@@</currentMemory> - <vcpu>@@NUMCPUS@@</vcpu> - <os> - <type>hvm</type> - <boot dev='hd'/> - </os> - <features> - <acpi/> - </features> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>destroy</on_crash> - <devices> - <emulator>@@KVM@@</emulator> - <disk type='file' device='disk'> - <source file='@@DISK@@'/> - <target dev='@@SYSTEM_DISK_PREFIX@@a' bus='@@SYSTEM_DISK_TYPE@@'/> - <driver name='qemu' type='@@SYSTEM_DISK_FORMAT@@' cache='@@SYSTEM_DISK_CACHE@@'/> - </disk> -@@@_SHARED_DISK_TEMPLATE@@@ -@@@NETWORK_TEMPLATE@@@ - <input type='mouse' bus='ps2'/> - <graphics type='vnc' port='-1' listen='127.0.0.1'/> - <serial type="file"> - <source path="@@KVMLOG@@/serial.@@NAME@@"/> - <target port="1"/> - </serial> - </devices> -</domain> diff --git a/templates/tsmserver.xml b/templates/tsmserver.xml deleted file mode 100644 index ca51d99..0000000 --- a/templates/tsmserver.xml +++ /dev/null @@ -1,43 +0,0 @@ -<!-- template for initial install of TSM server node --> -<domain type='kvm'> - <name>@@NAME@@</name> - <uuid>@@UUID@@</uuid> - <memory>@@MEM@@</memory> - <currentMemory>@@MEM@@</currentMemory> - <vcpu>@@NUMCPUS@@</vcpu> - <os> - <type>hvm</type> - <boot dev='hd'/> - </os> - <features> - <acpi/> - </features> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>destroy</on_crash> - <devices> - <emulator>@@KVM@@</emulator> - <disk type='file' device='disk'> - <source file='@@DISK@@'/> - <target dev='@@SYSTEM_DISK_PREFIX@@a' bus='@@SYSTEM_DISK_TYPE@@'/> - <driver name='qemu' cache='@@SYSTEM_DISK_CACHE@@'/> - </disk> - <disk type='file' device='disk'> - <source file='@@TSMDISK@@'/> - <target dev='@@SYSTEM_DISK_PREFIX@@b' bus='@@SYSTEM_DISK_TYPE@@'/> - <driver name='qemu' cache='@@SYSTEM_DISK_CACHE@@'/> - </disk> - <interface type='network'> - <mac address='@@MAC1@@'/> - <model type='@@NICMODEL@@'/> - <source network='net1'/> - </interface> - <input type='mouse' bus='ps2'/> - <graphics type='vnc' port='-1' listen='127.0.0.1'/> - <serial type="file"> - <source path="@@KVMLOG@@/serial.@@NAME@@"/> - <target port="1"/> - </serial> - </devices> -</domain> @@ -1,161 +0,0 @@ -#!/bin/bash -#make running virsh commands on a cluster easier - -#################### -# show program usage -usage () -{ - cat >&2 <<EOF -Usage: vircmd [OPTION] ... <COMMAND> - options: - -x enable script debugging - -n don't include the TSM node (if any) - -w, --wait [timeout] for start/shutdown wait for desired state change - - commands: - start CLUSTERNAME - start cluster nodes - - destroy CLUSTERNAME - power off cluster nodes (may cause data loss) - - shutdown CLUSTERNAME - shutdown cluster nodes - - undefine CLUSTERNAME - remove cluster - - CLUSTERNAME can be a glob-style pattern that specifies cluster nodes -EOF - exit 1 -} - -############################ -# parse command line options -temp=$(getopt -n "$prog" -o "xnw::" -l help -l wait:: -- "$@") - -[ $? != 0 ] && usage - -eval set -- "$temp" - -no_tsm=0 -wait=false -timeout="" - -while true ; do - case "$1" in - -x) set -x; shift ;; - -n) no_tsm=1; shift ;; - -w|--wait) wait=true ; timeout="$2" ; shift 2 ;; - --) shift ; break ;; - -h|--help|*) usage ;; # Shouldn't happen, so this is reasonable. - esac -done - -if [ $# -lt 2 ]; then - echo "Usage: vircmd COMMAND CLUSTERNAME" - exit 1 -fi - -cmd="$1" -cluster="$2" -count=0 - -if $wait ; then - case "$cmd" in - start) desired_state="running" ;; - shutdown) desired_state="shut off" ;; - *) echo "waiting not supported with \"$cmd\"" ; echo ; usage ;; - esac -fi - -export VIRSH_DEFAULT_CONNECT_URI=qemu:///system - -get_nodes () -{ - for i in $domains ; do - case "$i" in - ($1) - # If we're not skipping the TSM node or this isn't the TSM node... - if [ "$no_tsm" = 0 -o "${i/tsm/}" = "$i" ] ; then - nodes="${nodes} ${i}" - fi - esac - done -} - -domains=$(virsh list --all | awk '{print $2}' | tail -n +3) -nodes="" - -# If the cluster name doesn't have a wildcard then we need to be inventive. -if [ "${cluster/[\[\]\?\*]/}" = "$cluster" ] ; then - get_nodes "${cluster}[a-z]*[0-9]" -else - get_nodes "$cluster" -fi - -[ -n "$nodes" ] || { - echo "No nodes in cluster $2" - exit 1 -} - -rc=0 - -for i in $nodes ; do - # We want to retry the command when we see an internal error. - for x in $(seq 1 5) ; do - out=$(virsh $cmd "$i" 2>&1) - ret=$? # Hard to avoid this since we always want to echo $out :-( - echo "$out" - if [ $ret -ne 0 ] ; then - case "$out" in - *internal\ error*) - echo "Retrying \"virsh $cmd $i\" due to internal error" - sleep 3 - continue - esac - fi - break - done - [ $ret = 0 ] || rc=$ret -done - -# Now comes the waiting... but we don't wait if there was an error. -if [ $rc -ne 0 ] || ! $wait ; then - exit $rc -fi - -count=0 -while : ; do - if [ -n "$timeout" ] && [ $count -ge "$timeout" ] ; then - echo "Timed out after ${timeout}s waiting for nodes to enter state \"${desired_state}\":" - echo - fmt='%-20s %s\n' - printf "$fmt" "Domain" "State" - printf "$fmt" "------" "-----" - for i in $nodes ; do - state=$(virsh dominfo "$i" | sed -nr -e 's@^State:[[:space:]]+@@p') - printf "$fmt" "$i" "$state" - done - exit 62 # ETIME - fi - - pat="^State:[[:space:]]+${desired_state}\$" - all_good=true - for i in $nodes ; do - # Often "vircmd dominfo" returns 1 and prints rubbish like this: - # error: operation failed: could not query memory balloon allocation - # so we take pains to avoid this cluttering the output... - if virsh_out=$(virsh dominfo "$i" 2>&1) ; then - if ! echo "$virsh_out" | grep -E -q "$pat" ; then - all_good=false - fi - fi - done - $all_good && exit 0 - - sleep 1 - count=$(($count + 1)) -done - -exit $rc |