start:reinstall_disk
os:Linux
description:check reinstall disk, usded for x86 multi disk only, and not check RH7.2 for RH os wwn isue.
label:others,invoke_provision,install_disk

cmd:xdsh $$CN "dd if=/dev/zero of=/dev/sdb bs=1048576 count=100"
cmd:xdsh $$CN "dd if=/dev/zero of=/dev/sdb bs=1048576 count=300 seek=60858"
cmd:makedns -n
check:rc==0
cmd:makeconservercf
check:rc==0
cmd:cat /etc/conserver.cf | grep $$CN
check:output=~$$CN
cmd:sleep 20
cmd:if [ "__GETNODEATTR($$CN,arch)__" = "ppc64" -a  "__GETNODEATTR($$CN,mgt)__" != "ipmi" ]; then getmacs -D $$CN; fi
check:rc==0
cmd:makedhcp -n
check:rc==0
cmd:makedhcp -a
check:rc==0
cmd:sleep 10
cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi
check:output=~$$CN

cmd:if cat /etc/*release |grep "7.2" |grep "Red Hat">/dev/null;then mkdef $$STATELITE -u profile=compute provmethod=statelite osvers=rhels7.2;else mkdef $$STATELITE -u profile=compute provmethod=statelite; fi
cmd:chdef $$CN status=
check:rc==0
cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute
check:rc==0
check:output=~Provision node\(s\)\: $$CN

cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 30;((a++));if [ $a -gt 100 ];then break;fi done
cmd:lsdef -l $$CN | grep status
check:rc==0
check:output=~booted

cmd:xdsh $$CN "scp /var/log/xcat/xcat.log root@$$MN:/tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_before_re_$$NO"
cmd:cat /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_$$NO | grep "by sorting wwn and DRIVER"
check:output=~sdb

cmd:chdef $$CN status=
check:rc==0
cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute
check:rc==0
check:output=~Provision node\(s\)\: $$CN

cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 30;((a++));if [ $a -gt 100 ];then break;fi done
cmd:lsdef -l $$CN | grep status
check:rc==0
check:output=~booted

md:ping $$CN -c 3
check:rc==0
check:output=~64 bytes from $$CN
cmd:xdsh $$CN date
check:rc==0
check:output=~\d\d:\d\d:\d\d
cmd:xdsh $$CN mount
check:rc==0
cmd:sleep 120

cmd:xdsh $$CN "cat /proc/partitions" >> /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__re_log_$$NO
cmd:xdsh $$CN "cat /etc/*release" >> /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__re_log_$$NO
cmd:xdsh $$CN "cat /var/log/xcat/xcat.log | grep get_install_disk"  >> /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__re_log_$$NO
cmd:xdsh $$CN "scp /var/log/xcat/xcat.log root@$$MN:/tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__re_$$NO"

cmd:cat /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_$$NO | grep "partition"
check:output=~Check the partition sdb1
cmd:cat /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_$$NO | grep "The disks which have kernel"
check:output=~The disks which have kernel
cmd:cat /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_$$NO | grep "The disk sdb information"
check:output=~The disk sdb information
cmd:cat /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_$$NO | grep "disk_wwn="
check:output=~0x500a0751036d9c24
cmd:cat /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_$$NO | grep "into wwn"
check:output=~sdb 0x500a0751036d9c24 into wwn
cmd:cat /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_$$NO | grep "by sorting wwn and DRIVER"
check:output=~sdb

end
