diff --git a/templates/Manufacturing/common/data.exagear-centos7.cpu.config b/templates/Manufacturing/common/data.exagear-centos7.cpu.config new file mode 100644 index 0000000000000000000000000000000000000000..1f97981a54db47a9fb96b3b6ecc08ec7c89c9aa3 --- /dev/null +++ b/templates/Manufacturing/common/data.exagear-centos7.cpu.config @@ -0,0 +1,380 @@ +[SERVER] +11.11.11.11 + +[DOWNLOAD] +Exagear_Server/5.0.0 https://mirrors.huaweicloud.com/kunpeng/archive/ExaGear/ExaGear_5.0.0.tar.gz +Exagear_Guest/7 https://123.249.0.149/guest-images/exagear-guest-for-centos-7-x86_64-3439-1.noarch.rpm +CentOS_iso/7 https://mirrors.huaweicloud.com/centos-vault/centos/7.9.2009/isos/x86_64/CentOS-7-x86_64-Everything-2009.iso +CentOS_update/7 centos7_update.tar.gz #自行打包请将包命名为centos7_update.tar.gz,目录层级请设定为centos7_update/updates和centos7_update/extra,两个目录下都要包含Packages和repodata子目录。获取地址https://mirrors.huaweicloud.com/centos-vault/centos/7.9.2009/updates/x86_64/和https://mirrors.huaweicloud.com/centos-vault/centos/7.9.2009/extras/x86_64/ +Host_ios1/22.03sp2 https://dl-cdn.openeuler.openatom.cn/openEuler-22.03-LTS-SP2/ISO/aarch64/openEuler-22.03-LTS-SP2-aarch64-dvd.iso +Host_ios2/22.03sp3 https://dl-cdn.openeuler.openatom.cn/openEuler-22.03-LTS-SP3/ISO/aarch64/openEuler-22.03-LTS-SP3-aarch64-dvd.iso +mlnx-host/5.1.1.2 https://www.mellanox.com/downloads/ofed/MLNX_EN-5.8-5.1.1.2/mlnx-en-5.8-5.1.1.2-openeuler22.03-aarch64.tgz +mlnx-guest/5.1.1.2 https://www.mellanox.com/downloads/ofed/MLNX_EN-5.8-5.1.1.2/mlnx-en-5.8-5.1.1.2-rhel7.9-x86_64.tgz + +[DEPENDENCY] + + +[ENV] +guest_iso=${JARVIS_DOWNLOAD}/CentOS-7-x86_64-Everything-2009.iso +cenos7_update_pkg=${JARVIS_DOWNLOAD}/centos7_update.tar.gz +os_version=$(grep "VERSION=" /etc/os-release | cut -d '"' -f 2) +if [ "$os_version" == "22.03 (LTS-SP2)" ]; then + host_iso=${JARVIS_DOWNLOAD}/openEuler-22.03-LTS-SP2-everything-aarch64-dvd.iso +elif [ "$os_version" == "22.03 (LTS-SP3)" ]; then + host_iso=${JARVIS_DOWNLOAD}/openEuler-22.03-LTS-SP3-everything-aarch64-dvd.iso +fi + +read -p "Do you need to configure nfs service(Y/N, default N): " nfs_opt +if [ ! -z ${nfs_opt} ] && [ ${nfs_opt} == "Y" ];then + read -p "please input nfs share director(ending with '/'): " share_dir + nfs_share=${share_dir} + read -p "please input nfs server ip: " ip + nfs_server_ip=${ip} + echo "$nfs_share, $nfs_server_ip" +fi + +read -p "Do you need to configure password-less(Y/N, default N): " secret_opt +if [ ! -z ${secret_opt} ] && [ ${secret_opt} == "Y" ];then + + iplist=${JARVIS_DOWNLOAD}/iplist + > ${iplist} + + echo "please input ip list by line(ending with 'END'): " + while true + do + read line + if [ -z ${line} ];then + continue + fi + if [ $line == "END" ];then + break + fi + echo "$line" >> ${iplist} + done + + echo "please input server passwd: " + read -s server_passwd + passwd=${server_passwd} +fi + +[APP] +app_name = +build_dir = +binary_dir = +case_dir = + +[BUILD] +set -x + +config_OS() +{ + echo "[INFO] ========config OS=======" + firewalld_status=`systemctl status firewalld.service |grep Active |awk '{print $2}'` + if [ $firewalld_status != "inactive" ];then + systemctl disable firewalld.service + systemctl stop firewalld.service + fi + + if [ `ulimit -s` != 'unlimited' ] || [ `ulimit -l` != 'unlimited' ] || [ `ulimit -u` != '1000000' ] || [ `ulimit -n` != '1000000' ];then + ulimit -a + sed -i '$ a\* soft memlock unlimited' /etc/security/limits.conf + sed -i '$ a\* hard memlock unlimited' /etc/security/limits.conf + sed -i '$ a\* soft stack unlimited' /etc/security/limits.conf + sed -i '$ a\* hard stack unlimited' /etc/security/limits.conf + sed -i '$ a\* soft nofile 1000000' /etc/security/limits.conf + sed -i '$ a\* hard nofile 1000000' /etc/security/limits.conf + sed -i '$ a\* soft nproc 1000000' /etc/security/limits.conf + sed -i '$ a\* hard nproc 1000000' /etc/security/limits.conf + fi + + if [ `systemctl get-default` != 'multi-user.target' ];then + systemctl set-default multi-user.target + fi + + if [ `getenforce` != 'Disabled' ];then + sed -i '/^SELINUX=/s/.*/SELINUX=disabled/' /etc/selinux/config + setenforce 0 + fi +} + +install_host_dep() +{ + echo "[INFO] ========install host dependency packages=======" + # 镜像挂载 + mount_dir=/media/hostos + if [ ! -d ${mount_dir} ];then + mkdir ${mount_dir} + fi + mount -o loop ${host_iso} ${mount_dir} + + # 备份repo + repo_bak=/etc/yum.repos.d/bak + mkdir ${repo_bak} + mv /etc/yum.repos.d/*.repo ${repo_bak} +cat > /etc/yum.repos.d/local.repo << EOF +\[LocalHostOS\] +name=Local $os_version Repo +baseurl=file://${mount_dir} +gpgcheck=0 +enabled=1 +EOF + sed -i 's/\\\[LocalHostOS\\\]/[LocalHostOS]/g' /etc/yum.repos.d/local.repo + yum install xorg-x11-xauth -y +} + +install_host_driver() +{ + echo "[INFO] ========install host driver=======" + ofed_info -n > /dev/null 2>&1 + if [ $? -eq 0 ];then + echo "[INFO] host driver has beed installed." + return + fi + + cd ${JARVIS_DOWNLOAD} + rm MLNX_OFED_LINUX-5.8-5.1.1.2-openeuler22.03-aarch64 -rf + tar -zxvf MLNX_OFED_LINUX-5.8-5.1.1.2-openeuler22.03-aarch64.tgz + cd MLNX_OFED_LINUX-5.8-5.1.1.2-openeuler22.03-aarch64 + yum install pciutils-libs numactl-libs gcc-gfortran tcsh libusbx libnl3 tcl fuse-libs tk python3-devel lsof createrepo pciutils-devel perl -y + chmod +x mlnxofedinstall + ./mlnxofedinstall --add-kernel-support + #dracut -f + #/etc/init.d/openibd restart + ofed_info -n + mst start + + for dev_name in $(mst status |grep mst |awk '{print $1}') + do + mlxconfig -d ${dev_name} -y s PF_LOG_BAR_SIZE=8 + mlxconfig -y -d ${dev_name} s PCI_WR_ORDERING=1 + done + + # 添加无损配置 + echo "#!/bin/bash + for mlx_dev in \$(ibdev2netdev | awk '{print \$1}') + do + if_dev=\$(ibdev2netdev | grep \$mlx_dev | awk '{print \$5}') + echo "------------> Current: \${mlx_dev}:\${if_dev}" + ifconfig "\${if_dev}" mtu 4500. + cma_roce_tos -d "\${mlx_dev}" -t 106 + mlnx_qos -i "\${if_dev}" --pfc 0,0,0,0,1,0,0,0 --trust dscp + mlnx_qos -i \${if_dev} --dscp2prio set,26,4 + echo 48 >/sys/class/net/\${if_dev}/ecn/roce_np/cnp_dscp + echo 1 >/sys/class/net/\${if_dev}/ecn/roce_np/enable/4 + echo 1 >/sys/class/net/\${if_dev}/ecn/roce_rp/enable/4 + done + " > /etc/init.d/cx.sh + bash /etc/init.d/cx.sh + echo "bash /etc/init.d/cx.sh" >> /etc/rc.local + chmod +x /etc/rc.local +} + +install_exagear() +{ + echo "[INFO] ========install exagear=======" + rpm -qa |grep exagear-guest-for-centos-7-x86_64 > /dev/null 2>&1 + if [ $? -eq 0 ];then + echo "ExaGear has been installed." + else + cd ${JARVIS_DOWNLOAD} + rm -rf ExaGear_5.0.0 + tar -xf ExaGear_5.0.0.tar.gz + mv ExaGear\ 5.0.0/ ExaGear_5.0.0 + cd ExaGear_5.0.0/ExaGear_Server_for_Centos7/ + rpm -ivh exagear-*.rpm + cd ${JARVIS_DOWNLOAD} + rpm -ivh exagear-guest-for-centos-7-x86_64-3439-1.noarch.rpm + fi + rm -f /etc/exagear-guest.conf /etc/exagear-guest-x86_32.conf /etc/exagear-guest-x86_64.conf + ln -sf /opt/exagear/etc/exagear-guest-for-centos-7-x86_64.conf /etc/exagear-guest.conf + ln -sf /opt/exagear/etc/exagear-guest-for-centos-7-x86_64.conf /etc/exagear-guest-x86_32.conf + ln -sf /opt/exagear/etc/exagear-guest-for-centos-7-x86_64.conf /etc/exagear-guest-x86_64.conf + ln -sf /opt/exagear/etc/exagear-guest-for-centos-7-x86_64.conf /opt/exagear/etc/exagear-guest.conf + ln -sf /opt/exagear/etc/exagear-guest-for-centos-7-x86_64.conf /opt/exagear/etc/exagear-guest-x86_32.conf + ln -sf /opt/exagear/etc/exagear-guest-for-centos-7-x86_64.conf /opt/exagear/etc/exagear-guest-x86_64.conf +} + +install_guest_dep() +{ + echo "[INFO]========install guest dependency packages=======" + mount_dir=/media/guestos_7 + if [ ! -d ${mount_dir} ];then + mkdir ${mount_dir} + fi + mount -o loop ${guest_iso} ${mount_dir} + + tar -zxvf ${cenos7_update_pkg} -C /media + update_dir=/media/centos7_update/updates + # 创建本地yum源和安装基础依赖 + # 备份repo + repo_bak=/opt/exagear/images/centos-7-x86_64/etc/yum.repos.d/bak + mkdir ${repo_bak} + mv /opt/exagear/images/centos-7-x86_64/etc/yum.repos.d/*.repo ${repo_bak} + cat > /opt/exagear/images/centos-7-x86_64/etc/yum.repos.d/local.repo << EOF +\[LocalCentOS\] +name=Local CentOS Repo +baseurl=file://${mount_dir} +gpgcheck=0 +enabled=1 + +\[CentOS7-update\] +name=CentOS7-update +baseurl=file://${update_dir} +gpgcheck=0 +enabled=1 + +EOF + sed -i 's/\\\[LocalCentOS\\\]/[LocalCentOS]/g' /opt/exagear/images/centos-7-x86_64/etc/yum.repos.d/local.repo + sed -i 's/\\\[CentOS7-update\\\]/[CentOS7-update]/g' /opt/exagear/images/centos-7-x86_64/etc/yum.repos.d/local.repo + + # 创建本地yum源和安装基础依赖 + #exagear -- yum downgrade glib2 zlib glibc glibc-common openssl-libs openldap cyrus-sasl-lib kpartx systemd-libs systemd util-linux libuuid libmount libblkid libsmartcols expat nss-softokn-freebl-devel -y + exagear -- yum install -y libSM libXrender libXext libXt libglvnd-glx fontconfig qt* motif* gzip environment-modules openssh* redhat-lsb libnsl* perftest libibverbs infiniband-diags openldap* nss-pam-ldapd.x86_64* giflib mesa-dri-drivers libqt* libfabric +} + +install_guest_driver() +{ + echo "[INFO] ========install guest driver=======" + echo "${nfs_share}" >> /opt/exagear/images/centos-7-x86_64/.exagear/vpaths-list + guest_nfs=/opt/exagear/images/centos-7-x86_64/${nfs_share} + if [ ! -d ${guest_nfs} ];then + mkdir /opt/exagear/images/centos-7-x86_64/${nfs_share} + fi + ofed_info -n > /dev/null 2>&1 + if [ $? -eq 0 ];then + echo "[INFO] host driver has beed installed." + return + fi + cd ${JARVIS_DOWNLOAD} + rm MLNX_OFED_LINUX-*rhel7.9-x86_64/ -rf + tar -xvf MLNX_OFED_LINUX-*rhel7.9-x86_64.tgz + cd MLNX_OFED_LINUX-*rhel7.9-x86_64/ + chmod +x mlnxofedinstall + exagear -- yum install pciutils-libs numactl-libs gcc-gfortran tcsh libusbx libnl3 tcl fuse-libs tk -y + exagear -- echo "y" |./mlnxofedinstall --user-space-only + + # install ibdev2netdev + cd RPMS/ + exagear -- yum install mlnx-ofa_kernel-[0-9].[0-9]-OFED.*.x86_64.rpm -y +} +# 配置免密 +config_trust() +{ + echo "[INFO]========config trust=======" + if [ ! -s ${iplist} ] || [ -z ${passwd} ];then + return + fi + yum install ansible -y + yum install python3-libselinux.aarch64 -y # all node + +echo " +\[agent\] +`echo "$(cat $iplist)"` + +\[all:vars\] +ansible_ssh_user=root +ansible_ssh_pass=$passwd +" >> /etc/ansible/hosts + sed -i 's/\\\[agent\\\]/[agent]/g' /etc/ansible/hosts + sed -i 's/\\\[all:vars\\\]/[all:vars]/g' /etc/ansible/hosts + + mkdir /etc/ansible/config + + \rm ~/.ssh/id_rsa* -f + ssh-keygen -t rsa -f ~/.ssh/id_rsa -N "" -q + cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys + + cat > ~/.ssh/config << EOF +strictHostKeyChecking no +EOF + + cat > /etc/ansible/config/trust.yml << EOF +- name: trust config + hosts: all + gather_facts: False + tasks: + - name: copy .ssh + copy: + src: ~/.ssh + dest: ~/ + - name: chmod .ssh + file: + name: ~/.ssh + mode: 0600 + - name: chmod id_rsa + file: + name: ~/.ssh/id_rsa + mode: 0600 +EOF + + ansible-playbook /etc/ansible/config/trust.yml +} + +install_nfs_server() +{ + echo "[INFO] ========install nfs server=======" + if [ -z ${nfs_server_ip} ] || [ -z ${nfs_share} ];then + return + fi + systemctl stop firewalld + systemctl disable firewalld + + yum install -y nfs-utils rpcbind + + echo "${nfs_share} *(rw,no_subtree_check,fsid=12,no_root_squash)" >> /etc/exports + exportfs -r + + systemctl enable rpcbind.service + systemctl enable nfs-server.service + systemctl start rpcbind.service + systemctl start nfs-server.service + rpcinfo -p |grep nfs + if [ $? -eq 0 ];then + echo "nfs server install successfully" + fi +} + +install_nfs_client() +{ + echo "[INFO]========install nfs client=======" + if [ -z ${nfs_server_ip} ] || [ -z ${nfs_share} ];then + return + fi + systemctl stop firewalld + systemctl disable firewalld + + yum install -y nfs-utils rpcbind + + systemctl enable rpcbind.service + systemctl start rpcbind.service + + showmount -e ${nfs_server_ip} + + mkdir ${nfs_share} + echo "${nfs_server_ip}:${nfs_share} ${nfs_share} nfs nolock 0 2" >> /etc/fstab + mount -a + df -h |grep ${nfs_share} + if [ $? -eq 0 ];then + echo "nfs client install successfully" + fi +} + +config_OS +install_host_dep +install_host_driver +install_exagear +install_guest_dep +install_guest_driver +if [[ `hostname -I` =~ ${nfs_server_ip} ]];then + config_trust + install_nfs_server +else + install_nfs_client +fi +echo "Need to reboot" + + +[RUN] +run = /opt/exagear/bin/ubt_x64a64_al -v +binary = +nodes = 1 diff --git a/templates/Manufacturing/common/data.exagear-centos8.cpu.config b/templates/Manufacturing/common/data.exagear-centos8.cpu.config new file mode 100644 index 0000000000000000000000000000000000000000..31bf91499980ade7a2518235697e43905c489e4e --- /dev/null +++ b/templates/Manufacturing/common/data.exagear-centos8.cpu.config @@ -0,0 +1,374 @@ +[SERVER] +11.11.11.11 + +[DOWNLOAD] +Exagear_Server/5.0.0 https://mirrors.huaweicloud.com/kunpeng/archive/ExaGear/ExaGear_5.0.0.tar.gz +Exagear_Guest/8 https://123.249.0.149/guest-images/exagear-guest-for-centos-stream-8-x86_64-3439-1.noarch.rpm +CentOS_iso/8 https://mirrors.huaweicloud.com/centos-vault/centos/8.5.2111/isos/x86_64/CentOS-8.5.2111-x86_64-dvd1.iso +Host_ios1/22.03sp2 https://dl-cdn.openeuler.openatom.cn/openEuler-22.03-LTS-SP2/ISO/aarch64/openEuler-22.03-LTS-SP2-aarch64-dvd.iso +Host_ios2/22.03sp3 https://dl-cdn.openeuler.openatom.cn/openEuler-22.03-LTS-SP3/ISO/aarch64/openEuler-22.03-LTS-SP3-aarch64-dvd.iso +mlnx-host/5.1.1.2 https://www.mellanox.com/downloads/ofed/MLNX_EN-5.8-5.1.1.2/mlnx-en-5.8-5.1.1.2-openeuler22.03-aarch64.tgz +mlnx-guest/5.1.1.2 https://www.mellanox.com/downloads/ofed/MLNX_EN-5.8-5.1.1.2/mlnx-en-5.8-5.1.1.2-rhel8.5-x86_64.tgz + +[DEPENDENCY] + + +[ENV] +guest_iso=${JARVIS_DOWNLOAD}/CentOS-8.5.2111-x86_64-dvd1.iso +os_version=$(grep "VERSION=" /etc/os-release | cut -d '"' -f 2) +if [ "$os_version" == "22.03 (LTS-SP2)" ]; then + host_iso=${JARVIS_DOWNLOAD}/openEuler-22.03-LTS-SP2-everything-aarch64-dvd.iso +elif [ "$os_version" == "22.03 (LTS-SP3)" ]; then + host_iso=${JARVIS_DOWNLOAD}/openEuler-22.03-LTS-SP3-everything-aarch64-dvd.iso +fi + +read -p "Do you need to configure nfs service(Y/N, default N): " nfs_opt +if [ ! -z ${nfs_opt} ] && [ ${nfs_opt} == "Y" ];then + read -p "please input nfs share director(ending with '/'): " share_dir + nfs_share=${share_dir} + read -p "please input nfs server ip: " ip + nfs_server_ip=${ip} + echo "$nfs_share, $nfs_server_ip" +fi + +read -p "Do you need to configure password-less(Y/N, default N): " secret_opt +if [ ! -z ${secret_opt} ] && [ ${secret_opt} == "Y" ];then + iplist=${JARVIS_DOWNLOAD}/iplist + > ${iplist} + + echo "please input ip list by line(ending with 'END'): " + while true + do + read line + if [ -z ${line} ];then + continue + fi + if [ $line == "END" ];then + break + fi + echo "$line" >> ${iplist} + done + + echo "please input server passwd: " + read -s server_passwd + passwd=${server_passwd} +fi + +[APP] +app_name = +build_dir = +binary_dir = +case_dir = + +[BUILD] +set -x + +config_OS() +{ + echo "[INFO] ========config OS=======" + firewalld_status=`systemctl status firewalld.service |grep Active |awk '{print $2}'` + if [ $firewalld_status != "inactive" ];then + systemctl disable firewalld.service + systemctl stop firewalld.service + fi + + if [ `ulimit -s` != 'unlimited' ] || [ `ulimit -l` != 'unlimited' ] || [ `ulimit -u` != '1000000' ] || [ `ulimit -n` != '1000000' ];then + ulimit -a + sed -i '$ a\* soft memlock unlimited' /etc/security/limits.conf + sed -i '$ a\* hard memlock unlimited' /etc/security/limits.conf + sed -i '$ a\* soft stack unlimited' /etc/security/limits.conf + sed -i '$ a\* hard stack unlimited' /etc/security/limits.conf + sed -i '$ a\* soft nofile 1000000' /etc/security/limits.conf + sed -i '$ a\* hard nofile 1000000' /etc/security/limits.conf + sed -i '$ a\* soft nproc 1000000' /etc/security/limits.conf + sed -i '$ a\* hard nproc 1000000' /etc/security/limits.conf + fi + + if [ `systemctl get-default` != 'multi-user.target' ];then + systemctl set-default multi-user.target + fi + + if [ `getenforce` != 'Disabled' ];then + sed -i '/^SELINUX=/s/.*/SELINUX=disabled/' /etc/selinux/config + setenforce 0 + fi +} + + +install_host_dep() +{ + echo "[INFO] ========install host dependency packages=======" + # 镜像挂载 + mount_dir=/media/hostos + if [ ! -d ${mount_dir} ];then + mkdir ${mount_dir} + fi + mount -o loop ${host_iso} ${mount_dir} + + # 备份repo + repo_bak=/etc/yum.repos.d/bak + mkdir ${repo_bak} + mv /etc/yum.repos.d/*.repo ${repo_bak} + cat > /etc/yum.repos.d/local.repo << EOF +\[LocalHostOS\] +name=Local $os_version Repo +baseurl=file://${mount_dir} +gpgcheck=0 +enabled=1 +EOF + sed -i 's/\\\[LocalHostOS\\\]/[LocalHostOS]/g' /etc/yum.repos.d/local.repo + yum install xorg-x11-xauth -y +} + +install_host_driver() +{ + echo "[INFO]========install host driver=======" + ofed_info -n > /dev/null 2>&1 + if [ $? -eq 0 ];then + echo "[INFO] host driver has beed installed." + return + fi + cd ${JARVIS_DOWNLOAD} + rm MLNX_OFED_LINUX-5.8-5.1.1.2-openeuler22.03-aarch64 -rf + tar -zxvf MLNX_OFED_LINUX-5.8-5.1.1.2-openeuler22.03-aarch64.tgz + cd MLNX_OFED_LINUX-5.8-5.1.1.2-openeuler22.03-aarch64 + yum install pciutils-libs numactl-libs gcc-gfortran tcsh libusbx libnl3 tcl fuse-libs tk python3-devel lsof createrepo pciutils-devel perl -y + chmod +x mlnxofedinstall + ./mlnxofedinstall --add-kernel-support + #dracut -f + #/etc/init.d/openibd restart + ofed_info -n + mst start + + for dev_name in $(mst status |grep mst |awk '{print $1}') + do + mlxconfig -d ${dev_name} -y s PF_LOG_BAR_SIZE=8 + mlxconfig -y -d ${dev_name} s PCI_WR_ORDERING=1 + done + + # 添加无损配置 + echo "#!/bin/bash + for mlx_dev in \$(ibdev2netdev | awk '{print \$1}') + do + if_dev=\$(ibdev2netdev | grep \$mlx_dev | awk '{print \$5}') + echo "------------> Current: \${mlx_dev}:\${if_dev}" + ifconfig "\${if_dev}" mtu 4500. + cma_roce_tos -d "\${mlx_dev}" -t 106 + mlnx_qos -i "\${if_dev}" --pfc 0,0,0,0,1,0,0,0 --trust dscp + mlnx_qos -i \${if_dev} --dscp2prio set,26,4 + echo 48 >/sys/class/net/\${if_dev}/ecn/roce_np/cnp_dscp + echo 1 >/sys/class/net/\${if_dev}/ecn/roce_np/enable/4 + echo 1 >/sys/class/net/\${if_dev}/ecn/roce_rp/enable/4 + done + " > /etc/init.d/cx.sh + bash /etc/init.d/cx.sh + echo "bash /etc/init.d/cx.sh" >> /etc/rc.local + chmod +x /etc/rc.local +} + +install_exagear() +{ + echo "[INFO] ========install exagear=======" + rpm -qa |grep exagear-guest-for-centos-stream-8 > /dev/null 2>&1 + if [ $? -eq 0 ];then + echo "ExaGear has been installed." + else + cd ${JARVIS_DOWNLOAD} + rm -rf ExaGear_5.0.0 + tar -xf ExaGear_5.0.0.tar.gz + mv ExaGear\ 5.0.0/ ExaGear_5.0.0 + cd ExaGear_5.0.0/ExaGear_Server_for_Centos8/ + rpm -ivh exagear-*.rpm + cd ${JARVIS_DOWNLOAD} + rpm -ivh exagear-guest-for-centos-stream-8-x86_64-3439-1.noarch.rpm + fi + rm -f /etc/exagear-guest.conf /etc/exagear-guest-x86_32.conf /etc/exagear-guest-x86_64.conf + ln -sf /opt/exagear/etc/exagear-guest-for-centos-stream-8-x86_64.conf /etc/exagear-guest.conf + ln -sf /opt/exagear/etc/exagear-guest-for-centos-stream-8-x86_64.conf /etc/exagear-guest-x86_32.conf + ln -sf /opt/exagear/etc/exagear-guest-for-centos-stream-8-x86_64.conf /etc/exagear-guest-x86_64.conf + ln -sf /opt/exagear/etc/exagear-guest-for-centos-stream-8-x86_64.conf /opt/exagear/etc/exagear-guest.conf + ln -sf /opt/exagear/etc/exagear-guest-for-centos-stream-8-x86_64.conf /opt/exagear/etc/exagear-guest-x86_32.conf + ln -sf /opt/exagear/etc/exagear-guest-for-centos-stream-8-x86_64.conf /opt/exagear/etc/exagear-guest-x86_64.conf +} + +install_guest_dep() +{ + echo "[INFO] ========install guest dependency packages=======" + mount_dir=/media/guestos_8 + if [ ! -d ${mount_dir} ];then + mkdir ${mount_dir} + fi + mount -o loop ${guest_iso} ${mount_dir} + + # 创建本地yum源和安装基础依赖 + # 备份repo + repo_bak=/opt/exagear/images/centos-stream-8-x86_64/etc/yum.repos.d/bak + mkdir ${repo_bak} + mv /opt/exagear/images/centos-stream-8-x86_64/etc/yum.repos.d/*.repo ${repo_bak} +cat > /opt/exagear/images/centos-stream-8-x86_64/etc/yum.repos.d/local.repo << EOF +\[CentOS8\] +name=CentOS8 +baseurl=file://${mount_dir}/BaseOS +gpgcheck=0 +enable=1 + +\[CentOS8-appstream\] +name=CentOS8-appstream +baseurl=file://${mount_dir}/AppStream +gpgcheck=0 +enable=1 +EOF + sed -i 's/\\\[CentOS8\\\]/[CentOS8]/g' /opt/exagear/images/centos-stream-8-x86_64/etc/yum.repos.d/local.repo + sed -i 's/\\\[CentOS8-appstream\\\]/[CentOS8-appstream]/g' /opt/exagear/images/centos-stream-8-x86_64/etc/yum.repos.d/local.repo + + # 创建本地yum源和安装基础依赖 + exagear -- yum install -y libSM libXrender libXext libXt libglvnd-glx fontconfig qt* motif* gzip environment-modules openssh* redhat-lsb libnsl* perftest libibverbs infiniband-diags openldap* nss-pam-ldapd.x86_64* giflib mesa-dri-drivers libqt* libfabric +} + +install_guest_driver() +{ + + echo "[INFO]========install guest driver=======" + echo "${nfs_share}" >> /opt/exagear/images/centos-stream-8-x86_64/.exagear/vpaths-list + guest_nfs=/opt/exagear/images/centos-stream-8-x86_64/${nfs_share} + if [ ! -d ${guest_nfs} ];then + mkdir /opt/exagear/images/centos-stream-8-x86_64/${nfs_share} + fi + ofed_info -n > /dev/null 2>&1 + if [ $? -eq 0 ];then + echo "[INFO] host driver has beed installed." + return + fi + cd ${JARVIS_DOWNLOAD} + rm MLNX_OFED_LINUX-*-x86_64/ -rf + tar -xvf MLNX_OFED_LINUX-*rhel8.5-x86_64.tgz + cd MLNX_OFED_LINUX-*rhel8.5-x86_64/ + chmod +x mlnxofedinstall + exagear -- yum install pciutils-libs numactl-libs gcc-gfortran tcsh libusbx libnl3 tcl fuse-libs tk -y + exagear -- echo "y" | ./mlnxofedinstall --user-space-only + + # install ibdev2netdev + cd RPMS/ + exagear -- yum install mlnx-ofa_kernel-[0-9].[0-9]-OFED.*.x86_64.rpm -y +} +# 配置免密 +config_trust() +{ + echo "[INFO]========config trust=======" + if [ ! -s ${iplist} ] || [ -z ${passwd} ];then + return + fi + yum install ansible -y + yum install python3-libselinux.aarch64 -y # all node + +echo " +\[agent\] +`echo "$(cat $iplist)"` + +\[all:vars\] +ansible_ssh_user=root +ansible_ssh_pass=$passwd +" >> /etc/ansible/hosts + sed -i 's/\\\[agent\\\]/[agent]/g' /etc/ansible/hosts + sed -i 's/\\\[all:vars\\\]/[all:vars]/g' /etc/ansible/hosts + + mkdir /etc/ansible/config + + \rm ~/.ssh/id_rsa* -f + ssh-keygen -t rsa -f ~/.ssh/id_rsa -N "" -q + cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys + + cat > ~/.ssh/config << EOF +strictHostKeyChecking no +EOF + + cat > /etc/ansible/config/trust.yml << EOF +- name: trust config + hosts: all + gather_facts: False + tasks: + - name: copy .ssh + copy: + src: ~/.ssh + dest: ~/ + - name: chmod .ssh + file: + name: ~/.ssh + mode: 0600 + - name: chmod id_rsa + file: + name: ~/.ssh/id_rsa + mode: 0600 +EOF + + ansible-playbook /etc/ansible/config/trust.yml +} + +install_nfs_server() +{ + echo "[INFO] ========install nfs server=======" + if [ -z ${nfs_server_ip} ] || [ -z ${nfs_share} ];then + return + fi + systemctl stop firewalld + systemctl disable firewalld + + yum install -y nfs-utils rpcbind + + echo "${nfs_share} *(rw,no_subtree_check,fsid=12,no_root_squash)" >> /etc/exports + exportfs -r + + systemctl enable rpcbind.service + systemctl enable nfs-server.service + systemctl start rpcbind.service + systemctl start nfs-server.service + rpcinfo -p |grep nfs + if [ $? -eq 0 ];then + echo "nfs server install successfully" + fi +} + +install_nfs_client() +{ + echo "[INFO]========install nfs client=======" + if [ -z ${nfs_server_ip} ] || [ -z ${nfs_share} ];then + return + fi + systemctl stop firewalld + systemctl disable firewalld + + yum install -y nfs-utils rpcbind + + systemctl enable rpcbind.service + systemctl start rpcbind.service + + showmount -e ${nfs_server_ip} + + mkdir ${nfs_share} + echo "${nfs_server_ip}:${nfs_share} ${nfs_share} nfs nolock 0 2" >> /etc/fstab + mount -a + df -h |grep ${nfs_share} + if [ $? -eq 0 ];then + echo "nfs client install successfully" + fi +} + +config_OS +install_host_dep +install_host_driver +install_exagear +install_guest_dep +install_guest_driver +if [[ `hostname -I` =~ ${nfs_server_ip} ]];then + config_trust + install_nfs_server +else + install_nfs_client +fi +echo "Need to reboot" + + +[RUN] +run = /opt/exagear/bin/ubt_x64a64_al -v +binary = +nodes = 1 diff --git a/templates/Manufacturing/config/exagear_args.conf b/templates/Manufacturing/config/exagear_args.conf new file mode 100644 index 0000000000000000000000000000000000000000..6759459ced8a3c61e4387af298a9db05b38ffe55 --- /dev/null +++ b/templates/Manufacturing/config/exagear_args.conf @@ -0,0 +1,35 @@ +if [ "$EXAGEAR_APP_NAME" == "PERFORMANCE_BASE" ];then + EXAGEAR_USE_OPT="y" + EXAGEAR_FAST_MATH="y" +elif [ "$EXAGEAR_APP_NAME" == "PERFORMANCE_VECT1" ];then + EXAGEAR_USE_OPT="y" + EXAGEAR_FAST_MATH="y" + EXAGEAR_X86_ENABLE_AVX="y" + EXAGEAR_X86_DISABLE_SSE_PRESERVE="y" + EXAGEAR_ENABLE_SVE="y" +elif [ "$EXAGEAR_APP_NAME" == "PERFORMANCE_VECT2" ];then + EXAGEAR_USE_OPT="y" + EXAGEAR_FAST_MATH="y" + EXAGEAR_X86_ENABLE_AVX="y" + EXAGEAR_X86_DISABLE_SSE_PRESERVE="n" + EXAGEAR_ENABLE_SVE="n" +elif [ "$EXAGEAR_APP_NAME" == "FUNCTION" ];then + EXAGEAR_USE_OPT="n" + EXAGEAR_USE_CB="n" + EXAGEAR_DISABLE_NATIVE_RETURN_ADDR_OPT="y" + EXAGEAR_DISABLE_THP_PREALLOC="y" + EXAGEAR_DISABLE_THP_MADVISE="y" + EXAGEAR_DISABLE_FLAGS_ON_CALL_RET_OPT="y" + EXAGEAR_DISABLE_JIT_STORE_OPT="y" + EXAGEAR_DISABLE_SWITCHES_OPT="y" + EXAGEAR_X86_PRECISE_FP="y" + EXAGEAR_X86_PRECISE_80BIT_FP="y" + EXAGEAR_X86_ENABLE_AVX="y" + EXAGEAR_FAST_MATH="n" + EXAGEAR_SMO_MODE="all" +elif [ "$EXAGEAR_APP_NAME" == "PRECISION" ];then + EXAGEAR_X86_PRECISE_FP="y" + EXAGEAR_X86_PRECISE_80BIT_FP="y" + EXAGEAR_X86_ENABLE_AVX="y" + EXAGEAR_FAST_MATH="n" +fi