Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/t0backend/src/main/python/t0/backend/raidcreate/raidcreate.py b/t0backend/src/main/python/t0/backend/raidcreate/raidcreate.py
- index 052c64a..0ef2c3c 100755
- --- a/t0backend/src/main/python/t0/backend/raidcreate/raidcreate.py
- +++ b/t0backend/src/main/python/t0/backend/raidcreate/raidcreate.py
- @@ -82,6 +82,67 @@ rm -f $tmp
- crm_initial_conf = '/var/lib/mdraidscripts/initial.crm'
- +check_disks = '''
- + function check_disks () {
- + OPTIND=1;
- + while getopts ":e:f:z:s:" opt; do
- + case "$opt" in
- + e) empty_slots="$empty_slots $OPTARG"
- + ;;
- + f) failed_slots="$failed_slots $OPTARG"
- + ;;
- + z) zero_cap_slots="$zero_cap_slots $OPTARG"
- + ;;
- + s) enclosure=$OPTARG
- + ;;
- + esac
- + done
- + for slot in $empty_slots; do
- + present=$(wbcli $enclosure "getdrivestatus $slot" | awk -F"[[:space:]]+:[[:space:]]+" '/present/{print $2}');
- + if [[ "x$present" == "xyes" ]]; then
- + failed_slots="$failed_slots $slot"
- + fi;
- + done;
- + failed_slots="$failed_slots $zero_cap_slots"
- + slots_count=$(wbcli $encl "getdrivebaycount" | awk '/Found [0-9]+ bays/{print $2}');
- + i=0;
- + while [ $i -lt $slots_count ]; do
- + if [[ $failed_slots =~ $i ]]; then
- + wbcli $enclosure "setdriveindicator $slot";
- + echo "Disk checking: slot $slot of enclosure $enclosure is failed!" >&1;
- + else
- + wbcli $enclosure "cleardriveindecator $i";
- + fi
- + let "i += 1";
- + done
- + if [[ ! $failed_slots =~ ^[[:space:]]*$ ]]; then
- + exit 1;
- + fi
- + exit 0;
- + }
- + export -f check_disks;
- + dm_report | awk -F":[[:space:]]+|,[[:space:]]" \
- + 'BEGIN { first_encl=1; empty_slots="";
- + failed_slots=""; zero_cap_slots="";
- + error=0;
- + }
- + /^encl\:/{ if (!first_encl) {
- + e=system("check_disks " empty_slots " " failed_slots " " zero_cap_slots " -s " encl);
- + error = (e > error) ? e : error;
- + }
- + first_encl=0; encl=$6;
- + empty_slots=""; failed_slots=""; zero_cap_slots=""
- + };
- + /status: (Empty)/{ empty_slots = empty_slots " -e " $2 };
- + /status: (Failed)/{ failed_slots = failed_slots " -f " $2 };
- + /cap:[[:space:]]+0/{ zero_cap_slots = zero_cap_slots " -z " $2 };
- + END { e = system("check_disks " empty_slots " " failed_slots " " zero_cap_slots " -s " encl);
- + exit (e > error) ? e : error;
- + }'; && unset check_disks; &&
- +
- +'''
- +
- +
- class PipelineItem(object):
- """Holder for the pipeline item attributes like 'nodeset', 'chain', 'flags'"""
- @@ -148,29 +209,29 @@ osg_create_chain = [
- PipelineItem(nodeset='@all', chain=['rm -f /var/lib/mdraidscripts/mdadm.conf'],
- info="Deleting mdadm.conf"),
- PipelineItem(nodeset="@oss=primary",
- - chain=['/usr/sbin/mdraid-gpfs -t %s'],
- + chain=[check_disks + '/usr/sbin/mdraid-gpfs -t %s'],
- info="Creating RAID structures on NSD nodes", tags=['gpfs']),
- PipelineItem(nodeset="@oss=primary",
- - chain=[kvm_magic, '/usr/sbin/mdraid-create `cat /tmp/kvm_opts` %s -v oss'],
- + chain=[kvm_magic, check_disks + '/usr/sbin/mdraid-create `cat /tmp/kvm_opts` %s -v oss'],
- info="Creating RAID structures on OSS nodes", tags=['vanilla', 'hardened']),
- PipelineItem(nodeset="@oss=primary",
- chain=['/usr/sbin/mdraid-regenerate-conf -c', '/usr/sbin/mdraid-activate -d -m'],
- info="Activating RAIDs on OSS nodes",
- ),
- PipelineItem(nodeset="@mds=primary",
- - chain=[kvm_magic, '/usr/sbin/mdraid-create `cat /tmp/kvm_opts` %s -v mds --cmu_no_external'],
- + chain=[kvm_magic, check_disks + '/usr/sbin/mdraid-create `cat /tmp/kvm_opts` %s -v mds --cmu_no_external'],
- info="Creating RAID structures on MDS nodes", flags=[CREATE_MDS], tags=['classic']),
- PipelineItem(nodeset="@mds=primary",
- - chain=[kvm_magic, '/usr/sbin/mdraid-create `cat /tmp/kvm_opts` %s -v mds --config=ls300 --force_node_attr=primary --cmu_no_external'],
- + chain=[kvm_magic, check_disks + '/usr/sbin/mdraid-create `cat /tmp/kvm_opts` %s -v mds --config=ls300 --force_node_attr=primary --cmu_no_external'],
- info="Creating RAID structures on MDS nodes", flags=[CREATE_MDS], tags=['l300']),
- PipelineItem(nodeset="@mgmt=primary",
- - chain=[kvm_magic, '/usr/sbin/mdraid-create `cat /tmp/kvm_opts` %s -v smu'],
- + chain=[kvm_magic, check_disks + '/usr/sbin/mdraid-create `cat /tmp/kvm_opts` %s -v smu'],
- info="Creating RAID structures on MGMT nodes", tags=['smu']),
- PipelineItem(nodeset="@mgmt",
- chain=['/sbin/service diskmonitor restart'],
- info="Restarting diskmonitor on MGMT nodes", tags=['gpfs']),
- PipelineItem(nodeset="@mgmt=primary",
- - chain=['/usr/sbin/mdraid-gpfs -p mgmt %s'],
- + chain=[check_disks + '/usr/sbin/mdraid-gpfs -p mgmt %s'],
- info="Creating RAID structures on MGMT nodes", tags=['gpfs']),
- PipelineItem(nodeset="@mgmt",
- chain=['/usr/sbin/crm_attribute --type node --lifetime forever --name csflavor --update gpfs'],
- @@ -458,7 +519,7 @@ class RaidScriptOSGRun():
- self.flavor = Config.get_flavor()
- add_tag(self.flavor)
- else:
- - add_tag(self.flavor) #force flavor
- + add_tag(self.flavor) #force flavor
- trace("Force running for flavor: "+self.flavor)
- if keep_data:
- @@ -525,7 +586,7 @@ class RaidScriptOSGRun():
- self, node, cmd.format(
- p_host=p_host, ipmi_user=ipmi_user,
- ipmi_pass=ipmi_pass, s_host=s_host, sec_ipmi_netmask=sec_ipmi_netmask,
- - sec_ipmi_gateway=sec_ipmi_gateway, gem_stonith=gem_stonith, fscontext=fscontext,
- + sec_ipmi_gateway=sec_ipmi_gateway, gem_stonith=gem_stonith, fscontext=fscontext,
- ), info=step.info, logical_step="stonith_mds")
- elif step.flags and STONITH_OSS in step.flags:
- for node in NodeSet.expand(step.nodeset):
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement