From 7067220128d4ff4fdb39ada7401921959b260a19 Mon Sep 17 00:00:00 2001 From: Kilian Cavalotti Date: Wed, 24 May 2017 15:38:31 -0700 Subject: [PATCH 001/251] Enhance MTM detection from FRU pages For systems that don't provide "Product Name", try to use "Product Part Number" instead. Supermicro does this, for instance: # ipmitool fru print 0 Chassis Type : Other Chassis Part Number : CSE-118GQETS-R2K03P Chassis Serial : [...] Board Mfg Date : Sun Dec 31 16:00:00 1995 Board Mfg : Supermicro Board Serial : [...] Board Part Number : X10DGQ Product Manufacturer : Supermicro Product Part Number : SYS-1028GQ-TR Product Serial : [...] --- xCAT-genesis-scripts/bin/dodiscovery | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index f33ef9c3d..338f13c42 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -75,13 +75,17 @@ if [ -r /sys/devices/virtual/dmi/id/product_name ]; then #x86 if [ -z "$MTM" ]; then FRU=`ipmitool fru print 0` if [ $? -eq 0 ]; then - MTM=`echo "$FRU" | awk -F': ' '/Product Manufacturer/ {m=$2} /Product Name/ {n=$2} END {print m":"n}'` + m=`echo "$FRU" | awk -F': ' '/Product Manufacturer/ {print $2}'` + n=`echo "$FRU" | awk -F': ' '/Product Name/ {print $2}'` + if [ -z "$n" ]; then + n=`echo "$FRU" | awk -F': ' '/Product Part Number/ {print $2}'` + fi else logger -s -t $log_label -p local4.warning "Couldn't find MTM information in FRU, falling back to DMI (MTMS-based discovery may fail)" m=`cat /sys/devices/virtual/dmi/id/sys_vendor` n=`cat /sys/devices/virtual/dmi/id/product_name` - MTM="$m:$n" fi + MTM="$m:$n" fi SERIAL=`cat /sys/devices/virtual/dmi/id/product_serial` fi From b7676f7448df6b29a05fba4a2e84605f2d3b9156 Mon Sep 17 00:00:00 2001 From: Kilian Cavalotti Date: Thu, 25 May 2017 17:24:23 -0700 Subject: [PATCH 002/251] MTM: some systems have FRU entries, but set to "NONE" --- xCAT-genesis-scripts/bin/dodiscovery | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index 338f13c42..0ac4b9bd2 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -77,7 +77,7 @@ if [ -r /sys/devices/virtual/dmi/id/product_name ]; then #x86 if [ $? -eq 0 ]; then m=`echo "$FRU" | awk -F': ' '/Product Manufacturer/ {print $2}'` n=`echo "$FRU" | awk -F': ' '/Product Name/ {print $2}'` - if [ -z "$n" ]; then + if [ -z "$n" -o "$n" == "NONE" ]; then n=`echo "$FRU" | awk -F': ' '/Product Part Number/ {print $2}'` fi else From e3c9caf58af4cc474533172b4b225a0a23dc5e51 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 14 Jul 2017 03:55:26 -0400 Subject: [PATCH 003/251] Add new test case to daily regression bundles --- .../autotest/bundle/rhels6.9_ppc64.bundle | 32 ++++++++++++++++++ .../autotest/bundle/rhels6.9_x86_64.bundle | 31 +++++++++++++++++ .../autotest/bundle/rhels7.3_ppc64.bundle | 33 +++++++++++++++++++ .../autotest/bundle/rhels7.3_ppc64le.bundle | 33 +++++++++++++++++++ .../autotest/bundle/rhels7.3_x86_64.bundle | 32 ++++++++++++++++++ .../autotest/bundle/sles11.4_ppc64.bundle | 32 ++++++++++++++++++ .../autotest/bundle/sles11.4_x86_64.bundle | 31 +++++++++++++++++ .../autotest/bundle/sles12.2_ppc64le.bundle | 32 ++++++++++++++++++ .../autotest/bundle/sles12.2_x86_64.bundle | 31 +++++++++++++++++ .../bundle/ubuntu14.04.4_ppc64le.bundle | 32 ++++++++++++++++++ .../bundle/ubuntu14.04.4_x86_64.bundle | 31 +++++++++++++++++ .../bundle/ubuntu16.04.1_ppc64le.bundle | 32 ++++++++++++++++++ .../bundle/ubuntu16.04.1_x86_64.bundle | 31 +++++++++++++++++ 13 files changed, 413 insertions(+) diff --git a/xCAT-test/autotest/bundle/rhels6.9_ppc64.bundle b/xCAT-test/autotest/bundle/rhels6.9_ppc64.bundle index c790b2146..83c9b1185 100644 --- a/xCAT-test/autotest/bundle/rhels6.9_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.9_ppc64.bundle @@ -310,6 +310,38 @@ run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission xcatconfig_u_check_xcatsslversion_rhels_sles +bmcdiscover_help +bmcdiscover_q +bmcdiscover_version +chdef_nicips +confignetwork_2eth_bridge_br0 +confignetwork_2eth_bridge_br22_br33 +confignetwork_bond_eth2_eth3 +confignetwork_bond_false +confignetwork__bridge_false +confignetwork_installnic_2eth_bridge_br22_br33 +confignetwork_vlan_bond +confignetwork_vlan_eth0 +confignetwork_vlan_false +encrypted_passwd_md5_diskfull +encrypted_passwd_openssl_diskfull +encrypted_passwd_sha256_diskfull +encrypted_passwd_sha512_diskfull +makedhcp_remote_network +makedns_n_noderange +makeknownhosts_node_d +mkdef_regex_bmc +mkdef_regex_ip +mkdef_regex_kvm +mkdef_regex_nicsip +nodeset_errorcommand +nodeset_grub2 +nodeset_yaboot +nodestat_usage +rmimage_diskless +updatenode_diskful_syncfiles_failing +xdcp_nonroot_user +xdsh_permission_denied reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/rhels6.9_x86_64.bundle b/xCAT-test/autotest/bundle/rhels6.9_x86_64.bundle index df5b11571..e3a2c161d 100644 --- a/xCAT-test/autotest/bundle/rhels6.9_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.9_x86_64.bundle @@ -210,6 +210,37 @@ nodeset_cmdline nodeset_runimg nodeset_check_warninginfo xcatconfig_u_check_xcatsslversion_rhels_sles +bmcdiscover_help +bmcdiscover_q +bmcdiscover_version +chdef_nicips +confignetwork_2eth_bridge_br0 +confignetwork_2eth_bridge_br22_br33 +confignetwork_bond_eth2_eth3 +confignetwork_bond_false +confignetwork__bridge_false +confignetwork_installnic_2eth_bridge_br22_br33 +confignetwork_vlan_bond +confignetwork_vlan_eth0 +confignetwork_vlan_false +encrypted_passwd_md5_diskfull +encrypted_passwd_openssl_diskfull +encrypted_passwd_sha256_diskfull +encrypted_passwd_sha512_diskfull +makedhcp_remote_network +makedns_n_noderange +makeknownhosts_node_d +mkdef_regex_bmc +mkdef_regex_ip +mkdef_regex_kvm +mkdef_regex_nicsip +nodeset_errorcommand +nodeset_xnba +nodestat_usage +rmimage_diskless +updatenode_diskful_syncfiles_failing +xdcp_nonroot_user +xdsh_permission_denied reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle b/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle index b61c79e07..4e3974aa5 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle @@ -311,6 +311,39 @@ run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission xcatconfig_u_check_xcatsslversion_rhels_sles +bmcdiscover_help +bmcdiscover_q +bmcdiscover_version +chdef_nicips +confignetwork_2eth_bridge_br0 +confignetwork_2eth_bridge_br22_br33 +confignetwork_bond_eth2_eth3 +confignetwork_bond_false +confignetwork__bridge_false +confignetwork_installnic_2eth_bridge_br22_br33 +confignetwork_vlan_bond +confignetwork_vlan_eth0 +confignetwork_vlan_false +encrypted_passwd_md5_diskfull +encrypted_passwd_openssl_diskfull +encrypted_passwd_sha256_diskfull +encrypted_passwd_sha512_diskfull +makedhcp_remote_network +makedns_n_noderange +makeknownhosts_node_d +mkdef_regex_bmc +mkdef_regex_ip +mkdef_regex_kvm +mkdef_regex_nicsip +mkdef_rhels73 +nodeset_errorcommand +nodeset_grub2 +nodeset_yaboot +nodestat_usage +rmimage_diskless +updatenode_diskful_syncfiles_failing +xdcp_nonroot_user +xdsh_permission_denied reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle index b4b24da9c..c92c618bc 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle @@ -300,6 +300,39 @@ run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission xcatconfig_u_check_xcatsslversion_rhels_sles +bmcdiscover_help +bmcdiscover_q +bmcdiscover_version +chdef_nicips +confignetwork_2eth_bridge_br0 +confignetwork_2eth_bridge_br22_br33 +confignetwork_bond_eth2_eth3 +confignetwork_bond_false +confignetwork__bridge_false +confignetwork_installnic_2eth_bridge_br22_br33 +confignetwork_vlan_bond +confignetwork_vlan_eth0 +confignetwork_vlan_false +encrypted_passwd_md5_diskfull +encrypted_passwd_openssl_diskfull +encrypted_passwd_sha256_diskfull +encrypted_passwd_sha512_diskfull +makedhcp_remote_network +makedns_n_noderange +makeknownhosts_node_d +mkdef_regex_bmc +mkdef_regex_ip +mkdef_regex_kvm +mkdef_regex_nicsip +mkdef_rhels73 +nodeset_errorcommand +nodeset_grub2 +nodeset_petitboot +nodestat_usage +rmimage_diskless +updatenode_diskful_syncfiles_failing +xdcp_nonroot_user +xdsh_permission_denied packimage_m_cpio_c_gzip packimage_m_cpio_c_xz packimage_m_tar_c_gzip diff --git a/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle index 63e7b5294..12839e1d4 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle @@ -216,6 +216,38 @@ nodeset_shell nodeset_cmdline nodeset_runimg xcatconfig_u_check_xcatsslversion_rhels_sles +bmcdiscover_help +bmcdiscover_q +bmcdiscover_version +chdef_nicips +confignetwork_2eth_bridge_br0 +confignetwork_2eth_bridge_br22_br33 +confignetwork_bond_eth2_eth3 +confignetwork_bond_false +confignetwork__bridge_false +confignetwork_installnic_2eth_bridge_br22_br33 +confignetwork_vlan_bond +confignetwork_vlan_eth0 +confignetwork_vlan_false +encrypted_passwd_md5_diskfull +encrypted_passwd_openssl_diskfull +encrypted_passwd_sha256_diskfull +encrypted_passwd_sha512_diskfull +makedhcp_remote_network +makedns_n_noderange +makeknownhosts_node_d +mkdef_regex_bmc +mkdef_regex_ip +mkdef_regex_kvm +mkdef_regex_nicsip +mkdef_rhels73 +nodeset_errorcommand +nodeset_xnba +nodestat_usage +rmimage_diskless +updatenode_diskful_syncfiles_failing +xdcp_nonroot_user +xdsh_permission_denied reg_linux_diskless_installation_flat reg_linux_statelite_installation_flat SN_setup_case diff --git a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle index ecc350e90..f71d696a8 100644 --- a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle @@ -274,6 +274,38 @@ makentp_v makentp_h nodeset_check_warninginfo xcatconfig_u_check_xcatsslversion_rhels_sles +bmcdiscover_help +bmcdiscover_q +bmcdiscover_version +chdef_nicips +confignetwork_2eth_bridge_br0 +confignetwork_2eth_bridge_br22_br33 +confignetwork_bond_eth2_eth3 +confignetwork_bond_false +confignetwork__bridge_false +confignetwork_installnic_2eth_bridge_br22_br33 +confignetwork_vlan_bond +confignetwork_vlan_eth0 +confignetwork_vlan_false +encrypted_passwd_md5_diskfull +encrypted_passwd_openssl_diskfull +encrypted_passwd_sha256_diskfull +encrypted_passwd_sha512_diskfull +makedhcp_remote_network +makedns_n_noderange +makeknownhosts_node_d +mkdef_regex_bmc +mkdef_regex_ip +mkdef_regex_kvm +mkdef_regex_nicsip +nodeset_errorcommand +nodeset_grub2 +nodeset_yaboot +nodestat_usage +rmimage_diskless +updatenode_diskful_syncfiles_failing +xdcp_nonroot_user +xdsh_permission_denied reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle index 338ffb049..55f013dee 100644 --- a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle @@ -220,6 +220,37 @@ run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission xcatconfig_u_check_xcatsslversion_rhels_sles +bmcdiscover_help +bmcdiscover_q +bmcdiscover_version +chdef_nicips +confignetwork_2eth_bridge_br0 +confignetwork_2eth_bridge_br22_br33 +confignetwork_bond_eth2_eth3 +confignetwork_bond_false +confignetwork__bridge_false +confignetwork_installnic_2eth_bridge_br22_br33 +confignetwork_vlan_bond +confignetwork_vlan_eth0 +confignetwork_vlan_false +encrypted_passwd_md5_diskfull +encrypted_passwd_openssl_diskfull +encrypted_passwd_sha256_diskfull +encrypted_passwd_sha512_diskfull +makedhcp_remote_network +makedns_n_noderange +makeknownhosts_node_d +mkdef_regex_bmc +mkdef_regex_ip +mkdef_regex_kvm +mkdef_regex_nicsip +nodeset_errorcommand +nodeset_xnba +nodestat_usage +rmimage_diskless +updatenode_diskful_syncfiles_failing +xdcp_nonroot_user +xdsh_permission_denied reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle index cda0ea4f2..3b89a73a1 100644 --- a/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle @@ -234,6 +234,38 @@ run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd xcatconfig_u_check_xcatsslversion_rhels_sles +bmcdiscover_help +bmcdiscover_q +bmcdiscover_version +chdef_nicips +confignetwork_2eth_bridge_br0 +confignetwork_2eth_bridge_br22_br33 +confignetwork_bond_eth2_eth3 +confignetwork_bond_false +confignetwork__bridge_false +confignetwork_installnic_2eth_bridge_br22_br33 +confignetwork_vlan_bond +confignetwork_vlan_eth0 +confignetwork_vlan_false +encrypted_passwd_md5_diskfull +encrypted_passwd_openssl_diskfull +encrypted_passwd_sha256_diskfull +encrypted_passwd_sha512_diskfull +makedhcp_remote_network +makedns_n_noderange +makeknownhosts_node_d +mkdef_regex_bmc +mkdef_regex_ip +mkdef_regex_kvm +mkdef_regex_nicsip +nodeset_errorcommand +nodeset_grub2 +nodeset_petitboot +nodestat_usage +rmimage_diskless +updatenode_diskful_syncfiles_failing +xdcp_nonroot_user +xdsh_permission_denied sles_migration1 sles_migration2 reg_linux_statelite_installation_flat diff --git a/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle b/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle index 1c9cedf37..c2c3d4096 100644 --- a/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle @@ -220,6 +220,37 @@ run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd xcatconfig_u_check_xcatsslversion_rhels_sles +bmcdiscover_help +bmcdiscover_q +bmcdiscover_version +chdef_nicips +confignetwork_2eth_bridge_br0 +confignetwork_2eth_bridge_br22_br33 +confignetwork_bond_eth2_eth3 +confignetwork_bond_false +confignetwork__bridge_false +confignetwork_installnic_2eth_bridge_br22_br33 +confignetwork_vlan_bond +confignetwork_vlan_eth0 +confignetwork_vlan_false +encrypted_passwd_md5_diskfull +encrypted_passwd_openssl_diskfull +encrypted_passwd_sha256_diskfull +encrypted_passwd_sha512_diskfull +makedhcp_remote_network +makedns_n_noderange +makeknownhosts_node_d +mkdef_regex_bmc +mkdef_regex_ip +mkdef_regex_kvm +mkdef_regex_nicsip +nodeset_errorcommand +nodeset_xnba +nodestat_usage +rmimage_diskless +updatenode_diskful_syncfiles_failing +xdcp_nonroot_user +xdsh_permission_denied sles_migration1 sles_migration2 reg_linux_diskless_installation_flat diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle index 2f56db766..0d7131ffd 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle @@ -271,5 +271,37 @@ run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission xcatconfig_u_check_xcatsslversion_ubuntu +bmcdiscover_help +bmcdiscover_q +bmcdiscover_version +chdef_nicips +confignetwork_2eth_bridge_br0 +confignetwork_2eth_bridge_br22_br33 +confignetwork_bond_eth2_eth3 +confignetwork_bond_false +confignetwork__bridge_false +confignetwork_installnic_2eth_bridge_br22_br33 +confignetwork_vlan_bond +confignetwork_vlan_eth0 +confignetwork_vlan_false +encrypted_passwd_md5_diskfull +encrypted_passwd_openssl_diskfull +encrypted_passwd_sha256_diskfull +encrypted_passwd_sha512_diskfull +makedhcp_remote_network +makedns_n_noderange +makeknownhosts_node_d +mkdef_regex_bmc +mkdef_regex_ip +mkdef_regex_kvm +mkdef_regex_nicsip +nodeset_errorcommand +nodeset_grub2 +nodeset_petitboot +nodestat_usage +rmimage_diskless +updatenode_diskful_syncfiles_failing +xdcp_nonroot_user +xdsh_permission_denied ubuntu_migration1_p8le ubuntu_migration2_p8le diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle index eba0da466..b07bd9f55 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle @@ -277,5 +277,36 @@ rmdocker_f_command lsdocker_h_command lsdocker_l_command xcatconfig_u_check_xcatsslversion_ubuntu +bmcdiscover_help +bmcdiscover_q +bmcdiscover_version +chdef_nicips +confignetwork_2eth_bridge_br0 +confignetwork_2eth_bridge_br22_br33 +confignetwork_bond_eth2_eth3 +confignetwork_bond_false +confignetwork__bridge_false +confignetwork_installnic_2eth_bridge_br22_br33 +confignetwork_vlan_bond +confignetwork_vlan_eth0 +confignetwork_vlan_false +encrypted_passwd_md5_diskfull +encrypted_passwd_openssl_diskfull +encrypted_passwd_sha256_diskfull +encrypted_passwd_sha512_diskfull +makedhcp_remote_network +makedns_n_noderange +makeknownhosts_node_d +mkdef_regex_bmc +mkdef_regex_ip +mkdef_regex_kvm +mkdef_regex_nicsip +nodeset_errorcommand +nodeset_xnba +nodestat_usage +rmimage_diskless +updatenode_diskful_syncfiles_failing +xdcp_nonroot_user +xdsh_permission_denied ubuntu_migration1_vm ubuntu_migration2_vm diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle index 178c2ee8b..c03ecbfe0 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle @@ -272,6 +272,38 @@ run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd xcatconfig_u_check_xcatsslversion_ubuntu +bmcdiscover_help +bmcdiscover_q +bmcdiscover_version +chdef_nicips +confignetwork_2eth_bridge_br0 +confignetwork_2eth_bridge_br22_br33 +confignetwork_bond_eth2_eth3 +confignetwork_bond_false +confignetwork__bridge_false +confignetwork_installnic_2eth_bridge_br22_br33 +confignetwork_vlan_bond +confignetwork_vlan_eth0 +confignetwork_vlan_false +encrypted_passwd_md5_diskfull +encrypted_passwd_openssl_diskfull +encrypted_passwd_sha256_diskfull +encrypted_passwd_sha512_diskfull +makedhcp_remote_network +makedns_n_noderange +makeknownhosts_node_d +mkdef_regex_bmc +mkdef_regex_ip +mkdef_regex_kvm +mkdef_regex_nicsip +nodeset_errorcommand +nodeset_grub2 +nodeset_petitboot +nodestat_usage +rmimage_diskless +updatenode_diskful_syncfiles_failing +xdcp_nonroot_user +xdsh_permission_denied ubuntu_migration1_p8le ubuntu_migration2_p8le diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle index 5ed165f5e..610c072c0 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle @@ -269,5 +269,36 @@ disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd nodeset_check_warninginfo xcatconfig_u_check_xcatsslversion_ubuntu +bmcdiscover_help +bmcdiscover_q +bmcdiscover_version +chdef_nicips +confignetwork_2eth_bridge_br0 +confignetwork_2eth_bridge_br22_br33 +confignetwork_bond_eth2_eth3 +confignetwork_bond_false +confignetwork__bridge_false +confignetwork_installnic_2eth_bridge_br22_br33 +confignetwork_vlan_bond +confignetwork_vlan_eth0 +confignetwork_vlan_false +encrypted_passwd_md5_diskfull +encrypted_passwd_openssl_diskfull +encrypted_passwd_sha256_diskfull +encrypted_passwd_sha512_diskfull +makedhcp_remote_network +makedns_n_noderange +makeknownhosts_node_d +mkdef_regex_bmc +mkdef_regex_ip +mkdef_regex_kvm +mkdef_regex_nicsip +nodeset_errorcommand +nodeset_xnba +nodestat_usage +rmimage_diskless +updatenode_diskful_syncfiles_failing +xdcp_nonroot_user +xdsh_permission_denied ubuntu_migration1_vm ubuntu_migration2_vm From 55699e81c4fe781a3b9311100cad4bad2d3933a5 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 27 Jul 2017 08:49:13 -0400 Subject: [PATCH 004/251] add test case for issue 3414 : incorrect petitboot configuration for nodeset shell in flat hierarchical #3480 --- xCAT-test/autotest/testcase/genesis/cases0 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xCAT-test/autotest/testcase/genesis/cases0 b/xCAT-test/autotest/testcase/genesis/cases0 index f9fb966ea..64085644b 100644 --- a/xCAT-test/autotest/testcase/genesis/cases0 +++ b/xCAT-test/autotest/testcase/genesis/cases0 @@ -30,3 +30,19 @@ cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n check:rc==0 cmd:cat /tmp/genesistestlog/* end + +start:nodeset_shell_incorrectmasterip +description:very if computenode need to do nodeset shell in different net with master will success +cmd:chdef testnode arch=ppc64le cons=ipmi groups=all ip=60.1.1.1 netboot=petitboot +cmd:masterip=`lsdef -t site -i master -c 2>&1 | awk -F'=' '{print \$2}'`;echo $masterip;masternet=`ifconfig |awk "BEGIN{RS=\"\"}/\<$masterip\>/{print \$1}"|head -n 1 | awk -F ":" '{print \$1}'`;echo $masternet;net2=` netstat -i |grep -v Kernel|grep -v Iface |grep -v lo|grep -v $masternet|head -n 1|awk '{print \$1}'`;echo $net2;net2ip=`ifconfig $net2 |grep inet|grep -v inet6`;ifconfig $net2 60.3.3.3 ;makenetworks;makehosts;nodeset testnode shell;cat /tftpboot/petitboot/testnode |grep "xcatd=60.3.3.3:3001 destiny=shell";if [[ $? -eq 0 ]] ;then if [[ -z $net2ip ]];then ifconfig $net2 0.0.0.0;exit 0;else ifconfig $net2 $net2ip;exit 0;fi ;else exit 1;fi +check:rc==0 +cmd:chdef testnode arch=x86_64 netboot=xnba +cmd:masterip=`lsdef -t site -i master -c 2>&1 | awk -F'=' '{print \$2}'`;echo $masterip;masternet=`ifconfig |awk "BEGIN{RS=\"\"}/\<$masterip\>/{print \$1}"|head -n 1 | awk -F ":" '{print \$1}'`;echo $masternet;net2=` netstat -i |grep -v Kernel|grep -v Iface |grep -v lo|grep -v $masternet|head -n 1|awk '{print \$1}'`;echo $net2;net2ip=`ifconfig $net2 |grep inet|grep -v inet6`;ifconfig $net2 60.3.3.3 ;makenetworks;makehosts;nodeset testnode shell;cat /tftpboot/xcat/xnba/nodes/testnode |grep "xcatd=60.3.3.3:3001 destiny=shell";if [[ $? -eq 0 ]] ;then if [[ -z $net2ip ]];then ifconfig $net2 0.0.0.0;exit 0;else ifconfig $net2 $net2ip;exit 0;fi ;else exit 1;fi +check:rc==0 +cmd:chdef testnode arch=x86_64 netboot=grub2 +cmd:masterip=`lsdef -t site -i master -c 2>&1 | awk -F'=' '{print \$2}'`;echo $masterip;masternet=`ifconfig |awk "BEGIN{RS=\"\"}/\<$masterip\>/{print \$1}"|head -n 1 | awk -F ":" '{print \$1}'`;echo $masternet;net2=` netstat -i |grep -v Kernel|grep -v Iface |grep -v lo|grep -v $masternet|head -n 1|awk '{print \$1}'`;echo $net2;net2ip=`ifconfig $net2 |grep inet|grep -v inet6`;ifconfig $net2 60.3.3.3 ;makenetworks;makehosts;nodeset testnode shell; cat /tftpboot/boot/grub2/testnode |grep "xcatd=60.3.3.3:3001 destiny=shell";if [[ $? -eq 0 ]] ;then if [[ -z $net2ip ]];then ifconfig $net2 0.0.0.0;exit 0;else ifconfig $net2 $net2ip;exit 0;fi ;else exit 1;fi +check:rc==0 +cmd:makehosts -d testnode +cmd:rmdef testnode +cmd:rmdef -t network 60_0_0_0-255_0_0_0 +end From 9ed7419096a25b559f49e9ef4bcd4fba9d018b4f Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 2 Aug 2017 00:15:36 -0400 Subject: [PATCH 005/251] Remove commented code, fix spelling error in dodiscovery --- xCAT-genesis-scripts/bin/dodiscovery | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index e870783fb..f86e36c18 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -93,7 +93,6 @@ if [ -r /sys/devices/virtual/dmi/id/product_name ]; then #x86 UUID=`sed -e 's/\(..\)\(..\)\(..\)\(..\)-\(..\)\(..\)-\(..\)\(..\)/\4\3\2\1-\6\5-\8\7/' /sys/devices/virtual/dmi/id/product_uuid` elif [ -r /proc/device-tree/model ]; then #POWER - #MTM=`cat /proc/device-tree/model |awk -F, '{print $2}'` MTM=`cat /proc/device-tree/model -vT | sed -e 's/^.*,//' | sed -e 's/^[\t ]*//'| sed -e 's/[\t ]*\^@//'` CPUCOUNT=`cat /proc/cpuinfo |grep -e "^cpu\s*:"|wc -l` PLATFORM=`cat /proc/cpuinfo | grep -e "^platform\s*:" | awk '{print \$3}'` @@ -107,25 +106,14 @@ elif [ -r /proc/device-tree/model ]; then #POWER UUID=unknown fi -#CPUCOUNT=`cat /proc/cpuinfo |grep "model name"|wc -l` # The MEMORY will look like this: 32868920 MEMORY=`cat /proc/meminfo |grep MemTotal|awk '{printf "%.0fMB\n", $2/1024}'` -# The MEMORY will look like this: 32GiB -#MEMORY=`lshw -C memory -short |grep "System Memory"|awk -F' ' '{print $3}'` -# The DISKSIZE will look like this: /dev/sda:250GB,/dev/sdb:250GB -#DISKSIZE=`lshw -C disk -short |grep disk |awk -F' ' '{print $2":"$4}'|sed 'N;s/\n/,/'` # The DISKSIZE will look like this: sdb:250GB,sda:250GB DISKSIZE=`cat /proc/partitions |grep -e "sd.\>" |awk -F' ' '{printf "%s:%.0fGB\n", $4, $3*0.000001024}' |sed 'N;s/\n/,/'` -#UUID=`sed -e 's/\(..\)\(..\)\(..\)\(..\)-\(..\)\(..\)-\(..\)\(..\)/\4\3\2\1-\6\5-\8\7/' /sys/devices/virtual/dmi/id/product_uuid` -#grep "model name" /proc/cpuinfo | while read line; do #to avoid pulling in tail, we do a goofy thing -# echo $line > /tmp/cpumod -#done -#CPUTYPE=`cat /tmp/cpumod|awk -F':' '{print $2}'|sed -e 's/^ //'` - -logger -s -t $log_label -p local4.info "Beginning echo infomation to discovery packet file..." +logger -s -t $log_label -p local4.info "Beginning echo information to discovery packet file..." echo '' > /tmp/discopacket echo "findme" >> /tmp/discopacket echo "1" >> /tmp/discopacket From 02c82d4a0411a7344a086114b4adeb4660ca8c39 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Mon, 7 Aug 2017 21:00:50 -0400 Subject: [PATCH 006/251] Support rspconfig command to change PDU's ip address, netmask and hostname --- xCAT-server/lib/xcat/plugins/pdu.pm | 97 ++++++++++++++++++- .../lib/xcat/plugins/switchdiscover.pm | 36 ++++++- 2 files changed, 129 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/pdu.pm b/xCAT-server/lib/xcat/plugins/pdu.pm index c4e71ef96..2372152f5 100644 --- a/xCAT-server/lib/xcat/plugins/pdu.pm +++ b/xCAT-server/lib/xcat/plugins/pdu.pm @@ -177,6 +177,8 @@ sub process_request my $subcmd = $exargs[0]; if ($subcmd eq 'sshcfg') { process_sshcfg($noderange, $subcmd, $callback); + }elsif ($subcmd =~ /=/) { + process_netcfg($request, $subreq, $subcmd, $callback); } else { $callback->({ errorcode => [1],error => "The input $command $subcmd is not support for pdu"}); } @@ -467,6 +469,87 @@ sub connectTopdu { } +#------------------------------------------------------- + +=head3 process_netcfg + + Config hostname of PDU + Config ip/netmask of PDU via PduManager command + PduManager is a tool for CoralPdu to manager the PDU. + * /dev/shm/bin/PduManager -h + '-i' set PDU system IP + '-n' set system ip netmask. e.g.:PduManager -i xxx.xxx.xxx.xxx -n xxx.xxx.xxx.xxx + + example: rspconfig coralpdu hostname=coralpdu + rspconfig coralpdu ip=1.1.1.1,netmask=255.0.0.0 + +=cut + +#------------------------------------------------------- +sub process_netcfg { + my $request = shift; + my $subreq = shift; + my $subcmd = shift; + my $callback = shift; + my $hostname; + my $ip; + my $netmask; + my $args; + + my $nodes = $request->{node}; + my $rsp = {}; + + xCAT::MsgUtils->message("I", "set hostname "); + my @cmds = split(/,/,$subcmd); + foreach my $cmd (@cmds) { + my ($key, $value) = split(/=/, $cmd); + if ($key =~ /hostname/) { + $hostname = $value; + $args = "echo $hostname > /etc/hostname;/etc/init.d/hostname.sh"; + xCAT::Utils->runxcmd({ command => ['xdsh'], + node => $nodes, + arg => [ $args ] }, $subreq, 0, 1); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message("I", "xdsh command to set hostname failed"); + } + }elsif ($key =~ /ip/) { + $ip = $value; + } elsif ($key =~ /netmask/) { + $netmask = $value; + } else { + xCAT::MsgUtils->message("I", "rspconfig $cmd is not support yet"); + } + } + + $args = "/dev/shm/bin/PduManager "; + my $opt; + if ($ip) { + $opt = "-i $ip "; + } + if ($netmask) { + $opt = $opt . "-n $netmask"; + } + if ($opt) { + my $dshcmd = $args . $opt ; + #comment this for now, coralPDU on the lab is not support PduManager yet + my $output = xCAT::Utils->runxcmd({ command => ['xdsh'], node => $nodes, arg => [ $dshcmd ] }, $subreq, 0, 1); + if ($::RUNCMD_RC != 0) { + xCAT::SvrUtils::sendmsg("@$output", $callback); + } + } +} + +#------------------------------------------------------- + +=head3 process_sshcfg + + Config passwordless for coralpdu + + example: rspconfig coralpdu sshcfg + +=cut + +#------------------------------------------------------- sub process_sshcfg { my $noderange = shift; my $subcmd = shift; @@ -585,6 +668,18 @@ sub session_exec { return($mbmatch); } +#----------------------------------------------------------------- + +=head3 process_pdudiscover + + Discover the pdu for a given range of DHCP ip address + it will call switchdiscover command with -s snmp --pdu options + + example: pdudiscover --range iprange -w + +=cut + +#------------------------------------------------------------------ sub process_pdudiscover { my $request = shift; my $sub_req = shift; @@ -615,8 +710,6 @@ sub process_pdudiscover { my $rsp = {}; push @{ $rsp->{data} }, "$result"; xCAT::MsgUtils->message("I", $rsp, $callback); - - } diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index f39141092..a22b9d1a8 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -1404,15 +1404,18 @@ sub matchPredefineSwitch { } my $stype = get_switchtype($vendor); + if (exists($globalopt{pdu})) { + $stype="pdu"; + } send_msg($request, 0, "$device discovered and matched: $dswitch to $node" ); # only write to xcatdb if -w or --setup option specified if ( (exists($globalopt{w})) || (exists($globalopt{setup})) ) { if (exists($globalopt{pdu})) { - xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"otherinterfaces=$ip",'status=Matched',"mac=$mac","switchtype=$stype","usercomment=$vendor"] }, $sub_req, 0, 1); + xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"otherinterfaces=$ip",'status=Matched',"mac=$mac","usercomment=$vendor"] }, $sub_req, 0, 1); } else { - xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"otherinterfaces=$ip",'status=Matched',"mac=$mac","switchtype=$stype","usercomment=$vendor","switchtype=$stype"] }, $sub_req, 0, 1); + xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"otherinterfaces=$ip",'status=Matched',"mac=$mac","switchtype=$stype","usercomment=$vendor"] }, $sub_req, 0, 1); } } @@ -1436,6 +1439,35 @@ sub switchsetup { my $request = shift; my $sub_req = shift; if (exists($globalopt{pdu})) { + my $mytype = "pdu"; + my $nodetab = xCAT::Table->new('hosts'); + my $nodehash = $nodetab->getNodesAttribs(\@{${nodes_to_config}->{$mytype}},['ip','otherinterfaces']); + # get netmask from network table + my $nettab = xCAT::Table->new("networks"); + my @nets; + if ($nettab) { + @nets = $nettab->getAllAttribs('net','mask'); + } + + foreach my $pdu(@{${nodes_to_config}->{$mytype}}) { + my $cmd = "rspconfig $pdu sshcfg"; + xCAT::Utils->runcmd($cmd, 0); + my $ip = $nodehash->{$pdu}->[0]->{otherinterfaces}; + my $mask; + foreach my $net (@nets) { + if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $ip, $net->{'mask'}, 0)) { + $mask=$net->{'mask'}; + } + } + $cmd = "rspconfig $pdu hostname=$pdu,ip=$otherinterfaces,netmask=$mask"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC == 0) { + xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$pdu,"ip=$ip","otherinterfaces="] }, $sub_req, 0, 1); + } else { + send_msg($request, 0, "Failed to run rspconfig command to set ip/netmask\n"); + } + + } return; } From ea1016196d07a28311f4f876405890f9677a7ea8 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 9 Aug 2017 02:31:38 -0400 Subject: [PATCH 007/251] add new case chdef_site_check --- xCAT-test/autotest/bundle/rhels6.9_ppc64.bundle | 1 + xCAT-test/autotest/bundle/rhels6.9_x86_64.bundle | 1 + xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle | 1 + xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle | 1 + xCAT-test/autotest/bundle/sles11.4_ppc64.bundle | 1 + xCAT-test/autotest/bundle/sles11.4_x86_64.bundle | 1 + xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/sles12.2_x86_64.bundle | 1 + xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle | 1 + xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle | 1 + 13 files changed, 13 insertions(+) diff --git a/xCAT-test/autotest/bundle/rhels6.9_ppc64.bundle b/xCAT-test/autotest/bundle/rhels6.9_ppc64.bundle index 83c9b1185..d7cbdac24 100644 --- a/xCAT-test/autotest/bundle/rhels6.9_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.9_ppc64.bundle @@ -40,6 +40,7 @@ chdef_dynamic_group chdef_multiple_keys chdef_n chdef_t_o_error +chdef_site_check chtab_null chtab_d chtab_modify_node diff --git a/xCAT-test/autotest/bundle/rhels6.9_x86_64.bundle b/xCAT-test/autotest/bundle/rhels6.9_x86_64.bundle index e3a2c161d..b0ece8695 100644 --- a/xCAT-test/autotest/bundle/rhels6.9_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.9_x86_64.bundle @@ -8,6 +8,7 @@ makehost_n_r chdef_null chdef_z chdef_t_o_error +chdef_site_check chtab_null chtab_d chtab_modify_node diff --git a/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle b/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle index 4e3974aa5..4a80fa152 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle @@ -40,6 +40,7 @@ chdef_dynamic_group chdef_multiple_keys chdef_n chdef_t_o_error +chdef_site_check chtab_null chtab_d chtab_modify_node diff --git a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle index c92c618bc..3b39f4131 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle @@ -43,6 +43,7 @@ chdef_dynamic_group chdef_multiple_keys chdef_n chdef_t_o_error +chdef_site_check chtab_null chtab_d chtab_modify_node diff --git a/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle index 12839e1d4..c271f7c53 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle @@ -8,6 +8,7 @@ makehost_n_r chdef_null chdef_z chdef_t_o_error +chdef_site_check chtab_null chtab_d chtab_modify_node diff --git a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle index f71d696a8..7639a6437 100644 --- a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle @@ -11,6 +11,7 @@ chdef_dynamic_group chdef_multiple_keys chdef_n chdef_t_o_error +chdef_site_check chtab_null chtab_d chtab_modify_node diff --git a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle index 55f013dee..597db4a76 100644 --- a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle @@ -8,6 +8,7 @@ makehost_n_r chdef_null chdef_z chdef_t_o_error +chdef_site_check chtab_null chtab_d chtab_modify_node diff --git a/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle index 3b89a73a1..2a383f9b6 100644 --- a/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle @@ -20,6 +20,7 @@ confignetwork_secondarynic_thirdnic_multiplevalue_updatenode chdef_null chdef_z chdef_t_o_error +chdef_site_check chtab_null chtab_d chtab_modify_node diff --git a/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle b/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle index c2c3d4096..588625da9 100644 --- a/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle @@ -8,6 +8,7 @@ makehost_n_r chdef_null chdef_z chdef_t_o_error +chdef_site_check chtab_null chtab_d chtab_modify_node diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle index 0d7131ffd..2f3c69bb2 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle @@ -20,6 +20,7 @@ confignetwork_secondarynic_thirdnic_multiplevalue_updatenode chdef_null chdef_z chdef_t_o_error +chdef_site_check chtab_null chtab_d chtab_modify_node diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle index b07bd9f55..933dea55f 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle @@ -9,6 +9,7 @@ makehost_n_r chdef_null chdef_z chdef_t_o_error +chdef_site_check chtab_null chtab_d chtab_modify_node diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle index c03ecbfe0..ac8601b41 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle @@ -21,6 +21,7 @@ confignetwork_secondarynic_thirdnic_multiplevalue_updatenode chdef_null chdef_z chdef_t_o_error +chdef_site_check chtab_null chtab_d chtab_modify_node diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle index 610c072c0..6d4816a4a 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle @@ -9,6 +9,7 @@ makehost_n_r chdef_null chdef_z chdef_t_o_error +chdef_site_check chtab_null chtab_d chtab_modify_node From 11890b660b8fd5945f6829038abc7d5979b28937 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Wed, 9 Aug 2017 14:32:18 -0400 Subject: [PATCH 008/251] using sshpass (if availble) connect to openbmc console --- xCAT-server/share/xcat/cons/openbmc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/cons/openbmc b/xCAT-server/share/xcat/cons/openbmc index 6d166a7d9..2bda67133 100755 --- a/xCAT-server/share/xcat/cons/openbmc +++ b/xCAT-server/share/xcat/cons/openbmc @@ -91,7 +91,12 @@ if ($ENV{SSHCONSOLEPORT}) { $sshport= $ENV{SSHCONSOLEPORT}; } -print "If the console cannot connect, please verify whether ssh keys has been configured on the bmc for $username user\n"; +#user needs to download sshpass rpm if need to use it +if (-x '/usr/bin/sshpass') { + exec "/usr/bin/sshpass -p $password ssh -p $sshport -l $username $bmcip"; +} else { + exec "ssh -p $sshport -l $username $bmcip"; +} + -exec "ssh -p $sshport -l $username $bmcip"; From 5b9ff98cd1b9e06bd9dabfbedea1cccd5b75f9e6 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 9 Aug 2017 23:18:37 -0400 Subject: [PATCH 009/251] update for xCAT 2.13.6 release --- docs/source/overview/xcat2_release.rst | 60 ++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/docs/source/overview/xcat2_release.rst b/docs/source/overview/xcat2_release.rst index 2062b7c30..26bdd6b92 100644 --- a/docs/source/overview/xcat2_release.rst +++ b/docs/source/overview/xcat2_release.rst @@ -14,6 +14,66 @@ xCAT 2.13.x |xCAT |New OS |New |New Feature | |Version | |Hardware | | +=================================+===============+=============+==================================+ +|| xCAT 2.13.6 |- RHEL 7.4 | |-OpenBMC support(Alpha level code)| +|| 2017/8/10 | | | | +|| | | | rsetboot | +| `2.13.6 Release Notes `_ | | |-WSP EUH support | +| | | | | +| | | | Hardware discovery | +| | | | bmcsetup | +| | | |-nodeset performance enhancement | +| | | | (Phase 3) | +| | | | | +| | | | Dispatch request to the specified| +| | | | service nodes | +| | | |-Boston server verification | +| | | |-CORAL hardware/switch discovery | +| | | | process | +| | | | | +| | | | the DHCP dynamic range | +| | | | DHCP relay | +| | | |-network configuration interface | +| | | | | +| | | | niccustomscripts | +| | | | refine xCAT network scripts | +| | | | related document | +| | | |-xCAT MN migration steps | +| | | | verification | +| | | |-new xCAT prototype | +| | | | | +| | | | the framework for copycds | +| | | | the framework for deploying RH on| +| | | | x86 VMs | +| | | |-[xcat-deps] xcat-genesis-base | +| | | | package based on Fedora 26 ppc64 | ++---------------------------------+---------------+-------------+----------------------------------+ +|| xCAT 2.13.5 | | |-OpenBMC support(Alpha level code)| +|| 2017/6/30 | | | | +|| | | | rinv | +| `2.13.5 Release Notes `_ | | |-Enhancements to self testing | +| | | | tool xcat-test | +| | | |-Service node pool support for | +| | | | rhels7 ppc64le diskless | +| | | |-Mellanox cumulus switch ZTP based| +| | | | discovery and auto-configuration | +| | | |-Performance enhancements | +| | | | | +| | | | makedhcp, makedns | +| | | | nodeset | +| | | |-[xcat-deps] ipmitool-xcat package| +| | | | updated to version 1.8.18 for | +| | | | | +| | | | RHEL7.x | +| | | | SLES12.x | +| | | | Ubuntu14.04.x | +| | | |-[xcat-deps] conserver-xcat | +| | | | package updated to version 8.2.1 | +| | | | | ++---------------------------------+---------------+-------------+----------------------------------+ || xCAT 2.13.4 |- RHV 4.1 | |- OpenBMC support(experimental): | || 2017/5/19 | | | | || | | | rinv | From 46fb9398247fd036aee6ba8733c8dc961ebcef66 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 10 Aug 2017 02:16:37 -0400 Subject: [PATCH 010/251] Activate the build 2.13.6 --- README.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index c9250eb90..d45b6ea6e 100644 --- a/README.rst +++ b/README.rst @@ -8,7 +8,7 @@ Documentation xCAT documentation is available at: http://xcat-docs.readthedocs.io/en/latest/ -|docs_latest| |docs_2135| |docs_2134| |docs_2133| |docs_2132| |docs_2131| |docs_2130| |docs_212| +|docs_latest| |docs_2136| |docs_2135| |docs_2134| |docs_2133| |docs_2132| |docs_2131| |docs_2130| |docs_212| Open Source License ------------------- @@ -22,6 +22,11 @@ Developers Developers and prospective contributors are encouraged to read the `Developers Guide `_ In particular the `GitHub `_ related subsection. +.. |docs_2136| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.6 + :alt: 2.13.6 documentation status + :scale: 100% + :target: http://xcat-docs.readthedocs.io/en/2.13.6/ + .. |docs_2135| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.5 :alt: 2.13.5 documentation status :scale: 100% From 12d03a67f0e589d3215f2586c7fb8be773e84226 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 10 Aug 2017 03:07:59 -0400 Subject: [PATCH 011/251] update for release note update --- docs/source/overview/xcat2_release.rst | 46 ++++++++++++-------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/docs/source/overview/xcat2_release.rst b/docs/source/overview/xcat2_release.rst index 26bdd6b92..5a5557db1 100644 --- a/docs/source/overview/xcat2_release.rst +++ b/docs/source/overview/xcat2_release.rst @@ -14,38 +14,34 @@ xCAT 2.13.x |xCAT |New OS |New |New Feature | |Version | |Hardware | | +=================================+===============+=============+==================================+ -|| xCAT 2.13.6 |- RHEL 7.4 | |-OpenBMC support(Alpha level code)| -|| 2017/8/10 | | | | -|| | | | rsetboot | -| `2.13.6 Release Notes `_ | | |-WSP EUH support | -| | | | | -| | | | Hardware discovery | -| | | | bmcsetup | +|| xCAT 2.13.6 |- RHEL 7.4 |-Boston |-OpenBMC support(Alpha level code)| +|| 2017/8/10 | | server | | +|| | | | rsetboot net/hd/def | +| `2.13.6 Release Notes `_ | | | rspconfig retrieve OpenBCM ip/ | +| | | | netmask/gateway information | | | | |-nodeset performance enhancement | | | | | (Phase 3) | | | | | | | | | | Dispatch request to the specified| -| | | | service nodes | -| | | |-Boston server verification | -| | | |-CORAL hardware/switch discovery | -| | | | process | +| | | |service nodes with 'disjointdhcps'| +| | | | Enhance the output of nodeset in | +| | | |hierarchical cluster | | | | | | -| | | | the DHCP dynamic range | -| | | | DHCP relay | -| | | |-network configuration interface | +| | | |-network configuration interface: | +| | | | confignetwork is the only | +| | | |interface to configure network | +| | | |on SN/CN | | | | | | -| | | | niccustomscripts | -| | | | refine xCAT network scripts | -| | | | related document | -| | | |-xCAT MN migration steps | -| | | | verification | -| | | |-new xCAT prototype | +| | | |-For hardware discovery | +| | | | enhance bmcdiscover to use BMC | +| | | |MAC address to identify BMC with | +| | | |its host | +| | | | enhance "xcatprobe discovery" | +| | | |tool to do configuration check | +| | | |before starting hardware discovery| | | | | | -| | | | the framework for copycds | -| | | | the framework for deploying RH on| -| | | | x86 VMs | | | | |-[xcat-deps] xcat-genesis-base | | | | | package based on Fedora 26 ppc64 | +---------------------------------+---------------+-------------+----------------------------------+ From 807c2f0634b8e0755385a913a5c20380e69a8efa Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 4 Aug 2017 03:32:34 -0400 Subject: [PATCH 012/251] Add test cases for node discovery (mtm_based and switch_based) and bmc discovery --- .../testcase/discovery/bmc_discovery_only | 6 + .../testcase/discovery/discovery_test | 833 ++++++++++++++++++ .../discovery/mtm_based_node_discovery | 6 + .../discovery/switch_based_node_discovery | 6 + 4 files changed, 851 insertions(+) create mode 100644 xCAT-test/autotest/testcase/discovery/bmc_discovery_only create mode 100755 xCAT-test/autotest/testcase/discovery/discovery_test create mode 100644 xCAT-test/autotest/testcase/discovery/mtm_based_node_discovery create mode 100644 xCAT-test/autotest/testcase/discovery/switch_based_node_discovery diff --git a/xCAT-test/autotest/testcase/discovery/bmc_discovery_only b/xCAT-test/autotest/testcase/discovery/bmc_discovery_only new file mode 100644 index 000000000..924547e7d --- /dev/null +++ b/xCAT-test/autotest/testcase/discovery/bmc_discovery_only @@ -0,0 +1,6 @@ +start:bmc_discovery_only +description: test the whole process of bmc discovery +Attribute: $$NODE_DISCOVERY_TARGET:The machine plan to be discovered. $$NODE_DISCOVERY_BMC_DYNAMIC_IP_RANGE :The valid dymanic ip range which has been configured in DHCP server and can offer service. +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/discovery/discovery_test --discovery_target_node $$NODE_DISCOVERY_TARGET --bmc_dynamic_ip_range $$NODE_DISCOVERY_BMC_DYNAMIC_IP_RANGE --bmc_discovery_only +check:rc==0 +end diff --git a/xCAT-test/autotest/testcase/discovery/discovery_test b/xCAT-test/autotest/testcase/discovery/discovery_test new file mode 100755 index 000000000..26f9cf42e --- /dev/null +++ b/xCAT-test/autotest/testcase/discovery/discovery_test @@ -0,0 +1,833 @@ +#!/usr/bin/env perl +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +use strict; +use warnings; +use Getopt::Long; +use Data::Dumper; +use Time::Local; +use File::Basename; +use File::Path; + + +#--------------command line attrbutes-------------- +my $needhelp = 0; +my $discovery_mode = undef; +my $discovery_target_node = undef; +my $bmc_dynamic_ip_range = undef; + +#my $node_dynamic_ip_range = undef; +my $bmc_target_mac = undef; +my $osimage = undef; +my $bmc_discovery_only = 0; + +#--------------global attributes---------------- +my $prpgram_path = dirname(File::Spec->rel2abs(__FILE__)); +my $program_name = basename($0); +my $rst = 0; +my @error = (); + +#The structure of %discovery_target_node_info +# $discovery_target_node_info{nodename} +# $discovery_target_node_info{bmc} +# $discovery_target_node_info{ip} +# $discovery_target_node_info{mtm} +# $discovery_target_node_info{serial} +# $discovery_target_node_info{switch} +# $discovery_target_node_info{switchport} +my %discovery_target_node_info; + +my @expected_bmc_node_name; +my @origin_bmc_definition; +my $be_discovered_bmc_node; + + +my $discovery_prodefine_node_name_in_automation = "discovery_prodefine_node_name_in_automation"; + +my @expected_attrs_for_bmc_discovery = ("mtm", "serial", "bmcusername", "bmcpassword", "bmc"); +my @expected_attrs_for_mtms_based_node_discovery = ("ip", "bmc", "mtm", "serial", "mgt", "cons", "netboot", "mac", "bmcusername", "bmcpassword"); +my @expected_attrs_for_switch_based_node_discovery = ("ip", "bmc", "mtm", "serial", "mgt", "cons", "netboot", "mac", "bmcusername", "bmcpassword", "switch", "switchport"); + +#----------------------usage-------------------- +$::USAGE = "Usage: +To get help: + $program_name -h + +To just test the process of bmc discovery + $program_name --discovery_target_node --bmc_dynamic_ip_range --bmc_discovery_only + +To test the whole process of mtms_based node discovery + $program_name --discovery_mode mtms --discovery_target_node --bmc_dynamic_ip_range --osimage + +To test the whole process of switch_based node discovery + $program_name --discovery_mode switch --discovery_target_node --bmc_dynamic_ip_range --osimage + +Options: + discovery_target_node: Required. The node planned to be discovered which must be definied in xcat DB ahead. + bmc_dynamic_ip_range: Required. A valid dymanic ip range which has been configured in DHCP server and can offer service before invoking $program_name. The format of ip range is x.y1-y2.n1-n2.m1-m2 + discovery_mode: The mode of discovery. Valid mode are mtms, switch. + osimage: The image used to deploy on target node. + bmc_discovery_only: Just test bmc discovery process, not test node discovery process. + +"; + + +#============================================================================================== +# main process +#============================================================================================== +if ( + !GetOptions("h" => \$needhelp, + "discovery_mode=s" => \$discovery_mode, + "discovery_target_node=s" => \$discovery_target_node, + "bmc_dynamic_ip_range=s" => \$bmc_dynamic_ip_range, + "osimage=s" => \$osimage, + "bmc_discovery_only" => \$bmc_discovery_only) + ) +{ + print "[ERROR] Invalid usage.\n$::USAGE"; + to_exit(1); +} + +if ($needhelp) +{ + print "$::USAGE\n"; + to_exit(0); +} + +unless(defined $discovery_target_node and defined $bmc_dynamic_ip_range){ + print "[ERROR] Missing option.\n$::USAGE"; + to_exit(1); +} + +if (defined $discovery_mode) +{ + unless ($discovery_mode eq "mtms" || $discovery_mode eq "switch") { + print "[ERROR] Invalid value of option 'discovery_mode'\n$::USAGE"; + to_exit(1); + } + + unless($osimage){ + print "[ERROR] Missing option osimage.\n$::USAGE"; + to_exit(1); + } +} + +$SIG{TERM} = $SIG{INT} = sub { + to_exit(1); +}; + +print "----------------Check the configuration of test case itself----------------\n"; +$rst = check_test_case_self_conf($discovery_mode, $discovery_target_node, \@error); +if ($rst) { + print "To Check the configration of test case itself......[Failed]\n"; + dump_error(\@error); + to_exit(1); +} else { + print "To Check the configration of test case itself......[pass]\n"; + print "The discovery mode is $discovery_mode\n" if ($discovery_mode); + print "The reference node is $discovery_target_node\n"; + my @output = runcmd("lsdef $discovery_target_node"); + print "$_\n" foreach (@output); + print "The reference bmc mac is $bmc_target_mac\n" if ($bmc_target_mac); + print "The bmc dynamic ip range is $bmc_dynamic_ip_range\n" if ($bmc_dynamic_ip_range); +} + +print "----------------To set up test environment for bmc discovery----------------\n"; +$rst = set_up_test_env_for_bmc_discovery(\@error); +if ($rst) { + print "To set up test environment......[Failed]\n"; + dump_error(\@error); + to_exit(1); +} else { + print "To set up test environment......[pass]\n"; + my $expected_bmc = join(" or ", @expected_bmc_node_name); + print "Expected bmc node generated after bmcdiscovery is $expected_bmc\n"; +} + +print "----------------To discover BMC of $discovery_target_node ----------------\n"; +$rst = bmc_discovery(\@error); +if ($rst) { + print "To discover BMC of $discovery_target_node......[Failed]\n"; + dump_error(\@error); + to_exit(1); +} else { + print "To discover BMC of $discovery_target_node......[pass]\n"; + print "The discovered BMC is $be_discovered_bmc_node\n"; + my @output = runcmd("lsdef $be_discovered_bmc_node"); + print "$_\n" foreach (@output); +} + +if ($bmc_discovery_only) { + to_exit(0); +} + +print "----------------To set up test environment for node discovery----------------\n"; +$rst = set_up_test_env_for_node_discovery(\@error); +if ($rst) { + print "To set up test environment......[Failed]\n"; + dump_error(\@error); + to_exit(1); +} else { + print "To set up test environment......[pass]\n"; + print "The predefine node used to be discovered is $discovery_prodefine_node_name_in_automation\n"; + my @output = runcmd("lsdef $discovery_prodefine_node_name_in_automation"); + print "$_\n" foreach (@output); +} + +print "----------------To discover node $discovery_target_node ----------------\n"; +$rst = node_discovery(\@error); +if ($rst) { + print "To discover node $discovery_prodefine_node_name_in_automation......[Failed]\n"; + dump_error(\@error); + to_exit(1); +} else { + print "To discover node $discovery_prodefine_node_name_in_automation......[pass]\n"; + print "The discovered node is $discovery_prodefine_node_name_in_automation\n"; + my @output = runcmd("lsdef $discovery_prodefine_node_name_in_automation"); + print "$_\n" foreach (@output); +} + +to_exit(0); + +#============================================================================================= +# sub functions +#============================================================================================== +#-------------------------------------------------------- +# Fuction name: check_test_case_self_conf +# Description: +# Atrributes: +# Retrun code: +#-------------------------------------------------------- +sub check_test_case_self_conf { + my $discovery_mode = shift; + my $target_node = shift; + my $error_ref = shift; + + @$error_ref = (); + $discovery_target_node_info{nodename} = $target_node; + my @output = runcmd("lsdef -l $target_node"); + if ($::RUNCMD_RC) { + push @$error_ref, "The reference node $target_node is not defined in xcat database"; + } else { + + #backup original node definition + foreach (@output) { + $discovery_target_node_info{$1} = $2 if ($_ =~ /\s*(\w+)=(.+)/); + } + + $discovery_target_node_info{mac} = lc($discovery_target_node_info{mac}) if ($discovery_target_node_info{mac}); + + my @missing_attrs; + if ($bmc_discovery_only) { + foreach (@expected_attrs_for_bmc_discovery) { + push @missing_attrs, $_ unless (defined($discovery_target_node_info{$_})); + } + } else { + if ($discovery_mode eq "mtms") { + foreach (@expected_attrs_for_mtms_based_node_discovery) { + push @missing_attrs, $_ unless (defined($discovery_target_node_info{$_})); + } + } elsif ($discovery_mode eq "switch") { + foreach (@expected_attrs_for_switch_based_node_discovery) { + push @missing_attrs, $_ unless (defined($discovery_target_node_info{$_})); + } + } + } + + if (@missing_attrs) { + my $missing_attrs_str = join(",", @missing_attrs); + push @$error_ref, "The reference node '$target_node' is missing '$missing_attrs_str' attribute"; + } + } + + if ((defined $discovery_mode) and ($discovery_mode eq "switch") and (defined $discovery_target_node_info{switch})) { + runcmd("lsdef $discovery_target_node_info{switch}"); + if ($::RUNCMD_RC) { + push @$error_ref, "There is not switch $discovery_target_node_info{switch} definition in current MN"; + } else { + my @output = runcmd("xcatprobe switch_macmap $discovery_target_node_info{switch}"); + if ($::RUNCMD_RC) { + push @$error_ref, "Switch $discovery_target_node_info{switch} can not be accessed"; + } + } + } + + if (defined $osimage) { + runcmd(" lsdef -t osimage $osimage"); + if ($::RUNCMD_RC) { + push @$error_ref, "There is not $osimage definition in current MN"; + } + } + + #To calculate BMC's mac + @output = runcmd("nmap -sn -n $discovery_target_node_info{bmc}"); + if (grep { /Note: Host seems down/i } @output) { + push @$error_ref, "bmc $discovery_target_node_info{bmc} host down"; + }else{ + my %bmcinfo = calculate_bmc_info("$discovery_target_node_info{bmc}"); + if(((defined $bmcinfo{serial}) and ($bmcinfo{serial} eq lc("$discovery_target_node_info{serial}"))) and ((defined $bmcinfo{mtm}) and ($bmcinfo{mtm} eq lc("$discovery_target_node_info{mtm}")))){ + foreach (@output){ + $bmc_target_mac=lc($1) if($_ =~ /MAC Address:\s*(\w+:\w+:\w+:\w+:\w+:\w+).+/); + } + }else{ + push @$error_ref, "The ip $discovery_target_node_info{bmc} corresponds to $bmcinfo{mtm}|$bmcinfo{serial}, not to expected $discovery_target_node_info{mtm}|$discovery_target_node_info{serial}"; + } + + unless(defined $bmc_target_mac){ + push @$error_ref, "Failed to calculate bmc's mac"; + } + } + + if (@$error_ref) { + return 1; + } else { + return 0; + } +} + +#-------------------------------------------------------- +# Fuction name: to_exit +# Description: +# Atrributes: +# Retrun code: +#-------------------------------------------------------- +sub to_exit { + my $exit_code = shift; + + my $cmd; + my @output; + + #delete predefine node used by test + @output = runcmd("lsdef $discovery_prodefine_node_name_in_automation"); + #print Dumper \@output; + unless ($::RUNCMD_RC) { + my @cmds = ("makedns -d $discovery_prodefine_node_name_in_automation", + "nodeset $discovery_prodefine_node_name_in_automation offline", + "makehosts -d $discovery_prodefine_node_name_in_automation", + "rmdef $discovery_prodefine_node_name_in_automation"); + runcmd("$_") foreach (@cmds); + } + + #to restore original environment + if (%discovery_target_node_info) { + my @output = runcmd("lsdef $discovery_target_node"); + if ($::RUNCMD_RC) { + $cmd = "chdef -t node -o $discovery_target_node "; + foreach (keys %discovery_target_node_info) { + next if ($_ eq "nodename"); + $cmd .= "$_='$discovery_target_node_info{$_}' "; + } + + #print "$cmd\n"; + runcmd("$cmd"); + runcmd("makehosts -a $discovery_target_node"); + } + } + + if (defined $be_discovered_bmc_node) { + runcmd("lsdef $be_discovered_bmc_node"); + unless ($::RUNCMD_RC) { + runcmd("rmdef $be_discovered_bmc_node"); + } + } + + if (@origin_bmc_definition) { + for (my $i = 0 ; $i <= $#origin_bmc_definition ; $i++) { + $cmd = "chdef -t node -o $origin_bmc_definition[$i]{bmcname} "; + foreach (keys %{ $origin_bmc_definition[$i] }) { + next if ($_ eq "bmcname"); + $cmd .= "$_='$origin_bmc_definition[$i]{$_}' "; + } + runcmd("$cmd"); + } + } + exit $exit_code; +} + +#-------------------------------------------------------- +# Fuction name: runcmd +# Description: +# Atrributes: +# Retrun code: +#-------------------------------------------------------- +sub runcmd { + my ($cmd) = @_; + my $rc = 0; + $::RUNCMD_RC = 0; + my $outref = []; + + @$outref = `$cmd 2>&1`; + if ($?) + { + $rc = $?; + $::RUNCMD_RC = $rc; + } + chomp(@$outref); + return @$outref; +} + + +#-------------------------------------------------------- +# Fuction name: dump_error +# Description: +# Atrributes: +# Retrun code: +#-------------------------------------------------------- +sub dump_error { + my $error_ref = shift; + foreach (@$error_ref) { + print "$_\n"; + } +} + +#-------------------------------------------------------- +# Fuction name: set_up_test_env_for_bmc_discovery +# Description: +# Atrributes: +# Retrun code: +#-------------------------------------------------------- +sub set_up_test_env_for_bmc_discovery { + my $error_ref = shift; + my @output; + + my $tmp_bmc_name; + if (defined $discovery_target_node_info{mtm} and defined $discovery_target_node_info{serial}) { + $tmp_bmc_name = lc("node-$discovery_target_node_info{mtm}-$discovery_target_node_info{serial}"); + push @expected_bmc_node_name, $tmp_bmc_name; + } + $tmp_bmc_name = lc("node-$bmc_target_mac"); + $tmp_bmc_name =~ s/://g; + push @expected_bmc_node_name, $tmp_bmc_name; + + for (my $i = 0 ; $i <= $#expected_bmc_node_name ; $i++) { + @output = runcmd("lsdef -l $expected_bmc_node_name[$i]"); + unless ($::RUNCMD_RC) { + $origin_bmc_definition[$i]{bmcname} = $expected_bmc_node_name[$i]; + foreach (@output) { + $origin_bmc_definition[$i]{$1} = $2 if ($_ =~ /\s*(\w+)=(.+)/); + } + print "To run rmdef $expected_bmc_node_name[$i]\n"; + runcmd("rmdef $expected_bmc_node_name[$i]"); + } + } + + #To clear up history + my @cmds = ("ipmitool-xcat -H $discovery_target_node_info{bmc} -U $discovery_target_node_info{bmcusername} -P $discovery_target_node_info{bmcpassword} chassis power off", +"ipmitool-xcat -H $discovery_target_node_info{bmc} -U $discovery_target_node_info{bmcusername} -P $discovery_target_node_info{bmcpassword} raw 0x32 0xBA 00 00", +"ipmitool-xcat -H $discovery_target_node_info{bmc} -U $discovery_target_node_info{bmcusername} -P $discovery_target_node_info{bmcpassword} raw 0x32 0x66"); + + foreach my $cmd (@cmds) { + print "To run '$cmd' ..."; + @output = runcmd("$cmd"); + if ($::RUNCMD_RC) { + print "[Failed]\n"; + dump_error(\@output); + return 1; + } else { + print "[Successful]\n"; + } + } + + return 0; +} + +#-------------------------------------------------------- +# Fuction name: set_up_test_env_node_discovery +# Description: +# Atrributes: +# Retrun code: +#-------------------------------------------------------- +sub set_up_test_env_for_node_discovery { + my $error_ref = shift; + my @output; + + #To clear up history and predefine node + my $predef_node_cmd = "chdef -t node -o $discovery_prodefine_node_name_in_automation "; + if ($discovery_mode eq "mtms") { + foreach (@expected_attrs_for_mtms_based_node_discovery) { + next if ($_ eq "mac"); + $predef_node_cmd .= "$_='$discovery_target_node_info{$_}' "; + } + $predef_node_cmd .= "bmcvlantag='$discovery_target_node_info{bmcvlantag}' " if ($discovery_target_node_info{bmcvlantag}); + } elsif ($discovery_mode eq "switch") { + foreach (@expected_attrs_for_switch_based_node_discovery) { + next if (($_ eq "mtm") or ($_ eq "serial") or ($_ eq "mac")); + $predef_node_cmd .= "$_='$discovery_target_node_info{$_}' "; + } + $predef_node_cmd .= "bmcvlantag='$discovery_target_node_info{bmcvlantag}' " if ($discovery_target_node_info{bmcvlantag}); + } + $predef_node_cmd .= "installnic=mac primarynic=mac groups=autotest"; + + my @cmds = ("makedns -d $discovery_target_node", + "nodeset $discovery_target_node offline", + "makehosts -d $discovery_target_node", + "rm -f /var/log/consoles/node-*", + "rmdef $discovery_target_node", + "rm -f /var/lib/dhcp/*", + "touch /var/lib/dhcpd/dhcpd.leases", + "systemctl restart dhcpd", + "$predef_node_cmd", + "makehosts -a $discovery_prodefine_node_name_in_automation", + "makedns $discovery_prodefine_node_name_in_automation"); + + foreach my $cmd (@cmds) { + print "To run '$cmd'.."; + @output = runcmd("$cmd"); + if ($::RUNCMD_RC) { + print "failed\n"; + dump_error(\@output); + return 1; + } else { + print "successful\n"; + } + } + + return 0; +} + +#-------------------------------------------------------- +# Fuction name: bmc_discovery +# Description: +# Atrributes: +# Retrun code: +#-------------------------------------------------------- +sub bmc_discovery { + my $error_ref = shift; + + print "Waiting for the BMC to get dynamic ip....\n"; + + my @candidate_ips = parse_dynamic_ip_range($bmc_dynamic_ip_range); + my $bmc_dynamic_ip = undef; + for (my $i = 0 ; $i < 30 ; $i++) { + foreach (@candidate_ips) { + print "ping -c 1 $_\n"; + runcmd("ping -c 1 $_"); + unless ($::RUNCMD_RC) { + my @output = runcmd("arp $_ |awk -F' ' '/$_/{print \$3}'"); + print "The mac of ip $_ is $output[0]. The target bmc mac is $bmc_target_mac\n"; + unless ($::RUNCMD_RC) { + $output[0] = lc($output[0]); + if ($output[0] eq $bmc_target_mac) { + + #print "bmc got dynamic ip is $_\n"; + $bmc_dynamic_ip = $_; + last; + } + } + } + } + last if (defined $bmc_dynamic_ip); + sleep 2; + } + + if (defined $bmc_dynamic_ip) { + print "BMC to get dynamic ip $bmc_dynamic_ip\n"; + } else { + print "BMC failed to get dynamic ip from $bmc_dynamic_ip_range in expected 1 minute\n"; + return 1; + } + + print "Starting to discover BMC.........\n"; + my $cmd = "bmcdiscover --range $bmc_dynamic_ip_range -z -w"; + my @output = runcmd("$cmd"); + + my %foundbmcs; + my $current_bmc; + foreach (@output) { + if ($_ =~ /^(node-.+):/) { + $current_bmc = $1; + $foundbmcs{$current_bmc}{objectname} = $1; + } elsif ($_ =~ /\s*(\w+)=(.+)/) { + $foundbmcs{$current_bmc}{$1} = $2; + } + } + + #print "Found bmcs:\n"; + #print Dumper \%foundbmcs; + if (%foundbmcs) { + foreach my $foundbmc (keys %foundbmcs) { + + if (defined $foundbmcs{$foundbmc}{mtm} and defined $foundbmcs{$foundbmc}{serial}) { + next unless (($foundbmcs{$foundbmc}{mtm} eq $discovery_target_node_info{mtm}) && ($foundbmcs{$foundbmc}{serial} eq $discovery_target_node_info{serial})); + + #discovered bmc node name should be node-mtm-serial if can obtain mtm and serial + my $tmp_bmc_name = lc("node-$foundbmcs{$foundbmc}{mtm}-$foundbmcs{$foundbmc}{serial}"); + if ($foundbmcs{$foundbmc}{objectname} ne $tmp_bmc_name) { + push @$error_ref, "Found mtm and serial attributes of bmc, but bmc node name is not composed by mtm and serial"; + return 1; + } + + if ($foundbmcs{$foundbmc}{objectname} ne $expected_bmc_node_name[0]) { + push @$error_ref, "The discovered bmc node's name $foundbmcs{$foundbmc}{objectname} dose not match the expected bmc node's name $expected_bmc_node_name[0]"; + return 1; + } + + $be_discovered_bmc_node = $expected_bmc_node_name[0]; + } else { + + #discovered bmc node name should be node-mac if can not obtain mtm and serial + if ($foundbmcs{$foundbmc}{objectname} !~ /^node-\w{12}$/) { + push @$error_ref, "No found mtm and serial attributes of bmc, should use mac address to generate bmc node name, but discovered bmc name is $foundbmcs{$foundbmc}{objectname}, not work as expect"; + return 1; + } + + if ($foundbmcs{$foundbmc}{objectname} ne $expected_bmc_node_name[1]) { + push @$error_ref, "The discovered bmc node name $foundbmcs{$foundbmc}{objectname} dose not match the expected bmc node name $expected_bmc_node_name[1]"; + return 1; + } + + $be_discovered_bmc_node = $expected_bmc_node_name[1]; + } + + if ($foundbmcs{$foundbmc}{bmc} ne $bmc_dynamic_ip) { + push @$error_ref, "The discovered bmc ip $foundbmcs{$foundbmc}{bmc} dose not match the expected bmc ip $bmc_dynamic_ip"; + return 1; + } + } + } else { + push @$error_ref, "bmcdiscover command did not find target bmc of $discovery_mode"; + return 1; + } + + return 0; +} + + +#-------------------------------------------------------- +# Fuction name: node_discovery +# Description: +# Atrributes: +# Retrun code: +#-------------------------------------------------------- +sub node_discovery { + my $error_ref = shift; + my @output; + + print "Boot target node $discovery_target_node, start discovery process\n"; + my @cmds = ("rsetboot $be_discovered_bmc_node net", + "rpower $be_discovered_bmc_node boot"); + foreach my $cmd (@cmds) { + print "$cmd\n"; + @output = runcmd("$cmd"); + print "$_\n" foreach (@output); + if ($::RUNCMD_RC) { + push @$error_ref, "Boot target node $discovery_target_node failed"; + return 1; + } + } + + #suppose discovery process should get MAC address for predined node in 10 minuts + my $find_me_succ = 0; + my $mac_in_find_me; + for (my $i = 0 ; $i < 30 ; $i++) { + sleep 20; + @output = runcmd("lsdef $discovery_prodefine_node_name_in_automation |grep ' mac='"); + #print Dumper \@output; + if ($::RUNCMD_RC) { + print "$discovery_prodefine_node_name_in_automation has not get mac address, detect again after 20s\n"; + next; + } + $find_me_succ = 1; + my @tmp_array = split("=", $output[0]); + $mac_in_find_me = $tmp_array[1]; + last; + } + + unless ($find_me_succ) { + push @$error_ref, "$discovery_prodefine_node_name_in_automation failed to get mac address in expected 10 minutes\n"; + return 1; + } + + $mac_in_find_me = lc($mac_in_find_me); + if ($mac_in_find_me ne $discovery_target_node_info{mac}) { + push @$error_ref, "The mac $mac_in_find_me obtained by discovery does not match the expected mac $discovery_target_node_info{mac}"; + return 1; + } + + runcmd("lsdef $be_discovered_bmc_node"); + unless ($::RUNCMD_RC) { + push @$error_ref, "The temporary bmc node $be_discovered_bmc_node was not deleted after $discovery_target_node was discovered"; + return 1; + } + print "Predefined node $discovery_prodefine_node_name_in_automation has obtained correct mac address\n\n"; + + #-------------------------------------- + print "Start to test getadapter,bmcsetup,node provision. Add them into chain list\n"; + @cmds = ("chdef $discovery_prodefine_node_name_in_automation chain='runcmd=getadapter,runcmd=bmcsetup,osimage=$osimage'", + "lsdef $discovery_prodefine_node_name_in_automation -i chain"); + foreach my $cmd (@cmds) { + print "$cmd\n"; + @output = runcmd("$cmd"); + print "$_\n" foreach (@output); + if ($::RUNCMD_RC) { + push @$error_ref, "Add getadapter into chain failed"; + return 1; + } + } + + #suppose getadapter should return adapters information in 10 minutes + print "Waiting for doing getadapter on node $discovery_prodefine_node_name_in_automation\n"; + $find_me_succ = 0; + for (my $i = 0 ; $i < 60 ; $i++) { + sleep 10; + @output = runcmd("lsdef $discovery_prodefine_node_name_in_automation |grep nicsadapter"); + #print Dumper \@output; + if ($::RUNCMD_RC) { + print "$discovery_prodefine_node_name_in_automation has not get adapters info, detect again after 10s\n"; + next; + } + $find_me_succ = 1; + last; + } + unless ($find_me_succ) { + push @$error_ref, "getadapter failed to obtain adapter info in expected 10 minutes"; + return 1; + } + print "getadapter obtain below adapter infomation\n"; + print "$_\n" foreach (@output); + + if (!(grep { /$discovery_target_node_info{mac}/i } @output)) { + push @$error_ref, "The adapters information obtained by getadapter does not contain expected mac $discovery_target_node_info{mac}"; + return 1; + } + + print "getadapter works well\n\n"; + + #------------------------------------------ + #suppose bmcsetup should set bmc ip to a static ip in 10 minutes + print "Waiting for doing bmcsetup on node $discovery_prodefine_node_name_in_automation\n"; + $find_me_succ = 0; + for (my $i = 0 ; $i < 60 ; $i++) { + sleep 10; + print "ping -c 1 $discovery_target_node_info{bmc}\n"; + @output = runcmd("ping -c 1 $discovery_target_node_info{bmc}"); + if ($::RUNCMD_RC) { + print "$discovery_prodefine_node_name_in_automation 's bmc has not get static ip $discovery_target_node_info{bmc}, detect again after 10s\n"; + next; + } + $find_me_succ = 1; + last; + } + unless ($find_me_succ) { + push @$error_ref, "bmcsetup faield to set bmc 's ip to static ip $discovery_target_node_info{bmc} in expected 10 minutes"; + return 1; + } + + @output = runcmd("nmap -sn -n $discovery_target_node_info{bmc} |awk -F' ' '/MAC Address/ {print \$3}'"); + #print Dumper \@output; + if ($::RUNCMD_RC) { + push @$error_ref, "IP $discovery_target_node_info{bmc} is working but does not reply namp request"; + return 1; + } else { + $output[0] = lc($output[0]); + if ($output[0] ne $bmc_target_mac) { + push @$error_ref, "The mac which ip $discovery_target_node_info{bmc} is working on does not match $discovery_target_node bmc's mac"; + return 1; + } + } + + print "bmcsetup is successful\n\n"; + + #------------------------------------------ + #suppose provision should be finished in 60 minutes + print "Waiting for doing provision on node $discovery_prodefine_node_name_in_automation\n"; + $find_me_succ = 0; + sleep 300; + for (my $i = 0 ; $i < 360 ; $i++) { + sleep 10; + @output = runcmd("lsdef $discovery_prodefine_node_name_in_automation |grep booted"); + if ($::RUNCMD_RC) { + print "The status of $discovery_prodefine_node_name_in_automation has not become booted, detect again after 10s\n"; + next; + } + $find_me_succ = 1; + last; + } + unless ($find_me_succ) { + push @$error_ref, "$discovery_prodefine_node_name_in_automation did not finishe provision in expected 65 minutes"; + return 1; + } + + my $get_mn_info = 0; + @output = runcmd("xdsh $discovery_prodefine_node_name_in_automation 'cat /opt/xcat/xcatinfo'"); + if ($::RUNCMD_RC) { + push @$error_ref, "Failed to run xdsh against $discovery_prodefine_node_name_in_automation"; + return 1; + } else { + + #to check if cn was deployed by current MN + foreach (@output) { + if ($_ =~ /XCATSERVER=(.+)/) { + runcmd("ip addr |grep $1"); + if ($::RUNCMD_RC) { + push @$error_ref, "$discovery_prodefine_node_name_in_automation was deployed by $1, not current MN"; + return 1; + } + $get_mn_info = 1; + } + } + } + unless ($get_mn_info) { + push @$error_ref, "Failed to get currnet MN's information from $discovery_prodefine_node_name_in_automation"; + return 1; + } + print "Provision against $discovery_prodefine_node_name_in_automation is successful\n"; + return 0; +} + +#-------------------------------------------------------- +# Fuction name: parse_dynamic_ip_range +# Description: +# Atrributes: +# Retrun code: +#-------------------------------------------------------- +sub parse_dynamic_ip_range { + my $original_dynamic_ip_str = shift; + my @ips = (); + my @sec = split(/\./, $original_dynamic_ip_str); + for (my $i = 0 ; $i <= $#sec ; $i++) { + $sec[$i] = "{$1,$2}" if ($sec[$i] =~ /(\d+)-(\d+)/); + } + my $str = join(".", @sec); + my @output = runcmd("echo $str"); + return split(/ /, $output[0]); +} + +#-------------------------------------------------------- +# Fuction name: parse_dynamic_ip_range +# Description: +# Atrributes: +# Retrun code: +#-------------------------------------------------------- +sub calculate_bmc_info{ + my $bmcip = shift; + my %bmcinfo; + my @fru_num = (0, 2, 3); + foreach my $fru_cmd_num (@fru_num) { + my $fru_cmd = "ipmitool-xcat -I lanplus -U $discovery_target_node_info{bmcusername} -P $discovery_target_node_info{bmcpassword} " . + "\-H $bmcip fru print $fru_cmd_num"; + #print "$fru_cmd\n"; + my @fru_output_array =runcmd("$fru_cmd"); + if (($::RUNCMD_RC eq 0) && @fru_output_array) { + my $fru_output = join(" ", @fru_output_array); + + if (($fru_output =~ /Chassis Part Number\s*:\s*(\S*).*Chassis Serial\s*:\s*(\S*)/)) { + $bmcinfo{mtm} = lc($1); + $bmcinfo{serial} = lc($2); + last; + } + + if (($fru_output =~ /Product Part Number :\s*(\S*).*Product Serial :\s*(\S*)/)) { + $bmcinfo{mtm} = lc($1); + $bmcinfo{serial} = lc($2); + last; + } + + if (($fru_output =~ /Product Manufacturer\s+:\s+(.*?)\s+P.*?roduct Name\s+:\s+(.*?)\s+P.*?roduct Serial\s+:\s+(\S+)/)) { + $bmcinfo{mtm} = lc("$1:$2"); + $bmcinfo{serial} = lc($3); + last; + } + } + } + return %bmcinfo; +} diff --git a/xCAT-test/autotest/testcase/discovery/mtm_based_node_discovery b/xCAT-test/autotest/testcase/discovery/mtm_based_node_discovery new file mode 100644 index 000000000..80e28fa3c --- /dev/null +++ b/xCAT-test/autotest/testcase/discovery/mtm_based_node_discovery @@ -0,0 +1,6 @@ +start:mtms_based_node_discovery +description: test the whole process of mtms_based node discovery +Attribute: $$NODE_DISCOVERY_TARGET:The machine plan to be discovered. $$NODE_DISCOVERY_BMC_DYNAMIC_IP_RANGE :The valid dymanic ip range which has been configured in DHCP server and can offer service. +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/discovery/discovery_test --discovery_mode mtms --discovery_target_node $$NODE_DISCOVERY_TARGET --bmc_dynamic_ip_range $$NODE_DISCOVERY_BMC_DYNAMIC_IP_RANGE --osimage __GETNODEATTR($$NODE_DISCOVERY_TARGET,os)__-__GETNODEATTR($$NODE_DISCOVERY_TARGET,arch)__-install-compute +check:rc==0 +end diff --git a/xCAT-test/autotest/testcase/discovery/switch_based_node_discovery b/xCAT-test/autotest/testcase/discovery/switch_based_node_discovery new file mode 100644 index 000000000..092e33388 --- /dev/null +++ b/xCAT-test/autotest/testcase/discovery/switch_based_node_discovery @@ -0,0 +1,6 @@ +start:switch_based_node_discovery +description: test the whole process of switch_based node discovery +Attribute: $$NODE_DISCOVERY_TARGET:The machine plan to be discovered. $$NODE_DISCOVERY_BMC_DYNAMIC_IP_RANGE :The valid dymanic ip range which has been configured in DHCP server and can offer service. +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/discovery/discovery_test --discovery_mode switch --discovery_target_node $$NODE_DISCOVERY_TARGET --bmc_dynamic_ip_range $$NODE_DISCOVERY_BMC_DYNAMIC_IP_RANGE --osimage __GETNODEATTR($$NODE_DISCOVERY_TARGET,os)__-__GETNODEATTR($$NODE_DISCOVERY_TARGET,arch)__-install-compute +check:rc==0 +end From 11d613f2a4d069a97808f51e5fb2f5f46b122220 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 10 Aug 2017 04:23:29 -0400 Subject: [PATCH 013/251] update the format --- docs/source/overview/xcat2_release.rst | 72 ++++++++++++++------------ 1 file changed, 39 insertions(+), 33 deletions(-) diff --git a/docs/source/overview/xcat2_release.rst b/docs/source/overview/xcat2_release.rst index 5a5557db1..3eeee4299 100644 --- a/docs/source/overview/xcat2_release.rst +++ b/docs/source/overview/xcat2_release.rst @@ -14,60 +14,66 @@ xCAT 2.13.x |xCAT |New OS |New |New Feature | |Version | |Hardware | | +=================================+===============+=============+==================================+ -|| xCAT 2.13.6 |- RHEL 7.4 |-Boston |-OpenBMC support(Alpha level code)| +|| xCAT 2.13.6 |- RHEL 7.4 |-Boston |- OpenBMC support | || 2017/8/10 | | server | | || | | | rsetboot net/hd/def | | `2.13.6 Release Notes `_ | | | rspconfig retrieve OpenBCM ip/ | | | | | netmask/gateway information | -| | | |-nodeset performance enhancement | -| | | | (Phase 3) | +| | | |- nodeset performance enhancement | +| | | | (Phase 3) | | | | | | -| | | | Dispatch request to the specified| -| | | |service nodes with 'disjointdhcps'| -| | | | Enhance the output of nodeset in | -| | | |hierarchical cluster | +| | | | Dispatch request to the | +| | | | specified service nodes with | +| | | | 'disjointdhcps' | +| | | | Enhance the output of nodeset | +| | | | in hierarchical cluster | | | | | | -| | | |-network configuration interface: | -| | | | confignetwork is the only | -| | | |interface to configure network | -| | | |on SN/CN | +| | | |- network configuration interface:| | | | | | -| | | |-For hardware discovery | -| | | | enhance bmcdiscover to use BMC | -| | | |MAC address to identify BMC with | -| | | |its host | -| | | | enhance "xcatprobe discovery" | -| | | |tool to do configuration check | -| | | |before starting hardware discovery| +| | | | confignetwork is the only | +| | | | interface to configure network | +| | | | on SN/CN | | | | | | -| | | |-[xcat-deps] xcat-genesis-base | -| | | | package based on Fedora 26 ppc64 | +| | | |- For hardware discovery | +| | | | | +| | | | enhance bmcdiscover to use BMC | +| | | | MAC address to identify BMC with| +| | | | its host | +| | | | enhance "xcatprobe discovery" | +| | | | tool to do configuration check | +| | | | before starting hardware | +| | | | discovery | +| | | | | +| | | |- [xcat-deps] xcat-genesis-base | +| | | | package based on Fedora 26 ppc64| +---------------------------------+---------------+-------------+----------------------------------+ -|| xCAT 2.13.5 | | |-OpenBMC support(Alpha level code)| +|| xCAT 2.13.5 | | |- OpenBMC support | || 2017/6/30 | | | | || | | | rinv | | `2.13.5 Release Notes `_ | | |-Enhancements to self testing | -| | | | tool xcat-test | -| | | |-Service node pool support for | -| | | | rhels7 ppc64le diskless | -| | | |-Mellanox cumulus switch ZTP based| -| | | | discovery and auto-configuration | -| | | |-Performance enhancements | +| /XCAT_2.13.5_Release_Notes>`_ | | |- Enhancements to self testing | +| | | | tool xcat-test | +| | | |- Service node pool support for | +| | | | rhels7 ppc64le diskless | +| | | |- Mellanox cumulus switch ZTP | +| | | | based discovery and | +| | | | auto-configuration | +| | | |- Performance enhancements | | | | | | | | | | makedhcp, makedns | | | | | nodeset | -| | | |-[xcat-deps] ipmitool-xcat package| -| | | | updated to version 1.8.18 for | +| | | |- [xcat-deps] ipmitool-xcat | +| | | | package updated to version | +| | | | 1.8.18 for | | | | | | | | | | RHEL7.x | | | | | SLES12.x | | | | | Ubuntu14.04.x | -| | | |-[xcat-deps] conserver-xcat | -| | | | package updated to version 8.2.1 | +| | | |- [xcat-deps] conserver-xcat | +| | | | package updated to version 8.2.1| | | | | | +---------------------------------+---------------+-------------+----------------------------------+ || xCAT 2.13.4 |- RHV 4.1 | |- OpenBMC support(experimental): | From daa3442f3731c0077a3985251c4653d4713654f0 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 10 Aug 2017 04:33:00 -0400 Subject: [PATCH 014/251] update the format --- docs/source/overview/xcat2_release.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/source/overview/xcat2_release.rst b/docs/source/overview/xcat2_release.rst index 3eeee4299..c6f7266b1 100644 --- a/docs/source/overview/xcat2_release.rst +++ b/docs/source/overview/xcat2_release.rst @@ -17,9 +17,10 @@ xCAT 2.13.x || xCAT 2.13.6 |- RHEL 7.4 |-Boston |- OpenBMC support | || 2017/8/10 | | server | | || | | | rsetboot net/hd/def | -| `2.13.6 Release Notes `_ | | | rspconfig retrieve OpenBCM ip/ | +| `2.13.6 Release Notes `_ | | | /delete/check | +| | | | rspconfig retrieve OpenBCM ip/ | | | | | netmask/gateway information | | | | |- nodeset performance enhancement | | | | | (Phase 3) | From 3be7e88ac6c97f904b8a9d1df10efb68d87877e7 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 10 Aug 2017 04:36:04 -0400 Subject: [PATCH 015/251] update the format --- docs/source/overview/xcat2_release.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/source/overview/xcat2_release.rst b/docs/source/overview/xcat2_release.rst index c6f7266b1..7bec2cfde 100644 --- a/docs/source/overview/xcat2_release.rst +++ b/docs/source/overview/xcat2_release.rst @@ -20,6 +20,7 @@ xCAT 2.13.x | `2.13.6 Release Notes `_ | | | /delete/check | +| | | | | | | | | rspconfig retrieve OpenBCM ip/ | | | | | netmask/gateway information | | | | |- nodeset performance enhancement | @@ -27,7 +28,8 @@ xCAT 2.13.x | | | | | | | | | Dispatch request to the | | | | | specified service nodes with | -| | | | 'disjointdhcps' | +| | | | 'disjointdhcps' | +| | | | | | | | | Enhance the output of nodeset | | | | | in hierarchical cluster | | | | | | @@ -42,6 +44,7 @@ xCAT 2.13.x | | | | enhance bmcdiscover to use BMC | | | | | MAC address to identify BMC with| | | | | its host | +| | | | | | | | | enhance "xcatprobe discovery" | | | | | tool to do configuration check | | | | | before starting hardware | From edac803e86813dc85070c48552ee58b94ae13127 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 10 Aug 2017 04:37:14 -0400 Subject: [PATCH 016/251] update for xCAT 2.13.6 release --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 270e99067..9d1b248b3 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -59,7 +59,7 @@ author = u'IBM Corporation' # The short X.Y version. version = '2' # The full version, including alpha/beta/rc tags. -release = '2.12' +release = '2.13.6' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From 8ec52357bfd2bd372e9fded96536e4ca6cf2a1a5 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 10 Aug 2017 06:27:25 -0400 Subject: [PATCH 017/251] Update version to 2.13.7 --- Version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Version b/Version index 14239ef15..ea55a03fa 100644 --- a/Version +++ b/Version @@ -1 +1 @@ -2.13.6 +2.13.7 From 0b29b4629a8b249446cb5c75bdf9e2d5b6aa51f4 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 10 Aug 2017 08:35:44 -0400 Subject: [PATCH 018/251] incorrect petitboot configuration for nodeset shell in flat #3548 --- xCAT-test/autotest/testcase/genesis/cases0 | 15 ++-- xCAT-test/autotest/testcase/genesis/test.sh | 81 +++++++++++++++++++++ 2 files changed, 86 insertions(+), 10 deletions(-) create mode 100755 xCAT-test/autotest/testcase/genesis/test.sh diff --git a/xCAT-test/autotest/testcase/genesis/cases0 b/xCAT-test/autotest/testcase/genesis/cases0 index 64085644b..d0994215a 100644 --- a/xCAT-test/autotest/testcase/genesis/cases0 +++ b/xCAT-test/autotest/testcase/genesis/cases0 @@ -30,19 +30,14 @@ cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n check:rc==0 cmd:cat /tmp/genesistestlog/* end - start:nodeset_shell_incorrectmasterip description:very if computenode need to do nodeset shell in different net with master will success -cmd:chdef testnode arch=ppc64le cons=ipmi groups=all ip=60.1.1.1 netboot=petitboot -cmd:masterip=`lsdef -t site -i master -c 2>&1 | awk -F'=' '{print \$2}'`;echo $masterip;masternet=`ifconfig |awk "BEGIN{RS=\"\"}/\<$masterip\>/{print \$1}"|head -n 1 | awk -F ":" '{print \$1}'`;echo $masternet;net2=` netstat -i |grep -v Kernel|grep -v Iface |grep -v lo|grep -v $masternet|head -n 1|awk '{print \$1}'`;echo $net2;net2ip=`ifconfig $net2 |grep inet|grep -v inet6`;ifconfig $net2 60.3.3.3 ;makenetworks;makehosts;nodeset testnode shell;cat /tftpboot/petitboot/testnode |grep "xcatd=60.3.3.3:3001 destiny=shell";if [[ $? -eq 0 ]] ;then if [[ -z $net2ip ]];then ifconfig $net2 0.0.0.0;exit 0;else ifconfig $net2 $net2ip;exit 0;fi ;else exit 1;fi +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/genesis/test.sh -cd xnba check:rc==0 -cmd:chdef testnode arch=x86_64 netboot=xnba -cmd:masterip=`lsdef -t site -i master -c 2>&1 | awk -F'=' '{print \$2}'`;echo $masterip;masternet=`ifconfig |awk "BEGIN{RS=\"\"}/\<$masterip\>/{print \$1}"|head -n 1 | awk -F ":" '{print \$1}'`;echo $masternet;net2=` netstat -i |grep -v Kernel|grep -v Iface |grep -v lo|grep -v $masternet|head -n 1|awk '{print \$1}'`;echo $net2;net2ip=`ifconfig $net2 |grep inet|grep -v inet6`;ifconfig $net2 60.3.3.3 ;makenetworks;makehosts;nodeset testnode shell;cat /tftpboot/xcat/xnba/nodes/testnode |grep "xcatd=60.3.3.3:3001 destiny=shell";if [[ $? -eq 0 ]] ;then if [[ -z $net2ip ]];then ifconfig $net2 0.0.0.0;exit 0;else ifconfig $net2 $net2ip;exit 0;fi ;else exit 1;fi +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/genesis/test.sh -cd grub2 check:rc==0 -cmd:chdef testnode arch=x86_64 netboot=grub2 -cmd:masterip=`lsdef -t site -i master -c 2>&1 | awk -F'=' '{print \$2}'`;echo $masterip;masternet=`ifconfig |awk "BEGIN{RS=\"\"}/\<$masterip\>/{print \$1}"|head -n 1 | awk -F ":" '{print \$1}'`;echo $masternet;net2=` netstat -i |grep -v Kernel|grep -v Iface |grep -v lo|grep -v $masternet|head -n 1|awk '{print \$1}'`;echo $net2;net2ip=`ifconfig $net2 |grep inet|grep -v inet6`;ifconfig $net2 60.3.3.3 ;makenetworks;makehosts;nodeset testnode shell; cat /tftpboot/boot/grub2/testnode |grep "xcatd=60.3.3.3:3001 destiny=shell";if [[ $? -eq 0 ]] ;then if [[ -z $net2ip ]];then ifconfig $net2 0.0.0.0;exit 0;else ifconfig $net2 $net2ip;exit 0;fi ;else exit 1;fi +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/genesis/test.sh -cd petitboot +check:rc==0 +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/genesis/test.sh -c check:rc==0 -cmd:makehosts -d testnode -cmd:rmdef testnode -cmd:rmdef -t network 60_0_0_0-255_0_0_0 end diff --git a/xCAT-test/autotest/testcase/genesis/test.sh b/xCAT-test/autotest/testcase/genesis/test.sh new file mode 100755 index 000000000..9741f4a11 --- /dev/null +++ b/xCAT-test/autotest/testcase/genesis/test.sh @@ -0,0 +1,81 @@ +#!/bin/bash +function check_destiny(){ +chdef testnode arch=ppc64le cons=ipmi groups=all ip=60.1.1.1 netboot=$NETBOOT; +masterip=`lsdef -t site -i master -c 2>&1 | awk -F'=' '{print $2}'`; +masternet=`ifconfig | awk "BEGIN{RS=\"\"}/\<$masterip\>/{print \$1}"|head -n 1 | awk -F ' ' '{print $1}'|awk -F ":" '{print \$1}' 2>&1`; +net2=`netstat -i -a|grep -v Kernel|grep -v Iface |grep -v lo|grep -v $masternet|head -n 1|awk '{print $1}'`;echo net2 is $net2; +net2ip=""; + if [[ -z $net2 ]];then + echo null + return 1; + else + net2ipstring=`ifconfig $net2 |grep inet|grep -v inet6`; + if [[ $? -eq 0 ]];then + net2ip=`ifconfig $net2 |grep inet|grep -v inet6|awk -F ' ' '{print $2}'|awk -F ":" '{print $2}'`; + if [[ -z $net2ip ]];then + net2ip=`ifconfig $net2 |grep inet|grep -v inet6|awk -F ' ' '{print $2}'`; + fi + else + net2ip=0.0.0.0; + fi + ifconfig $net2 60.3.3.3 ; + makenetworks; + makehosts testnode; + nodeset testnode shell; + ifconfig $net2 "$net2ip"; + cat "$SHELLFOLDER"testnode |grep "xcatd=60.3.3.3:3001 destiny=shell"; + if [[ $? -eq 0 ]] ;then + return 0; + else + echo wrong; + return 1; + fi + fi +} +function clear_env(){ +makehosts -d testnode +rmdef testnode +rmdef -t network 60_0_0_0-255_0_0_0 + if [[ $? -eq 0 ]];then + return 0; + else + return 1; + fi +} +NETBOOT="" +SHELLFOLDER="" +while [ "$#" -gt "0" ] +do + case $1 in + "-cd"|"--check" ) + NETBOOT=$2; + if [[ $NETBOOT =~ petitboot ]];then + SHELLFOLDER="/tftpboot/petitboot/"; + elif [[ $NETBOOT =~ xnba ]];then + SHELLFOLDER="/tftpboot/xcat/xnba/nodes/" + else + SHELLFOLDER="/tftpboot/boot/grub2/"; + fi + check_destiny ; + if [[ $? -eq 1 ]];then + exit 1 + else + exit 0 + fi + ;; + "-c"|"--clear" ) + clear_env; + if [[ $? -eq 1 ]];then + exit 1 + else + exit 0 + fi + ;; + *) + echo + echo "Please Insert $0: -cd|-c" + echo + exit 1; + ;; + esac +done From d8600c25c117ee26a579eab3f9ac059d24148c6e Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 10 Aug 2017 11:08:41 -0400 Subject: [PATCH 019/251] Modify the comments --- xCAT-server/share/xcat/cons/openbmc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/cons/openbmc b/xCAT-server/share/xcat/cons/openbmc index 2bda67133..52160df8e 100755 --- a/xCAT-server/share/xcat/cons/openbmc +++ b/xCAT-server/share/xcat/cons/openbmc @@ -91,10 +91,13 @@ if ($ENV{SSHCONSOLEPORT}) { $sshport= $ENV{SSHCONSOLEPORT}; } -#user needs to download sshpass rpm if need to use it +# To automatically connect to the console without the need to send over the ssh keys, +# ensure sshpass is installed on the Management and/or Service Nodes. if (-x '/usr/bin/sshpass') { exec "/usr/bin/sshpass -p $password ssh -p $sshport -l $username $bmcip"; } else { + # This will prompt the user to enter the password for the BMC + # if ssh keys are not sent and sshpass is not being used exec "ssh -p $sshport -l $username $bmcip"; } From 6210f197dce479872e9775b0f2c9737fd1c7580d Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 10 Aug 2017 14:51:43 -0400 Subject: [PATCH 020/251] Adding some packages that would help debug issues on the service nodes --- .../share/xcat/install/rh/service.rhels7.ppc64le.pkglist | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-server/share/xcat/install/rh/service.rhels7.ppc64le.pkglist b/xCAT-server/share/xcat/install/rh/service.rhels7.ppc64le.pkglist index 681455dfb..ddae9074b 100644 --- a/xCAT-server/share/xcat/install/rh/service.rhels7.ppc64le.pkglist +++ b/xCAT-server/share/xcat/install/rh/service.rhels7.ppc64le.pkglist @@ -34,3 +34,6 @@ perl-DBD-Pg wget util-linux-ng net-tools +pciutils +bind-utils +tcpdump From fa0799c4c42f43ddaf3a3b149c63eadf2d6ef4ba Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 10 Aug 2017 15:16:15 -0400 Subject: [PATCH 021/251] With PR #3525 (4d54889a36b580bd6aba851037625febe24609b2) MAC address is used so this workaround is no longer needed --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 5f61b6726..0e754539c 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -125,14 +125,6 @@ sub process_request my $request_command = shift; $::CALLBACK = $callback; - #$::args = $request->{arg}; - if (ref($request->{environment}) eq 'ARRAY' and ref($request->{environment}->[0]->{XCAT_DEV_WITHERSPOON}) eq 'ARRAY') { - $::XCAT_DEV_WITHERSPOON = $request->{environment}->[0]->{XCAT_DEV_WITHERSPOON}->[0]; - } elsif (ref($request->{environment}) eq 'ARRAY') { - $::XCAT_DEV_WITHERSPOON = $request->{environment}->[0]->{XCAT_DEV_WITHERSPOON}; - } else { - $::XCAT_DEV_WITHERSPOON = $request->{environment}->{XCAT_DEV_WITHERSPOON}; - } if ($request->{sn}) { my $dhcpservers = $request->{dhcpservers}; if (!defined($dhcpservers) or ref($dhcpservers) ne 'ARRAY') { @@ -1182,10 +1174,6 @@ sub bmcdiscovery_openbmc{ if (defined($response->{data})) { if (defined($response->{data}->{PartNumber}) and defined($response->{data}->{SerialNumber})) { $mtm = $response->{data}->{PartNumber}; - if (defined($::XCAT_DEV_WITHERSPOON) && ($::XCAT_DEV_WITHERSPOON eq "TRUE")) { - xCAT::MsgUtils->message("I", { data => ["XCAT_DEV_WITHERSPOON=TRUE, forcing MTM to empty string for $ip (Original MTM=$mtm)"] }, $::CALLBACK); - $mtm = ""; - } $serial = $response->{data}->{SerialNumber}; } From deb6d6f02b276ba52b278715e4795dcccb5e2a35 Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 25 Jul 2017 01:33:10 -0400 Subject: [PATCH 022/251] expose reventlog and modify time format --- xCAT-server/lib/xcat/plugins/openbmc.pm | 42 ++++++++++++++----------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 229555314..fddc82c03 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -135,8 +135,8 @@ my %status_info = ( }, REVENTLOG_CLEAR_REQUEST => { method => "POST", - init_url => "$openbmc_url/records/events/action/clear", - data => "", + init_url => "$openbmc_project_url/logging//action/delete", + data => '{ "data": [] }', }, REVENTLOG_CLEAR_RESPONSE => { process => \&reventlog_response, @@ -513,10 +513,6 @@ sub parse_args { return ([ 1, "Unsupported command: $command $subcommand" ]); } } elsif ($command eq "reventlog") { - # - # disable function until fully tested - # - $check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; } my $option_s = 0; unless (GetOptions("s" => \$option_s,)) { return ([1, "Error parsing arguments." ]); @@ -1444,7 +1440,7 @@ sub reventlog_response { } else { my ($entry_string, $option_s) = split(",", $status_info{REVENTLOG_RESPONSE}{argv}); my $content_info; - my %output_s = () if ($option_s); + my %output = (); my $entry_num = 0; $entry_string = "all" if ($entry_string eq "0"); $entry_num = 0 + $entry_string if ($entry_string ne "all"); @@ -1452,21 +1448,29 @@ sub reventlog_response { foreach my $key_url (keys %{$response_info->{data}}) { my %content = %{ ${ $response_info->{data} }{$key_url} }; my $id_num = 0 + $content{Id} if ($content{Id}); - if (($entry_string eq "all" or ($id_num and ($entry_num ge $id_num))) and $content{Message}) { - my $content_info = $content{Timestamp} . " " . $content{Message}; - if ($option_s) { - $output_s{$id_num} = $content_info; - $entry_num = $id_num if ($entry_num < $id_num); - } else { - xCAT::SvrUtils::sendmsg("$content_info", $callback, $node); - } + if ($content{Message}) { + my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($content{Timestamp}/1000); + $mon += 1; + $year += 1900; + my $UTC_time = sprintf ("%02d/%02d/%04d %02d:%02d:%02d", $mon, $mday, $year, $hour, $min, $sec); + my $content_info = "Entry $content{Id}:" . $UTC_time . " " . $content{Message}; + $output{$id_num} = $content_info; } } - if (%output_s) { - for (my $key = $entry_num; $key >= 1; $key--) { - xCAT::SvrUtils::sendmsg("$output_s{$key}", $callback, $node) if ($output_s{$key}); - } + my $count = 0; + if ($option_s) { + foreach my $key ( sort { $b <=> $a } keys %output) { + xCAT::SvrUtils::sendmsg($output{$key}, $callback, $node); + $count++; + last if ($entry_string ne "all" and $count >= $entry_num); + } + } else { + foreach my $key (keys %output) { + xCAT::SvrUtils::sendmsg("$output{$key}", $callback, $node) if ($output{$key}); + $count++; + last if ($entry_string ne "all" and $count >= $entry_num); + } } } From 7afbaaded1e38825d81198bdfad5616fbb093690 Mon Sep 17 00:00:00 2001 From: bybai Date: Fri, 11 Aug 2017 02:42:12 -0400 Subject: [PATCH 023/251] enhance netname/net/mask duplicate or invalid --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 90 +++++++++++++++++++- xCAT-server/lib/xcat/plugins/networks.pm | 15 +++- 2 files changed, 101 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index 5fd00c2e8..416251f44 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -1693,7 +1693,6 @@ sub defmk { my $type = $::FINALATTRS{$obj}{objtype}; - # check to make sure we have type if (!$type) { @@ -1714,10 +1713,30 @@ sub defmk my @nets = xCAT::DBobjUtils->getObjectsOfType('network'); my %objhash; foreach my $n (@nets) { + # netname is duplicate + if ( $obj eq $n ) { + my $rsp; + $rsp->{data}->[0] = "A network definition called \'$n\' already exists. Cannot create a definition for \'$obj\'."; + xCAT::MsgUtils->message("E", $rsp, $::callback); + $error = 1; + delete $::FINALATTRS{$obj}; + next OBJ; + } $objhash{$n} = $type; } + # When adding a new network entry, net and mask cannot be empty + if (!($::FINALATTRS{$obj}{net} && $::FINALATTRS{$obj}{mask})) + { + my $rsp; + $rsp->{data}->[0] = "Net or mask value should not be empty for xCAT network object \'$obj\'."; + xCAT::MsgUtils->message("E", $rsp, $::callback); + $error = 1; + delete $::FINALATTRS{$obj}; + next OBJ; + } my %nethash = xCAT::DBobjUtils->getobjdefs(\%objhash); foreach my $o (keys %nethash) { + # there is a network entry contains the same net and mask if (($nethash{$o}{net} eq $::FINALATTRS{$obj}{net}) && ($nethash{$o}{mask} eq $::FINALATTRS{$obj}{mask})) { my $rsp; $rsp->{data}->[0] = "A network definition called \'$o\' already exists that contains the same net and mask values. Cannot create a definition for \'$obj\'."; @@ -1727,6 +1746,7 @@ sub defmk next OBJ; } } + } # if object already exists @@ -2370,6 +2390,74 @@ sub defch $isDefined = 1; } + if ($type eq 'network') + { + my $isInvalid = 0; + # When adding a new network entry, net and mask cannot be empty + if (!$isDefined && !($::FINALATTRS{$obj}{'net'} && $::FINALATTRS{$obj}{'mask'})) + { + my $rsp; + $rsp->{data}->[0] = "Net or mask value should not be empty for xCAT network object \'$obj\'."; + xCAT::MsgUtils->message("E", $rsp, $::callback); + $error = 1; + $isInvalid = 1; + delete($::FINALATTRS{$obj}); + next; + } + my @nets = xCAT::DBobjUtils->getObjectsOfType('network'); + my %objhash; + foreach my $n (@nets) { + $objhash{$n} = $type; + } + # get original networks data + my %nethash = xCAT::DBobjUtils->getobjdefs(\%objhash); + foreach my $o (keys %nethash) { + # the netname already exists + if ($isDefined) + { + # when net is empty, chdef command should add net value, $::FINALATTRS{$obj}{net} should have value + if ((!$nethash{$o}{net}) && (!$::FINALATTRS{$obj}{net})) + { + $isInvalid=1; + my $rsp; + $rsp->{data}->[0] = "Attribute \'net\' is not specified for network entry \'$obj\', skipping."; + xCAT::MsgUtils->message("E", $rsp, $::callback); + $error = 1; + last; + } + # when mask is empty, chdef command should add mask value, $::FINALATTRS{$obj}{mask} should have value + if ((!$nethash{$o}{mask}) && (!$::FINALATTRS{$obj}{mask})) + { + $isInvalid=1; + my $rsp; + $rsp->{data}->[0] = "Attribute \'mask\' is not specified for network entry \'$obj\', skipping."; + xCAT::MsgUtils->message("E", $rsp, $::callback); + $error = 1; + last; + } + } + # the netname does not exist + else { + # there is a network definition already contains the same net and mask, it is duplicate + if (($nethash{$o}{net} eq $::FINALATTRS{$obj}{net}) && ($nethash{$o}{mask} eq $::FINALATTRS{$obj}{mask})) + { + $isInvalid=1; + my $rsp; + $rsp->{data}->[0] = "A network definition called \'$o\' already exists that contains the same net and mask values. Cannot create a definition for \'$obj\'."; + xCAT::MsgUtils->message("E", $rsp, $::callback); + $error = 1; + last; + } + + } + + } + if($isInvalid) + { + delete($::FINALATTRS{$obj}); + next; + } + } if (!$isDefined && ($type eq 'node') && (!defined($::FINALATTRS{$obj}{'groups'}) || !$::FINALATTRS{$obj}{'groups'})) { my $rsp; diff --git a/xCAT-server/lib/xcat/plugins/networks.pm b/xCAT-server/lib/xcat/plugins/networks.pm index cbbea2188..01c24af7b 100644 --- a/xCAT-server/lib/xcat/plugins/networks.pm +++ b/xCAT-server/lib/xcat/plugins/networks.pm @@ -325,7 +325,6 @@ sub donets # - compare net and mask values my $foundmatch = 0; foreach my $netn (@netlist) { - # split definition mask my ($dm1, $dm2, $dm3, $dm4) = split('\.', $nethash{$netn}{'mask'}); @@ -359,7 +358,7 @@ sub donets if ($foundmatch) { next; } - + # add new network def $nettab->setAttribs({ 'net' => $net, 'mask' => $netmask }, { 'netname' => $netname, 'gateway' => $gateway, 'mgtifname' => $i }); } @@ -450,6 +449,7 @@ sub donets { #should be the lines to think about, do something with U, and something else with UG my $foundmatch = 0; + my $netnamematch = 0; my $rsp; my $net; my $mask; @@ -504,7 +504,12 @@ sub donets my ($n1, $n2, $n3, $n4) = split('\.', $net); foreach my $netn (@netlist) { - + # check if this netname is already defined + if ( $netname eq $netn ) { + $netnamematch = 1; + $callback->({ warning => "The network entry \'$netname\' already exists in xCAT networks table. Cannot create a definition for \'$netname\'" }); + last; + } # split definition mask my ($dm1, $dm2, $dm3, $dm4) = split('\.', $nethash{$netn}{'mask'}); @@ -519,6 +524,10 @@ sub donets } } + # if this net entry exists, go to next line in networks table + if ($netnamematch) { + last; + } # get mtu value my $mtu; my @rowm; From 6e16bd9f27f0d530a09291762a6fc30bf1205d7d Mon Sep 17 00:00:00 2001 From: bybai Date: Fri, 11 Aug 2017 04:14:42 -0400 Subject: [PATCH 024/251] fix CI failure --- xCAT-server/lib/xcat/plugins/networks.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/networks.pm b/xCAT-server/lib/xcat/plugins/networks.pm index 01c24af7b..d4db7d8a4 100644 --- a/xCAT-server/lib/xcat/plugins/networks.pm +++ b/xCAT-server/lib/xcat/plugins/networks.pm @@ -507,7 +507,6 @@ sub donets # check if this netname is already defined if ( $netname eq $netn ) { $netnamematch = 1; - $callback->({ warning => "The network entry \'$netname\' already exists in xCAT networks table. Cannot create a definition for \'$netname\'" }); last; } # split definition mask @@ -524,10 +523,6 @@ sub donets } } - # if this net entry exists, go to next line in networks table - if ($netnamematch) { - last; - } # get mtu value my $mtu; my @rowm; @@ -553,6 +548,11 @@ sub donets push @{ $rsp->{data} }, " mtu=$mtu"; } } else { + # if this net entry exists, go to next line in networks table + if ($netnamematch) { + $callback->({ warning => "The network entry \'$netname\' already exists in xCAT networks table. Cannot create a definition for \'$netname\'" }); + last; + } if (!$foundmatch) { $nettab->setAttribs({ 'net' => $net, 'mask' => $mask }, { 'netname' => $netname, 'mgtifname' => $mgtifname, 'gateway' => $gw, 'mtu' => $mtu }); } From 3c8f16b4c84084840b296df93e9c5b424daa3ff6 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Fri, 11 Aug 2017 16:12:51 +0800 Subject: [PATCH 025/251] Add a test case against confignetwork --- .../autotest/testcase/confignetwork/cases0 | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/xCAT-test/autotest/testcase/confignetwork/cases0 b/xCAT-test/autotest/testcase/confignetwork/cases0 index f0a21ea0e..535bd9245 100644 --- a/xCAT-test/autotest/testcase/confignetwork/cases0 +++ b/xCAT-test/autotest/testcase/confignetwork/cases0 @@ -936,3 +936,23 @@ check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi cmd:xdsh $$CN "rm -rf /tmp/backupnet/ /tmp/interfaces" end + +start:confignetwork_static_installnic +description:Reconfigure installnic without dhclient lease file +cmd:lsdef $$CN -z && lsdef -l $$CN -z >/tmp/CN.stanza +check:rc==0 +cmd:xdsh $$CN "mkdir -p /tmp/backupnet" +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:xdsh $$CN 'rm -f /var/lib/dhcp/dhclient.leases /var/lib/dhclient/dhclient.leases' +check:rc==0 +cmd:updatenode $$CN 'confignetwork -s' +check:rc==0 +cmd:xdsh $$CN date +check:rc==0 +# Clean up +cmd:test -e /tmp/CN.stanza && rmdef $$CN && mkdef -z Date: Fri, 11 Aug 2017 22:53:02 -0400 Subject: [PATCH 026/251] Adding strace to the pkglist for service nodes --- xCAT-server/share/xcat/install/rh/service.rhels7.ppc64le.pkglist | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-server/share/xcat/install/rh/service.rhels7.ppc64le.pkglist b/xCAT-server/share/xcat/install/rh/service.rhels7.ppc64le.pkglist index ddae9074b..9c169c658 100644 --- a/xCAT-server/share/xcat/install/rh/service.rhels7.ppc64le.pkglist +++ b/xCAT-server/share/xcat/install/rh/service.rhels7.ppc64le.pkglist @@ -36,4 +36,5 @@ util-linux-ng net-tools pciutils bind-utils +strace tcpdump From b70dd0d401e23326293bdebde79da689c53e715d Mon Sep 17 00:00:00 2001 From: bnordgren Date: Sat, 12 Aug 2017 15:10:51 -0600 Subject: [PATCH 027/251] Cannot chdef something before it is created. --- .../ppc64le/discovery/mtms/discovery_using_defined.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/mtms/discovery_using_defined.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/mtms/discovery_using_defined.rst index d69d5d706..f12aa1354 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/mtms/discovery_using_defined.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/mtms/discovery_using_defined.rst @@ -93,6 +93,9 @@ The BMC IP address is obtained by the open range dhcp server and the plan in thi serial=10112CA ip=10.1.2.1 +#. Define the compute nodes into xCAT: :: + + cat predefined.stanzas | mkdef -z #. Set the chain table to run the ``bmcsetup`` script, this will set the BMC IP to static. :: @@ -110,9 +113,6 @@ The BMC IP address is obtained by the open range dhcp server and the plan in thi chdef cn01 bmc=172.20.2.1 -#. Define the compute nodes into xCAT: :: - - cat predefined.stanzas | mkdef -z #. Add the compute node IP information to ``/etc/hosts``: :: From 55c15023aa5a1b6e2323f796a2e56a9efbb6cf66 Mon Sep 17 00:00:00 2001 From: XuWei Date: Sun, 13 Aug 2017 21:59:38 -0400 Subject: [PATCH 028/251] fix issue 3668, make rsetboot node do rsetboot stat --- xCAT-server/lib/xcat/plugins/openbmc.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 00ffa21dc..cec5c83c0 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -651,7 +651,7 @@ sub parse_command_status { my $subcommands = shift; my $subcommand; - if ($$subcommands[-1] =~ /V|verbose/) { + if ($$subcommands[-1] and $$subcommands[-1] =~ /V|verbose/) { $::VERBOSE = 1; pop(@$subcommands); } @@ -727,7 +727,11 @@ sub parse_command_status { } if ($command eq "rsetboot") { - $subcommand = $$subcommands[0]; + if (defined($$subcommands[0])) { + $subcommand = $$subcommands[0]; + } else { + $subcommand = "stat"; + } if ($subcommand =~ /^hd$|^net$|^cd$|^default$|^def$/) { $next_status{LOGIN_RESPONSE} = "RSETBOOT_SET_REQUEST"; $next_status{RSETBOOT_SET_REQUEST} = "RSETBOOT_SET_RESPONSE"; @@ -750,7 +754,7 @@ sub parse_command_status { if ($command eq "reventlog") { my $option_s = 0; - if ($$subcommands[-1] eq "-s") { + if ($$subcommands[-1] and $$subcommands[-1] eq "-s") { $option_s = 1; pop(@$subcommands); } From e421982a5982a8635fc71cdb9e508a4b03b658c2 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Mon, 14 Aug 2017 01:07:09 -0400 Subject: [PATCH 029/251] Modify depending on comments --- .../testcase/discovery/discovery_test | 108 ++++++++++-------- 1 file changed, 62 insertions(+), 46 deletions(-) diff --git a/xCAT-test/autotest/testcase/discovery/discovery_test b/xCAT-test/autotest/testcase/discovery/discovery_test index 26f9cf42e..217133953 100755 --- a/xCAT-test/autotest/testcase/discovery/discovery_test +++ b/xCAT-test/autotest/testcase/discovery/discovery_test @@ -15,7 +15,6 @@ my $discovery_mode = undef; my $discovery_target_node = undef; my $bmc_dynamic_ip_range = undef; -#my $node_dynamic_ip_range = undef; my $bmc_target_mac = undef; my $osimage = undef; my $bmc_discovery_only = 0; @@ -44,11 +43,19 @@ my $be_discovered_bmc_node; my $discovery_prodefine_node_name_in_automation = "discovery_prodefine_node_name_in_automation"; my @expected_attrs_for_bmc_discovery = ("mtm", "serial", "bmcusername", "bmcpassword", "bmc"); +my $expected_attrs_for_bmc_discovery_str = join(",", @expected_attrs_for_bmc_discovery); + my @expected_attrs_for_mtms_based_node_discovery = ("ip", "bmc", "mtm", "serial", "mgt", "cons", "netboot", "mac", "bmcusername", "bmcpassword"); +my $expected_attrs_for_mtms_based_node_discovery_str = join(",",@expected_attrs_for_mtms_based_node_discovery); + my @expected_attrs_for_switch_based_node_discovery = ("ip", "bmc", "mtm", "serial", "mgt", "cons", "netboot", "mac", "bmcusername", "bmcpassword", "switch", "switchport"); +my $expected_attrs_for_switch_based_node_discovery_str = join(",", @expected_attrs_for_switch_based_node_discovery); #----------------------usage-------------------- $::USAGE = "Usage: + + To test bmc discovery process, switch_based node discovery process or mtms_based node discovery process. + To get help: $program_name -h @@ -62,12 +69,18 @@ To test the whole process of switch_based node discovery $program_name --discovery_mode switch --discovery_target_node --bmc_dynamic_ip_range --osimage Options: - discovery_target_node: Required. The node planned to be discovered which must be definied in xcat DB ahead. + discovery_target_node: Required. The reference node planned to be discovered which must be definied in xcat DB ahead. bmc_dynamic_ip_range: Required. A valid dymanic ip range which has been configured in DHCP server and can offer service before invoking $program_name. The format of ip range is x.y1-y2.n1-n2.m1-m2 - discovery_mode: The mode of discovery. Valid mode are mtms, switch. - osimage: The image used to deploy on target node. - bmc_discovery_only: Just test bmc discovery process, not test node discovery process. + discovery_mode: The mode of discovery. Valid mode are mtms or switch. Used with option 'osimage'. Can not be used with 'bmc_discovery_only' at the same time. + osimage: The image used to deploy on target node. Used with option 'discovery_mode'. Can not be used with option 'bmc_discovery_only' at the same time. + bmc_discovery_only: Just test bmc discovery process, not test node discovery process. Can not be used with option 'osimage' or 'discovery_mode' at the same time. +Notes: + Up to now, only support one reference test node. + When preparing reference test node, below atrributes are required for each test scenario. + For only bmc discovery: $expected_attrs_for_bmc_discovery_str + For mtm_based node discovery: $expected_attrs_for_mtms_based_node_discovery_str + For switch_based node discovery: $expected_attrs_for_switch_based_node_discovery_str "; @@ -83,7 +96,7 @@ if ( "bmc_discovery_only" => \$bmc_discovery_only) ) { - print "[ERROR] Invalid usage.\n$::USAGE"; + print "[ERROR] Invalid usage.\n\n$::USAGE"; to_exit(1); } @@ -94,19 +107,25 @@ if ($needhelp) } unless(defined $discovery_target_node and defined $bmc_dynamic_ip_range){ - print "[ERROR] Missing option.\n$::USAGE"; + print "[ERROR] options 'discovery_target_node' and 'bmc_dynamic_ip_range' are required.\n\n$::USAGE"; to_exit(1); } -if (defined $discovery_mode) -{ - unless ($discovery_mode eq "mtms" || $discovery_mode eq "switch") { - print "[ERROR] Invalid value of option 'discovery_mode'\n$::USAGE"; +if($bmc_discovery_only){ + if($discovery_mode or $osimage){ + print "[ERROR] option 'bmc_discovery_only' can not be used with 'discovery_mode' or 'osimage' at the sametime\n\n$::USAGE"; to_exit(1); } - - unless($osimage){ - print "[ERROR] Missing option osimage.\n$::USAGE"; +}else{ + unless($discovery_mode and $osimage){ + print "[ERROR] options 'discovery_mode' and 'osimage' are necessary for testing node discovery process. Or use option 'bmc_discovery_only' to test bmc discovery\n\n$::USAGE"; + to_exit(1); + } +} + +if (defined $discovery_mode){ + unless ($discovery_mode eq "mtms" || $discovery_mode eq "switch") { + print "[ERROR] Invalid value of option 'discovery_mode'\n$::USAGE"; to_exit(1); } } @@ -116,26 +135,26 @@ $SIG{TERM} = $SIG{INT} = sub { }; print "----------------Check the configuration of test case itself----------------\n"; -$rst = check_test_case_self_conf($discovery_mode, $discovery_target_node, \@error); +$rst = check_test_case_self_conf(\@error); if ($rst) { print "To Check the configration of test case itself......[Failed]\n"; - dump_error(\@error); + dump_info(\@error); to_exit(1); } else { print "To Check the configration of test case itself......[pass]\n"; print "The discovery mode is $discovery_mode\n" if ($discovery_mode); print "The reference node is $discovery_target_node\n"; my @output = runcmd("lsdef $discovery_target_node"); - print "$_\n" foreach (@output); + dump_info(\@output); print "The reference bmc mac is $bmc_target_mac\n" if ($bmc_target_mac); print "The bmc dynamic ip range is $bmc_dynamic_ip_range\n" if ($bmc_dynamic_ip_range); } print "----------------To set up test environment for bmc discovery----------------\n"; -$rst = set_up_test_env_for_bmc_discovery(\@error); +$rst = reset_bmc_to_factory(\@error); if ($rst) { print "To set up test environment......[Failed]\n"; - dump_error(\@error); + dump_info(\@error); to_exit(1); } else { print "To set up test environment......[pass]\n"; @@ -147,13 +166,13 @@ print "----------------To discover BMC of $discovery_target_node --------------- $rst = bmc_discovery(\@error); if ($rst) { print "To discover BMC of $discovery_target_node......[Failed]\n"; - dump_error(\@error); + dump_info(\@error); to_exit(1); } else { print "To discover BMC of $discovery_target_node......[pass]\n"; print "The discovered BMC is $be_discovered_bmc_node\n"; my @output = runcmd("lsdef $be_discovered_bmc_node"); - print "$_\n" foreach (@output); + dump_info(\@output); } if ($bmc_discovery_only) { @@ -164,26 +183,26 @@ print "----------------To set up test environment for node discovery------------ $rst = set_up_test_env_for_node_discovery(\@error); if ($rst) { print "To set up test environment......[Failed]\n"; - dump_error(\@error); + dump_info(\@error); to_exit(1); } else { print "To set up test environment......[pass]\n"; print "The predefine node used to be discovered is $discovery_prodefine_node_name_in_automation\n"; my @output = runcmd("lsdef $discovery_prodefine_node_name_in_automation"); - print "$_\n" foreach (@output); + dump_info(\@output); } print "----------------To discover node $discovery_target_node ----------------\n"; $rst = node_discovery(\@error); if ($rst) { print "To discover node $discovery_prodefine_node_name_in_automation......[Failed]\n"; - dump_error(\@error); + dump_info(\@error); to_exit(1); } else { print "To discover node $discovery_prodefine_node_name_in_automation......[pass]\n"; print "The discovered node is $discovery_prodefine_node_name_in_automation\n"; my @output = runcmd("lsdef $discovery_prodefine_node_name_in_automation"); - print "$_\n" foreach (@output); + dump_info(\@output); } to_exit(0); @@ -198,15 +217,13 @@ to_exit(0); # Retrun code: #-------------------------------------------------------- sub check_test_case_self_conf { - my $discovery_mode = shift; - my $target_node = shift; my $error_ref = shift; @$error_ref = (); - $discovery_target_node_info{nodename} = $target_node; - my @output = runcmd("lsdef -l $target_node"); + $discovery_target_node_info{nodename} = $discovery_target_node; + my @output = runcmd("lsdef -l $discovery_target_node"); if ($::RUNCMD_RC) { - push @$error_ref, "The reference node $target_node is not defined in xcat database"; + push @$error_ref, "The reference node $discovery_target_node is not defined in xcat database"; } else { #backup original node definition @@ -235,7 +252,7 @@ sub check_test_case_self_conf { if (@missing_attrs) { my $missing_attrs_str = join(",", @missing_attrs); - push @$error_ref, "The reference node '$target_node' is missing '$missing_attrs_str' attribute"; + push @$error_ref, "The reference node '$discovery_target_node' is missing '$missing_attrs_str' attribute"; } } @@ -367,12 +384,12 @@ sub runcmd { #-------------------------------------------------------- -# Fuction name: dump_error +# Fuction name: dump_info # Description: # Atrributes: # Retrun code: #-------------------------------------------------------- -sub dump_error { +sub dump_info { my $error_ref = shift; foreach (@$error_ref) { print "$_\n"; @@ -380,13 +397,12 @@ sub dump_error { } #-------------------------------------------------------- -# Fuction name: set_up_test_env_for_bmc_discovery +# Fuction name: reset_bmc_to_factory # Description: # Atrributes: # Retrun code: #-------------------------------------------------------- -sub set_up_test_env_for_bmc_discovery { - my $error_ref = shift; +sub reset_bmc_to_factory { my @output; my $tmp_bmc_name; @@ -420,7 +436,7 @@ sub set_up_test_env_for_bmc_discovery { @output = runcmd("$cmd"); if ($::RUNCMD_RC) { print "[Failed]\n"; - dump_error(\@output); + dump_info(\@output); return 1; } else { print "[Successful]\n"; @@ -437,7 +453,6 @@ sub set_up_test_env_for_bmc_discovery { # Retrun code: #-------------------------------------------------------- sub set_up_test_env_for_node_discovery { - my $error_ref = shift; my @output; #To clear up history and predefine node @@ -474,7 +489,7 @@ sub set_up_test_env_for_node_discovery { @output = runcmd("$cmd"); if ($::RUNCMD_RC) { print "failed\n"; - dump_error(\@output); + dump_info(\@output); return 1; } else { print "successful\n"; @@ -602,7 +617,7 @@ sub node_discovery { my $error_ref = shift; my @output; - print "Boot target node $discovery_target_node, start discovery process\n"; + print "Boot target node $discovery_prodefine_node_name_in_automation, start discovery process\n"; my @cmds = ("rsetboot $be_discovered_bmc_node net", "rpower $be_discovered_bmc_node boot"); foreach my $cmd (@cmds) { @@ -615,6 +630,8 @@ sub node_discovery { } } + print "Waiting for node $discovery_prodefine_node_name_in_automation be discoveried\n"; + #suppose discovery process should get MAC address for predined node in 10 minuts my $find_me_succ = 0; my $mac_in_find_me; @@ -659,7 +676,7 @@ sub node_discovery { @output = runcmd("$cmd"); print "$_\n" foreach (@output); if ($::RUNCMD_RC) { - push @$error_ref, "Add getadapter into chain failed"; + push @$error_ref, "Add getadapter,bmcsetup,osimage into chain failed"; return 1; } } @@ -683,7 +700,7 @@ sub node_discovery { return 1; } print "getadapter obtain below adapter infomation\n"; - print "$_\n" foreach (@output); + dump_info(\@output); if (!(grep { /$discovery_target_node_info{mac}/i } @output)) { push @$error_ref, "The adapters information obtained by getadapter does not contain expected mac $discovery_target_node_info{mac}"; @@ -782,18 +799,17 @@ sub node_discovery { #-------------------------------------------------------- sub parse_dynamic_ip_range { my $original_dynamic_ip_str = shift; - my @ips = (); my @sec = split(/\./, $original_dynamic_ip_str); for (my $i = 0 ; $i <= $#sec ; $i++) { - $sec[$i] = "{$1,$2}" if ($sec[$i] =~ /(\d+)-(\d+)/); + $sec[$i] = "{$1..$2}" if ($sec[$i] =~ /(\d+)-(\d+)/); } my $str = join(".", @sec); my @output = runcmd("echo $str"); return split(/ /, $output[0]); -} +} #-------------------------------------------------------- -# Fuction name: parse_dynamic_ip_range +# Fuction name: calculate_bmc_info # Description: # Atrributes: # Retrun code: From a97f6507c2951e602d9988069d89811cf8635cc1 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Mon, 14 Aug 2017 02:14:23 -0400 Subject: [PATCH 030/251] modify depending on comment --- xCAT-test/autotest/testcase/discovery/discovery_test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/discovery/discovery_test b/xCAT-test/autotest/testcase/discovery/discovery_test index 217133953..c940f57a4 100755 --- a/xCAT-test/autotest/testcase/discovery/discovery_test +++ b/xCAT-test/autotest/testcase/discovery/discovery_test @@ -76,8 +76,8 @@ Options: bmc_discovery_only: Just test bmc discovery process, not test node discovery process. Can not be used with option 'osimage' or 'discovery_mode' at the same time. Notes: - Up to now, only support one reference test node. - When preparing reference test node, below atrributes are required for each test scenario. + Up to now, only support one discovery_target_node. + When preparing discovery_target_node, below atrributes are required for each test scenario. For only bmc discovery: $expected_attrs_for_bmc_discovery_str For mtm_based node discovery: $expected_attrs_for_mtms_based_node_discovery_str For switch_based node discovery: $expected_attrs_for_switch_based_node_discovery_str From 94009a475d13ce05c01cf0fa4a2b4d3ebb2ec6d1 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Mon, 14 Aug 2017 02:22:21 -0400 Subject: [PATCH 031/251] return errorcode 1 if failed for xcatprobe switch_macmap --- xCAT-probe/subcmds/switch_macmap | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xCAT-probe/subcmds/switch_macmap b/xCAT-probe/subcmds/switch_macmap index 3a52ca5df..2b4757177 100755 --- a/xCAT-probe/subcmds/switch_macmap +++ b/xCAT-probe/subcmds/switch_macmap @@ -120,6 +120,7 @@ foreach (<$fd>) { } } close($fd); +my $rc = 0; if (-f $normal_file) { unlink($normal_file); } @@ -129,8 +130,10 @@ if (-f $error_file) { if (@error_nodes) { my $error_node = join(",", @error_nodes); probe_utils->send_msg("$output", "d", "[$error_node] : Error, switch-macmap can only be run against xCAT objects that have 'nodetype=switch'"); + $rc = 1; } foreach (@fails) { probe_utils->send_msg("$output", "f", "$_"); + $rc = 1; } -exit 0; +exit $rc; From 7f4842519034501f756c6eaa0987649e39b1304e Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 14 Aug 2017 15:54:05 -0400 Subject: [PATCH 032/251] Allow update image relative filename --- xCAT-server/lib/xcat/plugins/openbmc.pm | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 00ffa21dc..8aa8e5814 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -19,6 +19,7 @@ use JSON; use HTTP::Async; use HTTP::Cookies; use File::Basename; +use File::Spec; use Data::Dumper; use Getopt::Long; use xCAT::OPENBMC; @@ -419,6 +420,7 @@ sub process_request { my $command = $request->{command}->[0]; my $noderange = $request->{node}; my $extrargs = $request->{arg}; + $::cwd = $request->{cwd}->[0]; my @exargs = ($request->{arg}); if (ref($extrargs)) { @exargs = @$extrargs; @@ -841,7 +843,6 @@ sub parse_command_status { } } - my $filename = undef; my $file_id = undef; my $grep_cmd = "/usr/bin/grep -a"; my $version_tag = '"version=IBM"'; @@ -850,17 +851,22 @@ sub parse_command_status { # Filename or file id was specified if ($update_file =~ /.*\.tar$/) { # Filename ending on .tar was specified - $filename = $update_file; - $::UPLOAD_FILE = $update_file; # Save filename to upload + if (File::Spec->file_name_is_absolute($update_file)) { + $::UPLOAD_FILE = $update_file; + } + else { + # If relative file path was given, convert it to absolute + $::UPLOAD_FILE = xCAT::Utils->full_path($update_file, $::cwd); + } # Verify file exists and is readable - unless (-r $filename) { - xCAT::SvrUtils::sendmsg([1,"Cannot access $filename"], $callback); + unless (-r $::UPLOAD_FILE) { + xCAT::SvrUtils::sendmsg([1,"Cannot access $::UPLOAD_FILE"], $callback); return 1; } if ($check_version) { # Display firmware version of the specified .tar file - my $firmware_version_in_file = `$grep_cmd $version_tag $filename`; - my $purpose_version_in_file = `$grep_cmd $purpose_tag $filename`; + my $firmware_version_in_file = `$grep_cmd $version_tag $::UPLOAD_FILE`; + my $purpose_version_in_file = `$grep_cmd $purpose_tag $::UPLOAD_FILE`; chomp($firmware_version_in_file); chomp($purpose_version_in_file); my ($purpose_string,$purpose_value) = split("=", $purpose_version_in_file); @@ -1864,7 +1870,7 @@ sub rflash_response { # curl commands my $curl_login_cmd = "curl -c cjar -k -H 'Content-Type: application/json' -X POST $request_url/login -d '" . $content_login . "'"; my $curl_logout_cmd = "curl -b cjar -k -H 'Content-Type: application/json' -X POST $request_url/logout -d '" . $content_logout . "'"; - my $curl_upload_cmd = "curl -b cjar -k -H 'Content-Type: application/octet-stream' -X PUT -T $::UPLOAD_FILE $request_url/upload/image/"; + my $curl_upload_cmd = "curl -b cjar -k -H 'Content-Type: application/octet-stream' -X PUT -T " . $::UPLOAD_FILE . " $request_url/upload/image/"; # Try to login my $curl_login_result = `$curl_login_cmd`; From 580b399adec05c795c9f4b42a8442a74edc936ce Mon Sep 17 00:00:00 2001 From: chenglch Date: Tue, 15 Aug 2017 10:35:33 +0800 Subject: [PATCH 033/251] Add trace log in db subroutines (#3666) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch add trace log for the db access. Currently support 5 log levels: - 0: disable the trace log for db. - 1: trace the calls of database subroutines. - 2: trace the event to build the cache for the table - 3: trace the event with cache hit - 4: trace the SQL statement implement-feature: #3612 Output example from xcat/cluster.log: ··· Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::setAttribs"},"type":"end","elapsed":"0.00176s"} Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::setAttribs"},"type":"start"} Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"addon":"SELECT * FROM site WHERE \"value\" = ? AND \"comments\" = ? AND \"disable\" = ? AND \"key\" = ?","table":"site","method":"xCAT::Table::setAttribs"},"type":"start_sql"} Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::setAttribs"},"type":"end_sql","elapsed":"0.00043s"} Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"addon":"INSERT INTO site (\"value\",\"comments\",\"key\",\"disable\") VALUES (?,?,?,?)","table":"site","method":"xCAT::Table::setAttribs"},"type":"start_sql"} Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"addon":"INSERT INTO site (\"value\",\"comments\",\"key\",\"disable\") VALUES (?,?,?,?)","table":"site","method":"xCAT::Table::setAttribs"},"type":"end_sql","elapsed":"0.00043s"} Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::setAttribs"},"type":"end","elapsed":"0.00171s"} Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::getAttribs"},"type":"start"} Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"addon":"SELECT * FROM site WHERE \"key\" = ? and (\"disable\" is NULL or \"disable\" in ('0','no','NO','No','nO'))","table":"site","method":"xCAT::Table::getAttribs"},"type":"start_sql"} Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::getAttribs"},"type":"end_sql","elapsed":"0.00061s"} Aug 9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::getAttribs"},"type":"end","elapsed":"0.00125s"} Aug 9 01:59:19 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::getAllAttribs"},"type":"start"} Aug 9 01:59:19 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"addon":"SELECT * FROM site WHERE \"disable\" is NULL or \"disable\" in ('0','no','NO','No','nO')","table":"site","method":"xCAT::Table::getAllAttribs"},"type":"start_sql"} Aug 9 01:59:19 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"addon":"SELECT * FROM site WHERE \"disable\" is NULL or \"disable\" in ('0','no','NO','No','nO')","table":"site","method":"xCAT::Table::getAllAttribs"},"type":"end_sql","elapsed":"0.00080s"} ··· --- .../admin-guides/references/man5/site.5.rst | 9 + perl-xCAT/xCAT/Schema.pm | 11 +- perl-xCAT/xCAT/Table.pm | 213 +++++++++++++++++- 3 files changed, 226 insertions(+), 7 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man5/site.5.rst b/docs/source/guides/admin-guides/references/man5/site.5.rst index 7fb2bf6cc..992ea778f 100644 --- a/docs/source/guides/admin-guides/references/man5/site.5.rst +++ b/docs/source/guides/admin-guides/references/man5/site.5.rst @@ -390,6 +390,15 @@ site Attributes: hierarchicalattrs: Table attributes(e.g. postscripts, postbootscripts) that will be included hierarchically. Attribute values for all the node's groups will be applied to the node in the groups' order except the repeat one. + dbtracelevel: The trace level for the database access log. To activate this setting, please. + restart xcatd or send HUP signal to the 'xcatd: DB Access' process, Like: . + ps -ef | grep 'xcatd: DB Access' | grep -v grep | awk '{print $2}' | xargs kill -HUP + Currrent support values: + 0: disable the trace log for db + 1: trace the calls of database subroutines + 2: Besides the log from level 1, trace the event to build the cache for the table + 3: Besides the log from level 2, trace the event with cache hit + 4: Besides the log from level 3, trace the SQL statement for the db access ----------------------- VIRTUALIZATION ATTRIBUTES diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 2dfdb7076..1da0353f7 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -1243,7 +1243,16 @@ passed as argument rather than by table value', " Qualified Domain Name). Otherwise, the original behavior will be performed.\n\n" . " hierarchicalattrs: Table attributes(e.g. postscripts, postbootscripts) that will be\n" . " included hierarchically. Attribute values for all the node's groups\n" . -" will be applied to the node in the groups' order except the repeat one.\n\n" . +" will be applied to the node in the groups' order except the repeat one.\n" . +" dbtracelevel: The trace level for the database access log. To activate this setting, please. \n". +" restart xcatd or send HUP signal to the 'xcatd: DB Access' process, Like: .\n". +" ps -ef | grep 'xcatd: DB Access' | grep -v grep | awk '{print \$2}' | xargs kill -HUP \n". +" Currrent support values: \n" . +" 0: disable the trace log for db \n" . +" 1: trace the calls of database subroutines \n" . +" 2: Besides the log from level 1, trace the event to build the cache for the table \n" . +" 3: Besides the log from level 2, trace the event with cache hit \n" . +" 4: Besides the log from level 3, trace the SQL statement for the db access \n\n" . " -----------------------\n" . "VIRTUALIZATION ATTRIBUTES\n" . " -----------------------\n" . diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index 508de47c7..b4f8f75e5 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -71,6 +71,9 @@ require xCAT::Schema; require xCAT::NodeRange; use Text::Balanced qw(extract_bracketed); require xCAT::NotifHandler; +use Time::HiRes qw/time/; +use JSON; + #The process id of the database worker # -1 db process has not been started, access db in direct access mode. @@ -82,7 +85,19 @@ my $dbsockpath = "/var/run/xcat/dbworker.sock." . $$; my $exitdbthread; my $dbobjsforhandle; my $intendedpid; +my $dbtracelevel; +my %elapsed; +use constant BUILD_CACHE_TYPE => "build_cache"; +use constant CACHE_HIT_TYPE => "cache_hit"; +use constant START_TYPE => "start"; +use constant END_TYPE => "end"; +use constant START_SQL_TYPE => "start_sql"; +use constant END_SQL_TYPE => "end_sql"; +use constant INFO_TYPE => "info"; + +my %trace_level_mapping = (START_TYPE() => 1, END_TYPE() => 1, BUILD_CACHE_TYPE() => 2, + CACHE_HIT_TYPE() => 3, START_SQL_TYPE() => 4, END_SQL_TYPE() => 4, INFO_TYPE() => 5); sub dbc_call { my $self = shift; @@ -155,6 +170,99 @@ sub dbc_submit { } } + +#-------------------------------------------------------------------------------- + +=head3 _trace_log + + Private helper function to write log message in json format + + Arguments: + $type: the type of the log content. + $msg: the message content + Returns: + none + + Error: + none + +=cut + +#-------------------------------------------------------------------------------- +sub _trace_log +{ + my ($type, $msg) = @_; + if( $type eq START_TYPE || $type eq START_SQL_TYPE) { + $elapsed{$trace_level_mapping{$type}} = time(); + } + my %hash = ("type" => $type, "msg" => $msg); + if($type eq END_TYPE || $type eq END_SQL_TYPE) { + if (!$elapsed{$trace_level_mapping{$type}}) { + return; + } + $hash{"elapsed"} = sprintf("%.5fs", time() - $elapsed{$trace_level_mapping{$type}}); + } + xCAT::MsgUtils->message("S", "[DB Trace]: ".encode_json(\%hash)); +} + + +#-------------------------------------------------------------------------------- + +=head3 trace_db + + Add log entries to trace db acccess + + Arguments: + $type: the type of the log content. If it is "start", "start_sq"l, "end", "end_sql", + a timer will be used to help calculate the elapsed time. Note, "start" and "end" + or "start_sql" and "end_sql" must be used in pairs. + $addon: the addon message. + Returns: + none + + Error: + none + + Example: + $self->trace_db("start"); # timer started. + ...... + $self->trace_db("end"); # print elapsed time. + + $self->trace_db("start_sql"); # timer started. + ...... # statement to run the sql + $self->trace_db("end_sql"); # print elapsed time. + +=cut + +#-------------------------------------------------------------------------------- +sub trace_db { + my $self = shift; + my ($type, $addon) = @_; + if (!$dbtracelevel) { + return; + } + if($dbworkerpid > 0) { + return; + } + $type = INFO_TYPE if (!$type); + if (!exists($trace_level_mapping{$type})) { + xCAT::MsgUtils->message("S", "Unsupported db trace type $type"); + return; + } + if (($trace_level_mapping{$type} == 1) && (caller(2))[3] ne "xCAT::Table::handle_dbc_request") { + # ignore internal calls + return; + } + + if ($trace_level_mapping{$type} <= $dbtracelevel) { + my $msg; + $msg->{"table"} = $self->{tabname}; + $msg->{"method"} = (caller(1))[3]; + $msg->{"addon"} = $addon if $addon; + _trace_log($type, $msg); + } +} + sub shut_dbworker { $dbworkerpid = -1; #For now, just turn off usage of the db worker #This was created as the monitoring framework shutdown code otherwise seems to have a race condition @@ -188,6 +296,7 @@ sub init_dbworker { } unless ($dbworkerpid) { $intendedpid = $$; + $dbtracelevel = xCAT::TableUtils->get_site_attribute("dbtracelevel"); $SIG{CHLD} = sub { while (waitpid(-1, WNOHANG) > 0) { } }; #avoid zombies from notification framework #This process is the database worker, it's job is to manage database queries to reduce required handles and to permit cross-process caching $0 = "xcatd: DB Access"; @@ -199,6 +308,13 @@ sub init_dbworker { $SIG{ALRM} = sub { exit 0; }; alarm(10); }; + $SIG{HUP} = sub { + $dbtracelevel = xCAT::TableUtils->get_site_attribute("dbtracelevel"); + xCAT::MsgUtils->message("S", "dbtracelevel has been reloaded, current value is $dbtracelevel"); + foreach my $item ( keys %elapsed) { + $elapsed{$item} = undef; + } + }; unlink($dbsockpath); umask(0077); $dbworkersocket = IO::Socket::UNIX->new(Local => $dbsockpath, Type => SOCK_STREAM, Listen => 8192); @@ -1453,8 +1569,10 @@ sub addAttribs $qstring = $qstring . "?,"; } $qstring =~ s/,$/)/; + $self->trace_db(START_SQL_TYPE, $qstring); my $sth = $self->{dbh}->prepare($qstring); $sth->execute(@bind); + $self->trace_db(END_SQL_TYPE); #$self->{dbh}->commit; @@ -1604,6 +1722,7 @@ sub setAttribs if ($dbworkerpid > 0) { return dbc_call($self, 'setAttribs', @_); } + $self->trace_db(START_TYPE); my $pKeypairs = shift; my %keypairs = (); if ($pKeypairs != undef) { %keypairs = %{$pKeypairs}; } @@ -1646,8 +1765,10 @@ sub setAttribs $qstring =~ s/ AND \z//; #print "this is qstring1: $qstring\n"; + $self->trace_db(START_SQL_TYPE, $qstring); $query = $self->{dbh}->prepare($qstring); $query->execute(@qargs); + $self->trace_db(END_SQL_TYPE); #get the first row $data = $query->fetchrow_arrayref(); @@ -1720,13 +1841,17 @@ sub setAttribs } } $cmd =~ s/ AND \z//; + $self->trace_db(START_SQL_TYPE, $qstring); my $sth = $self->{dbh}->prepare($cmd); unless ($sth) { + $self->trace_db(END_TYPE, "LINE ".__LINE__.": Error attempting requested DB operation"); return (undef, "Error attempting requested DB operation"); } my $err = $sth->execute(@bind); + $self->trace_db(END_SQL_TYPE); if (not defined($err)) { + $self->trace_db(END_TYPE, "LINE ".__LINE__.": ".$sth->errstr); return (undef, $sth->errstr); } $sth->finish; @@ -1781,10 +1906,13 @@ sub setAttribs $qstring = $qstring . "?,"; } $qstring =~ s/,$/)/; + $self->trace_db(START_SQL_TYPE, $qstring); my $sth = $self->{dbh}->prepare($qstring); my $err = $sth->execute(@bind); + $self->trace_db(END_SQL_TYPE, $qstring); if (not defined($err)) { + $self->trace_db(END_TYPE, "LINE ".__LINE__.": ". $sth->errstr); return (undef, $sth->errstr); } $sth->finish; @@ -1803,6 +1931,7 @@ sub setAttribs xCAT::NotifHandler->notify($action, $self->{tabname}, \@notif_data, \%new_notif_data); } + $self->trace_db(END_TYPE); return 0; } @@ -1850,6 +1979,7 @@ sub setAttribsWhere if ($dbworkerpid > 0) { return dbc_call($self, 'setAttribsWhere', @_); } + $self->trace_db(START_TYPE); my $where_clause = shift; my $elems = shift; my $cols = ""; @@ -1864,8 +1994,10 @@ sub setAttribsWhere } my $qstring = "SELECT * FROM " . $self->{tabname} . " WHERE " . $where_clause; my @qargs = (); + $self->trace_db(START_SQL_TYPE, $qstring); my $query = $self->{dbh}->prepare($qstring); $query->execute(@qargs); + $self->trace_db(END_SQL_TYPE); #get the first row my $data = $query->fetchrow_arrayref(); @@ -1903,10 +2035,13 @@ sub setAttribsWhere } chop($cols); my $cmd = "UPDATE " . $self->{tabname} . " set $cols where " . $where_clause; + $self->trace_db(START_SQL_TYPE, $qstring); my $sth = $self->{dbh}->prepare($cmd); my $err = $sth->execute(@bind); + $self->trace_db(END_SQL_TYPE); if (not defined($err)) { + $self->trace_db(END_TYPE, "LINE ".__LINE__.": ".$sth->errstr); return (undef, $sth->errstr); } @@ -1923,6 +2058,7 @@ sub setAttribsWhere \@notif_data, \%new_notif_data); } $sth->finish; + $self->trace_db(END_TYPE); return 0; } @@ -1968,6 +2104,7 @@ sub setNodesAttribs { if ($dbworkerpid > 0) { return dbc_call($self, 'setNodesAttribs', @_); } + $self->trace_db(START_TYPE); my $nodelist = shift; my $keyset = shift; my %cols = (); @@ -2025,6 +2162,7 @@ sub setNodesAttribs { } $self->{dbh}->commit; #commit pending transactions $self->{dbh}->{AutoCommit} = $oldac; #restore autocommit semantics + $self->trace_db(END_TYPE); return; } @@ -2066,8 +2204,10 @@ sub setNodesAttribs { $qstring = "SELECT * FROM " . $self->{tabname} . " WHERE $dnodekey in ("; $qstring .= '?, ' x scalar(@currnodes); $qstring =~ s/, $/)/; + $self->trace_db(START_SQL_TYPE, $qstring); my $query = $self->{dbh}->prepare($qstring); $query->execute(@currnodes); + $self->trace_db(END_SQL_TYPE); my $rec; while ($rec = $query->fetchrow_hashref()) { $updatenodes{ $rec->{$nodekey} } = 1; @@ -2093,7 +2233,7 @@ sub setNodesAttribs { $bindhooks =~ s/, $//; $columns =~ s/, $//; my $instring = "INSERT INTO " . $self->{tabname} . " ($columns) VALUES ($bindhooks)"; - + $self->trace_db(START_SQL_TYPE, $instring); #print $instring; $insertsth = $self->{dbh}->prepare($instring); } @@ -2105,7 +2245,9 @@ sub setNodesAttribs { foreach my $col (@orderedcols) { push @args, $hashrec->{$node}->{$col}; } + $insertsth->execute(@args); + $self->trace_db(END_SQL_TYPE); } if (not $upsth and keys %updatenodes) { #prepare an insert statement since one will be needed my $upstring = "UPDATE " . $self->{tabname} . " set "; @@ -2127,7 +2269,9 @@ sub setNodesAttribs { push @args, $hashrec->{$node}->{$col}; } push @args, $node; + $self->trace_db(START_SQL_TYPE, $upstring); $upsth->execute(@args); + $self->trace_db(END_SQL_TYPE); } } @currnodes = splice(@$nodelist, 0, $nodesatatime); @@ -2135,6 +2279,7 @@ sub setNodesAttribs { $self->{dbh}->commit; #commit pending transactions $self->{dbh}->{AutoCommit} = $oldac; #restore autocommit semantics $self->_refresh_cache(); #cache is invalid, refresh + $self->trace_db(END_TYPE); } #-------------------------------------------------------------------------- @@ -2170,6 +2315,7 @@ sub getNodesAttribs { if ($dbworkerpid > 0) { return dbc_call($self, 'getNodesAttribs', @_); } + $self->trace_db(START_TYPE); my $nodelist = shift; unless ($nodelist) { $nodelist = []; } #common to be invoked with undef seemingly my %options = (); @@ -2216,6 +2362,7 @@ sub getNodesAttribs { if ($self->{tabname} ne 'nodelist') { $self->{nodelist}->{_use_cache} = 0; } + $self->trace_db(END_TYPE); return $rethash; } @@ -2293,6 +2440,7 @@ sub _build_cache { #PRIVATE FUNCTION, PLEASE DON'T CALL DIRECTLY unless (grep /^$nodekey$/, @$attriblist) { push @$attriblist, $nodekey; } + $self->trace_db(BUILD_CACHE_TYPE); my @tabcache = $self->getAllAttribs(@$attriblist); $self->{_tablecache} = \@tabcache; $self->{_nodecache} = {}; @@ -2443,6 +2591,7 @@ sub getNodeAttribs #db worker scope return dbc_call($self, 'getNodeAttribs', @_); } + $self->trace_db(START_TYPE); if (!defined($self->{dbh})) { xCAT::MsgUtils->message("S", "xcatd: DBI is missing, Please check the db access process."); @@ -2521,6 +2670,7 @@ sub getNodeAttribs } } } + $self->trace_db(END_TYPE); return wantarray ? @data : $data[0]; } @@ -2862,7 +3012,6 @@ sub getNodeAttribs_nosub_returnany } } } - return @results; } @@ -2901,6 +3050,7 @@ sub getAllEntries if ($dbworkerpid > 0) { return dbc_call($self, 'getAllEntries', @_); } + $self->trace_db(START_TYPE); if (!defined($self->{dbh})) { xCAT::MsgUtils->message("S", "xcatd: DBI is missing, Please check the db access process."); @@ -2915,12 +3065,15 @@ sub getAllEntries my $disable = &delimitcol("disable"); if ($allentries) { # get all lines $query = $self->{dbh}->prepare('SELECT * FROM ' . $self->{tabname}); + $self->trace_db(START_SQL_TYPE, 'SELECT * FROM ' . $self->{tabname}); } else { # get only enabled lines my $qstring = 'SELECT * FROM ' . $self->{tabname} . " WHERE " . $disable . " is NULL or " . $disable . " in ('0','no','NO','No','nO')"; $query = $self->{dbh}->prepare($qstring); + $self->trace_db(START_SQL_TYPE, $qstring); } $query->execute(); + $self->trace_db(END_SQL_TYPE); while (my $data = $query->fetchrow_hashref()) { foreach (keys %$data) @@ -2933,6 +3086,7 @@ sub getAllEntries push @rets, $data; } $query->finish(); + $self->trace_db(END_TYPE); return \@rets; } @@ -2995,6 +3149,7 @@ sub getAllAttribsWhere if ($dbworkerpid > 0) { return dbc_call($self, 'getAllAttribsWhere', @_); } + $self->trace_db(START_TYPE); my $clause = shift; my $whereclause; my @attribs = @_; @@ -3011,8 +3166,10 @@ sub getAllAttribsWhere # delimit the disable column based on the DB my $disable = &delimitcol("disable"); $query2 = 'SELECT * FROM ' . $self->{tabname} . ' WHERE (' . $whereclause . ") and ($disable is NULL or $disable in ('0','no','NO','No','nO'))"; + $self->trace_db(START_SQL_TYPE, $query2); $query = $self->{dbh}->prepare($query2); $query->execute(); + $self->trace_db(END_SQL_TYPE); while (my $data = $query->fetchrow_hashref()) { my %newrow = (); @@ -3040,6 +3197,7 @@ sub getAllAttribsWhere } } $query->finish(); + $self->trace_db(END_TYPE); return @results; } @@ -3078,6 +3236,7 @@ sub getAllNodeAttribs if ($dbworkerpid > 0) { return dbc_call($self, 'getAllNodeAttribs', @_); } + $self->trace_db(START_TYPE); my $attribq = shift; my $hashretstyle = shift; my %options = @_; @@ -3098,8 +3257,10 @@ sub getAllNodeAttribs my $qstring = 'SELECT ' . $dnodekey . ' FROM ' . $self->{tabname} . " WHERE " . $disable . " is NULL or " . $disable . " in ('0','no','NO','No','nO')"; + $self->trace_db(START_SQL_TYPE, $qstring); $query = $self->{dbh}->prepare($qstring); $query->execute(); + $self->trace_db(END_SQL_TYPE); xCAT::NodeRange::retain_cache(1); unless ($options{prefetchcache}) { @@ -3171,6 +3332,7 @@ sub getAllNodeAttribs $self->{_use_cache} = 0; $self->{nodelist}->{_use_cache} = 0; $query->finish(); + $self->trace_db(END_TYPE); if ($hashretstyle) { return $rethash; } else { @@ -3212,9 +3374,10 @@ sub getAllAttribs if ($dbworkerpid > 0) { return dbc_call($self, 'getAllAttribs', @_); } - + $self->trace_db(START_TYPE); if (!defined($self->{dbh})) { xCAT::MsgUtils->message("S", "xcatd: DBI is missing, Please check the db access process."); + $self->trace_db(END_TYPE, "LINE ".__LINE__.": DBI is missing"); return undef; } @@ -3244,8 +3407,10 @@ sub getAllAttribs } if (@results) { + $self->trace_db(END_TYPE); return @results; #return wantarray ? @results : $results[0]; } + $self->trace_db(END_TYPE); return undef; } @@ -3254,10 +3419,12 @@ sub getAllAttribs my $query; my $qstring = "SELECT * FROM " . $self->{tabname} . " WHERE " . $disable . " is NULL or " . $disable . " in ('0','no','NO','No','nO')"; + $self->trace_db(START_SQL_TYPE, $qstring); $query = $self->{dbh}->prepare($qstring); #print $query; $query->execute(); + $self->trace_db(END_SQL_TYPE, $qstring); while (my $data = $query->fetchrow_hashref()) { my %newrow = (); @@ -3274,6 +3441,7 @@ sub getAllAttribs } } $query->finish(); + $self->trace_db(END_TYPE); return @results; } @@ -3317,6 +3485,7 @@ sub delEntries if ($dbworkerpid > 0) { return dbc_call($self, 'delEntries', @_); } + $self->trace_db(START_TYPE); my $keyref = shift; my @all_keyparis; my %keypairs; @@ -3361,10 +3530,10 @@ sub delEntries $qstring =~ s/\(\)//; $qstring =~ s/ OR \z//; - + $self->trace_db(START_SQL_TYPE, $qstring); my $query = $self->{dbh}->prepare($qstring); $query->execute(@qargs); - + $self->trace_db(END_SQL_TYPE); #prepare the notification data #put the column names at the very front push(@notif_data, $query->{NAME}); @@ -3399,8 +3568,10 @@ sub delEntries } $delstring =~ s/\(\)//; $delstring =~ s/ OR \z//; + $self->trace_db(START_SQL_TYPE, $delstring); my $stmt = $self->{dbh}->prepare($delstring); $stmt->execute(@stargs); + $self->trace_db(END_SQL_TYPE); $stmt->finish; $self->_refresh_cache(); #cache is invalid, refresh @@ -3411,7 +3582,7 @@ sub delEntries } @pieces = splice(@all_keyparis, 0, $record_num); } - + $self->trace_db(END_TYPE); } #-------------------------------------------------------------------------- @@ -3450,6 +3621,7 @@ sub getAttribs if ($dbworkerpid > 0) { return dbc_call($self, 'getAttribs', @_); } + $self->trace_db(START_TYPE); #my $key = shift; #my $keyval = shift; @@ -3510,8 +3682,11 @@ sub getAttribs } if (@results) { + $self->trace_db(END_TYPE); + $self->trace_db(CACHE_HIT_TYPE); return wantarray ? @results : $results[0]; } + $self->trace_db(END_TYPE); return undef; } @@ -3544,11 +3719,14 @@ sub getAttribs $statement .= "(" . $disable . " is NULL or " . $disable . " in ('0','no','NO','No','nO'))"; #print "This is my statement: $statement \n"; + $self->trace_db(START_SQL_TYPE, $statement); my $query = $self->{dbh}->prepare($statement); unless (defined $query) { + $self->trace_db(END_TYPE, "LINE ".__LINE__.": undef"); return undef; } $query->execute(@exeargs); + $self->trace_db(END_SQL_TYPE); my $data; while ($data = $query->fetchrow_hashref()) { @@ -3569,8 +3747,10 @@ sub getAttribs $query->finish(); if (@return) { + $self->trace_db(END_TYPE); return wantarray ? @return : $return[0]; } + $self->trace_db(END_TYPE); return undef; } @@ -3610,10 +3790,13 @@ sub getTable if ($dbworkerpid > 0) { return dbc_call($self, 'getTable', @_); } + $self->trace_db(START_TYPE); my @return; my $statement = 'SELECT * FROM ' . $self->{tabname}; + $self->trace_db(START_SQL_TYPE, $statement); my $query = $self->{dbh}->prepare($statement); $query->execute(); + $self->trace_db(END_SQL_TYPE); my $data; while ($data = $query->fetchrow_hashref()) { @@ -3631,8 +3814,10 @@ sub getTable $query->finish(); if (@return) { + $self->trace_db(END_TYPE); return @return; } + $self->trace_db(END_TYPE); return undef; } @@ -4089,6 +4274,7 @@ sub writeAllEntries if ($dbworkerpid > 0) { return dbc_call($self, 'writeAllEntries', @_); } + $self->trace_db(START_TYPE); my $filename = shift; my $fh; my $rc = 0; @@ -4097,6 +4283,7 @@ sub writeAllEntries unless (open($fh, " > $filename")) { my $msg = "Unable to open $filename for write \n."; `logger -p local4.err -t xcat $msg`; + $self->trace_db(END_TYPE, "LINE ".__LINE__.": ".$msg); return 1; } my $query; @@ -4112,9 +4299,11 @@ sub writeAllEntries # delimit the disable column based on the DB my $disable = &delimitcol("disable"); + $self->trace_db(START_SQL_TYPE, 'SELECT * FROM ' . $self->{tabname}); $query = $self->{dbh}->prepare('SELECT * FROM ' . $self->{tabname}); $query->execute(); + $self->trace_db(END_SQL_TYPE); while (my $data = $query->fetchrow_hashref()) { foreach (keys %$data) @@ -4128,6 +4317,7 @@ sub writeAllEntries } $query->finish(); CORE::close($fh); + $self->trace_db(END_TYPE); return $rc; } @@ -4170,6 +4360,7 @@ sub writeAllAttribsWhere if ($dbworkerpid > 0) { return dbc_call($self, 'writeAllAttribsWhere', @_); } + $self->trace_db(START_TYPE); my $clause = shift; my $filename = shift; my $whereclause; @@ -4184,6 +4375,7 @@ sub writeAllAttribsWhere unless (open($fh, " > $filename")) { my $msg = "Unable to open $filename for write \n."; `logger -p local4.err -t xcat $msg`; + $self->trace_db(END_TYPE, "LINE ".__LINE__.": ".$msg); return 1; } my $header; @@ -4201,8 +4393,10 @@ sub writeAllAttribsWhere # delimit the disable column based on the DB my $disable = &delimitcol("disable"); $query2 = 'SELECT * FROM ' . $self->{tabname} . ' WHERE (' . $whereclause . ") and ($disable is NULL or $disable in ('0','no','NO','No','nO'))"; + $self->trace_db(START_SQL_TYPE, $query2); $query = $self->{dbh}->prepare($query2); $query->execute(); + $self->trace_db(END_SQL_TYPE); while (my $data = $query->fetchrow_hashref()) { foreach (keys %$data) { @@ -4216,6 +4410,7 @@ sub writeAllAttribsWhere } $query->finish(); CORE::close($fh); + $self->trace_db(END_TYPE); return $rc; } @@ -4291,6 +4486,7 @@ sub getMAXMINEntries if ($dbworkerpid > 0) { return dbc_call($self, 'getMAXMINEntries', @_); } + $self->trace_db(START_TYPE); my $attr = shift; my $rets; my $query; @@ -4304,9 +4500,11 @@ sub getMAXMINEntries } else { $qstring = "SELECT MAX($attr) FROM " . $self->{tabname} . " WHERE " . $disable . " is NULL or " . $disable . " in ('0','no','NO','No','nO')"; } + $self->trace_db(START_SQL_TYPE, $qstring); $query = $self->{dbh}->prepare($qstring); $query->execute(); + $self->trace_db(END_SQL_TYPE); while (my $data = $query->fetchrow_hashref()) { foreach (keys %$data) @@ -4328,9 +4526,11 @@ sub getMAXMINEntries } else { $qstring = "SELECT MIN($attr) FROM " . $self->{tabname} . " WHERE " . $disable . " is NULL or " . $disable . " in ('0','no','NO','No','nO')"; } + $self->trace_db(START_SQL_TYPE, $qstring); $query = $self->{dbh}->prepare($qstring); $query->execute(); + $self->trace_db(END_SQL_TYPE); while (my $data = $query->fetchrow_hashref()) { foreach (keys %$data) @@ -4344,6 +4544,7 @@ sub getMAXMINEntries last; # better be only one value for min } } + $self->trace_db(END_TYPE); return $rets; } 1; From 021e87370400fd5c362b1b9c8629467a0de6132d Mon Sep 17 00:00:00 2001 From: immarvin Date: Sun, 13 Aug 2017 22:57:40 -0400 Subject: [PATCH 034/251] notify the nodes which are sending findme requestd about the status of the processing --- perl-xCAT/xCAT/Utils.pm | 35 ++++++++++++++++++++ xCAT-server/lib/xcat/plugins/aaadiscovery.pm | 15 --------- xCAT-server/lib/xcat/plugins/zzzdiscovery.pm | 19 ++++------- xCAT-server/sbin/xcatd | 13 ++++++++ 4 files changed, 55 insertions(+), 27 deletions(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 937a36473..6dfebad7e 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -4903,4 +4903,39 @@ sub acquire_lock_imageop { return (0,$lock); } +#-------------------------------------------------------------------------------- + +=head3 send_tcp_msg + establish a tcp socket to the specified IP address and port, then send the specifid message via the socket + Arguments: + $destip : the destination IP address + $destport: the destination TCP port + $msg : the message to send + Returns: + 0 on success, 1 on fail +=cut + +#-------------------------------------------------------------------------------- +sub send_tcp_msg { + my $self=shift; + my $destip=shift; + my $destport=shift; + my $msg=shift; + + my $sock = new IO::Socket::INET( + PeerAddr => $destip, + PeerPort => $destport, + Timeout => '1', + Proto => 'tcp' + ); + if ($sock) { + print $sock $msg; + close($sock); + return 0; + }else{ + return 1; + } +} + + 1; diff --git a/xCAT-server/lib/xcat/plugins/aaadiscovery.pm b/xCAT-server/lib/xcat/plugins/aaadiscovery.pm index a03518dcc..235c016b5 100644 --- a/xCAT-server/lib/xcat/plugins/aaadiscovery.pm +++ b/xCAT-server/lib/xcat/plugins/aaadiscovery.pm @@ -28,21 +28,6 @@ sub process_request { } my $client_ip = $req->{'_xcat_clientip'}; - #now, notify the node that its findme request is under processing - xCAT::MsgUtils->message("S", "Notify $client_ip that its findme request is processing\n"); - my $sock = new IO::Socket::INET( - PeerAddr => $client_ip, - PeerPort => '3001', - Timeout => '1', - Proto => 'tcp' - ); - if ($sock) { - print $sock "processing"; - close($sock); - }else{ - xCAT::MsgUtils->message("S", "Failed to notify $client_ip that its findme request is processing."); - } - my $arptable; if (-x "/usr/sbin/arp") { $arptable = `/usr/sbin/arp -n`; diff --git a/xCAT-server/lib/xcat/plugins/zzzdiscovery.pm b/xCAT-server/lib/xcat/plugins/zzzdiscovery.pm index 8665d62fb..7f6c0136a 100644 --- a/xCAT-server/lib/xcat/plugins/zzzdiscovery.pm +++ b/xCAT-server/lib/xcat/plugins/zzzdiscovery.pm @@ -7,6 +7,8 @@ BEGIN $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; } use lib "$::XCATROOT/lib/perl"; +use xCAT::Utils; + sub handled_commands { return { @@ -28,18 +30,11 @@ sub process_request { #now, notify the node that its findme request has been processed my $client_ip = $req->{'_xcat_clientip'}; - xCAT::MsgUtils->message("S","Notify $client_ip that its findme request has been processed"); - my $sock = new IO::Socket::INET( - PeerAddr => $client_ip, - PeerPort => '3001', - Timeout => '1', - Proto => 'tcp' - ); - if ($sock) { - print $sock "processed"; - close($sock); - }else{ - xCAT::MsgUtils->message("S", "Failed to notify $client_ip that its findme request has been processed"); + xCAT::MsgUtils->message("S","xcat.discovery.zzzdiscovery: Notify $client_ip that its findme request has been processed"); + #notify the client that its request is been processing + my $ret=xCAT::Utils->send_tcp_msg($client_ip,3001,"processed"); + if($ret){ + xCAT::MsgUtils->message("S", "xcat.discovery.zzzdiscovery: Failed to notify $client_ip that its findme request has been processed"); } }else{ xCAT::MsgUtils->message("S", "xcat.discovery.zzzdiscovery: ($req->{_xcat_clientmac}->[0]) Successfully discovered the node using $req->{discoverymethod}->[0] discovery method."); diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 25c9aaa3e..b65bed07c 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -801,10 +801,23 @@ sub do_udp_service { # This function opens up a UDP port foreach my $pkey (keys %packets) { my $saddr = $packets{$pkey}->[0]; $data = $packets{$pkey}->[1]; + my ($err, $srcip, $servicename) = Socket::getnameinfo($saddr,Socket::NI_NUMERICHOST,Socket::NIx_NOSERV); + if ($data =~ /^\037\213/) { # per rfc 1952, these two bytes are gzip, and they are invalid for store_fd({ data => $data, sockaddr => $saddr }, $discoctl); # for now, punt the gunzip to the worker process + #notify the client that its request is been processing + my $ret=xCAT::Utils->send_tcp_msg($srcip,3001,"processing"); + if($ret){ + xCAT::MsgUtils->message("S", "INFO xcatd: fail to notify $srcip that its 'findme' request is been processing"); + } } elsif ($data =~ /^ $data, sockaddr => $saddr }, $discoctl); + #notify the client that its request is been processing + my $ret=xCAT::Utils->send_tcp_msg($srcip,3001,"processing"); + if($ret){ + xCAT::MsgUtils->message("S", "INFO xcatd: fail to notify $srcip that its 'findme' request is been processing"); + } + } else { # for *now*, we'll do a tiny YAML subset if ($data =~ /^resourcerequest: xcatd$/) { $socket->send("ackresourcerequest\n", 0, $packets{$pkey}->[0]); From e4d8442e106267f42aacd6378853978020632902 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Tue, 15 Aug 2017 04:27:54 -0400 Subject: [PATCH 035/251] add usage and manpage for bmcdiscover "--sn" option --- .../references/man1/bmcdiscover.1.rst | 39 ++++++++++++++++--- xCAT-client/pods/man1/bmcdiscover.1.pod | 29 +++++++++++--- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 2 +- 3 files changed, 59 insertions(+), 11 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/bmcdiscover.1.rst b/docs/source/guides/admin-guides/references/man1/bmcdiscover.1.rst index 7173c39f5..60b3f6499 100644 --- a/docs/source/guides/admin-guides/references/man1/bmcdiscover.1.rst +++ b/docs/source/guides/admin-guides/references/man1/bmcdiscover.1.rst @@ -23,7 +23,7 @@ SYNOPSIS \ **bmcdiscover**\ [\ **-v | -**\ **-version**\ ] -\ **bmcdiscover**\ [\ **-s**\ \ *scan_method*\ ] [\ **-u**\ \ *bmc_user*\ ] [\ **-p**\ \ *bmc_passwd*\ ] [\ **-z**\ ] [\ **-w**\ ] \ **-**\ **-range**\ \ *ip_ranges*\ +\ **bmcdiscover**\ [\ **-**\ **-sn**\ \ *SN_nodename*\ ] [\ **-s**\ \ *scan_method*\ ] [\ **-u**\ \ *bmc_user*\ ] [\ **-p**\ \ *bmc_passwd*\ ] [\ **-z**\ ] [\ **-w**\ ] \ **-**\ **-range**\ \ *ip_ranges*\ \ **bmcdiscover**\ \ **-u**\ \ *bmc_user*\ \ **-p**\ \ *bmc_passwd*\ \ **-i**\ \ *bmc_ip*\ \ **-**\ **-check**\ @@ -56,6 +56,12 @@ OPTIONS +\ **-**\ **-sn**\ + + Specify one or more service node on which bmcdiscover will run. In hierarchical cluster, the MN may not be able to access the BMC of CN directly, but SN can. With this option, bmcdiscover will be dispatched to the specified SN and set them as the 'servicenode' attribute of the discovered BMC node. + + + \ **-s**\ Scan method (The only supported scan method at this time is \ **nmap**\ ) @@ -142,7 +148,7 @@ EXAMPLES Note: Input for IP range can be in the form: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.0-255.1-254. -2. To get all BMSs in IP range "10.4.22-23.100-254", displayed in xCAT stanza format: +2. To get all BMCs in IP range "10.4.22-23.100-254", displayed in xCAT stanza format: .. code-block:: perl @@ -150,7 +156,30 @@ Note: Input for IP range can be in the form: scanme.nmap.org, microsoft.com/24, bmcdiscover -s nmap --range "10.4.22-23.100-254" -z -3. Discover the BMCs and write the discovered-node definitions into the xCAT database and write out the stanza foramt to the console: +3. To discovery BMCs through sn01: + + +.. code-block:: perl + + bmcdiscover --sn sn01 -s nmap --range "10.4.22-23.100-254" -z + + +Output is similar to: + + +.. code-block:: perl + + node-70e28414291b: + objtype=node + groups=all + bmc=10.4.22.101 + cons=openbmc + mgt=openbmc + servicenode=sn01 + conserver=sn01 + + +4. Discover the BMCs and write the discovered-node definitions into the xCAT database and write out the stanza foramt to the console: .. code-block:: perl @@ -158,7 +187,7 @@ Note: Input for IP range can be in the form: scanme.nmap.org, microsoft.com/24, bmcdiscover -s nmap --range "10.4.22-23.100-254" -w -z -4. To check if the username or password is correct against the BMC: +5. To check if the username or password is correct against the BMC: .. code-block:: perl @@ -166,7 +195,7 @@ Note: Input for IP range can be in the form: scanme.nmap.org, microsoft.com/24, bmcdiscover -i 10.4.23.254 -u USERID -p PASSW0RD --check -5. Get BMC IP Address source, DHCP Address or static Address +6. Get BMC IP Address source, DHCP Address or static Address .. code-block:: perl diff --git a/xCAT-client/pods/man1/bmcdiscover.1.pod b/xCAT-client/pods/man1/bmcdiscover.1.pod index 2e967fab5..d7a203f67 100644 --- a/xCAT-client/pods/man1/bmcdiscover.1.pod +++ b/xCAT-client/pods/man1/bmcdiscover.1.pod @@ -8,7 +8,7 @@ B [B<-?>|B<-h>|B<--help>] B [B<-v>|B<--version>] -B [B<-s> I] [B<-u> I] [B<-p> I] [B<-z>] [B<-w>] B<--range> I +B [B<--sn> I] [B<-s> I] [B<-u> I] [B<-p> I] [B<-z>] [B<-w>] B<--range> I B B<-u> I B<-p> I B<-i> I B<--check> @@ -33,6 +33,10 @@ Note: The scan method currently support is B. Specify one or more IP ranges acceptable to nmap. IP range can be hostnames, IP addresses, networks, etc. A single IP address (10.1.2.3) or an IP range (10.1.2.0/24) can be specified. If the range is very large, the B command may take a long time to return. +=item B<--sn> + +Specify one or more service node on which bmcdiscover will run. In hierarchical cluster, the MN may not be able to access the BMC of CN directly, but SN can. With this option, bmcdiscover will be dispatched to the specified SN and set them as the 'servicenode' attribute of the discovered BMC node. + =item B<-s> Scan method (The only supported scan method at this time is B) @@ -90,19 +94,34 @@ Display version information Note: Input for IP range can be in the form: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.0-255.1-254. -2. To get all BMSs in IP range "10.4.22-23.100-254", displayed in xCAT stanza format: +2. To get all BMCs in IP range "10.4.22-23.100-254", displayed in xCAT stanza format: bmcdiscover -s nmap --range "10.4.22-23.100-254" -z -3. Discover the BMCs and write the discovered-node definitions into the xCAT database and write out the stanza foramt to the console: +3. To discovery BMCs through sn01: + + bmcdiscover --sn sn01 -s nmap --range "10.4.22-23.100-254" -z + +Output is similar to: + + node-70e28414291b: + objtype=node + groups=all + bmc=10.4.22.101 + cons=openbmc + mgt=openbmc + servicenode=sn01 + conserver=sn01 + +4. Discover the BMCs and write the discovered-node definitions into the xCAT database and write out the stanza foramt to the console: bmcdiscover -s nmap --range "10.4.22-23.100-254" -w -z -4. To check if the username or password is correct against the BMC: +5. To check if the username or password is correct against the BMC: bmcdiscover -i 10.4.23.254 -u USERID -p PASSW0RD --check -5. Get BMC IP Address source, DHCP Address or static Address +6. Get BMC IP Address source, DHCP Address or static Address bmcdiscover -i 10.4.23.254 -u USERID -p PASSW0RD --ipsource diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 0e754539c..a4ef5c5c5 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -183,7 +183,7 @@ sub bmcdiscovery_usage { push @{ $rsp->{data} }, "Usage:"; push @{ $rsp->{data} }, "\tbmcdiscover [-?|-h|--help]"; push @{ $rsp->{data} }, "\tbmcdiscover [-v|--version]"; - push @{ $rsp->{data} }, "\tbmcdiscover [-s scan_method] [-u bmc_user] [-p bmc_passwd] [-z] [-w] --range ip_range\n"; + push @{ $rsp->{data} }, "\tbmcdiscover [--sn ] [-s scan_method] [-u bmc_user] [-p bmc_passwd] [-z] [-w] --range ip_range\n"; push @{ $rsp->{data} }, "\tCheck BMC administrator User/Password:\n"; push @{ $rsp->{data} }, "\t\tbmcdiscover -u bmc_user -p bmc_password -i bmc_ip --check\n"; From eb5777ca2e4bb911155deab84e874d0f3fe456cc Mon Sep 17 00:00:00 2001 From: chenglch Date: Tue, 15 Aug 2017 10:14:48 +0800 Subject: [PATCH 036/251] Fix the error caused by too much open file descriptors The code in bmcdiscover do not close socket pair correctly which causes `Too many open files` error from system. This commit maintains a hash map to locate the file descriptors for child processes, close these files when the child processes exit. fix-issue: #3682 --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 49 +++++++-------------- 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 0e754539c..c5fca30e9 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -558,7 +558,7 @@ sub scan_process { my $children; # The number of child process my %sp_children; # Record the pid of child process my $bcmd; - my $sub_fds = new IO::Select; # Record the parent fd for each child process + if (!defined($method)) { @@ -609,7 +609,7 @@ sub scan_process { my $live_ip = split_comma_delim_str($ip_list); my $live_mac = split_comma_delim_str($mac_list); - + my %pipe_map; if (scalar(@{$live_ip}) > 0) { foreach (@{$live_ip}) { @@ -643,6 +643,9 @@ sub scan_process { if ($sp_children{$cpid}) { delete $sp_children{$cpid}; $children--; + forward_data($callback, $pipe_map{$cpid}); + close($pipe_map{$cpid}); + delete $pipe_map{$cpid}; } } }; @@ -672,7 +675,7 @@ sub scan_process { } else { bmcdiscovery_ipmi(${$live_ip}[$i], $opz, $opw, $request_command); } - + close($parent_fd); exit 0; } else { @@ -680,23 +683,15 @@ sub scan_process { # the main process will check all the parent fd and receive response $sp_children{$child} = 1; close($parent_fd); - $sub_fds->add($cfd); + $pipe_map{$child} = $cfd; } - do { sleep(1); } until ($children < 32); - } - - ################################################# - # receive data from child processes - ################################################ - while ($sub_fds->count > 0 or $children > 0) { - forward_data($callback, $sub_fds); - } - while (forward_data($callback, $sub_fds)) { + while($children > 0) { + sleep(1); } } else @@ -824,26 +819,14 @@ sub send_rep { sub forward_data { my $callback = shift; - my $fds = shift; - my @ready_fds = $fds->can_read(1); - my $rfh; - my $rc = @ready_fds; - foreach $rfh (@ready_fds) { - my $data; - my $responses; - eval { - $responses = fd_retrieve($rfh); - }; - if ($@ and $@ =~ /^Magic number checking on storable file/) { #this most likely means we ran over the end of available input - $fds->remove($rfh); - close($rfh); - } else { - eval { print $rfh "ACK\n"; }; #Ignore ack loss due to child giving up and exiting, we don't actually explicitly care about the acks - $callback->($responses); - } + my $cfd = shift; + my $responses; + eval { + $responses = fd_retrieve($cfd); + }; + if (!($@ and $@ =~ /^Magic number checking on storable file/)) { #this most likely means we ran over the end of available input + $callback->($responses); } - yield; #Try to avoid useless iterations as much as possible - return $rc; } From 0dcd6cc5c0c921d5a72e71684d9e4dbfd50579a0 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 15 Aug 2017 13:13:06 -0400 Subject: [PATCH 037/251] Message changed per suggestion --- xCAT-server/lib/xcat/plugins/openbmc.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 8aa8e5814..24a957b35 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1877,11 +1877,12 @@ sub rflash_response { my $h = from_json($curl_login_result); # convert command output to hash if ($h->{message} eq $::RESPONSE_OK) { # Login successfull, upload the file + xCAT::SvrUtils::sendmsg("Uploading $::UPLOAD_FILE ...", $callback, $node); my $curl_upload_result = `$curl_upload_cmd`; $h = from_json($curl_upload_result); # convert command output to hash if ($h->{message} eq $::RESPONSE_OK) { # Upload successfull - xCAT::SvrUtils::sendmsg("Update file $::UPLOAD_FILE successfully uploaded", $callback, $node); + xCAT::SvrUtils::sendmsg("Successful, use -l option to list.", $callback, $node); # Try to logoff, no need to check result, as there is nothing else to do if failure my $curl_logout_result = `$curl_logout_cmd`; } From 63a6c46371d160dd7141de951d819310c6a8c50d Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 15 Aug 2017 13:35:12 -0400 Subject: [PATCH 038/251] Sync Usage and Man pages for openbmc rflash command --- perl-xCAT/xCAT/Usage.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index dd40450e3..7339bc267 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -342,10 +342,10 @@ my %usage = ( rflash -p [--activate {disruptive|deferred}] [-d ] rflash [--commit | --recover] [-V|--verbose] rflash [--bpa_acdl] - PPC64LE (using IPMI Management) specific: - rflash [-c|--check] [--retry=] [-V] [|-d=] - PPC64LE (using OpenBMC Management) specific: - rflash [-c|--check] [-l|--list] [-a|--activate] [-u|--upload] [-d|--delete] [|]", + OpenPOWER BMC specific (using IPMI): + rflash [|-d=] [-c|--check] [--retry=] [-V] + OpenPOWER OpenBMC specific : + rflash [|] [-c|--check] [-a|--activate] [-l|--list] [-u|--upload] [-d|--delete]", "mkhwconn" => "Usage: mkhwconn [-h|--help] From 62c56561f28ef7a81f6e130838cf9c182895e2cd Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 15 Aug 2017 13:39:05 -0400 Subject: [PATCH 039/251] mend --- docs/source/guides/admin-guides/references/man5/nics.5.rst | 2 +- docs/source/guides/admin-guides/references/man7/group.7.rst | 4 ++-- docs/source/guides/admin-guides/references/man7/node.7.rst | 4 ++-- docs/source/guides/admin-guides/references/man7/osimage.7.rst | 2 +- perl-xCAT/xCAT/Usage.pm | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man5/nics.5.rst b/docs/source/guides/admin-guides/references/man5/nics.5.rst index cf4aab58c..208523103 100644 --- a/docs/source/guides/admin-guides/references/man5/nics.5.rst +++ b/docs/source/guides/admin-guides/references/man5/nics.5.rst @@ -129,7 +129,7 @@ nics Attributes: \ **nicsadapter**\ Comma-separated list of extra parameters that will be used for each NIC configuration. - !|,!|, for example, eth0!MTU=1500|MTU=1460,ib0!MTU=65520 CONNECTED_MODE=yes. + !,!, for example, enP3p3s0f1!mac=98:be:94:59:fa:cd linkstate=DOWN,enP3p3s0f2!mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face diff --git a/docs/source/guides/admin-guides/references/man7/group.7.rst b/docs/source/guides/admin-guides/references/man7/group.7.rst index 9a67dd224..a79e56ee8 100644 --- a/docs/source/guides/admin-guides/references/man7/group.7.rst +++ b/docs/source/guides/admin-guides/references/man7/group.7.rst @@ -41,7 +41,7 @@ group Attributes: \ **addkcmdline**\ (bootparams.addkcmdline) - User specified one or more parameters to be passed to the kernel. For the kernel options need to be persistent after installation, specify them with prefix "R::" + User specified kernel options for os provision process(no prefix) or the provisioned os(with prefix "R::"). The options should be delimited with spaces(" ") @@ -669,7 +669,7 @@ group Attributes: \ **nicsadapter**\ (nics.nicsadapter) Comma-separated list of extra parameters that will be used for each NIC configuration. - !|,!|, for example, eth0!MTU=1500|MTU=1460,ib0!MTU=65520 CONNECTED_MODE=yes. + !,!, for example, enP3p3s0f1!mac=98:be:94:59:fa:cd linkstate=DOWN,enP3p3s0f2!mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face diff --git a/docs/source/guides/admin-guides/references/man7/node.7.rst b/docs/source/guides/admin-guides/references/man7/node.7.rst index 0ab71ac4d..fbf9ada59 100644 --- a/docs/source/guides/admin-guides/references/man7/node.7.rst +++ b/docs/source/guides/admin-guides/references/man7/node.7.rst @@ -41,7 +41,7 @@ node Attributes: \ **addkcmdline**\ (bootparams.addkcmdline) - User specified one or more parameters to be passed to the kernel. For the kernel options need to be persistent after installation, specify them with prefix "R::" + User specified kernel options for os provision process(no prefix) or the provisioned os(with prefix "R::"). The options should be delimited with spaces(" ") @@ -669,7 +669,7 @@ node Attributes: \ **nicsadapter**\ (nics.nicsadapter) Comma-separated list of extra parameters that will be used for each NIC configuration. - !|,!|, for example, eth0!MTU=1500|MTU=1460,ib0!MTU=65520 CONNECTED_MODE=yes. + !,!, for example, enP3p3s0f1!mac=98:be:94:59:fa:cd linkstate=DOWN,enP3p3s0f2!mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face diff --git a/docs/source/guides/admin-guides/references/man7/osimage.7.rst b/docs/source/guides/admin-guides/references/man7/osimage.7.rst index c74014cf6..b4310d976 100644 --- a/docs/source/guides/admin-guides/references/man7/osimage.7.rst +++ b/docs/source/guides/admin-guides/references/man7/osimage.7.rst @@ -41,7 +41,7 @@ osimage Attributes: \ **addkcmdline**\ (linuximage.addkcmdline) - User specified arguments to be passed to the kernel. The user arguments are appended to xCAT.s default kernel arguments. For the kernel options need to be persistent after installation, specify them with prefix "R::". This attribute is ignored if linuximage.boottarget is set. + User specified kernel options for os provision process(no prefix) or the provisioned os(with prefix "R::"). The options should be delimited with spaces(" "). This attribute is ignored if linuximage.boottarget is set. diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 7339bc267..b0c78d73b 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -344,7 +344,7 @@ my %usage = ( rflash [--bpa_acdl] OpenPOWER BMC specific (using IPMI): rflash [|-d=] [-c|--check] [--retry=] [-V] - OpenPOWER OpenBMC specific : + OpenPOWER OpenBMC specific: rflash [|] [-c|--check] [-a|--activate] [-l|--list] [-u|--upload] [-d|--delete]", "mkhwconn" => "Usage: From 61bad888249396d3c0760621635a2e9466e2cdbc Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 15 Aug 2017 21:09:05 -0400 Subject: [PATCH 040/251] Change bmcdiscover for OpenBMC to look at Model instead of Part Number --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 0e754539c..7e3eabd1d 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -1172,8 +1172,8 @@ sub bmcdiscovery_openbmc{ my $serial; if (defined($response->{data})) { - if (defined($response->{data}->{PartNumber}) and defined($response->{data}->{SerialNumber})) { - $mtm = $response->{data}->{PartNumber}; + if (defined($response->{data}->{Model}) and defined($response->{data}->{SerialNumber})) { + $mtm = $response->{data}->{Model}; $serial = $response->{data}->{SerialNumber}; } From 2516628c9ae6a45611bc4bab3e0bacc451a71400 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 16 Aug 2017 08:49:43 -0400 Subject: [PATCH 041/251] incorrect petitboot configuration for nodeset shell in flat #3548 --- xCAT-test/autotest/testcase/genesis/cases0 | 6 +++--- xCAT-test/autotest/testcase/genesis/test.sh | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/xCAT-test/autotest/testcase/genesis/cases0 b/xCAT-test/autotest/testcase/genesis/cases0 index d0994215a..9294ec467 100644 --- a/xCAT-test/autotest/testcase/genesis/cases0 +++ b/xCAT-test/autotest/testcase/genesis/cases0 @@ -32,11 +32,11 @@ cmd:cat /tmp/genesistestlog/* end start:nodeset_shell_incorrectmasterip description:very if computenode need to do nodeset shell in different net with master will success -cmd:/opt/xcat/share/xcat/tools/autotest/testcase/genesis/test.sh -cd xnba +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/genesis/test.sh -check xnba check:rc==0 -cmd:/opt/xcat/share/xcat/tools/autotest/testcase/genesis/test.sh -cd grub2 +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/genesis/test.sh -check grub2 check:rc==0 -cmd:/opt/xcat/share/xcat/tools/autotest/testcase/genesis/test.sh -cd petitboot +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/genesis/test.sh -check petitboot check:rc==0 cmd:/opt/xcat/share/xcat/tools/autotest/testcase/genesis/test.sh -c check:rc==0 diff --git a/xCAT-test/autotest/testcase/genesis/test.sh b/xCAT-test/autotest/testcase/genesis/test.sh index 9741f4a11..72d906ccc 100755 --- a/xCAT-test/autotest/testcase/genesis/test.sh +++ b/xCAT-test/autotest/testcase/genesis/test.sh @@ -6,7 +6,7 @@ masternet=`ifconfig | awk "BEGIN{RS=\"\"}/\<$masterip\>/{print \$1}"|head -n 1 net2=`netstat -i -a|grep -v Kernel|grep -v Iface |grep -v lo|grep -v $masternet|head -n 1|awk '{print $1}'`;echo net2 is $net2; net2ip=""; if [[ -z $net2 ]];then - echo null + echo "could not verify the test" return 1; else net2ipstring=`ifconfig $net2 |grep inet|grep -v inet6`; @@ -19,7 +19,6 @@ net2ip=""; net2ip=0.0.0.0; fi ifconfig $net2 60.3.3.3 ; - makenetworks; makehosts testnode; nodeset testnode shell; ifconfig $net2 "$net2ip"; @@ -35,7 +34,6 @@ net2ip=""; function clear_env(){ makehosts -d testnode rmdef testnode -rmdef -t network 60_0_0_0-255_0_0_0 if [[ $? -eq 0 ]];then return 0; else @@ -47,7 +45,7 @@ SHELLFOLDER="" while [ "$#" -gt "0" ] do case $1 in - "-cd"|"--check" ) + "-check"|"--check" ) NETBOOT=$2; if [[ $NETBOOT =~ petitboot ]];then SHELLFOLDER="/tftpboot/petitboot/"; From c3f335b8a02d4a197be798ca505ed29f040850d1 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 16 Aug 2017 09:01:13 -0400 Subject: [PATCH 042/251] incorrect petitboot configuration for nodeset shell in flat #3548 --- xCAT-test/autotest/testcase/genesis/cases0 | 6 +++--- xCAT-test/autotest/testcase/genesis/test.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/genesis/cases0 b/xCAT-test/autotest/testcase/genesis/cases0 index 9294ec467..545b552b1 100644 --- a/xCAT-test/autotest/testcase/genesis/cases0 +++ b/xCAT-test/autotest/testcase/genesis/cases0 @@ -32,11 +32,11 @@ cmd:cat /tmp/genesistestlog/* end start:nodeset_shell_incorrectmasterip description:very if computenode need to do nodeset shell in different net with master will success -cmd:/opt/xcat/share/xcat/tools/autotest/testcase/genesis/test.sh -check xnba +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/genesis/test.sh --check xnba check:rc==0 -cmd:/opt/xcat/share/xcat/tools/autotest/testcase/genesis/test.sh -check grub2 +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/genesis/test.sh --check grub2 check:rc==0 -cmd:/opt/xcat/share/xcat/tools/autotest/testcase/genesis/test.sh -check petitboot +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/genesis/test.sh --check petitboot check:rc==0 cmd:/opt/xcat/share/xcat/tools/autotest/testcase/genesis/test.sh -c check:rc==0 diff --git a/xCAT-test/autotest/testcase/genesis/test.sh b/xCAT-test/autotest/testcase/genesis/test.sh index 72d906ccc..d0332ca7e 100755 --- a/xCAT-test/autotest/testcase/genesis/test.sh +++ b/xCAT-test/autotest/testcase/genesis/test.sh @@ -45,7 +45,7 @@ SHELLFOLDER="" while [ "$#" -gt "0" ] do case $1 in - "-check"|"--check" ) + "--check" ) NETBOOT=$2; if [[ $NETBOOT =~ petitboot ]];then SHELLFOLDER="/tftpboot/petitboot/"; From f3a506496d602a63aedd4f09616f4e9da27d0309 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 16 Aug 2017 15:19:48 -0400 Subject: [PATCH 043/251] hangle rflash relative path and more Boston product ids --- xCAT-server/lib/xcat/plugins/ipmi.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 82f43f460..666e3bfd6 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -33,6 +33,7 @@ use xCAT::SvrUtils; use xCAT::NetworkUtils; use xCAT::Usage; use File::Path; +use File::Spec; use Thread qw(yield); use LWP 5.64; @@ -1612,8 +1613,8 @@ sub isopenpower { if ($sessdata->{prod_id} == 43707 and $sessdata->{mfg_id} == 0) { # mft_id 0 and prod_id 43707 is for Firestone,Minsky return 1; - } elsif (($sessdata->{prod_id} == 0 or $sessdata->{prod_id} == 2355) and $sessdata->{mfg_id} == 10876) { - # mfg_id 10876 is for IBM Power S822LC for Big Data (Supermicro), prod_id 2355 for B&S, and 0 for Boston + } elsif (($sessdata->{prod_id} =~ /0|2355|2437/) and $sessdata->{mfg_id} == 10876) { + # mfg_id 10876 is for IBM Power S822LC for Big Data (Supermicro), prod_id 2355 for B&S, and 0 or 2437 for Boston return 1; } else { return 0; @@ -1964,6 +1965,10 @@ sub do_firmware_update { if ($opt =~ /-d=/) { my ($attribute, $directory_name) = split(/=/, $opt); if (defined $directory_name) { + unless (File::Spec->file_name_is_absolute($directory_name)) { + # Directory name was passed in as relative path, prepend current working dir + $directory_name = xCAT::Utils->full_path($directory_name, $::cwd); + } # directory was passed in, verify it is valid if (-d $directory_name) { # Passed in directory name exists @@ -1981,10 +1986,11 @@ sub do_firmware_update { } } - # For IBM Power S822LC for Big Data (Supermicro) machines such as P9 Boston (9006-22C) or P8 Briggs (8001-22C) + # For IBM Power S822LC for Big Data (Supermicro) machines such as + # P9 Boston (9006-22C, 9006-12) or P8 Briggs (8001-22C) # firmware update is done using pUpdate utility expected to be in the # specified data directory along with the update files .bin for BMC or .pnor for Host - if ($output =~ /8001-22C|9006-22C/) { + if ($output =~ /8001-22C|9006-22C|9006-12C/) { # Verify valid data directory was specified unless ($pUpdate_directory) { $exit_with_error_func->($sessdata->{node}, $callback, From 45df02f4f3bc899da51f6adb7db891713f4f279d Mon Sep 17 00:00:00 2001 From: Matt Ezell Date: Wed, 16 Aug 2017 21:08:52 -0400 Subject: [PATCH 044/251] Sort 'xcatprobe switch_macmap' ports in 'natural' order Old: swp1,swp11,swp12,swp2,swp20,swp21 New: swp1,swp2,swp11,swp12,swp20,swp21 --- xCAT-server/lib/xcat/plugins/switch.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/switch.pm b/xCAT-server/lib/xcat/plugins/switch.pm index dff93d270..523932036 100644 --- a/xCAT-server/lib/xcat/plugins/switch.pm +++ b/xCAT-server/lib/xcat/plugins/switch.pm @@ -251,7 +251,7 @@ sub process_request { $cb->({ node => [ { name => $switch, data => ["PASS"] } ] }); next; } - foreach my $port (sort keys %{ $macinfo->{$switch} }) { + foreach my $port (map{$_->[0]}sort{$a->[1] cmp $b->[1] || $a->[2] <=> $b->[2]}map{[$_, /^(.*?)(\d+)?$/]} keys %{ $macinfo->{$switch} }) { my $node = ''; if (defined($macinfo->{$switch}->{$port}->{Node})) { $node = $macinfo->{$switch}->{$port}->{Node}; From a364dad6cf96b742969a5351b2c6dfcfc7390f32 Mon Sep 17 00:00:00 2001 From: Yuan Bai Date: Thu, 17 Aug 2017 10:18:29 +0800 Subject: [PATCH 045/251] Add xCAT MN migration doc (#3646) * Add xCAT MN migration doc * polished based on comments * polished * polished --- docs/source/advanced/index.rst | 1 + docs/source/advanced/migration/index.rst | 7 + docs/source/advanced/migration/migration.rst | 189 +++++++++++++++++++ 3 files changed, 197 insertions(+) create mode 100644 docs/source/advanced/migration/index.rst create mode 100644 docs/source/advanced/migration/migration.rst diff --git a/docs/source/advanced/index.rst b/docs/source/advanced/index.rst index 3a78e0ac9..8c84eb6ac 100755 --- a/docs/source/advanced/index.rst +++ b/docs/source/advanced/index.rst @@ -6,6 +6,7 @@ Advanced Topics chain/index.rst cluster_maintenance/index.rst + migration/index.rst confluent/index.rst docker/index.rst domain_name_resolution/index.rst diff --git a/docs/source/advanced/migration/index.rst b/docs/source/advanced/migration/index.rst new file mode 100644 index 000000000..7ceda4e45 --- /dev/null +++ b/docs/source/advanced/migration/index.rst @@ -0,0 +1,7 @@ +Migrate xCat Management node +============================ + +.. toctree:: + :maxdepth: 2 + + migration.rst diff --git a/docs/source/advanced/migration/migration.rst b/docs/source/advanced/migration/migration.rst new file mode 100644 index 000000000..c93902f58 --- /dev/null +++ b/docs/source/advanced/migration/migration.rst @@ -0,0 +1,189 @@ +xCAT Management Node Migration +============================== + +This document describes how to migrate xCAT Management node to a new node. The following example describes a typical scenario, this example is verified on redhat7.3. + +#. Initially, the first xcat management node is active, and the second node is passive. +#. Backup all useful xCAT data from xCAT Management node to back-up server at regular intervals. +#. When the first xCAT management node is broken, use backup to restore original xCAT data to the second node with the same host name and ip. + +Backup Old xCAT Management Node +------------------------------- + +Backup xCAT management node data to backup server: + +1.1 Backup xCAT important files and directories: + + #. Get ``installdir`` from ``site`` table, backup ``installdir`` directory, + in this case, back up ``install`` directory: :: + + lsdef -t site clustersite -i installdir + Object name: clustersite + installdir=/install + + #. Backup these two xCAT directories: :: + + ~/.xcat + /etc/xcat + + **Notes**: backing up ``~/.xcat`` is for all users who have xCAT client certs. + + #. If there are customized files and directories for ``otherpkgdir``, ``pkgdir``, ``pkglist`` or ``template`` in some `osimage` definitions, backup these files and directories. for example: :: + + lsdef -t osimage customized_rhels7.4-x86_64-install-compute -i otherpkgdir,pkgdir,pkglist,template + Object name: customized_rhels7.4-x86_64-install-compute + otherpkgdir=//post/otherpkgs/rhels7.4/x86_64 + pkgdir=//rhels7.4/x86_64 + pkglist=//compute.rhels7.pkglist + template=//compute.rhels7.tmpl + +1.2 Backup ssh related files: :: + + /etc/ssh + ~/.ssh + +1.3 Backup host files: :: + + /etc/resolv.conf + /etc/hosts + /etc/passwd + /etc/group + +1.4 Backup yum resource files: :: + + /etc/yum.repos.d + +1.5 Backup conserver conf files: :: + + /etc/conserver.cf + +1.6 Backup DNS related files: :: + + /etc/named + /etc/named.conf + /etc/named.iscdlv.key + /etc/named.root.key + /etc/rndc.key + /etc/sysconfig/named + /var/named + +1.7 Backup dhcp files: :: + + /etc/dhcp + /var/lib/dhcpd + /etc/sysconfig/dhcpd + /etc/sysconfig/dhcpd6 + +1.8 Backup apache: :: + + /etc/httpd + /var/www + +1.9 Backup tftp files: :: + + /tftpboot + +1.10 Backup NTP configure file: :: + + /etc/ntp.conf + +1.11 Backup database configure files (optional): + + * **[PostgreSQL]** :: + + /var/lib/pgsql/data/pg_hba.conf + /var/lib/pgsql/data/postgresql.conf + +1.12 Backup NFS (optional): :: + + /etc/exports + /var/lib/nfs + /etc/sysconfig/nfs + +1.13 (optional) + +Besides the files mentioned above, there may be some additional customization files and production files that need to be backup, depending on your local unique requirements. Here are some example files that can be considered: :: + + /.profile + /.rhosts + /etc/auto_master + /etc/auto/maps/auto.u + /etc/motd + /etc/security/limits + /etc/netscvc.conf + /etc/inetd.conf + /etc/security/passwd + /etc/security/group + /etc/services + /etc/inittab(andmore) + +1.14 Backup the xCAT database tables for the current configuration, using command: :: + + dumpxCATdb -p + +1.15 Save all installed xCAT RPM names into a file: :: + + rpm -qa|grep -i xCAT > xcat_rpm_names + +1.16 (Optional) Find customization made to files installed from packages, backup these files. For example :: + + rpm -q --verify -a conserver-xcat + rpm -q --verify -a xCAT-server + rpm -q --verify -a syslinux-xcat + rpm -q --verify -a xCAT-client + rpm -q --verify -a xCAT + + +Restore xCAT management node +---------------------------- + +2.1 Power off old xCAT management server before configuring new xCAT management server + +2.2 Configure new xCAT management server using the same ip and hostname as old xCAT management server. Configure the same additional network for hardware management network if needed, for example, bmc network or hmc network. xCAT management server setup refer to :doc:`Prepare the Management Node <../../guides/install-guides/yum/prepare_mgmt_node>` + +2.3 Overwrite files/directories methioned in above 1.2, 1.3, 1.4 from backup server to new xCAT management server + +2.4 Download xcat-core and xcat-dep tar ball, then install xCAT in new xCAT management server, refer to :doc:`install xCAT <../../guides/install-guides/yum/install>` + +2.5 Use ``rpm -qa|grep -i xCAT`` to list all xCAT RPMs in new xCAT management node, compare these RPMs base name with those in ``xcat_rpm_names`` from above 1.15. If some RPMs are missing, use ``yum install `` to install missing RPMs. + +2.6 If use ``MySQL``/``MariaDB``/``PostgreSQL``, migrate xCAT to use ``MySQL/MariaDB/PostgreSQL`` refer to :doc:`Configure a Database <../hierarchy/databases/index>` + +2.7 To restore the xCAT database + + a. Restore xCAT database from the ``/dbbackup/db`` directory without ``auditlog`` and ``eventlog``, enter: :: + + restorexCATdb -p /dbbackup/db + + b. Restore the xCAT database including ``auditlog`` and ``eventlog`` from the ``/dbbackup/db`` directory, enter: :: + + restorexCATdb -a -p /dbbackup/db + + c. (optinal) Overwrite files in above 1.11, restart ``PostgreSQL``: :: + + service postgresql restart + +2.8 Overwrite remaining files/directories methioned in above 1.1, 1.5, 1.6, 1.7, 1.8, 1.9, 1.10, 1.12; If needed, check if files exist based on above 1.13 and 1.16. + +2.9 Verify xCAT: :: + + tabdump site + +2.10 Restart ``named``, use ``nslookup`` to check ``DNS``: :: + + service named restart + nslookup + +2.11 Restart ``conserver``, use ``rcons`` to check console: :: + + service conserver restart + rcons + +2.12 Configure DHCP: :: + + makedhcp -n + makedhcp -a + +2.13 Restart ``httpd`` for REST API, for more information refer to :doc:`Rest API<../../../advanced/restapi/index>`: :: + + service httpd restart From 8c663f946b0b6df444d2010a93f33c6021ace69a Mon Sep 17 00:00:00 2001 From: Bin Xu Date: Thu, 17 Aug 2017 10:49:27 +0800 Subject: [PATCH 046/251] Filter non-content lines when generating mypostscripts --- xCAT-server/share/xcat/install/scripts/post.debian | 4 ++-- xCAT-server/share/xcat/install/scripts/post.rhel5.s390x | 4 ++-- xCAT-server/share/xcat/install/scripts/post.rhel6.s390x | 4 ++-- xCAT-server/share/xcat/install/scripts/post.sles10.s390x | 4 ++-- xCAT-server/share/xcat/install/scripts/post.sles11.s390x | 4 ++-- xCAT-server/share/xcat/install/scripts/post.xcat | 4 ++-- xCAT/postscripts/xcatdsklspost | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/post.debian b/xCAT-server/share/xcat/install/scripts/post.debian index f11296a24..3f8aa5aa0 100644 --- a/xCAT-server/share/xcat/install/scripts/post.debian +++ b/xCAT-server/share/xcat/install/scripts/post.debian @@ -59,7 +59,7 @@ do mv $i/postscripts /xcatpost rm -rf $i chmod +x /xcatpost/* - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |egrep '' |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` MAX_RETRIES=10 RETRY=0 @@ -72,7 +72,7 @@ do let SLI=$RANDOM%10+10 sleep $SLI - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |egrep ''|sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` done diff --git a/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x b/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x index 63de0a3a2..63bfc4e1a 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x @@ -47,7 +47,7 @@ do chmod +x /xcatpost/* # Get postscript to run on this node from xcat server - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |egrep ''|sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` MAX_RETRIES=10 RETRY=0 @@ -63,7 +63,7 @@ do sleep $SLI # Get postscript to run on this node from xcat server - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |egrep ''|sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` done diff --git a/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x b/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x index 5bfd78b99..72e441781 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x @@ -47,7 +47,7 @@ do chmod +x /xcatpost/* # Get postscript to run on this node from xcat server - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |egrep ''|sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` MAX_RETRIES=10 RETRY=0 @@ -63,7 +63,7 @@ do sleep $SLI # Get postscript to run on this node from xcat server - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |egrep ''|sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` done diff --git a/xCAT-server/share/xcat/install/scripts/post.sles10.s390x b/xCAT-server/share/xcat/install/scripts/post.sles10.s390x index 9770af8b8..f6d0947a3 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles10.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.sles10.s390x @@ -52,7 +52,7 @@ do chmod +x /xcatpost/* # Get postscript to run on this node from xcat server - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript + /xcatpost/getpostscript.awk |egrep ''|sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript MYCONT=`grep MASTER /tmp/mypostscript` MAX_RETRIES=10 RETRY=0 @@ -67,7 +67,7 @@ do sleep $SLI # Get postscript to run on this node from xcat server - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript + /xcatpost/getpostscript.awk |egrep ''|sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript MYCONT=`grep MASTER /tmp/mypostscript` done diff --git a/xCAT-server/share/xcat/install/scripts/post.sles11.s390x b/xCAT-server/share/xcat/install/scripts/post.sles11.s390x index d3f244404..e213ee557 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles11.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.sles11.s390x @@ -53,7 +53,7 @@ do chmod +x /xcatpost/* # Get postscript to run on this node from xcat server - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript + /xcatpost/getpostscript.awk |egrep ''|sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript MYCONT=`grep MASTER /tmp/mypostscript` MAX_RETRIES=10 RETRY=0 @@ -68,7 +68,7 @@ do sleep $SLI # Get postscript to run on this node from xcat server - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript + /xcatpost/getpostscript.awk |egrep ''|sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript MYCONT=`grep MASTER /tmp/mypostscript` done diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index ba66f082b..388badb7b 100755 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -138,7 +138,7 @@ if [ ! -x /xcatpost/mypostscript ]; then /tmp/updateflag $MASTER $XCATIPORT "installstatus failed" sleep 36500d fi - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |egrep ''|sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript MYCONT=`grep ^MASTER= /xcatpost/mypostscript` RETRY=0 @@ -150,7 +150,7 @@ if [ ! -x /xcatpost/mypostscript ]; then let SLI=$RANDOM%10+10 sleep $SLI - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |egrep ''|sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript MYCONT=`grep ^MASTER= /xcatpost/mypostscript` done diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 81df3d557..989b35548 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -637,7 +637,7 @@ if [ ! -x /$xcatpost/mypostscript ]; then useflowcontrol=0 fi fi - /$xcatpost/getpostscript.awk | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /$xcatpost/mypostscript; + /$xcatpost/getpostscript.awk | egrep '' | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /$xcatpost/mypostscript; MYCONT=`grep MASTER /$xcatpost/mypostscript` if [ ! -z "$MYCONT" ]; then break; From eb3b720a405ab1521b3acfde7b6b5105d9f1a9d0 Mon Sep 17 00:00:00 2001 From: XuWei Date: Wed, 16 Aug 2017 22:52:30 -0400 Subject: [PATCH 047/251] modify man page --- .../guides/admin-guides/references/man1/rsetboot.1.rst | 10 +++++++++- xCAT-client/pods/man1/rsetboot.1.pod | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rsetboot.1.rst b/docs/source/guides/admin-guides/references/man1/rsetboot.1.rst index 73f96eaf1..735a94c5d 100644 --- a/docs/source/guides/admin-guides/references/man1/rsetboot.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rsetboot.1.rst @@ -11,7 +11,7 @@ SYNOPSIS ******** -\ **rsetboot**\ \ *noderange*\ {\ **hd | net | cd | default | stat**\ } [\ **-u**\ ] [\ **-p**\ ] +\ **rsetboot**\ \ *noderange*\ [\ **hd | net | cd | default | stat**\ ] [\ **-u**\ ] [\ **-p**\ ] \ **rsetboot**\ [\ **-h | -**\ **-help | -v | -**\ **-version**\ ] @@ -101,6 +101,14 @@ EXAMPLES rsetboot node[14-56],node[70-203] stat + Or: + + + .. code-block:: perl + + rsetboot node[14-56],node[70-203] + + 3. diff --git a/xCAT-client/pods/man1/rsetboot.1.pod b/xCAT-client/pods/man1/rsetboot.1.pod index c9e6b1fd6..cdec1042b 100644 --- a/xCAT-client/pods/man1/rsetboot.1.pod +++ b/xCAT-client/pods/man1/rsetboot.1.pod @@ -5,7 +5,7 @@ B - Sets the boot device to be used for BMC-based servers for the next =head1 SYNOPSIS -B I {B|B|B|B|B} [B<-u>] [B<-p>] +B I [B|B|B|B|B] [B<-u>] [B<-p>] B [B<-h>|B<--help>|B<-v>|B<--version>] @@ -64,6 +64,10 @@ Display the next-boot value for nodes 14-56 and 70-203: rsetboot node[14-56],node[70-203] stat +Or: + + rsetboot node[14-56],node[70-203] + =item 3. Restore the next-boot value for these nodes back to their default set in the BIOS: From ad7793909cf1fe9e27b62142072937edf5bc5549 Mon Sep 17 00:00:00 2001 From: Matt Ezell Date: Thu, 17 Aug 2017 00:05:45 -0400 Subject: [PATCH 048/251] Skip built-in MAC addresses on switches Newer Cumulus versions show a MAC address on each port. Those MACs aren't discoverable devices, so skip them to clean up the 'xcatprobe switch_macmap' output. --- perl-xCAT/xCAT/MacMap.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/MacMap.pm b/perl-xCAT/xCAT/MacMap.pm index 426cf1619..e1a7df81f 100644 --- a/perl-xCAT/xCAT/MacMap.pm +++ b/perl-xCAT/xCAT/MacMap.pm @@ -734,6 +734,9 @@ sub refresh_switch { xCAT::MsgUtils->message("I", "MTU information is not availabe for this switch $switch"); } + # get port state + my $mactostate = walkoid($session, '.1.3.6.1.2.1.17.7.1.2.2.1.3', silentfail => 1, verbose => $self->{show_verbose_info}, switch => $switch, callback => $self->{callback}); + #Above is valid without community string indexing, on cisco, we need it on the next one and onward my $iftovlanmap = walkoid($session, '.1.3.6.1.4.1.9.9.68.1.2.2.1.2', silentfail => 1, verbose => $self->{show_verbose_info}, switch => $switch, callback => $self->{callback}); #use cisco vlan membership mib to ascertain vlan my $trunktovlanmap = walkoid($session, '.1.3.6.1.4.1.9.9.46.1.6.1.1.5', silentfail => 1, verbose => $self->{show_verbose_info}, switch => $switch, callback => $self->{callback}); #for trunk ports, we are interested in the native vlan, so we need cisco vtp mib too @@ -807,8 +810,11 @@ sub refresh_switch { my $vlan = @tmp[0]; my @mac = @tmp[ -6 .. -1 ]; my $macstring = sprintf("%02x:%02x:%02x:%02x:%02x:%02x", @mac); - push @{ $index_to_mac{$index} }, $macstring; - push @{ $index_to_vlan{$index} }, $vlan; + # Skip "permanent" ports + if (!defined($mactostate->{$_}) || $mactostate->{$_} != 4) { + push @{ $index_to_mac{$index} }, $macstring; + push @{ $index_to_vlan{$index} }, $vlan; + } } foreach my $boid (keys %$bridgetoifmap) { my $port_index = $boid; From 748d4647448816fc49220e0a65e01426bd1e807c Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Thu, 17 Aug 2017 13:44:14 +0800 Subject: [PATCH 049/251] Test cases of compute node deployment with MLNX OFED InfiniBand drivers --- .../rhel-infiniband-diskfull-install.sh | 160 ++++++++++++++++ .../rhel-infiniband-diskless-install.sh | 176 ++++++++++++++++++ 2 files changed, 336 insertions(+) create mode 100755 xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh create mode 100755 xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh diff --git a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh new file mode 100755 index 000000000..ec277a729 --- /dev/null +++ b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh @@ -0,0 +1,160 @@ +#!/bin/bash + +######## +# Set all the variables below + +LINUX_DISTRO="rhels7.4" +LINUX_ARCH="ppc64le" + +COMPUTE_NODE="c910f03c01p10" +SOURCE_DIR="/media/xcat" + +######## + +# $SOURCE_DIR is a directory this test case will be searched for. +# Files with the name looked like the following will be searched. +# +# -rw-r--r-- 1 nobody nobody 79404 Jul 27 01:20 dkms-2.3-5.20170523git8c3065c.el7.noarch.rpm +# -rw-r--r-- 1 nobody nobody 29085696 Jul 9 09:24 mlnx-en-4.1-1.0.2.0-rhel7.3-ppc64le.iso +# -rw-r--r-- 2 nobody nobody 3188944896 Oct 31 2016 RHEL-7.3-20161019.0-Server-ppc64le-dvd1.iso + +######## +# Auto detect all the source packages from the ${SOURCE_DIR} + +[ -d "${SOURCE_DIR}" ] +[ "$?" -ne "0" ] && echo "Directory ${SOURCE_DIR} not found." >&2 && exit 1 + +declare DKMS_RPM +declare RHEL_ISO +declare MLNX_ISO + +for f in "${SOURCE_DIR}"/* +do + r="$(realpath "${f}")" + [ -f "${r}" ] || continue + case "${r##*/}" in + "RHEL-"*"-"*"-Server-${LINUX_ARCH}-dvd1.iso") + RHEL_ISO="${r}" + ;; + "MLNX_OFED_LINUX-"*"-"*"-${LINUX_DISTRO/s/}-${LINUX_ARCH}.iso") + MLNX_ISO="${r}" + ;; + "dkms-"*".el7.noarch.rpm") + DKMS_RPM="${r}" + ;; + esac +done + +######## +# Override the auto detect results here. + +#MLNX_ISO="${SOURCE_DIR}/mlnx-en-4.1-1.0.2.0-rhel7.3-ppc64le.iso" +#RHEL_ISO="${SOURCE_DIR}/RHEL-7.3-20161019.0-Server-ppc64le-dvd1.iso" +#DKMS_RPM="${SOURCE_DIR}/dkms-2.3-5.20170523git8c3065c.el7.noarch.rpm" + +######## +echo "Red Hat Enterprise Linux Server ISO" +echo "===================================" +echo "${RHEL_ISO}" +echo +echo "Mellanox EN Driver for Linux" +echo "============================" +echo "${MLNX_ISO}" +echo +echo "DKMS RPM" +echo "========" +echo "${DKMS_RPM}" +echo + +echo "The files listed above were found and will be used for this test case" +echo "Press Ctrl-C to abort!" +for t in {5..1} +do + echo -n " ... ${t}" + sleep 1 + echo -n -e "\b\b\b\b\b\b" +done +######## + +OSIMAGE_NAME="${LINUX_DISTRO}-${LINUX_ARCH}-install-mlnx" +OSIMAGE_OTHERPKGDIR="/install/post/otherpkgs/${LINUX_DISTRO}/${LINUX_ARCH}" +OSIMAGE_ROOTIMGDIR="/install/install/${LINUX_DISTRO}/${LINUX_ARCH}/${OSIMAGE_NAME}" + +[ -f "${RHEL_ISO}" ] +[ "$?" -ne "0" ] && echo "File ${RHEL_ISO} not found." >&2 && exit 1 +copycds "${RHEL_ISO}" +[ "$?" -ne "0" ] && echo "Copy CD failed." >&2 && exit 1 + +rmdef -t osimage "${OSIMAGE_NAME}" +mkdef -z <<-EOF +# + +${OSIMAGE_NAME}: + objtype=osimage + imagetype=linux + osarch=${LINUX_ARCH} + osdistroname=${LINUX_DISTRO}-${LINUX_ARCH} + osname=Linux + osvers=${LINUX_DISTRO} + otherpkgdir="${OSIMAGE_OTHERPKGDIR}" + otherpkglist=/install/custom/install/rh/mlnx.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.otherpkgs.pkglist + pkgdir=/install/${LINUX_DISTRO}/${LINUX_ARCH} + pkglist=/install/custom/install/rh/mlnx.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.pkglist + profile=compute + provmethod=install + template=/opt/xcat/share/xcat/install/rh/compute.${LINUX_DISTRO%%.*}.tmpl +EOF +[ "$?" -ne "0" ] && echo "Make osimage definition failed." >&2 && exit 1 + +mkdir -p /install/mlnx +cp "${MLNX_ISO}" /install/mlnx + +mkdir -p /install/custom/install/rh + +( + cat /opt/xcat/share/xcat/install/rh/compute.${LINUX_DISTRO%%.*}.pkglist + + cat <<-EOF + + # For MLNX OFED support + EOF + cat /opt/xcat/share/xcat/ib/netboot/rh/ib.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.pkglist +) >"/install/custom/install/rh/mlnx.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.pkglist" + +( + : +) >"/install/custom/install/rh/mlnx.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.otherpkgs.pkglist" + +cp /opt/xcat/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install.v2 \ + /install/postscripts/mlnxofed_ib_install.v2 + +chdef "${COMPUTE_NODE}" "postscripts=syslog,remoteshell,syncfiles,mlnxofed_ib_install.v2 -p /install/mlnx/${MLNX_ISO##*/} -m --add-kernel-support" + +rm -rf "${OSIMAGE_OTHERPKGDIR}" +mkdir -p "${OSIMAGE_OTHERPKGDIR}" + +makedhcp -n +rinstall "${COMPUTE_NODE}" "osimage=${OSIMAGE_NAME}" + +NETBOOT_TIMEOUT=600 +declare -i WAIT=0 + +while sleep 10 +do + (( WAIT += 10 )) + nodestat "${COMPUTE_NODE}" | grep ': sshd$' + [ "$?" -eq "0" ] && break + [ "${WAIT}" -le "${NETBOOT_TIMEOUT}" ] + [ "$?" -ne "0" ] && echo "Netboot failed" >&2 && exit 1 +done + +# For workaround the GitHub issue #3549 +sleep 5 + +xdsh "${COMPUTE_NODE}" date +[ "$?" -ne "0" ] && echo "Failed connect to compute node via SSH." >&2 && exit 1 + +#xdsh "${COMPUTE_NODE}" 'rpm -q cuda' | grep ': cuda-' +#[ "$?" -ne "0" ] && echo "CUDA installation checking failed" >&2 && exit 1 + +exit 0 diff --git a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh new file mode 100755 index 000000000..d9eb79eac --- /dev/null +++ b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh @@ -0,0 +1,176 @@ +#!/bin/bash + +######## +# Set all the variables below + +LINUX_DISTRO="rhels7.4" +LINUX_ARCH="ppc64le" + +COMPUTE_NODE="c910f03c01p10" +SOURCE_DIR="/media/xcat" + +######## + +# $SOURCE_DIR is a directory this test case will be searched for. +# Files with the name looked like the following will be searched. +# +# -rw-r--r-- 1 nobody nobody 79404 Jul 27 01:20 dkms-2.3-5.20170523git8c3065c.el7.noarch.rpm +# -rw-r--r-- 1 nobody nobody 29085696 Jul 9 09:24 mlnx-en-4.1-1.0.2.0-rhel7.3-ppc64le.iso +# -rw-r--r-- 2 nobody nobody 3188944896 Oct 31 2016 RHEL-7.3-20161019.0-Server-ppc64le-dvd1.iso + +######## +# Auto detect all the source packages from the ${SOURCE_DIR} + +[ -d "${SOURCE_DIR}" ] +[ "$?" -ne "0" ] && echo "Directory ${SOURCE_DIR} not found." >&2 && exit 1 + +declare DKMS_RPM +declare RHEL_ISO +declare MLNX_ISO + +for f in "${SOURCE_DIR}"/* +do + r="$(realpath "${f}")" + [ -f "${r}" ] || continue + case "${r##*/}" in + "RHEL-"*"-"*"-Server-${LINUX_ARCH}-dvd1.iso") + RHEL_ISO="${r}" + ;; + "MLNX_OFED_LINUX-"*"-"*"-${LINUX_DISTRO/s/}-${LINUX_ARCH}.iso") + MLNX_ISO="${r}" + ;; + "dkms-"*".el7.noarch.rpm") + DKMS_RPM="${r}" + ;; + esac +done + +######## +# Override the auto detect results here. + +#MLNX_ISO="${SOURCE_DIR}/mlnx-en-4.1-1.0.2.0-rhel7.3-ppc64le.iso" +#RHEL_ISO="${SOURCE_DIR}/RHEL-7.3-20161019.0-Server-ppc64le-dvd1.iso" +#DKMS_RPM="${SOURCE_DIR}/dkms-2.3-5.20170523git8c3065c.el7.noarch.rpm" + +######## +echo "Red Hat Enterprise Linux Server ISO" +echo "===================================" +echo "${RHEL_ISO}" +echo +echo "Mellanox EN Driver for Linux" +echo "============================" +echo "${MLNX_ISO}" +echo +echo "DKMS RPM" +echo "========" +echo "${DKMS_RPM}" +echo + +echo "The files listed above were found and will be used for this test case" +echo "Press Ctrl-C to abort!" +for t in {5..1} +do + echo -n " ... ${t}" + sleep 1 + echo -n -e "\b\b\b\b\b\b" +done +######## + +OSIMAGE_NAME="${LINUX_DISTRO}-${LINUX_ARCH}-netboot-mlnx" +OSIMAGE_OTHERPKGDIR="/install/post/otherpkgs/${LINUX_DISTRO}/${LINUX_ARCH}" +OSIMAGE_ROOTIMGDIR="/install/netboot/${LINUX_DISTRO}/${LINUX_ARCH}/${OSIMAGE_NAME}" + +[ -f "${RHEL_ISO}" ] +[ "$?" -ne "0" ] && echo "File ${RHEL_ISO} not found." >&2 && exit 1 +copycds "${RHEL_ISO}" +[ "$?" -ne "0" ] && echo "Copy CD failed." >&2 && exit 1 + +rmdef -t osimage "${OSIMAGE_NAME}" +mkdef -z <<-EOF +# + +${OSIMAGE_NAME}: + objtype=osimage + exlist=/opt/xcat/share/xcat/netboot/rh/compute.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.exlist + imagetype=linux + osarch=${LINUX_ARCH} + osdistroname=${LINUX_DISTRO}-${LINUX_ARCH} + osname=Linux + osvers=${LINUX_DISTRO} + otherpkgdir="${OSIMAGE_OTHERPKGDIR}" + otherpkglist=/install/custom/netboot/rh/mlnx.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.otherpkgs.pkglist + permission=755 + pkgdir=/install/${LINUX_DISTRO}/${LINUX_ARCH} + pkglist=/install/custom/netboot/rh/mlnx.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.pkglist + postinstall=/install/custom/netboot/rh/mlnx.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.postinstall + profile=compute + provmethod=netboot + rootimgdir=${OSIMAGE_ROOTIMGDIR} +EOF +[ "$?" -ne "0" ] && echo "Make osimage definition failed." >&2 && exit 1 + +mkdir -p /install/mlnx +cp "${MLNX_ISO}" /install/mlnx + +mkdir -p /install/custom/netboot/rh + +( + cat /opt/xcat/share/xcat/netboot/rh/compute.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.pkglist + + cat <<-EOF + + # For MLNX OFED support + EOF + cat /opt/xcat/share/xcat/ib/netboot/rh/ib.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.pkglist +) >"/install/custom/netboot/rh/mlnx.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.pkglist" + +( + : +) >"/install/custom/netboot/rh/mlnx.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.otherpkgs.pkglist" + +cp /opt/xcat/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install.v2 \ + /install/postscripts/mlnxofed_ib_install.v2 +( + cat "/opt/xcat/share/xcat/netboot/rh/compute.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.postinstall" + cat <<-EOF + + NODESETSTATE=genimage IMGROOTPATH=${OSIMAGE_ROOTIMGDIR}/rootimg bash -x /install/postscripts/mlnxofed_ib_install.v2 -p /install/mlnx/${MLNX_ISO##*/} -m --add-kernel-support + EOF +) >"/install/custom/netboot/rh/mlnx.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.postinstall" +chmod 0755 "/install/custom/netboot/rh/mlnx.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.postinstall" + +rm -rf "${OSIMAGE_OTHERPKGDIR}" +mkdir -p "${OSIMAGE_OTHERPKGDIR}" + +rm -rf "${OSIMAGE_ROOTIMGDIR}" + +genimage "${OSIMAGE_NAME}" +[ "$?" -ne "0" ] && echo "genimage failed" >&2 && exit 1 +packimage "${OSIMAGE_NAME}" +[ "$?" -ne "0" ] && echo "packimage failed" >&2 && exit 1 + +makedhcp -n +rinstall "${COMPUTE_NODE}" "osimage=${OSIMAGE_NAME}" + +NETBOOT_TIMEOUT=600 +declare -i WAIT=0 + +while sleep 10 +do + (( WAIT += 10 )) + nodestat "${COMPUTE_NODE}" | grep ': sshd$' + [ "$?" -eq "0" ] && break + [ "${WAIT}" -le "${NETBOOT_TIMEOUT}" ] + [ "$?" -ne "0" ] && echo "Netboot failed" >&2 && exit 1 +done + +# For workaround the GitHub issue #3549 +sleep 5 + +xdsh "${COMPUTE_NODE}" date +[ "$?" -ne "0" ] && echo "Failed connect to compute node via SSH." >&2 && exit 1 + +#xdsh "${COMPUTE_NODE}" 'rpm -q cuda' | grep ': cuda-' +#[ "$?" -ne "0" ] && echo "CUDA installation checking failed" >&2 && exit 1 + +exit 0 From 73c032068a8a54836d2be628efbacc4718902b3b Mon Sep 17 00:00:00 2001 From: bybai Date: Thu, 17 Aug 2017 02:42:53 -0400 Subject: [PATCH 050/251] enhance error log --- xCAT/postscripts/confignetwork | 6 +++--- xCAT/postscripts/nicutils.sh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/xCAT/postscripts/confignetwork b/xCAT/postscripts/confignetwork index b5d20c15b..645de5d95 100755 --- a/xCAT/postscripts/confignetwork +++ b/xCAT/postscripts/confignetwork @@ -406,12 +406,12 @@ function sort_nics_device_order { vlan_slot=$vlan_slot" "$num fi else - echo "Error: $nic_dev $base_nic_dev pair is invalid nic and nicdevice pair." + echo "Error: nicdevices.$nic_dev base nic device cannot be $base_nic_type $base_nic_dev.(nicdevices is only required on vlan/bond/bridge)" fi ((num+=1)) done else - log_error "Error: only support configure bond/vlan/bridge on redhat." + log_error "only support configure bond/vlan/bridge on redhat." fi fi new_order=$eth_slot" "$bond_slot" "$vlan_slot @@ -555,7 +555,7 @@ function configure_nicdevice { errorcode=1 fi else - log_error "Error : please check nic data in nics table." + log_error "please check nic data in nics table." errorcode=1 fi diff --git a/xCAT/postscripts/nicutils.sh b/xCAT/postscripts/nicutils.sh index d00155256..d57598512 100755 --- a/xCAT/postscripts/nicutils.sh +++ b/xCAT/postscripts/nicutils.sh @@ -76,7 +76,7 @@ function log_lines { ###################################################### function log_error { local __msg="$*" - $log_print_cmd $log_print_arg "[E]: $__msg" + $log_print_cmd $log_print_arg "[E]:Error: $__msg" return 0 } @@ -1473,7 +1473,7 @@ function create_bond_interface { wait_for_ifstate $ifname UP 200 1 rc=$? if [ $rc -ne 0 ]; then - log_error "Error! Interface \"$ifname\" was NOT in \"UP\" state eventually." + log_error "Interface \"$ifname\" was NOT in \"UP\" state eventually." $ip link show $ifname \ | $sed -e 's/^/['$ifname' ip out >> /g' \ | log_lines info From 39c4e7081f2d13154708f97b8e0433b7f63a26a0 Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 15 Aug 2017 23:26:34 -0400 Subject: [PATCH 051/251] fix issue xCAT install failed on sles11.4 & rhels6.9 in automation #3693;move send_tcp_msg from Utils.pm to NetworkUtils.pm --- perl-xCAT/xCAT/NetworkUtils.pm | 31 ++++++++++++ perl-xCAT/xCAT/Utils.pm | 34 ------------- xCAT-server/lib/xcat/plugins/zzzdiscovery.pm | 4 +- xCAT-server/sbin/xcatd | 50 ++++++++------------ 4 files changed, 54 insertions(+), 65 deletions(-) diff --git a/perl-xCAT/xCAT/NetworkUtils.pm b/perl-xCAT/xCAT/NetworkUtils.pm index 9b65054a2..cb01ca93e 100755 --- a/perl-xCAT/xCAT/NetworkUtils.pm +++ b/perl-xCAT/xCAT/NetworkUtils.pm @@ -2778,4 +2778,35 @@ sub gen_net_boot_params return $net_params; } +#-------------------------------------------------------------------------------- +=head3 send_tcp_msg + establish a tcp socket to the specified IP address and port, then send the specifid message via the socket + Arguments: + $destip : the destination IP address + $destport: the destination TCP port + $msg : the message to send + Returns: + 0 on success, 1 on fail +=cut +#-------------------------------------------------------------------------------- +sub send_tcp_msg { + my $self=shift; + my $destip=shift; + my $destport=shift; + my $msg=shift; + + my $sock = new IO::Socket::INET( + PeerAddr => $destip, + PeerPort => $destport, + Timeout => '1', + Proto => 'tcp' + ); + if ($sock) { + print $sock $msg; + close($sock); + return 0; + }else{ + return 1; + } +} 1; diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 6dfebad7e..83ff67d5f 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -4903,39 +4903,5 @@ sub acquire_lock_imageop { return (0,$lock); } -#-------------------------------------------------------------------------------- - -=head3 send_tcp_msg - establish a tcp socket to the specified IP address and port, then send the specifid message via the socket - Arguments: - $destip : the destination IP address - $destport: the destination TCP port - $msg : the message to send - Returns: - 0 on success, 1 on fail -=cut - -#-------------------------------------------------------------------------------- -sub send_tcp_msg { - my $self=shift; - my $destip=shift; - my $destport=shift; - my $msg=shift; - - my $sock = new IO::Socket::INET( - PeerAddr => $destip, - PeerPort => $destport, - Timeout => '1', - Proto => 'tcp' - ); - if ($sock) { - print $sock $msg; - close($sock); - return 0; - }else{ - return 1; - } -} - 1; diff --git a/xCAT-server/lib/xcat/plugins/zzzdiscovery.pm b/xCAT-server/lib/xcat/plugins/zzzdiscovery.pm index 7f6c0136a..f76338081 100644 --- a/xCAT-server/lib/xcat/plugins/zzzdiscovery.pm +++ b/xCAT-server/lib/xcat/plugins/zzzdiscovery.pm @@ -7,7 +7,7 @@ BEGIN $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; } use lib "$::XCATROOT/lib/perl"; -use xCAT::Utils; +use xCAT::NetworkUtils; sub handled_commands { @@ -32,7 +32,7 @@ sub process_request { my $client_ip = $req->{'_xcat_clientip'}; xCAT::MsgUtils->message("S","xcat.discovery.zzzdiscovery: Notify $client_ip that its findme request has been processed"); #notify the client that its request is been processing - my $ret=xCAT::Utils->send_tcp_msg($client_ip,3001,"processed"); + my $ret=xCAT::NetworkUtils->send_tcp_msg($client_ip,3001,"processed"); if($ret){ xCAT::MsgUtils->message("S", "xcat.discovery.zzzdiscovery: Failed to notify $client_ip that its findme request has been processed"); } diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index b65bed07c..f2b7027f4 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -636,25 +636,9 @@ sub do_discovery_process { $vintage = time(); } # site table reread every 15 second my $data; - my $client; - my $clientn; - my $clientip; if (ref $msg eq 'HASH') { $data = $msg->{data}; } else { die "incorrect code to disco"; } - my $saddr = $msg->{sockaddr}; - if ($inet6support) { - ($client, $sport) = Socket6::getnameinfo($saddr); - ($clientip, $sport) = Socket6::getnameinfo($saddr, Socket6::NI_NUMERICHOST()); - if ($clientip =~ /::ffff:.*\..*\./) { - $clientip =~ s/^::ffff://; - } - if ($client =~ /::ffff:.*\..*\./) { - $client =~ s/^::ffff://; - } - } else { - ($sport, $clientn) = sockaddr_in($saddr); - $clientip = inet_ntoa($clientn); - $client = gethostbyaddr($clientn, AF_INET); - } + my $clientip = $msg->{sockaddr}; + $sport=$msg->{sport}; if ($data =~ /^\037\213/) { # per rfc 1952, these two bytes are gzip, and they are invalid for # xcatrequest xml, so go ahead and decompress it my $bigdata; @@ -663,12 +647,10 @@ sub do_discovery_process { } my $req = eval { XMLin($data, SuppressEmpty => undef, ForceArray => 1) }; if ($req and $req->{command} and ($req->{command}->[0] eq "findme" and $sport < 1000)) { # only consider priveleged port requests to start with - $req->{'_xcat_clienthost'} = $client; $req->{'_xcat_clientip'} = $clientip; $req->{'_xcat_clientport'} = $sport; if (defined($cmd_handlers{"findme"}) and xCAT::NetworkUtils->nodeonmynet($clientip)) { # only discover from ips that appear to be on a managed network xCAT::MsgUtils->message("S", "xcatd: Processing discovery request from " . $req->{'_xcat_clientip'}); - # Using cacheonly will cause the discovery processing running 2 times, cacheonly seems useless for switch.pm, so remove it #$req->{cacheonly}->[0] = 1; #plugin_command($req,undef,\&build_response); @@ -678,7 +660,7 @@ sub do_discovery_process { #} } else { - xCAT::MsgUtils->message("S", "xcatd: Skipping discovery from " . $client . " because we either have no discovery plugins or the client address does not match an IP network that xCAT is managing"); + xCAT::MsgUtils->message("S", "xcatd: Skipping discovery from " . $clientip . " because we either have no discovery plugins or the client address does not match an IP network that xCAT is managing"); } } } @@ -801,21 +783,31 @@ sub do_udp_service { # This function opens up a UDP port foreach my $pkey (keys %packets) { my $saddr = $packets{$pkey}->[0]; $data = $packets{$pkey}->[1]; - my ($err, $srcip, $servicename) = Socket::getnameinfo($saddr,Socket::NI_NUMERICHOST,Socket::NIx_NOSERV); - + my $sport; + my $clientip; + my $clientn; + if ($inet6support) { + ($clientip, $sport) = Socket6::getnameinfo($saddr, Socket6::NI_NUMERICHOST()); + if ($clientip =~ /::ffff:.*\..*\./) { + $clientip =~ s/^::ffff://; + } + } else { + ($sport, $clientn) = sockaddr_in($saddr); + $clientip = inet_ntoa($clientn); + } if ($data =~ /^\037\213/) { # per rfc 1952, these two bytes are gzip, and they are invalid for - store_fd({ data => $data, sockaddr => $saddr }, $discoctl); # for now, punt the gunzip to the worker process + store_fd({ data => $data, sockaddr => $clientip, sport => $sport }, $discoctl); # for now, punt the gunzip to the worker process #notify the client that its request is been processing - my $ret=xCAT::Utils->send_tcp_msg($srcip,3001,"processing"); + my $ret=xCAT::NetworkUtils->send_tcp_msg($clientip,3001,"processing"); if($ret){ - xCAT::MsgUtils->message("S", "INFO xcatd: fail to notify $srcip that its 'findme' request is been processing"); + xCAT::MsgUtils->message("S", "INFO xcatd: fail to notify $clientip that its 'findme' request is been processing"); } } elsif ($data =~ /^ $data, sockaddr => $saddr }, $discoctl); + store_fd({ data => $data, sockaddr => $clientip, sport => $sport }, $discoctl); #notify the client that its request is been processing - my $ret=xCAT::Utils->send_tcp_msg($srcip,3001,"processing"); + my $ret=xCAT::NetworkUtils->send_tcp_msg($clientip,3001,"processing"); if($ret){ - xCAT::MsgUtils->message("S", "INFO xcatd: fail to notify $srcip that its 'findme' request is been processing"); + xCAT::MsgUtils->message("S", "INFO xcatd: fail to notify $clientip that its 'findme' request is been processing"); } } else { # for *now*, we'll do a tiny YAML subset From f4c047d018c8f82388e6a176877a4d378e64f0d5 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Thu, 17 Aug 2017 15:45:21 +0800 Subject: [PATCH 052/251] Revise the test case confignetwork_static_installnic --- xCAT-test/autotest/testcase/confignetwork/cases0 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-test/autotest/testcase/confignetwork/cases0 b/xCAT-test/autotest/testcase/confignetwork/cases0 index 535bd9245..4ccd5bb3e 100644 --- a/xCAT-test/autotest/testcase/confignetwork/cases0 +++ b/xCAT-test/autotest/testcase/confignetwork/cases0 @@ -945,6 +945,8 @@ cmd:xdsh $$CN "mkdir -p /tmp/backupnet" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi check:rc==0 +cmd:xdsh $$CN 'killall dhclient' +cmd:xdsh $$CN 'killall -KILL dhclient' cmd:xdsh $$CN 'rm -f /var/lib/dhcp/dhclient.leases /var/lib/dhclient/dhclient.leases' check:rc==0 cmd:updatenode $$CN 'confignetwork -s' @@ -955,4 +957,5 @@ check:rc==0 cmd:test -e /tmp/CN.stanza && rmdef $$CN && mkdef -z Date: Thu, 17 Aug 2017 16:06:32 +0800 Subject: [PATCH 053/251] Add test case confignetwork_ib_ipoib --- xCAT-test/autotest/testcase/infiniband/cases0 | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 xCAT-test/autotest/testcase/infiniband/cases0 diff --git a/xCAT-test/autotest/testcase/infiniband/cases0 b/xCAT-test/autotest/testcase/infiniband/cases0 new file mode 100644 index 000000000..a4b366c1a --- /dev/null +++ b/xCAT-test/autotest/testcase/infiniband/cases0 @@ -0,0 +1,25 @@ +start:confignetwork_ib_ipoib +description: this case is to test confignetwork could configure secondarynic successfully with updatenode. +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi +check:rc==0 +cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=ib0 +check:rc==0 +cmd:chdef $$CN nicips.ib0=11.1.0.100 nictypes.ib0=infiniband nicnetworks.ib0=11_1_0_0-255_255_0_0 +check:rc==0 +cmd:updatenode $$CN -P confignetwork +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-ib0"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-ib0"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/ib0";else echo "Sorry,this is not supported os"; fi +check:output=~11.1.0.100 +cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev ib0" +cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-ib0"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-ib0"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/ib0";else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/";else echo "Sorry,this is not supported os"; fi +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" +end From c8ee22034d7cbffe4500da6a2019b55dc54fd9da Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 17 Aug 2017 10:45:10 -0400 Subject: [PATCH 054/251] Manpage and usage improvements --- .../source/guides/admin-guides/references/man1/rflash.1.rst | 6 +++++- perl-xCAT/xCAT/Usage.pm | 4 +++- xCAT-client/pods/man1/rflash.1.pod | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rflash.1.rst b/docs/source/guides/admin-guides/references/man1/rflash.1.rst index 84d176e49..dbece0af2 100644 --- a/docs/source/guides/admin-guides/references/man1/rflash.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rflash.1.rst @@ -57,7 +57,11 @@ OpenPOWER OpenBMC specific : ============================ -\ **rflash**\ \ *noderange*\ [\ *tar_file_path*\ | \ *image_id*\ ] [\ **-c | -**\ **-check**\ ] [\ **-a | -**\ **-activate**\ ] [\ **-l | -**\ **-list**\ ] [\ **-u | -**\ **-upload**\ ] [\ **-d | -**\ **-delete**\ ] +\ **rflash**\ \ *noderange*\ {[\ **-c | -**\ **-check**\ ] | [\ **-l | -**\ **-list**\ ]} + +\ **rflash**\ \ *noderange*\ \ *tar_file_path*\ {[\ **-c | -**\ **-check**\ ] | [\ **-u | -**\ **-upload**\ ]} + +\ **rflash**\ \ *noderange*\ \ *image_id*\ {[\ **-a | -**\ **-activate**\ ] | [\ **-d | -**\ **-delete**\ ]} diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index b0c78d73b..b41fa6ab9 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -345,7 +345,9 @@ my %usage = ( OpenPOWER BMC specific (using IPMI): rflash [|-d=] [-c|--check] [--retry=] [-V] OpenPOWER OpenBMC specific: - rflash [|] [-c|--check] [-a|--activate] [-l|--list] [-u|--upload] [-d|--delete]", + rflash {[-c|--check] | [-l|--list]} + rflash {[-c|--check] | [-u|--upload]} + rflash {[-a|--activate] | [-d|--delete]}", "mkhwconn" => "Usage: mkhwconn [-h|--help] diff --git a/xCAT-client/pods/man1/rflash.1.pod b/xCAT-client/pods/man1/rflash.1.pod index 70c964d15..ac2de5adc 100644 --- a/xCAT-client/pods/man1/rflash.1.pod +++ b/xCAT-client/pods/man1/rflash.1.pod @@ -28,7 +28,11 @@ B I [I | B<-d=>I] [B<-c>|B<--c =head2 OpenPOWER OpenBMC specific : -B I [I | I] [B<-c>|B<--check>] [B<-a>|B<--activate>] [B<-l>|B<--list>] [B<-u>|B<--upload>] [B<-d>|B<--delete>] +B I {[B<-c>|B<--check>] | [B<-l>|B<--list>]} + +B I I {[B<-c>|B<--check>] | [B<-u>|B<--upload>]} + +B I I {[B<-a>|B<--activate>] | [B<-d>|B<--delete>]} =head1 B From 425188dd7903ebd43501f3a8bc10d117412a6c62 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 17 Aug 2017 21:56:54 -0400 Subject: [PATCH 055/251] fix some typo in case makedhcp_remote_network --- xCAT-test/autotest/testcase/makedhcp/cases0 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-test/autotest/testcase/makedhcp/cases0 b/xCAT-test/autotest/testcase/makedhcp/cases0 index 417f3f5a8..d676640ba 100644 --- a/xCAT-test/autotest/testcase/makedhcp/cases0 +++ b/xCAT-test/autotest/testcase/makedhcp/cases0 @@ -189,13 +189,13 @@ check:rc==0 cmd: cp -f /etc/hosts /etc/hosts.bak cmd:echo "100.100.100.2 testnode" >> /etc/hosts check:rc==0 -cmd:makdhcp -d testnode +cmd:makedhcp -d testnode cmd:makedhcp testnode check:rc==0 -cmd:makdhcp -q testnode +cmd:makedhcp -q testnode check:rc==0 check:output=~testnode: ip-address = 100.100.100.2 -cmd:makdhcp -d testnode +cmd:makedhcp -d testnode check:rc==0 cmd:makedhcp -n check:rc==0 From ff7e52b304aa1276e401b823b5e61fcc83be1ffa Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 17 Aug 2017 22:03:57 -0400 Subject: [PATCH 056/251] rspconfig ip to dhcp for openbmc --- xCAT-server/lib/xcat/plugins/openbmc.pm | 45 +++++++++++++++++++------ 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 00ffa21dc..6aade674d 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -277,6 +277,14 @@ my %status_info = ( RSPCONFIG_SET_RESPONSE => { process => \&rspconfig_response, }, + RSPCONFIG_DHCP_REQUEST => { + method => "POST", + init_url => "$openbmc_project_url/network/action/Reset", + data => "[]", + }, + RSPCONFIG_DHCP_RESPONSE => { + process => \&rspconfig_response, + }, RSPCONFIG_SSHCFG_REQUEST => { method => "GET", init_url => "", @@ -553,7 +561,6 @@ sub parse_args { # # disable function until fully tested # - $check = unsupported($callback); # Check later for each subcommand: if (ref($check) eq "ARRAY") { return $check; } my $setorget; foreach $subcommand (@ARGV) { if ($subcommand =~ /^(\w+)=(.*)/) { @@ -564,9 +571,12 @@ sub parse_args { my $nodes_num = @$noderange; return ([ 1, "Invalid parameter for option $key" ]) unless ($value); - return ([ 1, "Invalid parameter for option $key: $value" ]) unless (xCAT::NetworkUtils->isIpaddr($value)); + return ([ 1, "Invalid parameter for option $key: $value" ]) if ($key != "ip" and !xCAT::NetworkUtils->isIpaddr($value)); if ($key eq "ip") { return ([ 1, "Can not configure more than 1 nodes' ip at the same time" ]) if ($nodes_num >= 2); + if ($value != "dhcp" and !xCAT::NetworkUtils->isIpaddr($value)) { + return ([ 1, "Invalid parameter for option $key: $value" ]); + } } $setorget = "set"; if (ref($check) eq "ARRAY") { return $check; } @@ -791,15 +801,23 @@ sub parse_command_status { } elsif ($subcommand =~ /^(\w+)=(.+)/) { my $key = $1; my $value = $2; - $next_status{LOGIN_RESPONSE} = "RSPCONFIG_SET_REQUEST"; - $next_status{RSPCONFIG_SET_REQUEST} = "RSPCONFIG_SET_RESPONSE"; - $next_status{RSPCONFIG_SET_RESPONSE} = "RSPCONFIG_GET_REQUEST"; - $next_status{RSPCONFIG_GET_REQUEST} = "RSPCONFIG_GET_RESPONSE"; - if ($key eq "ip") { - $status_info{RSPCONFIG_SET_RESPONSE}{ip} = $value; + if ($key eq "ip" and $value eq "dhcp") { + $next_status{LOGIN_RESPONSE} = "RSPCONFIG_DHCP_REQUEST"; + $next_status{RSPCONFIG_DHCP_REQUEST} = "RSPCONFIG_DHCP_RESPONSE"; + $next_status{RSPCONFIG_DHCP_RESPONSE} = "RPOWER_BMCREBOOT_REQUEST"; + $next_status{RPOWER_BMCREBOOT_REQUEST} = "RPOWER_RESET_RESPONSE"; + $status_info{RPOWER_RESET_RESPONSE}{argv} = "bmcreboot"; + } else { + $next_status{LOGIN_RESPONSE} = "RSPCONFIG_SET_REQUEST"; + $next_status{RSPCONFIG_SET_REQUEST} = "RSPCONFIG_SET_RESPONSE"; + $next_status{RSPCONFIG_SET_RESPONSE} = "RSPCONFIG_GET_REQUEST"; + $next_status{RSPCONFIG_GET_REQUEST} = "RSPCONFIG_GET_RESPONSE"; + if ($key eq "ip") { + $status_info{RSPCONFIG_SET_RESPONSE}{ip} = $value; + } + $status_info{RSPCONFIG_SET_REQUEST}{data} = ""; # wait for interface, ip/netmask/gateway is $value + push @options, $key; } - $status_info{RSPCONFIG_SET_REQUEST}{data} = ""; # wait for interface, ip/netmask/gateway is $value - push @options, $key; } } $status_info{RSPCONFIG_GET_RESPONSE}{argv} = join(",", @options); @@ -1649,6 +1667,13 @@ sub rspconfig_response { xCAT::SvrUtils::sendmsg("$_", $callback, $node) foreach (@output); } + if ($node_info{$node}{cur_status} eq "RSPCONFIG_DHCP_RESPONSE") { + if ($response_info->{'message'} eq $::RESPONSE_OK) { + xCAT::SvrUtils::sendmsg("DHCP", $callback, $node); + xCAT::SvrUtils::sendmsg("Will reset BMC...", $callback, $node); + } + } + if ($next_status{ $node_info{$node}{cur_status} }) { $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }; gen_send_request($node); From 092dea62e9259041fd0ab1502d9f7c23298a7b41 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 17 Aug 2017 23:06:05 -0400 Subject: [PATCH 057/251] refine case makeknownhosts_node_d --- xCAT-test/autotest/testcase/makeknownhosts/cases0 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/makeknownhosts/cases0 b/xCAT-test/autotest/testcase/makeknownhosts/cases0 index afe1e371d..7bd31898b 100644 --- a/xCAT-test/autotest/testcase/makeknownhosts/cases0 +++ b/xCAT-test/autotest/testcase/makeknownhosts/cases0 @@ -33,11 +33,13 @@ description:delete known node entry from $ROOTHOME/.ssh cmd:makeknownhosts $$CN cmd:cat ~/.ssh/known_hosts|grep $$CN check:output=~$$CN +cmd:cat ~/.ssh/known_hosts|grep __GETNODEATTR($$CN,ip)__ +check:rc==0 cmd:makeknownhosts $$CN -d check:rc==0 -cmd:cat ~/.ssh/known_hosts|grep $$CN +cmd:cat ~/.ssh/known_hosts|grep __GETNODEATTR($$CN,ip)__ check:rc!=0 -check:output!~$$CN +check:output!~__GETNODEATTR($$CN,ip)__ end start:makeknownhosts_node_v From 52b1226c68c010883f9406e3a169c27537d2c598 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 18 Aug 2017 02:50:25 -0400 Subject: [PATCH 058/251] fix bug 3718, refine case mkdef_regex_kvm to reduce the false failure --- xCAT-test/autotest/testcase/mkdef/cases1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xCAT-test/autotest/testcase/mkdef/cases1 b/xCAT-test/autotest/testcase/mkdef/cases1 index a19e5d305..b4db39f83 100644 --- a/xCAT-test/autotest/testcase/mkdef/cases1 +++ b/xCAT-test/autotest/testcase/mkdef/cases1 @@ -44,17 +44,17 @@ cmd:chtab node=kvms 'vm.host=|\D+(\d+)\D+(\d+)\D+(\d+)\D+(\d+)|c($1)f($2)x($3)|' check:rc==0 cmd:mkdef -t node -o c01f02x03v04 groups=kvms mgt=kvm check:rc==0 -cmd:chdef c01f02x03v04 -i vmcpus | grep 'vmcpus=2$' +cmd:lsdef c01f02x03v04 -i vmcpus | grep 'vmcpus=2$' check:rc==0 -cmd:chdef c01f02x03v04 -i vmhost | grep 'vmhost=c01f02x03$' +cmd:lsdef c01f02x03v04 -i vmhost | grep 'vmhost=c01f02x03$' check:rc==0 -cmd:chdef c01f02x03v04 -i vmmemory | grep 'vmmemory=3072$' +cmd:lsdef c01f02x03v04 -i vmmemory | grep 'vmmemory=3072$' check:rc==0 -cmd:chdef c01f02x03v04 -i vmnicnicmodel | grep 'vmnicnicmodel=virtio$' +cmd:lsdef c01f02x03v04 -i vmnicnicmodel | grep 'vmnicnicmodel=virtio$' check:rc==0 -cmd:chdef c01f02x03v04 -i vmnics | grep 'vmnics=virbr2$' +cmd:lsdef c01f02x03v04 -i vmnics | grep 'vmnics=virbr2$' check:rc==0 -cmd:chdef c01f02x03v04 -i vmstorage | grep 'vmstorage=dir:///install/vms/vm4$' +cmd:lsdef c01f02x03v04 -i vmstorage | grep 'vmstorage=dir:///install/vms/vm4$' check:rc==0 cmd:rmdef -t node c01f02x03v04 check:rc==0 From 1db1308eb329cc401759860964fd0f4c137072f8 Mon Sep 17 00:00:00 2001 From: Bin Xu Date: Fri, 18 Aug 2017 17:55:28 +0800 Subject: [PATCH 059/251] Fix 3722, move setNodesAttribute out of the node loop --- xCAT-server/lib/xcat/plugins/destiny.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/destiny.pm b/xCAT-server/lib/xcat/plugins/destiny.pm index 6d3aaae6f..ae72167d6 100755 --- a/xCAT-server/lib/xcat/plugins/destiny.pm +++ b/xCAT-server/lib/xcat/plugins/destiny.pm @@ -655,8 +655,8 @@ sub setdestiny { if ($reststates) { $updates->{$_}->{'currchain'} = $reststates; } - $chaintab->setNodesAttribs($updates); } + $chaintab->setNodesAttribs($updates); return getdestiny($flag + 1); } @@ -784,6 +784,7 @@ sub getdestiny { @nodes = ($node); } my $node; + xCAT::MsgUtils->trace(0, "d", "destiny->process_request: getdestiny..."); $restab = xCAT::Table->new('noderes'); my $chaintab = xCAT::Table->new('chain'); my $chainents = $chaintab->getNodesAttribs(\@nodes, [qw(currstate chain)]); From 9f2f40609a9da964bd04d92e6d01d96d768f6359 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Fri, 18 Aug 2017 09:49:36 -0400 Subject: [PATCH 060/251] change network command from "," to space --- xCAT-server/lib/xcat/plugins/pdu.pm | 19 ++++++++++++------- .../lib/xcat/plugins/switchdiscover.pm | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/pdu.pm b/xCAT-server/lib/xcat/plugins/pdu.pm index 2372152f5..5441b87e0 100644 --- a/xCAT-server/lib/xcat/plugins/pdu.pm +++ b/xCAT-server/lib/xcat/plugins/pdu.pm @@ -177,7 +177,7 @@ sub process_request my $subcmd = $exargs[0]; if ($subcmd eq 'sshcfg') { process_sshcfg($noderange, $subcmd, $callback); - }elsif ($subcmd =~ /=/) { + }elsif ($subcmd =~ /ip|netmask|hostname/) { process_netcfg($request, $subreq, $subcmd, $callback); } else { $callback->({ errorcode => [1],error => "The input $command $subcmd is not support for pdu"}); @@ -481,7 +481,7 @@ sub connectTopdu { '-n' set system ip netmask. e.g.:PduManager -i xxx.xxx.xxx.xxx -n xxx.xxx.xxx.xxx example: rspconfig coralpdu hostname=coralpdu - rspconfig coralpdu ip=1.1.1.1,netmask=255.0.0.0 + rspconfig coralpdu ip=1.1.1.1 netmask=255.0.0.0 =cut @@ -496,12 +496,16 @@ sub process_netcfg { my $netmask; my $args; + my $extrargs = $request->{arg}; + my @exargs = ($request->{arg}); + if (ref($extrargs)) { + @exargs = @$extrargs; + } + my $nodes = $request->{node}; my $rsp = {}; - xCAT::MsgUtils->message("I", "set hostname "); - my @cmds = split(/,/,$subcmd); - foreach my $cmd (@cmds) { + foreach my $cmd (@exargs) { my ($key, $value) = split(/=/, $cmd); if ($key =~ /hostname/) { $hostname = $value; @@ -510,14 +514,14 @@ sub process_netcfg { node => $nodes, arg => [ $args ] }, $subreq, 0, 1); if ($::RUNCMD_RC != 0) { - xCAT::MsgUtils->message("I", "xdsh command to set hostname failed"); + xCAT::SvrUtils::sendmsg("xdsh command to set hostname failed", $callback); } }elsif ($key =~ /ip/) { $ip = $value; } elsif ($key =~ /netmask/) { $netmask = $value; } else { - xCAT::MsgUtils->message("I", "rspconfig $cmd is not support yet"); + xCAT::SvrUtils::sendmsg("rspconfig $cmd is not support yet, ignored", $callback); } } @@ -531,6 +535,7 @@ sub process_netcfg { } if ($opt) { my $dshcmd = $args . $opt ; + xCAT::SvrUtils::sendmsg($dshcmd, $callback); #comment this for now, coralPDU on the lab is not support PduManager yet my $output = xCAT::Utils->runxcmd({ command => ['xdsh'], node => $nodes, arg => [ $dshcmd ] }, $subreq, 0, 1); if ($::RUNCMD_RC != 0) { diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index a22b9d1a8..d590d62ce 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -407,7 +407,7 @@ sub process_request { } if (!($result)) { - send_msg( \%request, 0, " No switch found "); + send_msg( \%request, 0, " No $device found "); return; } From 0dbfef1e017ec5e101c7d244d0fa5860e09ddae0 Mon Sep 17 00:00:00 2001 From: XuWei Date: Sun, 20 Aug 2017 22:33:36 -0400 Subject: [PATCH 061/251] modified depending on comments --- xCAT-server/lib/xcat/plugins/openbmc.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 6aade674d..d6835ab7a 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1669,8 +1669,8 @@ sub rspconfig_response { if ($node_info{$node}{cur_status} eq "RSPCONFIG_DHCP_RESPONSE") { if ($response_info->{'message'} eq $::RESPONSE_OK) { - xCAT::SvrUtils::sendmsg("DHCP", $callback, $node); - xCAT::SvrUtils::sendmsg("Will reset BMC...", $callback, $node); + my $bmc_node = "$node BMC"; + xCAT::SvrUtils::sendmsg("Setting IP to DHCP...", $callback, $bmc_node); } } From 337501871f4b4fbeb6dc40c7dcc051c04a0bbfd0 Mon Sep 17 00:00:00 2001 From: XuWei Date: Sun, 20 Aug 2017 22:35:31 -0400 Subject: [PATCH 062/251] modified depending on comments --- xCAT-server/lib/xcat/plugins/openbmc.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index d6835ab7a..e3b70a444 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -561,6 +561,7 @@ sub parse_args { # # disable function until fully tested # + $check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; } my $setorget; foreach $subcommand (@ARGV) { if ($subcommand =~ /^(\w+)=(.*)/) { From c6c8370d488ca0d2d0ea97f7334c7c4f51a27def Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Mon, 21 Aug 2017 13:22:17 +0800 Subject: [PATCH 063/251] Revise InfiniBand test case --- .../infiniband/rhel-infiniband-diskless-install.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh index d9eb79eac..18f61a70e 100755 --- a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh +++ b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh @@ -142,6 +142,13 @@ chmod 0755 "/install/custom/netboot/rh/mlnx.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.po rm -rf "${OSIMAGE_OTHERPKGDIR}" mkdir -p "${OSIMAGE_OTHERPKGDIR}" +mkdir -p "${OSIMAGE_OTHERPKGDIR}"/dkms +[ -f "${DKMS_RPM}" ] +[ "$?" -ne "0" ] && echo "File ${DKMS_RPM} not found." >&2 && exit 1 +cp "${DKMS_RPM}" "${OSIMAGE_OTHERPKGDIR}/dkms" + +( cd "${OSIMAGE_OTHERPKGDIR}" && createrepo . ) + rm -rf "${OSIMAGE_ROOTIMGDIR}" genimage "${OSIMAGE_NAME}" @@ -170,7 +177,7 @@ sleep 5 xdsh "${COMPUTE_NODE}" date [ "$?" -ne "0" ] && echo "Failed connect to compute node via SSH." >&2 && exit 1 -#xdsh "${COMPUTE_NODE}" 'rpm -q cuda' | grep ': cuda-' -#[ "$?" -ne "0" ] && echo "CUDA installation checking failed" >&2 && exit 1 +xdsh "${COMPUTE_NODE}" 'rpm -qa' | grep 'mlnx' +[ "$?" -ne "0" ] && echo "MLNX OFED installation checking failed" >&2 && exit 1 exit 0 From b8ce0c1c8a960d3a4f62c1e232546da708d0aa45 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Mon, 21 Aug 2017 13:27:28 +0800 Subject: [PATCH 064/251] Revise InfiniBand test case --- xCAT-test/autotest/testcase/infiniband/cases0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/infiniband/cases0 b/xCAT-test/autotest/testcase/infiniband/cases0 index a4b366c1a..65fbcc04e 100644 --- a/xCAT-test/autotest/testcase/infiniband/cases0 +++ b/xCAT-test/autotest/testcase/infiniband/cases0 @@ -1,5 +1,5 @@ start:confignetwork_ib_ipoib -description: this case is to test confignetwork could configure secondarynic successfully with updatenode. +description: this case is to test confignetwork could configure the first infiniband interface, ib0, successfully with updatenode. cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" From 4ead5aedb9e37567379fc24caeec5f0d42dc1f4a Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Mon, 21 Aug 2017 13:29:42 +0800 Subject: [PATCH 065/251] Revise InfiniBand test case --- .../infiniband/rhel-infiniband-diskfull-install.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh index ec277a729..6cc575646 100755 --- a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh +++ b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh @@ -133,6 +133,11 @@ chdef "${COMPUTE_NODE}" "postscripts=syslog,remoteshell,syncfiles,mlnxofed_ib_in rm -rf "${OSIMAGE_OTHERPKGDIR}" mkdir -p "${OSIMAGE_OTHERPKGDIR}" +mkdir -p "${OSIMAGE_OTHERPKGDIR}"/dkms +[ -f "${DKMS_RPM}" ] +[ "$?" -ne "0" ] && echo "File ${DKMS_RPM} not found." >&2 && exit 1 +cp "${DKMS_RPM}" "${OSIMAGE_OTHERPKGDIR}/dkms" + makedhcp -n rinstall "${COMPUTE_NODE}" "osimage=${OSIMAGE_NAME}" @@ -154,7 +159,7 @@ sleep 5 xdsh "${COMPUTE_NODE}" date [ "$?" -ne "0" ] && echo "Failed connect to compute node via SSH." >&2 && exit 1 -#xdsh "${COMPUTE_NODE}" 'rpm -q cuda' | grep ': cuda-' -#[ "$?" -ne "0" ] && echo "CUDA installation checking failed" >&2 && exit 1 +xdsh "${COMPUTE_NODE}" 'rpm -qa' | grep 'mlnx' +[ "$?" -ne "0" ] && echo "MLNX OFED installation checking failed" >&2 && exit 1 exit 0 From 1bde69df54933f91aaf906e755c6eba2e784a395 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Mon, 21 Aug 2017 15:25:34 +0800 Subject: [PATCH 066/251] modify xcatconfig testcase for issue 3636 (#3695) * modify xcatconfig testcase for issue 3636 * modify xcatconfig testcase for issue 3636 --- xCAT-test/autotest/testcase/xcatconfig/case0 | 98 +++++++++++++------- 1 file changed, 66 insertions(+), 32 deletions(-) diff --git a/xCAT-test/autotest/testcase/xcatconfig/case0 b/xCAT-test/autotest/testcase/xcatconfig/case0 index 59bfcf65f..294fe2aeb 100644 --- a/xCAT-test/autotest/testcase/xcatconfig/case0 +++ b/xCAT-test/autotest/testcase/xcatconfig/case0 @@ -56,6 +56,7 @@ cmd:mv -f /root/sshbak/* /root/.ssh check:rc==0 cmd:rm -rf /root/sshbak check:rc==0 + end @@ -66,12 +67,12 @@ os:Linux cmd:cp -rf /root/.ssh /root/sshbak check:rc==0 #step2:run command and check the output -cmd:xcatconfig -k -c +cmd:xcatconfig -k -c >/tmp/xcatconfig.test 2>&1 +check:rc==0 +cmd:if [[ `cat /tmp/xcatconfig.test |grep FAILED` ]] || [[ `cat /tmp/xcatconfig.test |grep error` ]] || [[ `cat /tmp/xcatconfig.test |grep "fail"` ]] || [[ `cat /tmp/xcatconfig.test |grep Error` ]];then exit 1;fi +check:rc==0 +cmd:if [[ `cat /tmp/xcatconfig.test |grep "Generated /root/.ssh/id_rsa.pub"` ]] && [[ `cat /tmp/xcatconfig.test |grep "Created xCAT certificate"` ]] && [[ `cat /tmp/xcatconfig.test |grep "Signature ok"` ]];then exit 0;else exit 1;fi check:rc==0 -check:output=~Generated /root/.ssh/id_rsa.pub -check:output=~Created xCAT certificate -check:output=~Signature ok -check:output!=(Fail|fail|Error|error) #step3:To make sure /root/.ssh/id_rsa.pub is regenerated cmd:diff /root/.ssh/id_rsa.pub /root/sshbak/id_rsa.pub check:rc!=0 @@ -85,9 +86,35 @@ cmd:mv -f /root/sshbak/* /root/.ssh check:rc==0 cmd:rm -rf /root/sshbak check:rc==0 +cmd:rm -rf /tmp/xcatconfig.test +check:rc==0 end +start:xcatconfig_c +description:To regenerate cretials +os:Linux +#step1:backup: /etc/xcat/ca /etc/xcat/cert +cmd:cp -r /etc/xcat/ca /etc/xcat/cabak;cp -r /etc/xcat/cert /etc/xcat/certbak + +#step2:run command and check the output +cmd:xcatconfig -c >/tmp/xcatconfig.test 2>&1 +check:rc==0 +cmd:if [[ `cat /tmp/xcatconfig.test |grep FAILED` ]] || [[ `cat /tmp/xcatconfig.test |grep error` ]] || [[ `cat /tmp/xcatconfig.test |grep "fail"` ]] || [[ `cat /tmp/xcatconfig.test |grep Error` ]];then exit 1;fi +check:rc==0 +cmd:if [[ `cat /tmp/xcatconfig.test |grep "Created xCAT certificate"` ]] && [[ `cat /tmp/xcatconfig.test |grep "Signature ok"` ]];then exit 0;else exit 1;fi +check:rc==0 +#step3:make sure the /etc/xcat/ca /etc/xcat/cert is rewrite +cmd:diff /etc/xcat/ca /etc/xcat/cabak +check:rc!=0 +cmd:diff /etc/xcat/cert /etc/xcat/certbak +check:rc!=0 +#step4:restore test environment +cmd:rm -rf /tmp/xcatconfig.test +check:rc==0 +cmd:mv -f /etc/xcat/cabak /etc/xcat/ca ;mv -f /etc/xcat/certbak /etc/xcat/cert +check:rc==0 +end start:xcatconfig_s description:To regenerate node host ssh keys @@ -109,13 +136,13 @@ check:rc!=0 cmd:diff /install/postscripts/hostkeys/ssh_host_rsa_key.pub /install/postscripts/hostkeysbak/ssh_host_rsa_key.pub check:rc!=0 #step5:restore test environment -cmd:mv -f /etc/xcat/hostkeysbak/* /etc/xcat/hostkeys +cmd:rm -rf /etc/xcat/hostkeys/*;mv -f /etc/xcat/hostkeysbak/* /etc/xcat/hostkeys check:rc==0 cmd:rm -rf /etc/xcat/hostkeysbak check:rc==0 -cmd:mv -f /install/postscripts/hostkeysbak/* /install/postscripts/hostkeys +cmd:rm -rf /install/postscripts/hostkeys/*;mv -f /install/postscripts/hostkeysbak/* /install/postscripts/hostkeys check:rc==0 -cmd:rm -rf /install/postscripts/hostkeysbak +cmd:rm -rf /install/postscripts/hostkeysbak;rm -rf /etc/xcat/hostkeysbak check:rc==0 end @@ -128,13 +155,12 @@ check:rc==0 cmd:cp -rf /install/postscripts/hostkeys /install/postscripts/hostkeysbak check:rc==0 #step2:run command and check messages -cmd:xcatconfig -s -c +cmd:xcatconfig -s -c >/tmp/xcatconfig.test 2>&1 +check:rc==0 +cmd:if [[ `cat /tmp/xcatconfig.test |grep FAILED` ]] || [[ `cat /tmp/xcatconfig.test |grep error` ]] || [[ `cat /tmp/xcatconfig.test |grep "fail"` ]] || [[ `cat /tmp/xcatconfig.test |grep Error` ]];then exit 1;fi +check:rc==0 +cmd:if [[ `cat /tmp/xcatconfig.test |grep "Created xCAT certificate"` ]] && [[ `cat /tmp/xcatconfig.test |grep "Generating new node hostkeys"` ]] && [[ `cat /tmp/xcatconfig.test |grep "Signature ok"` ]] && [[ `cat /tmp/xcatconfig.test |grep "Generating SSH2 RSA Key"` ]];then exit 0;else exit 1;fi check:rc==0 -check:output=~Created xCAT certificate -check:output=~Generating new node hostkeys -check:output=~Generating SSH2 RSA Key -check:output=~Signature ok -check:output!=(Fail|fail|Error|error) #step3:Make sure /etc/xcat/hostkeys/ssh_host_rsa_key.pub is regenerated cmd:diff /etc/xcat/hostkeys/ssh_host_rsa_key.pub /etc/xcat/hostkeysbak/ssh_host_rsa_key.pub check:rc!=0 @@ -142,14 +168,16 @@ check:rc!=0 cmd:diff /install/postscripts/hostkeys/ssh_host_rsa_key.pub /install/postscripts/hostkeysbak/ssh_host_rsa_key.pub check:rc!=0 #step5:restore test environment -cmd:mv -f /etc/xcat/hostkeysbak/* /etc/xcat/hostkeys +cmd:rm -rf /etc/xcat/hostkeys/*;mv -f /etc/xcat/hostkeysbak/* /etc/xcat/hostkeys check:rc==0 -cmd:rm -rf /etc/xcat/hostkeysbak -check:rc==0 -cmd:mv -f /install/postscripts/hostkeysbak/* /install/postscripts/hostkeys +cmd:rm -rf /install/postscripts/hostkeys/*;mv -f /install/postscripts/hostkeysbak/* /install/postscripts/hostkeys check:rc==0 cmd:rm -rf /install/postscripts/hostkeysbak check:rc==0 +cmd:rm -rf /tmp/xcatconfig.test +check:rc==0 +cmd:rm -rf /etc/xcat/hostkeysbak;rm -rf /install/postscripts/hostkeysbak +check:rc==0 end start:xcatconfig_d_V @@ -196,16 +224,15 @@ check:rc==0 cmd:cp -rf /root/.ssh /root/sshbak check:rc==0 #prepare data:change existed site.maxssh, and add new key with value -#cmd:chtab key=maxssh site.value=888 -cmd:./install/xcat-core/xCAT-test/autotest/testcase/xcatconfig/change_site_table_values -check:rc==0 cmd:chtab key=testxcatconfigoptiond site.value=test check:rc==0 -#step2: run command and check output -cmd:xcatconfig -i +cmd:chtab key="dhcplease" site.value=43201 +check:rc==0 +#step2: run command and check output +cmd:xcatconfig -i >/tmp/xcatconfig.test 2>&1 +check:rc==0 +cmd:if [[ `cat /tmp/xcatconfig.test |grep FAILED` ]] || [[ `cat /tmp/xcatconfig.test |grep error` ]] || [[ `cat /tmp/xcatconfig.test |grep "Created xCAT certificate"` ]] || [[ `cat /tmp/xcatconfig.test |grep "fail"` ]] || [[ `cat /tmp/xcatconfig.test |grep Error` ]];then exit 1;fi check:rc==0 -check:output!=Created xCAT certificate -check:output!=(Fail|fail|Error|error) #step3: check the test result #xCATd is running cmd:service xcatd status @@ -220,18 +247,21 @@ check:rc==0 cmd:diff /root/.ssh/id_rsa.pub /install/postscripts/_ssh/authorized_keys check:rc==0 #keys in site table are not changed -#cmd:lsdef -t site -i testxcatconfigoptiond | grep "=test$" -cmd:cmd:./install/xcat-core/xCAT-test/autotest/testcase/xcatconfig/verify_site_table_values_is_changed +cmd:lsdef -t site -i testxcatconfigoptiond | grep "=test" check:rc==0 -cmd:lsdef -t site -i maxssh | grep "=888$" +cmd:lsdef -t site -i "dhcplease" | grep "=43201" check:rc==0 #step4.restore test environment -cmd:rm -rf /etc/xcat/hostkeysbak +cmd:rm -rf /etc/xcat/hostkeysbak;rm -rf /install/postscripts/hostkeysbak check:rc==0 cmd:restorexCATdb -p /tmp/xcatconfigtest check:rc==0 +cmd:lsdef -t site -i "dhcplease" | grep "=43200" +check:rc==0 cmd:rm -rf /tmp/xcatconfigtest check:rc==0 +cmd:rm -rf /tmp/xcatconfig.test +check:rc==0 end @@ -254,10 +284,10 @@ check:rc==0 cmd:chtab key=testxcatconfigoptiond site.value=test check:rc==0 #step2: run command and check output -cmd:xcatconfig -u +cmd:xcatconfig -u > /tmp/xcatconfig.test 2>&1 +check:rc==0 +cmd:if [[ `cat /tmp/xcatconfig.test |grep FAILED` ]] || [[ `cat /tmp/xcatconfig.test |grep error` ]] || [[ `cat /tmp/xcatconfig.test |grep "Created xCAT certificate"` ]] || [[ `cat /tmp/xcatconfig.test |grep "fail"` ]] || [[ `cat /tmp/xcatconfig.test |grep Error` ]];then exit 1;fi check:rc==0 -check:output!=Created xCAT certificate -check:output!=(Fail|fail|Error|error) #step3: check the test result #xCATd is running cmd:service xcatd status @@ -279,8 +309,12 @@ check:rc==0 #step4.restore test environment cmd:restorexCATdb -p /tmp/xcatconfigtest check:rc==0 +cmd:rm -rf /etc/xcat/hostkeysbak;rm -rf /install/postscripts/hostkeysbak +check:rc==0 cmd:rm -rf /tmp/xcatconfigtest check:rc==0 +cmd:rm -rf /tmp/xcatconfig.test +check:rc==0 end start:xcatconfig_u_check_xcatsslversion_rhels_sles From c8c1fc276f0c561fae65af9e5cbcd239424edd8c Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 21 Aug 2017 15:12:41 -0400 Subject: [PATCH 067/251] Allow -d flag for rflash --- .../admin-guides/references/man1/rflash.1.rst | 8 +-- perl-xCAT/xCAT/Usage.pm | 2 +- xCAT-client/pods/man1/rflash.1.pod | 6 +- xCAT-server/lib/xcat/plugins/ipmi.pm | 59 ++++++++++++------- 4 files changed, 46 insertions(+), 29 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rflash.1.rst b/docs/source/guides/admin-guides/references/man1/rflash.1.rst index dbece0af2..f5800fc38 100644 --- a/docs/source/guides/admin-guides/references/man1/rflash.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rflash.1.rst @@ -50,7 +50,7 @@ OpenPOWER BMC specific (using IPMI): ==================================== -\ **rflash**\ \ *noderange*\ [\ *hpm_file_path*\ | \ **-d=**\ \ *data_directory*\ ] [\ **-c | -**\ **-check**\ ] [\ **-**\ **-retry=**\ \ *count*\ ] [\ **-V**\ ] +\ **rflash**\ \ *noderange*\ [\ *hpm_file_path*\ | \ **-d**\ \ *data_directory*\ ] [\ **-c | -**\ **-check**\ ] [\ **-**\ **-retry=**\ \ *count*\ ] [\ **-V**\ ] OpenPOWER OpenBMC specific : @@ -172,11 +172,11 @@ The command will update firmware for OpenPOWER OpenBMC when given an OpenPOWER n \ **-d**\ \ *data_directory*\ + PPC (without HMC, using Direct FSP Management) specific: + Specifies the directory where the raw data from rpm packages for each CEC/Frame are located. The default directory is /tmp. The option is only used in Direct FSP/BPA Management. - - -\ **-d=**\ \ *data_directory*\ + OpenPOWER BMC specific (using IPMI): Used for IBM Power S822LC for Big Data systems only. Specifies the directory where the \ **pUpdate**\ utility and at least one of BMC or PNOR update files are located. The utility and update files can be downloaded from FixCentral. diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index b41fa6ab9..244142d14 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -343,7 +343,7 @@ my %usage = ( rflash [--commit | --recover] [-V|--verbose] rflash [--bpa_acdl] OpenPOWER BMC specific (using IPMI): - rflash [|-d=] [-c|--check] [--retry=] [-V] + rflash [|-d ] [-c|--check] [--retry=] [-V] OpenPOWER OpenBMC specific: rflash {[-c|--check] | [-l|--list]} rflash {[-c|--check] | [-u|--upload]} diff --git a/xCAT-client/pods/man1/rflash.1.pod b/xCAT-client/pods/man1/rflash.1.pod index ac2de5adc..79c21a313 100644 --- a/xCAT-client/pods/man1/rflash.1.pod +++ b/xCAT-client/pods/man1/rflash.1.pod @@ -24,7 +24,7 @@ B I I =head2 OpenPOWER BMC specific (using IPMI): -B I [I | B<-d=>I] [B<-c>|B<--check>] [B<--retry=>I] [B<-V>] +B I [I | B<-d> I] [B<-c>|B<--check>] [B<--retry=>I] [B<-V>] =head2 OpenPOWER OpenBMC specific : @@ -115,9 +115,11 @@ Specifies the directory where the packages are located. =item B<-d> I +PPC (without HMC, using Direct FSP Management) specific: + Specifies the directory where the raw data from rpm packages for each CEC/Frame are located. The default directory is /tmp. The option is only used in Direct FSP/BPA Management. -=item B<-d=>I +OpenPOWER BMC specific (using IPMI): Used for IBM Power S822LC for Big Data systems only. Specifies the directory where the B utility and at least one of BMC or PNOR update files are located. The utility and update files can be downloaded from FixCentral. diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 666e3bfd6..2e9f4f582 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1930,6 +1930,13 @@ sub do_firmware_update { $buffer_size = "15000"; } + my $directory_name; + if (@{ $sessdata->{extraargs} } > 1) { + @ARGV = @{ $sessdata->{extraargs} }; + use Getopt::Long; + GetOptions('d:s' => \$directory_name); + } + # check verbose, buffersize, and retry options for my $opt (@{$sessdata->{'extraargs'}}) { if ($opt =~ /-V{1,4}/) { @@ -1962,28 +1969,24 @@ sub do_firmware_update { } } } - if ($opt =~ /-d=/) { - my ($attribute, $directory_name) = split(/=/, $opt); - if (defined $directory_name) { - unless (File::Spec->file_name_is_absolute($directory_name)) { - # Directory name was passed in as relative path, prepend current working dir - $directory_name = xCAT::Utils->full_path($directory_name, $::cwd); - } - # directory was passed in, verify it is valid - if (-d $directory_name) { - # Passed in directory name exists - $pUpdate_directory = $directory_name; - } - else { - $exit_with_error_func->($sessdata->{node}, $callback, - "Can not access data directory $directory_name"); - } + + if (defined $directory_name) { + unless (File::Spec->file_name_is_absolute($directory_name)) { + # Directory name was passed in as relative path, prepend current working dir + $directory_name = xCAT::Utils->full_path($directory_name, $::cwd); + } + # directory was passed in, verify it is valid + if (-d $directory_name) { + # Passed in directory name exists + $pUpdate_directory = $directory_name; } else { - $exit_with_error_func->($sessdata->{node}, $callback, - "Data directory must be specified."); + $exit_with_error_func->($sessdata->{node}, $callback, "Can not access data directory $directory_name"); } } + else { + $exit_with_error_func->($sessdata->{node}, $callback, "Data directory must be specified."); + } } # For IBM Power S822LC for Big Data (Supermicro) machines such as @@ -1997,10 +2000,15 @@ sub do_firmware_update { "Directory name is required to update Boston or Briggs machines."); } + # Verify specified directory contains pUpdate utility + unless (-e "$pUpdate_directory/pUpdate") { + $exit_with_error_func->($sessdata->{node}, $callback, + "Can not find pUpdate utility in data directory $pUpdate_directory."); + } # Verify specified directory contains executable pUpdate utility unless (-x "$pUpdate_directory/pUpdate") { $exit_with_error_func->($sessdata->{node}, $callback, - "Can not find executable pUpdate utility in data directory $pUpdate_directory."); + "Execute permission is not set for pUpdate utility in data directory $pUpdate_directory."); } # Verify there is at least one of update files inside data directory - .bin or .pnor @@ -2389,6 +2397,7 @@ RETRY_UPGRADE: sub rflash { my $sessdata = shift; + my $directory_flag = 0; if (isopenpower($sessdata)) { # Do firmware update for firestone here. @@ -2397,10 +2406,16 @@ sub rflash { if ($opt =~ /^(-c|--check)$/i) { $sessdata->{subcommand} = "check"; # support verbose options for ipmitool command - } elsif ($opt !~ /.*\.hpm$/i && $opt !~ /^-V{1,4}$|^--buffersize=|^--retry=|^-d=/) { - $callback->({ error => "The option $opt is not supported or invalid update file specified", + } elsif ($opt =~ /^-d$/) { + # special handling if -d option which can be followed by a directory name + $directory_flag = 1; # set a flag that directory option was given + } elsif ($opt !~ /.*\.hpm$/i && $opt !~ /^-V{1,4}$|^--buffersize=|^--retry=/) { + # An unexpected flag was passed, but it could be a directory name. Display error only if not -d option + unless ($directory_flag) { + $callback->({ error => "The option $opt is not supported or invalid update file specified", errorcode => 1 }); - return; + return; + } } } From a263773b159dccee0698c37bfe953d8bdbf42ba2 Mon Sep 17 00:00:00 2001 From: Bin Xu Date: Tue, 22 Aug 2017 10:21:00 +0800 Subject: [PATCH 068/251] Set xcatmaster to facing IP in priority when the node is managed by service node. (#3696) * Fix #3428, set xcatmaster to facing IP in priority when the node is mananged by service node. * Always using my facing IP first than site.master * remove non-used variable sitemaster --- xCAT-server/lib/perl/xCAT/Template.pm | 29 +++++++++++++-------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index d1415fa3a..012163b8b 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -82,9 +82,9 @@ sub subvars { close($inh); #the logic to determine the $ENV{XCATMASTER} confirm to the following priority(from high to low): - #the "xcatmaster" attribute of the node - #the site.master - #the ip address of the mn facing the compute node + ## 1, the "xcatmaster" attribute of the node + ## 2, the ip address of the mn/sn facing the compute node + ## 3, the site.master my $master; #the "xcatmaster" attribute of the node @@ -94,16 +94,6 @@ sub subvars { $master = $et->{'xcatmaster'}; } - unless ($master) { - - #the site.master - my @masters = xCAT::TableUtils->get_site_attribute("master"); - my $tmp = $masters[0]; - if (defined($tmp)) { - $master = $tmp; - } - } - unless ($master) { #the ip address of the mn facing the compute node @@ -115,14 +105,23 @@ sub subvars { } } + unless ($master) { + + #the site.master + my @masters = xCAT::TableUtils->get_site_attribute("master"); + my $tmp = $masters[0]; + if (defined($tmp)) { + $master = $tmp; + } + } + unless ($master) { $tmplerr = "Unable to identify master for $node"; return; } $ENV{XCATMASTER} = $master; - - my ($host, $ipaddr) = xCAT::NetworkUtils->gethostnameandip($master); + my $ipaddr = xCAT::NetworkUtils->getipaddr($master); if ($ipaddr) { $ENV{MASTER_IP} = "$ipaddr"; } From adc81c0cbba6fc8776882e24fd113d67e7f3fe67 Mon Sep 17 00:00:00 2001 From: Matt Ezell Date: Mon, 21 Aug 2017 23:06:23 -0400 Subject: [PATCH 069/251] Install the cumulus license from cumulusztp (#3731) --- xCAT/postscripts/cumulusztp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xCAT/postscripts/cumulusztp b/xCAT/postscripts/cumulusztp index d1403edeb..6fdc7a537 100755 --- a/xCAT/postscripts/cumulusztp +++ b/xCAT/postscripts/cumulusztp @@ -114,6 +114,20 @@ else logger -s -t "xcat.cumulusztp" -p local4.info "SNMP enabled!" fi +#install license, if needed +cl-license > /dev/null 2>&1 +rc=$? +if [ "$rc" != "0" ];then + if cl-license -i http://$server_ip/install/custom/sw_os/cumulus/licensefile.txt; then + logger -s -t "xcat.cumulusztp" -p local4.info "installed Cumulus license" + systemctl enable switchd + systemctl start switchd + else + logger -s -t "xcat.cumulusztp" -p local4.err "failed to install Cumulus license" + echo "failed to install Cumulus license" + fi +fi + #config base interface ./configinterface rc=$? From 940a0b6dd4f3945021ee9aa516b67df487e6d78e Mon Sep 17 00:00:00 2001 From: Matt Ezell Date: Tue, 22 Aug 2017 02:39:36 -0400 Subject: [PATCH 070/251] Allow the cumulus discovery listener to accept multiple messages (#3732) --- xCAT/postscripts/documulusdiscovery | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xCAT/postscripts/documulusdiscovery b/xCAT/postscripts/documulusdiscovery index a6f8bae60..c9ab88695 100755 --- a/xCAT/postscripts/documulusdiscovery +++ b/xCAT/postscripts/documulusdiscovery @@ -17,7 +17,8 @@ EOF #listen to the 3001 port for any response from xcatd on MN #the message in the response will be written to /tmp/result.socat.out -socat TCP4-LISTEN:3001,reuseaddr EXEC:"/tmp/helper.socat.sh" & +socat TCP4-LISTEN:3001,reuseaddr,fork EXEC:"/tmp/helper.socat.sh" & +LISTENER_PID=$! #generate key pairs for the SSL connection between switch and xcatd on MN mkdir -p /etc/xcat @@ -86,6 +87,7 @@ gzip -9 /tmp/discopacket if [ -z "$XCATMASTER" ] || [ -z "$XCATPORT" ]; then logger -s -t $log_label -p local4.err "Failed to get xcatd connection information, exit..." + kill $LISTENER_PID rm -rf /tmp/result.socat.out rm -rf /tmp/helper.socat.sh exit 1 @@ -119,6 +121,7 @@ while [ $RETRY -lt $MAX_RETRY ]; do ((RETRY=RETRY+1)) done +kill $LISTENER_PID rm -rf /tmp/result.socat.out rm -rf /tmp/helper.socat.sh From 9e6785be64e4940f750c21674a98a2d6ec52a603 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Tue, 22 Aug 2017 03:27:49 -0400 Subject: [PATCH 071/251] refine cases to reduce false error --- xCAT-test/autotest/testcase/updatenode/cases3 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/updatenode/cases3 b/xCAT-test/autotest/testcase/updatenode/cases3 index 675d23ed2..73c0008f0 100644 --- a/xCAT-test/autotest/testcase/updatenode/cases3 +++ b/xCAT-test/autotest/testcase/updatenode/cases3 @@ -8,9 +8,10 @@ cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-inst check:rc==0 cmd:updatenode $$CN -F >/tmp/updatenode.F.out check:rc!=0 -cmd:grep 'updatenode exited with code 1' /tmp/updatenode.F.out +cmd:grep '"/tmp/non-existent" failed: No such file or directory' /tmp/updatenode.F.out check:rc==0 cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists= check:rc==0 cmd:rm -f /install/custom/install/__GETNODEATTR($$CN,os)__/booboo.synclist +cmd:rm -rf /tmp/updatenode.F.out end From e58dc0674f5046f945400b125af2dd340830e38c Mon Sep 17 00:00:00 2001 From: Matt Ezell Date: Tue, 22 Aug 2017 22:28:47 -0400 Subject: [PATCH 072/251] Send MTM in documulusdiscovery to support MTMS discovery (#3742) --- xCAT/postscripts/documulusdiscovery | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT/postscripts/documulusdiscovery b/xCAT/postscripts/documulusdiscovery index c9ab88695..8b0c612b1 100755 --- a/xCAT/postscripts/documulusdiscovery +++ b/xCAT/postscripts/documulusdiscovery @@ -43,6 +43,7 @@ logger -s -t $log_label -p local4.info "Beginning switch discovery process..." #grab the switch information dmidweinfo=$(/usr/sbin/dmidecode 2>/dev/null) PRODUCTNAME=$(echo "$dmidweinfo"|grep "Product Name"|cut -d: -f2|sed -e 's/^\s*//' -e 's/\s*$//') +VENDOR=$(echo "$dmidweinfo"|grep "Manufacturer"|cut -d: -f2|sed -e 's/^\s*//' -e 's/\s*$//') MTM=$PRODUCTNAME ARCH=$(uname -m) SERIAL=$(echo "$dmidweinfo"|grep "Serial Number"|cut -d: -f2|sed -e 's/^\s*//' -e 's/\s*$//') @@ -54,7 +55,8 @@ echo "1" >> /tmp/discopacket echo "switch" >> /tmp/discopacket echo "$ARCH" >> /tmp/discopacket #echo "$MTM" >> /tmp/discopacket -echo "$MTM" >> /tmp/discopacket +echo "$VENDOR" >> /tmp/discopacket +echo "$MTM" >> /tmp/discopacket echo "$SERIAL" >> /tmp/discopacket MAC_OF_FIRST_UP_NIC=$(ip addr show eth0|grep "link/ether"|awk -F' ' '{print $2}') From 0b62a94bd5f973f4b4231fa087f10787d2329d98 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Wed, 23 Aug 2017 14:17:50 +0800 Subject: [PATCH 073/251] Make the Infiniband integration test case run with xCAT-test --- xCAT-test/autotest/testcase/infiniband/cases0 | 10 ++++++++++ .../infiniband/rhel-infiniband-diskfull-install.sh | 3 +++ .../infiniband/rhel-infiniband-diskless-install.sh | 3 +++ 3 files changed, 16 insertions(+) diff --git a/xCAT-test/autotest/testcase/infiniband/cases0 b/xCAT-test/autotest/testcase/infiniband/cases0 index 65fbcc04e..c66b66ca7 100644 --- a/xCAT-test/autotest/testcase/infiniband/cases0 +++ b/xCAT-test/autotest/testcase/infiniband/cases0 @@ -1,3 +1,13 @@ +start:rhel_infiniband_diskless_install +cmd:RHEL_ISO="$$ISO" LINUX_DISTRO="$$OS" COMPUTE_NODE="$$CN" MLNX_ISO="$$MLNX" DKMS_RPM="$$DKMS" /opt/xcat/share/xcat/tools/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh +check:rc==0 +end + +start:rhel_infiniband_diskfull_install +cmd:RHEL_ISO="$$ISO" LINUX_DISTRO="$$OS" COMPUTE_NODE="$$CN" MLNX_ISO="$$MLNX" DKMS_RPM="$$DKMS" /opt/xcat/share/xcat/tools/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh +check:rc==0 +end + start:confignetwork_ib_ipoib description: this case is to test confignetwork could configure the first infiniband interface, ib0, successfully with updatenode. cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi diff --git a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh index 6cc575646..66ceb74fe 100755 --- a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh +++ b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh @@ -3,9 +3,12 @@ ######## # Set all the variables below +[ -n "$LINUX_DISTRO" ] && LINUX_DISTRO="rhels7.4" +[ -n "$LINUX_ARCH" ] && LINUX_ARCH="ppc64le" +[ -n "$COMPUTE_NODE" ] && COMPUTE_NODE="c910f03c01p10" SOURCE_DIR="/media/xcat" diff --git a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh index 18f61a70e..a5aad0e07 100755 --- a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh +++ b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh @@ -3,9 +3,12 @@ ######## # Set all the variables below +[ -n "$LINUX_DISTRO" ] && LINUX_DISTRO="rhels7.4" +[ -n "$LINUX_ARCH" ] && LINUX_ARCH="ppc64le" +[ -n "$COMPUTE_NODE" ] && COMPUTE_NODE="c910f03c01p10" SOURCE_DIR="/media/xcat" From 227e91a77174aa1ad502aed02e8b2de2fce8fa85 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Wed, 23 Aug 2017 15:30:19 +0800 Subject: [PATCH 074/251] Fix test case xdcp_nonroot_user --- xCAT-test/autotest/testcase/xdcp/cases1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/xdcp/cases1 b/xCAT-test/autotest/testcase/xdcp/cases1 index c27c54d1e..d5ab8a723 100644 --- a/xCAT-test/autotest/testcase/xdcp/cases1 +++ b/xCAT-test/autotest/testcase/xdcp/cases1 @@ -1,7 +1,7 @@ start:xdcp_nonroot_user cmd:useradd -m xyzzy check:rc==0 -cmd:( cd ~ && tar cf - .xcat .ssh ) | ( cd ~xyzzy && tar xf - ) +cmd:bash -c "( cd ~root && tar cf - .xcat .ssh ) | ( cd ~xyzzy && tar xf - )" check:rc==0 cmd:chown -R xyzzy ~xyzzy/.xcat ~xyzzy/.ssh check:rc==0 From 7401d38eb729c5b70081da668f6a6dc351d2e08d Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 23 Aug 2017 06:56:14 -0400 Subject: [PATCH 075/251] modify reventlog testcase for code change --- xCAT-test/autotest/testcase/reventlog/cases0 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/xCAT-test/autotest/testcase/reventlog/cases0 b/xCAT-test/autotest/testcase/reventlog/cases0 index cbb3aceba..1bbca123e 100644 --- a/xCAT-test/autotest/testcase/reventlog/cases0 +++ b/xCAT-test/autotest/testcase/reventlog/cases0 @@ -16,7 +16,5 @@ end start:reventlog_numofentries cmd:reventlog $$CN 5 check:rc==0 -check:output=~$$CN\s*:\s*.*\d\d/\d\d/\d\d\s*\S+|$$CN: no SEL entries -cmd:reventlog $$CN 3 | wc -l -check:output=~\s*1\s* +check:output=~$$CN\s*:\s*.*\d\d/\d\d/\d\d\s*\S+|$$CN: no SEL entries|Entry end From cfd26808c6a52fdae7f34fb79d112ff13a030e01 Mon Sep 17 00:00:00 2001 From: tingtli Date: Wed, 23 Aug 2017 16:14:20 +0800 Subject: [PATCH 076/251] add service node pool cases, for bug #3632 (#3699) * add service node pool cases, for bug #3632 * update cases according to comments * update according to comments --- ..._set_xcatmaster_in_sn_pool_tftp_mount_mode | 165 +++++++++++++++++ ...ter_in_sn_pool_tftp_mount_mode_checkresult | 49 ++++++ .../set_xcatmaster_in_sn_pool_tftp_mount_mode | 166 ++++++++++++++++++ ...ter_in_sn_pool_tftp_mount_mode_checkresult | 49 ++++++ .../snpool/setup_sn_pool_tftp_mount_mode | 119 +++++++++++++ 5 files changed, 548 insertions(+) create mode 100644 xCAT-test/autotest/testcase/snpool/not_set_xcatmaster_in_sn_pool_tftp_mount_mode create mode 100644 xCAT-test/autotest/testcase/snpool/not_set_xcatmaster_in_sn_pool_tftp_mount_mode_checkresult create mode 100644 xCAT-test/autotest/testcase/snpool/set_xcatmaster_in_sn_pool_tftp_mount_mode create mode 100644 xCAT-test/autotest/testcase/snpool/set_xcatmaster_in_sn_pool_tftp_mount_mode_checkresult create mode 100644 xCAT-test/autotest/testcase/snpool/setup_sn_pool_tftp_mount_mode diff --git a/xCAT-test/autotest/testcase/snpool/not_set_xcatmaster_in_sn_pool_tftp_mount_mode b/xCAT-test/autotest/testcase/snpool/not_set_xcatmaster_in_sn_pool_tftp_mount_mode new file mode 100644 index 000000000..9c3bd2aac --- /dev/null +++ b/xCAT-test/autotest/testcase/snpool/not_set_xcatmaster_in_sn_pool_tftp_mount_mode @@ -0,0 +1,165 @@ +start:not_set_xcatmaster_in_sn_pool_tftp_mount_mode +description: this case is to test when compute nodes' xcatmaster is not set in service node pool environment,compute node's provision files are correctly set after nodeset. +cmd:fdisk -l +cmd:df -T +#cmd:XCAT_DATABASE=$$XCAT_DATABASE /opt/xcat/share/xcat/tools/autotest/testcase/installation/pre_deploy_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__ +cmd:if [ ! -f /etc/xcat/cfgloc ];then XCAT_DATABASE=$$XCAT_DATABASE /opt/xcat/share/xcat/tools/autotest/testcase/installation/pre_deploy_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__;fi +check:rc==0 + +cmd:chtab key=nameservers site.value="" +check:rc==0 + +cmd:makedns -n +check:rc==0 +cmd:makeconservercf $$SN,$$CN +check:rc==0 +cmd:cat /etc/conserver.cf | grep $$SN +check:output=~$$SN +cmd:cat /etc/conserver.cf | grep $$CN +check:output=~$$CN +cmd:sleep 20 +cmd:if [[ "__GETNODEATTR($$SN,arch)__" = "ppc64" ]]; then getmacs -D $$SN -V; fi +check:rc==0 +cmd:if [[ "__GETNODEATTR($$SN,arch)__" = "ppc64" ]]; then getmacs -D $$CN -V; fi +check:rc==0 +cmd:makedhcp -n +check:rc==0 +cmd:makedhcp -a +check:rc==0 +cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$SN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$SN;fi +check:output=~$$SN +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:chdef -t node $$SN,$$CN groups=service,all +check:rc==0 +cmd:chdef -t group -o service profile=service installnic=mac +check:rc==0 +cmd:chdef -t group -o service setupnfs=1 setupdhcp=1 setuptftp=1 setupnameserver=1 setupconserver=1 setupntp=1 +check:rc==0 +cmd:chdef -t group -o service nfsserver= tftpserver= xcatmaster= monserver= +check:rc==0 + +cmd:copycds $$ISO +check:rc==0 + + +cmd:chdef -t site clustersite sharedtftp=0 +check:rc==0 +cmd:chdef -t site clustersite installloc="" +check:rc==0 + +cmd:cd /install/post/otherpkgs/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__/xcat/xcat-core && createrepo . +check:rc==0 + +cmd:if [[ "__GETNODEATTR($$SN,os)__" =~ "rh" ]]; then path="rh";elif [[ "__GETNODEATTR($$SN,os)__" =~ "sles" ]];then path="sles";fi; ver="__GETNODEATTR($$SN,os)__"; tmp=${ver%.*};ver=`echo "$tmp"|sed 's:[a-zA-Z]::g'`;cd /install/post/otherpkgs/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__/xcat/xcat-dep/$path$ver/__GETNODEATTR($$SN,arch)__ && createrepo .; +check:rc==0 + +cmd:chdef -t osimage __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service otherpkgdir=/install/post/otherpkgs/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__ +check:rc==0 + +cmd:if [[ "__GETNODEATTR($$SN,os)__" =~ "rh" ]]; then path="rh";elif [[ "__GETNODEATTR($$SN,os)__" =~ "sles" ]];then path="sles";fi; ver="__GETNODEATTR($$SN,os)__"; chdef -t osimage __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service otherpkglist=/opt/xcat/share/xcat/install/$path/service.${ver%.*}.__GETNODEATTR($$SN,arch)__.otherpkgs.pkglist; +check:rc==0 + +cmd:rinstall $$SN,$$CN osimage=__GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service +check:rc==0 +check:output=~Provision node\(s\)\: $$SN $$CN + +cmd:if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/installation/customize_sleep_for_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__ + +#Check status on SN after SN is installed +cmd:ping $$SN -c 3 +check:rc==0 +check:output=~64 bytes from $$SN +cmd:lsdef -l $$SN | grep status +check:rc==0 +check:output=~booted +cmd:xdsh $$SN date +check:rc==0 +check:output=~\d\d:\d\d:\d\d +#after bug 2586 is fixed, following 2 lines should be removed. +cmd:if [[ "__GETNODEATTR($$SN,os)__" =~ "sles" ]];then xdsh $$SN service xcatd restart; fi +check:rc==0 +cmd:xdsh $$SN "ps -ef |grep xcatd" +check:rc==0 +check:output=~xcatd: +cmd:xdsh $$SN "lsdef" +check:rc==0 +check:output=~$$SN: $$SN +cmd:xdsh $$SN "tabdump site" +check:rc==0 +check:output=~tftpdir +cmd:rsync -auv --exclude 'autoinst' /install $$SN:/ +check:rc==0 + +#Check status on CN after CN is installed since CN is taken as another SN. +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:xdsh $$CN date +check:rc==0 +check:output=~\d\d:\d\d:\d\d +#after bug 2586 is fixed, following 2 lines should be removed. +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "sles" ]];then xdsh $$CN service xcatd restart; fi +check:rc==0 +cmd:xdsh $$CN "ps -ef |grep xcatd" +check:rc==0 +check:output=~xcatd: +cmd:xdsh $$CN "lsdef" +check:rc==0 +check:output=~$$CN: $$CN +cmd:xdsh $$CN "tabdump site" +check:rc==0 +check:output=~tftpdir +cmd:rsync -auv --exclude 'autoinst' /install $$CN:/ +check:rc==0 + +#create a test compute node, don't set it's xcatmaster, set it's service node as SN and CN +cmd:mkdef -t node -o compute1 groups=compute ip=10.0.0.199 mac=4a:c8:f7:de:d0:09 profile=compute os=__GETNODEATTR($$CN,os)__ arch=__GETNODEATTR($$CN,arch)__ netboot=__GETNODEATTR($$CN,netboot)__ +check:rc==0 +cmd:chdef -t node -o compute1 servicenode=$$SN,$$CN xcatmaster= +check:rc==0 +cmd:makehosts compute1 +check:rc==0 +cmd:cat /etc/hosts +check:output=~compute1 +cmd:cp /etc/resolv.conf /etc/resolv.conf.bak +cmd:echo "nameserver $$MN" >> /etc/resolv.conf +check:rc==0 +cmd:makedns -n +check:rc==0 +cmd:makedhcp -n +check:rc==0 +cmd:makedhcp -a +check:rc==0 +cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep compute1;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep compute1;fi +check:output=~compute1 +cmd:if cat /etc/*release |grep SUSE >/dev/null;then xdsh $$SN cat /var/lib/dhcp/db/dhcpd.leases|grep compute1;elif cat /etc/*release |grep "Red Hat" >/dev/null;then xdsh $$SN cat /var/lib/dhcpd/dhcpd.leases|grep compute1;fi +check:output=~compute1 +cmd:if cat /etc/*release |grep SUSE >/dev/null;then xdsh $$CN cat /var/lib/dhcp/db/dhcpd.leases|grep compute1;elif cat /etc/*release |grep "Red Hat" >/dev/null;then xdsh $$CN cat /var/lib/dhcpd/dhcpd.leases|grep compute1;fi +check:output=~compute1 +cmd:nodeset compute1 osimage=__GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-compute +check:rc==0 +check:output=~compute1: install __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-compute +cmd:if [[ "__GETNODEATTR($$CN,netboot)__" =~ "grub2" ]]; then cat /tftpboot/boot/__GETNODEATTR($$CN,netboot)__/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "yaboot" ]];then cat /tftpboot/yaboot.conf*;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "xnba" ]];then cat /tftpboot/xcat/xnba/nodes/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "petitboot" ]];then cat /tftpboot/petitboot/compute1;fi +check:output=~http://$$MN|http://$$MASTERIP|http://${next-server} +cmd:if [[ "__GETNODEATTR($$CN,netboot)__" =~ "grub2" ]]; then xdsh $$SN cat /tftpboot/boot/__GETNODEATTR($$CN,netboot)__/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "yaboot" ]];then xdsh $$SN cat /tftpboot/yaboot.conf*;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "xnba" ]];then xdsh $$SN cat /tftpboot/xcat/xnba/nodes/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "petitboot" ]];then xdsh $$SN cat /tftpboot/petitboot/compute1;fi +check:output=~http://$$SN|http://__GETNODEATTR($$SN,ip)__|http://${next-server} +cmd:if [[ "__GETNODEATTR($$CN,netboot)__" =~ "grub2" ]]; then xdsh $$CN cat /tftpboot/boot/__GETNODEATTR($$CN,netboot)__/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "yaboot" ]];then xdsh $$CN cat /tftpboot/yaboot.conf*;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "xnba" ]];then xdsh $$CN cat /tftpboot/xcat/xnba/nodes/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "petitboot" ]];then xdsh $$CN cat /tftpboot/petitboot/compute1;fi +check:output=~http://$$CN|http://__GETNODEATTR($$CN,ip)__|http://${next-server} + +#process the speicial case when netboot=petitboot, since we have no physical machine test environment at the moment +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64le" ]] && [[ "__GETNODEATTR($$CN,netboot)__" != "petitboot" ]]; then chdef compute1 netboot=petitboot;nodeset compute1 osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute;cat /tftpboot/petitboot/compute1;else echo "http://$$MN";fi +check:output=~http://$$MN|http://$$MASTERIP|http://${next-server} +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64le" ]]; then xdsh $$SN cat /tftpboot/petitboot/compute1;else echo "http://$$SN";fi +check:output=~http://$$SN|http://__GETNODEATTR($$SN,ip)__|http://${next-server} +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64le" ]]; then xdsh $$CN cat /tftpboot/petitboot/compute1;else echo "http://$$CN";fi +check:output=~http://$$CN|http://__GETNODEATTR($$CN,ip)__|http://${next-server} + +cmd:noderm compute1 +check:rc==0 +cmd:cp -f /etc/resolv.conf.bak /etc/resolv.conf +end diff --git a/xCAT-test/autotest/testcase/snpool/not_set_xcatmaster_in_sn_pool_tftp_mount_mode_checkresult b/xCAT-test/autotest/testcase/snpool/not_set_xcatmaster_in_sn_pool_tftp_mount_mode_checkresult new file mode 100644 index 000000000..106bea82f --- /dev/null +++ b/xCAT-test/autotest/testcase/snpool/not_set_xcatmaster_in_sn_pool_tftp_mount_mode_checkresult @@ -0,0 +1,49 @@ +start:not_set_xcatmaster_in_sn_pool_tftp_mount_mode_checkresult +description: this case is to check the configuration files after nodeset for case not_set_xcatmaster_in_sn_pool_tftp_mount_mode + +#create a test compute node, don't set it's xcatmaster, set it's service node as SN and CN +cmd:mkdef -t node -o compute1 groups=compute ip=10.0.0.199 mac=4a:c8:f7:de:d0:09 profile=compute os=__GETNODEATTR($$CN,os)__ arch=__GETNODEATTR($$CN,arch)__ netboot=__GETNODEATTR($$CN,netboot)__ +check:rc==0 +cmd:chdef -t node -o compute1 servicenode=$$SN,$$CN xcatmaster= +check:rc==0 +cmd:makehosts compute1 +check:rc==0 +cmd:cat /etc/hosts +check:output=~compute1 +cmd:cp /etc/resolv.conf /etc/resolv.conf.bak +cmd:echo "nameserver $$MN" >> /etc/resolv.conf +check:rc==0 +cmd:makedns -n +check:rc==0 +cmd:makedhcp -n +check:rc==0 +cmd:makedhcp -a +check:rc==0 +cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep compute1;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep compute1;fi +check:output=~compute1 +cmd:if cat /etc/*release |grep SUSE >/dev/null;then xdsh $$SN cat /var/lib/dhcp/db/dhcpd.leases|grep compute1;elif cat /etc/*release |grep "Red Hat" >/dev/null;then xdsh $$SN cat /var/lib/dhcpd/dhcpd.leases|grep compute1;fi +check:output=~compute1 +cmd:if cat /etc/*release |grep SUSE >/dev/null;then xdsh $$CN cat /var/lib/dhcp/db/dhcpd.leases|grep compute1;elif cat /etc/*release |grep "Red Hat" >/dev/null;then xdsh $$CN cat /var/lib/dhcpd/dhcpd.leases|grep compute1;fi +check:output=~compute1 +cmd:nodeset compute1 osimage=__GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-compute +check:rc==0 +check:output=~compute1: install __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-compute +cmd:if [[ "__GETNODEATTR($$CN,netboot)__" =~ "grub2" ]]; then cat /tftpboot/boot/__GETNODEATTR($$CN,netboot)__/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "yaboot" ]];then cat /tftpboot/yaboot.conf*;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "xnba" ]];then cat /tftpboot/xcat/xnba/nodes/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "petitboot" ]];then cat /tftpboot/petitboot/compute1;fi +check:output=~http://$$MN|http://$$MASTERIP|http://${next-server} +cmd:if [[ "__GETNODEATTR($$CN,netboot)__" =~ "grub2" ]]; then xdsh $$SN cat /tftpboot/boot/__GETNODEATTR($$CN,netboot)__/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "yaboot" ]];then xdsh $$SN cat /tftpboot/yaboot.conf*;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "xnba" ]];then xdsh $$SN cat /tftpboot/xcat/xnba/nodes/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "petitboot" ]];then xdsh $$SN cat /tftpboot/petitboot/compute1;fi +check:output=~http://$$SN|http://__GETNODEATTR($$SN,ip)__|http://${next-server} +cmd:if [[ "__GETNODEATTR($$CN,netboot)__" =~ "grub2" ]]; then xdsh $$CN cat /tftpboot/boot/__GETNODEATTR($$CN,netboot)__/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "yaboot" ]];then xdsh $$CN cat /tftpboot/yaboot.conf*;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "xnba" ]];then xdsh $$CN cat /tftpboot/xcat/xnba/nodes/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "petitboot" ]];then xdsh $$CN cat /tftpboot/petitboot/compute1;fi +check:output=~http://$$CN|http://__GETNODEATTR($$CN,ip)__|http://${next-server} + +#process the speicial case when netboot=petitboot, since we have no physical machine test environment at the moment +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64le" ]] && [[ "__GETNODEATTR($$CN,netboot)__" != "petitboot" ]]; then chdef compute1 netboot=petitboot;nodeset compute1 osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute;cat /tftpboot/petitboot/compute1;else echo "http://$$MN";fi +check:output=~http://$$MN|http://$$MASTERIP|http://${next-server} +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64le" ]]; then xdsh $$SN cat /tftpboot/petitboot/compute1;else echo "http://$$SN";fi +check:output=~http://$$SN|http://__GETNODEATTR($$SN,ip)__|http://${next-server} +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64le" ]]; then xdsh $$CN cat /tftpboot/petitboot/compute1;else echo "http://$$CN";fi +check:output=~http://$$CN|http://__GETNODEATTR($$CN,ip)__|http://${next-server} + +cmd:noderm compute1 +check:rc==0 +cmd:cp -f /etc/resolv.conf.bak /etc/resolv.conf +end diff --git a/xCAT-test/autotest/testcase/snpool/set_xcatmaster_in_sn_pool_tftp_mount_mode b/xCAT-test/autotest/testcase/snpool/set_xcatmaster_in_sn_pool_tftp_mount_mode new file mode 100644 index 000000000..712946aa7 --- /dev/null +++ b/xCAT-test/autotest/testcase/snpool/set_xcatmaster_in_sn_pool_tftp_mount_mode @@ -0,0 +1,166 @@ +start:set_xcatmaster_in_sn_pool_tftp_mount_mode +description: this case is to test when compute nodes' xcatmaster is set in service node pool environment,compute node's provision files are correctly set after nodeset. +cmd:fdisk -l +cmd:df -T +#cmd:XCAT_DATABASE=$$XCAT_DATABASE /opt/xcat/share/xcat/tools/autotest/testcase/installation/pre_deploy_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__ +cmd:if [ ! -f /etc/xcat/cfgloc ];then XCAT_DATABASE=$$XCAT_DATABASE /opt/xcat/share/xcat/tools/autotest/testcase/installation/pre_deploy_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__;fi +check:rc==0 + +cmd:chtab key=nameservers site.value="" +check:rc==0 + +cmd:makedns -n +check:rc==0 +cmd:makeconservercf $$SN,$$CN +check:rc==0 +cmd:cat /etc/conserver.cf | grep $$SN +check:output=~$$SN +cmd:cat /etc/conserver.cf | grep $$CN +check:output=~$$CN +cmd:sleep 20 +cmd:if [[ "__GETNODEATTR($$SN,arch)__" = "ppc64" ]]; then getmacs -D $$SN -V; fi +check:rc==0 +cmd:if [[ "__GETNODEATTR($$SN,arch)__" = "ppc64" ]]; then getmacs -D $$CN -V; fi +check:rc==0 +cmd:makedhcp -n +check:rc==0 +cmd:makedhcp -a +check:rc==0 +cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$SN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$SN;fi +check:output=~$$SN +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:chdef -t node $$SN,$$CN groups=service,all +check:rc==0 +cmd:chdef -t group -o service profile=service installnic=mac +check:rc==0 +cmd:chdef -t group -o service setupnfs=1 setupdhcp=1 setuptftp=1 setupnameserver=1 setupconserver=1 setupntp=1 +check:rc==0 +cmd:chdef -t group -o service nfsserver= tftpserver= xcatmaster= monserver= +check:rc==0 + +cmd:copycds $$ISO +check:rc==0 + + +cmd:chdef -t site clustersite sharedtftp=0 +check:rc==0 +cmd:chdef -t site clustersite installloc="" +check:rc==0 + +cmd:cd /install/post/otherpkgs/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__/xcat/xcat-core && createrepo . +check:rc==0 + +cmd:if [[ "__GETNODEATTR($$SN,os)__" =~ "rh" ]]; then path="rh";elif [[ "__GETNODEATTR($$SN,os)__" =~ "sles" ]];then path="sles";fi; ver="__GETNODEATTR($$SN,os)__"; tmp=${ver%.*};ver=`echo "$tmp"|sed 's:[a-zA-Z]::g'`;cd /install/post/otherpkgs/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__/xcat/xcat-dep/$path$ver/__GETNODEATTR($$SN,arch)__ && createrepo .; +check:rc==0 + +cmd:chdef -t osimage __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service otherpkgdir=/install/post/otherpkgs/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__ +check:rc==0 + +cmd:if [[ "__GETNODEATTR($$SN,os)__" =~ "rh" ]]; then path="rh";elif [[ "__GETNODEATTR($$SN,os)__" =~ "sles" ]];then path="sles";fi; ver="__GETNODEATTR($$SN,os)__"; chdef -t osimage __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service otherpkglist=/opt/xcat/share/xcat/install/$path/service.${ver%.*}.__GETNODEATTR($$SN,arch)__.otherpkgs.pkglist; +check:rc==0 + +cmd:rinstall $$SN,$$CN osimage=__GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service +check:rc==0 +check:output=~Provision node\(s\)\: $$SN $$CN + +cmd:if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/installation/customize_sleep_for_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__ + +#Check status on SN after SN is installed +cmd:ping $$SN -c 3 +check:rc==0 +check:output=~64 bytes from $$SN +cmd:lsdef -l $$SN | grep status +check:rc==0 +check:output=~booted +cmd:xdsh $$SN date +check:rc==0 +check:output=~\d\d:\d\d:\d\d +#after bug 2586 is fixed, following 2 lines should be removed. +cmd:if [[ "__GETNODEATTR($$SN,os)__" =~ "sles" ]];then xdsh $$SN service xcatd restart; fi +check:rc==0 +cmd:xdsh $$SN "ps -ef |grep xcatd" +check:rc==0 +check:output=~xcatd: +cmd:xdsh $$SN "lsdef" +check:rc==0 +check:output=~$$SN: $$SN +cmd:xdsh $$SN "tabdump site" +check:rc==0 +check:output=~tftpdir +cmd:rsync -auv --exclude 'autoinst' /install $$SN:/ +check:rc==0 + +#Check status on CN after CN is installed since CN is taken as another SN. +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:xdsh $$CN date +check:rc==0 +check:output=~\d\d:\d\d:\d\d +#after bug 2586 is fixed, following 2 lines should be removed. +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "sles" ]];then xdsh $$CN service xcatd restart; fi +check:rc==0 +cmd:xdsh $$CN "ps -ef |grep xcatd" +check:rc==0 +check:output=~xcatd: +cmd:xdsh $$CN "lsdef" +check:rc==0 +check:output=~$$CN: $$CN +cmd:xdsh $$CN "tabdump site" +check:rc==0 +check:output=~tftpdir +cmd:rsync -auv --exclude 'autoinst' /install $$CN:/ +check:rc==0 + + +#create a test compute node, set it's xcatmaster as SN, set it's service node as SN and CN +cmd:mkdef -t node -o compute1 groups=compute ip=10.0.0.199 mac=4a:c8:f7:de:d0:09 profile=compute os=__GETNODEATTR($$CN,os)__ arch=__GETNODEATTR($$CN,arch)__ netboot=__GETNODEATTR($$CN,netboot)__ +check:rc==0 +cmd:chdef -t node -o compute1 servicenode=$$SN,$$CN xcatmaster=$$SN +check:rc==0 +cmd:makehosts compute1 +check:rc==0 +cmd:cat /etc/hosts +check:output=~compute1 +cmd:cp /etc/resolv.conf /etc/resolv.conf.bak +cmd:echo "nameserver $$MN" >> /etc/resolv.conf +check:rc==0 +cmd:makedns -n +check:rc==0 +cmd:makedhcp -n +check:rc==0 +cmd:makedhcp -a +check:rc==0 +cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep compute1;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep compute1;fi +check:output=~compute1 +cmd:if cat /etc/*release |grep SUSE >/dev/null;then xdsh $$SN cat /var/lib/dhcp/db/dhcpd.leases|grep compute1;elif cat /etc/*release |grep "Red Hat" >/dev/null;then xdsh $$SN cat /var/lib/dhcpd/dhcpd.leases|grep compute1;fi +check:output=~compute1 +cmd:if cat /etc/*release |grep SUSE >/dev/null;then xdsh $$CN cat /var/lib/dhcp/db/dhcpd.leases|grep compute1;elif cat /etc/*release |grep "Red Hat" >/dev/null;then xdsh $$CN cat /var/lib/dhcpd/dhcpd.leases|grep compute1;fi +check:output=~compute1 +cmd:nodeset compute1 osimage=__GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-compute +check:rc==0 +check:output=~compute1: install __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-compute +cmd:if [[ "__GETNODEATTR($$CN,netboot)__" =~ "grub2" ]]; then cat /tftpboot/boot/__GETNODEATTR($$CN,netboot)__/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "yaboot" ]];then cat /tftpboot/yaboot.conf*;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "xnba" ]];then cat /tftpboot/xcat/xnba/nodes/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "petitboot" ]];then cat /tftpboot/petitboot/compute1;fi +check:output=~http://$$SN|http://__GETNODEATTR($$SN,ip)__|http://${next-server} +cmd:if [[ "__GETNODEATTR($$CN,netboot)__" =~ "grub2" ]]; then xdsh $$SN cat /tftpboot/boot/__GETNODEATTR($$CN,netboot)__/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "yaboot" ]];then xdsh $$SN cat /tftpboot/yaboot.conf*;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "xnba" ]];then xdsh $$SN cat /tftpboot/xcat/xnba/nodes/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "petitboot" ]];then xdsh $$SN cat /tftpboot/petitboot/compute1;fi +check:output=~http://$$SN|http://__GETNODEATTR($$SN,ip)__|http://${next-server} +cmd:if [[ "__GETNODEATTR($$CN,netboot)__" =~ "grub2" ]]; then xdsh $$CN cat /tftpboot/boot/__GETNODEATTR($$CN,netboot)__/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "yaboot" ]];then xdsh $$CN cat /tftpboot/yaboot.conf*;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "xnba" ]];then xdsh $$CN cat /tftpboot/xcat/xnba/nodes/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "petitboot" ]];then xdsh $$CN cat /tftpboot/petitboot/compute1;fi +check:output=~http://$$SN|http://__GETNODEATTR($$SN,ip)__|http://${next-server} + +#process the speicial case when netboot=petitboot, since we have no physical machine test environment at the moment +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64le" ]] && [[ "__GETNODEATTR($$CN,netboot)__" != "petitboot" ]]; then chdef compute1 netboot=petitboot;nodeset compute1 osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute;cat /tftpboot/petitboot/compute1;else echo "http://$$SN";fi +check:output=~http://$$SN|http://__GETNODEATTR($$SN,ip)__|http://${next-server} +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64le" ]]; then xdsh $$SN cat /tftpboot/petitboot/compute1;else echo "http://$$SN";fi +check:output=~http://$$SN|http://__GETNODEATTR($$SN,ip)__|http://${next-server} +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64le" ]]; then xdsh $$CN cat /tftpboot/petitboot/compute1;else echo "http://$$SN";fi +check:output=~http://$$SN|http://__GETNODEATTR($$SN,ip)__|http://${next-server} + +cmd:noderm compute1 +check:rc==0 +cmd:cp -f /etc/resolv.conf.bak /etc/resolv.conf +end diff --git a/xCAT-test/autotest/testcase/snpool/set_xcatmaster_in_sn_pool_tftp_mount_mode_checkresult b/xCAT-test/autotest/testcase/snpool/set_xcatmaster_in_sn_pool_tftp_mount_mode_checkresult new file mode 100644 index 000000000..75079452e --- /dev/null +++ b/xCAT-test/autotest/testcase/snpool/set_xcatmaster_in_sn_pool_tftp_mount_mode_checkresult @@ -0,0 +1,49 @@ +start:set_xcatmaster_in_sn_pool_tftp_mount_mode_checkresult +description: this case is to check the configuration files after nodeset for case set_xcatmaster_in_sn_pool_tftp_mount_mode + +#create a test compute node, set it's xcatmaster as SN, set it's service node as SN and CN +cmd:mkdef -t node -o compute1 groups=compute ip=10.0.0.199 mac=4a:c8:f7:de:d0:09 profile=compute os=__GETNODEATTR($$CN,os)__ arch=__GETNODEATTR($$CN,arch)__ netboot=__GETNODEATTR($$CN,netboot)__ +check:rc==0 +cmd:chdef -t node -o compute1 servicenode=$$SN,$$CN xcatmaster=$$SN +check:rc==0 +cmd:makehosts compute1 +check:rc==0 +cmd:cat /etc/hosts +check:output=~compute1 +cmd:cp /etc/resolv.conf /etc/resolv.conf.bak +cmd:echo "nameserver $$MN" >> /etc/resolv.conf +check:rc==0 +cmd:makedns -n +check:rc==0 +cmd:makedhcp -n +check:rc==0 +cmd:makedhcp -a +check:rc==0 +cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep compute1;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep compute1;fi +check:output=~compute1 +cmd:if cat /etc/*release |grep SUSE >/dev/null;then xdsh $$SN cat /var/lib/dhcp/db/dhcpd.leases|grep compute1;elif cat /etc/*release |grep "Red Hat" >/dev/null;then xdsh $$SN cat /var/lib/dhcpd/dhcpd.leases|grep compute1;fi +check:output=~compute1 +cmd:if cat /etc/*release |grep SUSE >/dev/null;then xdsh $$CN cat /var/lib/dhcp/db/dhcpd.leases|grep compute1;elif cat /etc/*release |grep "Red Hat" >/dev/null;then xdsh $$CN cat /var/lib/dhcpd/dhcpd.leases|grep compute1;fi +check:output=~compute1 +cmd:nodeset compute1 osimage=__GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-compute +check:rc==0 +check:output=~compute1: install __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-compute +cmd:if [[ "__GETNODEATTR($$CN,netboot)__" =~ "grub2" ]]; then cat /tftpboot/boot/__GETNODEATTR($$CN,netboot)__/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "yaboot" ]];then cat /tftpboot/yaboot.conf*;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "xnba" ]];then cat /tftpboot/xcat/xnba/nodes/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "petitboot" ]];then cat /tftpboot/petitboot/compute1;fi +check:output=~http://$$SN|http://__GETNODEATTR($$SN,ip)__|http://${next-server} +cmd:if [[ "__GETNODEATTR($$CN,netboot)__" =~ "grub2" ]]; then xdsh $$SN cat /tftpboot/boot/__GETNODEATTR($$CN,netboot)__/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "yaboot" ]];then xdsh $$SN cat /tftpboot/yaboot.conf*;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "xnba" ]];then xdsh $$SN cat /tftpboot/xcat/xnba/nodes/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "petitboot" ]];then xdsh $$SN cat /tftpboot/petitboot/compute1;fi +check:output=~http://$$SN|http://__GETNODEATTR($$SN,ip)__|http://${next-server} +cmd:if [[ "__GETNODEATTR($$CN,netboot)__" =~ "grub2" ]]; then xdsh $$CN cat /tftpboot/boot/__GETNODEATTR($$CN,netboot)__/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "yaboot" ]];then xdsh $$CN cat /tftpboot/yaboot.conf*;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "xnba" ]];then xdsh $$CN cat /tftpboot/xcat/xnba/nodes/compute1;elif [[ "__GETNODEATTR($$CN,netboot)__" =~ "petitboot" ]];then xdsh $$CN cat /tftpboot/petitboot/compute1;fi +check:output=~http://$$SN|http://__GETNODEATTR($$SN,ip)__|http://${next-server} + +#process the speicial case when netboot=petitboot, since we have no physical machine test environment at the moment +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64le" ]] && [[ "__GETNODEATTR($$CN,netboot)__" != "petitboot" ]]; then chdef compute1 netboot=petitboot;nodeset compute1 osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute;cat /tftpboot/petitboot/compute1;else echo "http://$$SN";fi +check:output=~http://$$SN|http://__GETNODEATTR($$SN,ip)__|http://${next-server} +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64le" ]]; then xdsh $$SN cat /tftpboot/petitboot/compute1;else echo "http://$$SN";fi +check:output=~http://$$SN|http://__GETNODEATTR($$SN,ip)__|http://${next-server} +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64le" ]]; then xdsh $$CN cat /tftpboot/petitboot/compute1;else echo "http://$$SN";fi +check:output=~http://$$SN|http://__GETNODEATTR($$SN,ip)__|http://${next-server} + +cmd:noderm compute1 +check:rc==0 +cmd:cp -f /etc/resolv.conf.bak /etc/resolv.conf +end diff --git a/xCAT-test/autotest/testcase/snpool/setup_sn_pool_tftp_mount_mode b/xCAT-test/autotest/testcase/snpool/setup_sn_pool_tftp_mount_mode new file mode 100644 index 000000000..286606ce6 --- /dev/null +++ b/xCAT-test/autotest/testcase/snpool/setup_sn_pool_tftp_mount_mode @@ -0,0 +1,119 @@ +start:setup_sn_pool_tftp_mount_mode +description: this case is to test when sharedtftp=1 and installloc=/install are set on mn, after all service nodes are installed, /tftpboot and /install directory on all service nodes are mounted.Since test framework only support 1 sn and 1 cn parameter. This case will install CN as another service node. +cmd:fdisk -l +cmd:df -T +#cmd:XCAT_DATABASE=$$XCAT_DATABASE /opt/xcat/share/xcat/tools/autotest/testcase/installation/pre_deploy_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__ +cmd:if [ ! -f /etc/xcat/cfgloc ];then XCAT_DATABASE=$$XCAT_DATABASE /opt/xcat/share/xcat/tools/autotest/testcase/installation/pre_deploy_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__;fi +check:rc==0 + +cmd:chtab key=nameservers site.value="" +check:rc==0 + +cmd:makedns -n +check:rc==0 +cmd:makeconservercf $$SN,$$CN +check:rc==0 +cmd:cat /etc/conserver.cf | grep $$SN +check:output=~$$SN +cmd:cat /etc/conserver.cf | grep $$CN +check:output=~$$CN +cmd:sleep 20 +cmd:if [[ "__GETNODEATTR($$SN,arch)__" = "ppc64" ]]; then getmacs -D $$SN -V; fi +check:rc==0 +cmd:if [[ "__GETNODEATTR($$SN,arch)__" = "ppc64" ]]; then getmacs -D $$CN -V; fi +check:rc==0 +cmd:makedhcp -n +check:rc==0 +cmd:makedhcp -a +check:rc==0 +cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$SN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$SN;fi +check:output=~$$SN +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:chdef -t node $$SN,$$CN groups=service,all +check:rc==0 +cmd:chdef -t group -o service profile=service installnic=mac +check:rc==0 +cmd:chdef -t group -o service setupnfs=1 setupdhcp=1 setuptftp=1 setupnameserver=1 setupconserver=1 setupntp=1 +check:rc==0 +cmd:chdef -t group -o service nfsserver= tftpserver= xcatmaster= monserver= +check:rc==0 + +cmd:copycds $$ISO +check:rc==0 + + +cmd:chdef -t site clustersite sharedtftp=0 +check:rc==0 +cmd:chdef -t site clustersite installloc="" +check:rc==0 + +cmd:cd /install/post/otherpkgs/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__/xcat/xcat-core && createrepo . +check:rc==0 + +cmd:if [[ "__GETNODEATTR($$SN,os)__" =~ "rh" ]]; then path="rh";elif [[ "__GETNODEATTR($$SN,os)__" =~ "sles" ]];then path="sles";fi; ver="__GETNODEATTR($$SN,os)__"; tmp=${ver%.*};ver=`echo "$tmp"|sed 's:[a-zA-Z]::g'`;cd /install/post/otherpkgs/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__/xcat/xcat-dep/$path$ver/__GETNODEATTR($$SN,arch)__ && createrepo .; +check:rc==0 + +cmd:chdef -t osimage __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service otherpkgdir=/install/post/otherpkgs/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__ +check:rc==0 + +cmd:if [[ "__GETNODEATTR($$SN,os)__" =~ "rh" ]]; then path="rh";elif [[ "__GETNODEATTR($$SN,os)__" =~ "sles" ]];then path="sles";fi; ver="__GETNODEATTR($$SN,os)__"; chdef -t osimage __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service otherpkglist=/opt/xcat/share/xcat/install/$path/service.${ver%.*}.__GETNODEATTR($$SN,arch)__.otherpkgs.pkglist; +check:rc==0 + +cmd:rinstall $$SN,$$CN osimage=__GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service +check:rc==0 +check:output=~Provision node\(s\)\: $$SN $$CN + +cmd:if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/installation/customize_sleep_for_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__ + +#Check status on SN after SN is installed +cmd:ping $$SN -c 3 +check:rc==0 +check:output=~64 bytes from $$SN +cmd:lsdef -l $$SN | grep status +check:rc==0 +check:output=~booted +cmd:xdsh $$SN date +check:rc==0 +check:output=~\d\d:\d\d:\d\d +#after bug 2586 is fixed, following 2 lines should be removed. +cmd:if [[ "__GETNODEATTR($$SN,os)__" =~ "sles" ]];then xdsh $$SN service xcatd restart; fi +check:rc==0 +cmd:xdsh $$SN "ps -ef |grep xcatd" +check:rc==0 +check:output=~xcatd: +cmd:xdsh $$SN "lsdef" +check:rc==0 +check:output=~$$SN: $$SN +cmd:xdsh $$SN "tabdump site" +check:rc==0 +check:output=~tftpdir +cmd:rsync -auv --exclude 'autoinst' /install $$SN:/ +check:rc==0 + +#Check status on CN after CN is installed since CN is taken as another SN. +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:xdsh $$CN date +check:rc==0 +check:output=~\d\d:\d\d:\d\d +#after bug 2586 is fixed, following 2 lines should be removed. +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "sles" ]];then xdsh $$CN service xcatd restart; fi +check:rc==0 +cmd:xdsh $$CN "ps -ef |grep xcatd" +check:rc==0 +check:output=~xcatd: +cmd:xdsh $$CN "lsdef" +check:rc==0 +check:output=~$$CN: $$CN +cmd:xdsh $$CN "tabdump site" +check:rc==0 +check:output=~tftpdir +cmd:rsync -auv --exclude 'autoinst' /install $$CN:/ +check:rc==0 +end From 60972d3adb125762e5ca5e1c6d51f1adfa779475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=E1=B4=8F=C9=B4=C9=A2=20Jie?= Date: Wed, 23 Aug 2017 16:20:30 +0800 Subject: [PATCH 077/251] Add one test case for the `disjointdhcps` feature of command `nodeset` (#3594) * Add one test case for the `disjointdhcps` feature of command `nodeset` * Revise the nodeset test case * Revise the nodeset test case --- xCAT-test/autotest/testcase/nodeset/cases0 | 89 ++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/xCAT-test/autotest/testcase/nodeset/cases0 b/xCAT-test/autotest/testcase/nodeset/cases0 index 4d549447b..af7c08e1d 100644 --- a/xCAT-test/autotest/testcase/nodeset/cases0 +++ b/xCAT-test/autotest/testcase/nodeset/cases0 @@ -351,3 +351,92 @@ check:rc==1 check:output=~Error: Invalid argument: check:output=~Usage: nodeset end + +start:nodeset_disjointdhcps_petitboot +description: Verify the disjointdhcps feature when petitboot is used for OS loader. +cmd:rmdef testnode1 +cmd:rm -f /tftpboot/petitboot/testnode1 +cmd:mkdef -t node -o testnode1 arch=ppc64le cons=bmc groups=ipmi ip=10.1.1.200 mac=e6:d4:d2:3a:ad:06 mgt=ipmi profile=compute os=rhels7.99 +check:rc==0 +cmd:cp -f /etc/hosts /etc/hosts.xcattestbak +cmd:echo "10.1.1.200 testnode1" >> /etc/hosts +cmd:makedns -n +check:rc==0 +cmd:chdef testnode1 netboot=petitboot addkcmdline=debug +check:rc==0 +cmd:mkdef "rhels7.99-ppc64le-install-compute" -u profile=compute provmethod=install osvers=rhels7.99 osarch=ppc64le +cmd:mkdir -p /install/rhels7.99/ppc64le +cmd:mkdir -p /install/rhels7.99/ppc64le/ppc/ppc64le +cmd:echo blah >/install/rhels7.99/ppc64le/ppc/ppc64le/vmlinuz +cmd:echo blah >/install/rhels7.99/ppc64le/ppc/ppc64le/initrd.img +cmd:nodeset testnode1 osimage=rhels7.99-ppc64le-install-compute +check:rc==0 +cmd:grep "debug" /tftpboot/petitboot/testnode1 +check:rc==0 +#cmd:makedhcp -q testnode1 | grep ^testnode1: +#check:rc==0 +cmd:nodeset testnode1 offline +check:rc==0 +cmd:grep "debug" /tftpboot/petitboot/testnode1 +check:rc!=0 +cmd:chdef -t site sharedtftp=0 disjointdhcps=0 +check:rc==0 +cmd:chdef -t site tftpdir=/tftpboot.1 +check:rc==0 +cmd:mkdir -p /tftpboot.1/boot/grub2 +cmd:touch /tftpboot.1/boot/grub2/grub2.ppc +cmd:xdsh $$SN 'mkdir -p /tftpboot.1/boot/grub2' +cmd:xdsh $$SN 'touch /tftpboot.1/boot/grub2/grub2.ppc' +cmd:chdef -t node testnode1 servicenode=$$SN +check:rc==0 +cmd:rm -f /tftpboot/petitboot/testnode1 +cmd:xdsh $$SN 'rm -f /tftpboot/petitboot/testnode1' +cmd:nodeset testnode1 osimage=rhels7.99-ppc64le-install-compute +check:rc==0 +cmd:test -f /tftpboot.1/petitboot/testnode1 +check:rc==0 +cmd:xdsh $$SN 'test -f /tftpboot.1/petitboot/testnode1' +check:rc==0 +cmd:nodeset testnode1 offline +check:rc==0 +cmd:chdef -t site disjointdhcps=1 +check:rc==0 +cmd:chdef -t node testnode1 servicenode=nonexistenode +check:rc==0 +cmd:nodeset testnode1 osimage=rhels7.99-ppc64le-install-compute +check:rc==0 +cmd:test -f /tftpboot.1/petitboot/testnode1 +check:rc==0 +cmd:xdsh $$SN 'test -f /tftpboot.1/petitboot/testnode1' +check:rc!=0 +cmd:nodeset testnode1 offline +check:rc==0 +# DHCP dynamic range +cmd:chdef -t network 20_0_0_0-255_0_0_0 mask=255.0.0.0 tftpserver=$$SN dhcpserver=$$SN +check:rc==0 +cmd:nodeset testnode1 osimage=rhels7.99-ppc64le-install-compute +check:rc==0 +cmd:xdsh $$SN 'test -f /tftpboot.1/petitboot/testnode1' +check:rc==0 +# Clean up +cmd:rmdef -t network 20_0_0_0-255_0_0_0 +check:rc==0 +cmd:chdef -t site sharedtftp=1 +check:rc==0 +cmd:chdef -t site disjointdhcps=0 +check:rc==0 +cmd:chdef -t site tftpdir=/tftpboot +check:rc==0 +cmd:rm -rf /tftpboot.1 +cmd:xdsh $$SN 'rm -rf /tftpboot.1' +cmd:chdef -t node -o testnode1 ip= +check:rc==0 +cmd:cp -f /etc/hosts.xcattestbak /etc/hosts +cmd:getent hosts testnode1 | grep testnode1 +check:rc!=0 +cmd:nodeset testnode1 osimage=rhels7.99-ppc64le-install-compute +check:rc!=0 +cmd:noderm testnode1 +cmd:rmdef -t osimage -o "rhels7.99-ppc64le-install-compute" +cmd:rm -rf /install/rhels7.99 +end From d9827b7fc203da05d496377408dec52997212720 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 23 Aug 2017 05:15:24 -0400 Subject: [PATCH 078/251] add new cases for bundles against rhels7.4 --- .../autotest/bundle/rhels7.4_ppc64.bundle | 25 ++++++++++++++ .../autotest/bundle/rhels7.4_ppc64le.bundle | 34 +++++++++++++++++++ .../autotest/bundle/rhels7.4_x86_64.bundle | 33 ++++++++++++++++++ 3 files changed, 92 insertions(+) diff --git a/xCAT-test/autotest/bundle/rhels7.4_ppc64.bundle b/xCAT-test/autotest/bundle/rhels7.4_ppc64.bundle index 34e13e857..89135a51e 100644 --- a/xCAT-test/autotest/bundle/rhels7.4_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.4_ppc64.bundle @@ -32,6 +32,7 @@ chdef_dynamic_group chdef_multiple_keys chdef_n chdef_t_o_error +chdef_site_check chtab_null chtab_d chtab_modify_node @@ -296,6 +297,30 @@ run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission xcatconfig_u_check_xcatsslversion_rhels_sles +bmcdiscover_help +bmcdiscover_q +bmcdiscover_version +chdef_nicips +encrypted_passwd_md5_diskfull +encrypted_passwd_openssl_diskfull +encrypted_passwd_sha256_diskfull +encrypted_passwd_sha512_diskfull +makedhcp_remote_network +makedns_n_noderange +makeknownhosts_node_d +mkdef_regex_bmc +mkdef_regex_ip +mkdef_regex_kvm +mkdef_regex_nicsip +mkdef_rhels73 +nodeset_errorcommand +nodeset_grub2 +nodeset_yaboot +nodestat_usage +rmimage_diskless +updatenode_diskful_syncfiles_failing +xdcp_nonroot_user +xdsh_permission_denied reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/rhels7.4_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.4_ppc64le.bundle index 2984952bb..a63c77516 100644 --- a/xCAT-test/autotest/bundle/rhels7.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.4_ppc64le.bundle @@ -43,6 +43,7 @@ chdef_dynamic_group chdef_multiple_keys chdef_n chdef_t_o_error +chdef_site_check chtab_null chtab_d chtab_modify_node @@ -293,6 +294,39 @@ run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission xcatconfig_u_check_xcatsslversion_rhels_sles +bmcdiscover_help +bmcdiscover_q +bmcdiscover_version +chdef_nicips +confignetwork_2eth_bridge_br0 +confignetwork_2eth_bridge_br22_br33 +confignetwork_bond_eth2_eth3 +confignetwork_bond_false +confignetwork__bridge_false +confignetwork_installnic_2eth_bridge_br22_br33 +confignetwork_vlan_bond +confignetwork_vlan_eth0 +confignetwork_vlan_false +encrypted_passwd_md5_diskfull +encrypted_passwd_openssl_diskfull +encrypted_passwd_sha256_diskfull +encrypted_passwd_sha512_diskfull +makedhcp_remote_network +makedns_n_noderange +makeknownhosts_node_d +mkdef_regex_bmc +mkdef_regex_ip +mkdef_regex_kvm +mkdef_regex_nicsip +mkdef_rhels73 +nodeset_errorcommand +nodeset_grub2 +nodeset_petitboot +nodestat_usage +rmimage_diskless +updatenode_diskful_syncfiles_failing +xdcp_nonroot_user +xdsh_permission_denied packimage_m_cpio_c_gzip packimage_m_cpio_c_xz packimage_m_tar_c_gzip diff --git a/xCAT-test/autotest/bundle/rhels7.4_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.4_x86_64.bundle index 13f6f53c7..b90ff26e0 100644 --- a/xCAT-test/autotest/bundle/rhels7.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.4_x86_64.bundle @@ -19,6 +19,7 @@ confignetwork_secondarynic_nictype_updatenode_false chdef_null chdef_z chdef_t_o_error +chdef_site_check chtab_null chtab_d chtab_modify_node @@ -227,6 +228,38 @@ nodeset_shell nodeset_cmdline nodeset_runimg xcatconfig_u_check_xcatsslversion_rhels_sles +bmcdiscover_help +bmcdiscover_q +bmcdiscover_version +chdef_nicips +confignetwork_2eth_bridge_br0 +confignetwork_2eth_bridge_br22_br33 +confignetwork_bond_eth2_eth3 +confignetwork_bond_false +confignetwork__bridge_false +confignetwork_installnic_2eth_bridge_br22_br33 +confignetwork_vlan_bond +confignetwork_vlan_eth0 +confignetwork_vlan_false +encrypted_passwd_md5_diskfull +encrypted_passwd_openssl_diskfull +encrypted_passwd_sha256_diskfull +encrypted_passwd_sha512_diskfull +makedhcp_remote_network +makedns_n_noderange +makeknownhosts_node_d +mkdef_regex_bmc +mkdef_regex_ip +mkdef_regex_kvm +mkdef_regex_nicsip +mkdef_rhels73 +nodeset_errorcommand +nodeset_xnba +nodestat_usage +rmimage_diskless +updatenode_diskful_syncfiles_failing +xdcp_nonroot_user +xdsh_permission_denied reg_linux_diskless_installation_flat reg_linux_statelite_installation_flat SN_setup_case From 3d3a880f785e31e4e72470d2ae7f7598520c01f8 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Tue, 22 Aug 2017 15:10:58 +0800 Subject: [PATCH 079/251] Revise the test case confignetwork_static_installnic --- xCAT-test/autotest/testcase/confignetwork/cases0 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/confignetwork/cases0 b/xCAT-test/autotest/testcase/confignetwork/cases0 index 4ccd5bb3e..f468fae74 100644 --- a/xCAT-test/autotest/testcase/confignetwork/cases0 +++ b/xCAT-test/autotest/testcase/confignetwork/cases0 @@ -945,9 +945,9 @@ cmd:xdsh $$CN "mkdir -p /tmp/backupnet" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi check:rc==0 -cmd:xdsh $$CN 'killall dhclient' -cmd:xdsh $$CN 'killall -KILL dhclient' -cmd:xdsh $$CN 'rm -f /var/lib/dhcp/dhclient.leases /var/lib/dhclient/dhclient.leases' +cmd:xdsh $$CN "kill $(ps -A | awk '/dhclient/ { print $1 }')" +cmd:xdsh $$CN "kill -KILL $(ps -A | awk '/dhclient/ { print $1 }')" +cmd:xdsh $$CN 'rm -f /var/lib/dhcp/dhclient*.lease* /var/lib/dhclient/dhclient*.lease*' check:rc==0 cmd:updatenode $$CN 'confignetwork -s' check:rc==0 @@ -957,5 +957,5 @@ check:rc==0 cmd:test -e /tmp/CN.stanza && rmdef $$CN && mkdef -z Date: Wed, 23 Aug 2017 12:08:51 -0400 Subject: [PATCH 080/251] OpenBMC upload and activate firmware image file --- .../admin-guides/references/man1/rflash.1.rst | 16 +++- perl-xCAT/xCAT/Usage.pm | 2 +- xCAT-client/pods/man1/rflash.1.pod | 11 ++- xCAT-server/lib/xcat/plugins/openbmc.pm | 78 +++++++++++++++++-- 4 files changed, 94 insertions(+), 13 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rflash.1.rst b/docs/source/guides/admin-guides/references/man1/rflash.1.rst index f5800fc38..928102d6e 100644 --- a/docs/source/guides/admin-guides/references/man1/rflash.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rflash.1.rst @@ -59,7 +59,7 @@ OpenPOWER OpenBMC specific : \ **rflash**\ \ *noderange*\ {[\ **-c | -**\ **-check**\ ] | [\ **-l | -**\ **-list**\ ]} -\ **rflash**\ \ *noderange*\ \ *tar_file_path*\ {[\ **-c | -**\ **-check**\ ] | [\ **-u | -**\ **-upload**\ ]} +\ **rflash**\ \ *noderange*\ \ *tar_file_path*\ {[\ **-c | -**\ **-check**\ ] | [\ **-a | -**\ **-activate**\ ] | [\ **-u | -**\ **-upload**\ ]} \ **rflash**\ \ *noderange*\ \ *image_id*\ {[\ **-a | -**\ **-activate**\ ] | [\ **-d | -**\ **-delete**\ ]} @@ -208,7 +208,7 @@ The command will update firmware for OpenPOWER OpenBMC when given an OpenPOWER n \ **-a|-**\ **-activate**\ - Activate update image. Image id must be specified. + Activate update image. Image id or update file must be specified. @@ -322,7 +322,17 @@ The command will update firmware for OpenPOWER OpenBMC when given an OpenPOWER n .. code-block:: perl - rflash briggs01 -d=/root/supermicro/OP825 + rflash briggs01 -d /root/supermicro/OP825 + + + + +7. To update the firmware on the OpenBMC machine, specify the firmare update file to upload and activate: + + + .. code-block:: perl + + rflash p9euh02 -a /tmp/witherspoon.pnor.squashfs.tar diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 244142d14..d3f195fb7 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -346,7 +346,7 @@ my %usage = ( rflash [|-d ] [-c|--check] [--retry=] [-V] OpenPOWER OpenBMC specific: rflash {[-c|--check] | [-l|--list]} - rflash {[-c|--check] | [-u|--upload]} + rflash {[-c|--check] | [-a|--activate] | [-u|--upload]} rflash {[-a|--activate] | [-d|--delete]}", "mkhwconn" => "Usage: diff --git a/xCAT-client/pods/man1/rflash.1.pod b/xCAT-client/pods/man1/rflash.1.pod index 79c21a313..cc544efbb 100644 --- a/xCAT-client/pods/man1/rflash.1.pod +++ b/xCAT-client/pods/man1/rflash.1.pod @@ -30,7 +30,7 @@ B I [I | B<-d> I] [B<-c>|B<--c B I {[B<-c>|B<--check>] | [B<-l>|B<--list>]} -B I I {[B<-c>|B<--check>] | [B<-u>|B<--upload>]} +B I I {[B<-c>|B<--check>] | [B<-a>|B<--activate>] | [B<-u>|B<--upload>]} B I I {[B<-a>|B<--activate>] | [B<-d>|B<--delete>]} @@ -141,7 +141,7 @@ Specify number of times to retry the update if failure is detected. Default valu =item B<-a|--activate> -Activate update image. Image id must be specified. +Activate update image. Image id or update file must be specified. =item B<-l|--list> @@ -207,7 +207,12 @@ Print verbose message to rflash log file (/var/log/xcat/rflash/fs3.log) when upd =item 6. To update the firmware on IBM Power S822LC for Big Data machine specify the node name and the file path of the data directory containing pUpdate utility and BMC and/or PNOR update files: - rflash briggs01 -d=/root/supermicro/OP825 + rflash briggs01 -d /root/supermicro/OP825 + +=item 7. +To update the firmware on the OpenBMC machine, specify the firmare update file to upload and activate: + + rflash p9euh02 -a /tmp/witherspoon.pnor.squashfs.tar =back diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 5e91fbac6..412893b0e 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -43,6 +43,7 @@ $::POWER_STATE_QUIESCED = "quiesced"; $::POWER_STATE_RESET = "reset"; $::POWER_STATE_REBOOT = "reboot"; $::UPLOAD_FILE = ""; +$::UPLOAD_FILE_VERSION = ""; $::NO_ATTRIBUTES_RETURNED = "No attributes returned from the BMC."; @@ -172,6 +173,13 @@ my %status_info = ( RFLASH_UPDATE_CHECK_STATE_RESPONSE => { process => \&rflash_response, }, + RFLASH_UPDATE_CHECK_ID_REQUEST => { + method => "GET", + init_url => "$openbmc_project_url/software/enumerate", + }, + RFLASH_UPDATE_CHECK_ID_RESPONSE => { + process => \&rflash_response, + }, RFLASH_SET_PRIORITY_REQUEST => { method => "PUT", init_url => "$openbmc_project_url/software", @@ -625,7 +633,7 @@ sub parse_args { } if ($filename_passed) { # Filename was passed, check flags allowed with file - if ($option_flag !~ /^-c$|^--check$|^-d$|^--delete$|^-u$|^--upload$/) { + if ($option_flag !~ /^-c$|^--check$|^-u$|^--upload$|^-a$|^--activate$/) { return ([ 1, "Invalid option specified when a file is provided: $option_flag" ]); } } @@ -845,6 +853,7 @@ sub parse_command_status { my $upload = 0; my $activate = 0; my $update_file; + my $upload_and_activate = 0; foreach $subcommand (@$subcommands) { if ($subcommand =~ /-c|--check/) { @@ -866,6 +875,8 @@ sub parse_command_status { my $grep_cmd = "/usr/bin/grep -a"; my $version_tag = '"version=IBM"'; my $purpose_tag = '"purpose="'; + my $purpose_value; + my $version_value; if (defined $update_file) { # Filename or file id was specified if ($update_file =~ /.*\.tar$/) { @@ -882,17 +893,29 @@ sub parse_command_status { xCAT::SvrUtils::sendmsg([1,"Cannot access $::UPLOAD_FILE"], $callback); return 1; } - if ($check_version) { - # Display firmware version of the specified .tar file + if ($activate) { + # Activate flag was specified together with a update file. We want to + # upload the file and activate it. + $upload_and_activate = 1; + $activate = 0; + } + + if ($check_version | $upload_and_activate) { + # Extract Host version for the update file my $firmware_version_in_file = `$grep_cmd $version_tag $::UPLOAD_FILE`; my $purpose_version_in_file = `$grep_cmd $purpose_tag $::UPLOAD_FILE`; chomp($firmware_version_in_file); chomp($purpose_version_in_file); - my ($purpose_string,$purpose_value) = split("=", $purpose_version_in_file); - my ($version_string,$version_value) = split("=", $firmware_version_in_file); + (my $purpose_string,$purpose_value) = split("=", $purpose_version_in_file); + (my $version_string,$version_value) = split("=", $firmware_version_in_file); if ($purpose_value =~ /host/) { $purpose_value = "Host"; } + $::UPLOAD_FILE_VERSION = $version_value; + } + + if ($check_version) { + # Display firmware version of the specified .tar file xCAT::SvrUtils::sendmsg("TAR $purpose_value Firmware Product Version\: $version_value", $callback); } } @@ -940,6 +963,13 @@ sub parse_command_status { $next_status{"RFLASH_SET_PRIORITY_REQUEST"} = "RFLASH_SET_PRIORITY_RESPONSE"; $next_status{"RFLASH_SET_PRIORITY_RESPONSE"} = "RFLASH_UPDATE_CHECK_STATE_REQUEST"; } + if ($upload_and_activate) { + # Upload specified update file to BMC + $next_status{LOGIN_RESPONSE} = "RFLASH_FILE_UPLOAD_REQUEST"; + $next_status{"RFLASH_FILE_UPLOAD_REQUEST"} = "RFLASH_FILE_UPLOAD_RESPONSE"; + $next_status{"RFLASH_FILE_UPLOAD_RESPONSE"} = "RFLASH_UPDATE_CHECK_ID_REQUEST"; + $next_status{"RFLASH_UPDATE_CHECK_ID_REQUEST"} = "RFLASH_UPDATE_CHECK_ID_RESPONSE"; + } } print Dumper(\%next_status) . "\n"; @@ -1958,7 +1988,7 @@ sub rflash_response { } else { # Activation state of active and priority of non 0 - need to just set priority to 0 to activate - print "Update is already active, just need to set priority to 0"; + print "Update is already active, just need to set priority to 0\n"; $next_status{ $node_info{$node}{cur_status} } = "RFLASH_SET_PRIORITY_REQUEST"; } } @@ -1973,6 +2003,42 @@ sub rflash_response { } + if ($node_info{$node}{cur_status} eq "RFLASH_UPDATE_CHECK_ID_RESPONSE") { + my $activation_state; + my $progress_state; + my $priority_state; + + # Look through all the software entries and find the id of the one that matches + # the version of the uploaded file. Once found, set up request/response hash entries + # to activate that image. + foreach my $key_url (keys %{$response_info->{data}}) { + my %content = %{ ${ $response_info->{data} }{$key_url} }; + + $update_id = (split(/\//, $key_url))[ -1 ]; + if (defined($content{Version}) and $content{Version}) { + $update_version = $content{Version}; + } + if ($update_version eq $::UPLOAD_FILE_VERSION) { + # Found a match of uploaded file version with the image in software/enumerate + + # Set the image id for the activation request + $status_info{RFLASH_UPDATE_ACTIVATE_REQUEST}{init_url} .= "/$update_id/attr/RequestedActivation"; + $status_info{RFLASH_UPDATE_CHECK_STATE_REQUEST}{init_url} .= "/$update_id"; + $status_info{RFLASH_SET_PRIORITY_REQUEST}{init_url} .= "/$update_id/attr/Priority"; + + # Set next steps to activate the image + $next_status{ $node_info{$node}{cur_status} } = "RFLASH_UPDATE_ACTIVATE_REQUEST"; + $next_status{"RFLASH_UPDATE_ACTIVATE_REQUEST"} = "RFLASH_UPDATE_ACTIVATE_RESPONSE"; + $next_status{"RFLASH_UPDATE_ACTIVATE_RESPONSE"} = "RFLASH_UPDATE_CHECK_STATE_REQUEST"; + $next_status{"RFLASH_UPDATE_CHECK_STATE_REQUEST"} = "RFLASH_UPDATE_CHECK_STATE_RESPONSE"; + + $next_status{"RFLASH_SET_PRIORITY_REQUEST"} = "RFLASH_SET_PRIORITY_RESPONSE"; + $next_status{"RFLASH_SET_PRIORITY_RESPONSE"} = "RFLASH_UPDATE_CHECK_STATE_REQUEST"; + last; + } + } + } + if ($node_info{$node}{cur_status} eq "RFLASH_DELETE_IMAGE_RESPONSE") { xCAT::SvrUtils::sendmsg("Firmware update successfully removed", $callback, $node); } From da0c0bc0bb5995ae887e12b71576353682b9ae1b Mon Sep 17 00:00:00 2001 From: XuWei Date: Wed, 23 Aug 2017 21:26:20 -0400 Subject: [PATCH 081/251] modified depending on comments --- docs/source/guides/admin-guides/references/man1/rsetboot.1.rst | 2 +- xCAT-client/pods/man1/rsetboot.1.pod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rsetboot.1.rst b/docs/source/guides/admin-guides/references/man1/rsetboot.1.rst index 735a94c5d..da5c3876e 100644 --- a/docs/source/guides/admin-guides/references/man1/rsetboot.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rsetboot.1.rst @@ -21,7 +21,7 @@ DESCRIPTION *********** -\ **rsetboot**\ sets the boot media and boot mode that should be used on the next boot of the specified nodes. After the nodes are booted with the specified device and boot mode (e.g. via rpower(1)|rpower.1), the nodes will return to using the default boot device specified in the BIOS. Currently this command is only supported for IPMI nodes. +\ **rsetboot**\ sets the boot media and boot mode that should be used on the next boot of the specified nodes. After the nodes are booted with the specified device and boot mode (e.g. via rpower(1)|rpower.1), the nodes will return to using the default boot device specified in the BIOS. ******* diff --git a/xCAT-client/pods/man1/rsetboot.1.pod b/xCAT-client/pods/man1/rsetboot.1.pod index cdec1042b..75a2e9ef7 100644 --- a/xCAT-client/pods/man1/rsetboot.1.pod +++ b/xCAT-client/pods/man1/rsetboot.1.pod @@ -12,7 +12,7 @@ B [B<-h>|B<--help>|B<-v>|B<--version>] =head1 DESCRIPTION -B sets the boot media and boot mode that should be used on the next boot of the specified nodes. After the nodes are booted with the specified device and boot mode (e.g. via L), the nodes will return to using the default boot device specified in the BIOS. Currently this command is only supported for IPMI nodes. +B sets the boot media and boot mode that should be used on the next boot of the specified nodes. After the nodes are booted with the specified device and boot mode (e.g. via L), the nodes will return to using the default boot device specified in the BIOS. =head1 OPTIONS From 5a7226402972bd8a56b72935b8baf2078c0accc1 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Thu, 24 Aug 2017 02:49:52 -0400 Subject: [PATCH 082/251] remove test about vlan, bond, bridge from unsupport platform --- xCAT-test/autotest/bundle/rhels6.9_ppc64.bundle | 9 --------- xCAT-test/autotest/bundle/sles11.4_ppc64.bundle | 9 --------- xCAT-test/autotest/bundle/sles11.4_x86_64.bundle | 9 --------- xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle | 9 --------- xCAT-test/autotest/bundle/sles12.2_x86_64.bundle | 9 --------- xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle | 9 --------- xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle | 9 --------- xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle | 9 --------- xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle | 9 --------- 9 files changed, 81 deletions(-) diff --git a/xCAT-test/autotest/bundle/rhels6.9_ppc64.bundle b/xCAT-test/autotest/bundle/rhels6.9_ppc64.bundle index ea18baedd..6833252d3 100644 --- a/xCAT-test/autotest/bundle/rhels6.9_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.9_ppc64.bundle @@ -300,15 +300,6 @@ bmcdiscover_help bmcdiscover_q bmcdiscover_version chdef_nicips -confignetwork_2eth_bridge_br0 -confignetwork_2eth_bridge_br22_br33 -confignetwork_bond_eth2_eth3 -confignetwork_bond_false -confignetwork__bridge_false -confignetwork_installnic_2eth_bridge_br22_br33 -confignetwork_vlan_bond -confignetwork_vlan_eth0 -confignetwork_vlan_false encrypted_passwd_md5_diskfull encrypted_passwd_openssl_diskfull encrypted_passwd_sha256_diskfull diff --git a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle index d8aa3fbbf..b915614cb 100644 --- a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle @@ -264,15 +264,6 @@ bmcdiscover_help bmcdiscover_q bmcdiscover_version chdef_nicips -confignetwork_2eth_bridge_br0 -confignetwork_2eth_bridge_br22_br33 -confignetwork_bond_eth2_eth3 -confignetwork_bond_false -confignetwork__bridge_false -confignetwork_installnic_2eth_bridge_br22_br33 -confignetwork_vlan_bond -confignetwork_vlan_eth0 -confignetwork_vlan_false encrypted_passwd_md5_diskfull encrypted_passwd_openssl_diskfull encrypted_passwd_sha256_diskfull diff --git a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle index 597db4a76..79cbe3927 100644 --- a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle @@ -225,15 +225,6 @@ bmcdiscover_help bmcdiscover_q bmcdiscover_version chdef_nicips -confignetwork_2eth_bridge_br0 -confignetwork_2eth_bridge_br22_br33 -confignetwork_bond_eth2_eth3 -confignetwork_bond_false -confignetwork__bridge_false -confignetwork_installnic_2eth_bridge_br22_br33 -confignetwork_vlan_bond -confignetwork_vlan_eth0 -confignetwork_vlan_false encrypted_passwd_md5_diskfull encrypted_passwd_openssl_diskfull encrypted_passwd_sha256_diskfull diff --git a/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle index 4656f2610..bc1f4e039 100644 --- a/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle @@ -239,15 +239,6 @@ bmcdiscover_help bmcdiscover_q bmcdiscover_version chdef_nicips -confignetwork_2eth_bridge_br0 -confignetwork_2eth_bridge_br22_br33 -confignetwork_bond_eth2_eth3 -confignetwork_bond_false -confignetwork__bridge_false -confignetwork_installnic_2eth_bridge_br22_br33 -confignetwork_vlan_bond -confignetwork_vlan_eth0 -confignetwork_vlan_false encrypted_passwd_md5_diskfull encrypted_passwd_openssl_diskfull encrypted_passwd_sha256_diskfull diff --git a/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle b/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle index 8931b550e..77253d8cc 100644 --- a/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle @@ -236,15 +236,6 @@ bmcdiscover_help bmcdiscover_q bmcdiscover_version chdef_nicips -confignetwork_2eth_bridge_br0 -confignetwork_2eth_bridge_br22_br33 -confignetwork_bond_eth2_eth3 -confignetwork_bond_false -confignetwork__bridge_false -confignetwork_installnic_2eth_bridge_br22_br33 -confignetwork_vlan_bond -confignetwork_vlan_eth0 -confignetwork_vlan_false encrypted_passwd_md5_diskfull encrypted_passwd_openssl_diskfull encrypted_passwd_sha256_diskfull diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle index 120a16223..9c889b815 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle @@ -268,15 +268,6 @@ bmcdiscover_help bmcdiscover_q bmcdiscover_version chdef_nicips -confignetwork_2eth_bridge_br0 -confignetwork_2eth_bridge_br22_br33 -confignetwork_bond_eth2_eth3 -confignetwork_bond_false -confignetwork__bridge_false -confignetwork_installnic_2eth_bridge_br22_br33 -confignetwork_vlan_bond -confignetwork_vlan_eth0 -confignetwork_vlan_false encrypted_passwd_md5_diskfull encrypted_passwd_openssl_diskfull encrypted_passwd_sha256_diskfull diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle index 933dea55f..fa2d3253a 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle @@ -282,15 +282,6 @@ bmcdiscover_help bmcdiscover_q bmcdiscover_version chdef_nicips -confignetwork_2eth_bridge_br0 -confignetwork_2eth_bridge_br22_br33 -confignetwork_bond_eth2_eth3 -confignetwork_bond_false -confignetwork__bridge_false -confignetwork_installnic_2eth_bridge_br22_br33 -confignetwork_vlan_bond -confignetwork_vlan_eth0 -confignetwork_vlan_false encrypted_passwd_md5_diskfull encrypted_passwd_openssl_diskfull encrypted_passwd_sha256_diskfull diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle index 993f95012..73c1252d1 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle @@ -269,15 +269,6 @@ bmcdiscover_help bmcdiscover_q bmcdiscover_version chdef_nicips -confignetwork_2eth_bridge_br0 -confignetwork_2eth_bridge_br22_br33 -confignetwork_bond_eth2_eth3 -confignetwork_bond_false -confignetwork__bridge_false -confignetwork_installnic_2eth_bridge_br22_br33 -confignetwork_vlan_bond -confignetwork_vlan_eth0 -confignetwork_vlan_false encrypted_passwd_md5_diskfull encrypted_passwd_openssl_diskfull encrypted_passwd_sha256_diskfull diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle index 6d4816a4a..e1bd53098 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle @@ -274,15 +274,6 @@ bmcdiscover_help bmcdiscover_q bmcdiscover_version chdef_nicips -confignetwork_2eth_bridge_br0 -confignetwork_2eth_bridge_br22_br33 -confignetwork_bond_eth2_eth3 -confignetwork_bond_false -confignetwork__bridge_false -confignetwork_installnic_2eth_bridge_br22_br33 -confignetwork_vlan_bond -confignetwork_vlan_eth0 -confignetwork_vlan_false encrypted_passwd_md5_diskfull encrypted_passwd_openssl_diskfull encrypted_passwd_sha256_diskfull From aa068365d427ef17cf0c3edd82c0728e3048d801 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Wed, 23 Aug 2017 17:50:33 +0800 Subject: [PATCH 083/251] Revise InfiniBand test case --- xCAT-test/autotest/testcase/infiniband/cases0 | 3 +++ .../infiniband/rhel-infiniband-diskfull-install.sh | 12 +++++++----- .../infiniband/rhel-infiniband-diskless-install.sh | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/xCAT-test/autotest/testcase/infiniband/cases0 b/xCAT-test/autotest/testcase/infiniband/cases0 index c66b66ca7..f634bae17 100644 --- a/xCAT-test/autotest/testcase/infiniband/cases0 +++ b/xCAT-test/autotest/testcase/infiniband/cases0 @@ -24,6 +24,9 @@ cmd:updatenode $$CN -P confignetwork check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-ib0"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-ib0"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/ib0";else echo "Sorry,this is not supported os"; fi check:output=~11.1.0.100 +cmd:xdsh $$CN "ping -c 1 11.1.0.100" +check:rc==0 +# Clean up cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev ib0" cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-ib0"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-ib0"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/ib0";else echo "Sorry,this is not supported os"; fi diff --git a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh index 66ceb74fe..ede9f8aa4 100755 --- a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh +++ b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh @@ -141,10 +141,12 @@ mkdir -p "${OSIMAGE_OTHERPKGDIR}"/dkms [ "$?" -ne "0" ] && echo "File ${DKMS_RPM} not found." >&2 && exit 1 cp "${DKMS_RPM}" "${OSIMAGE_OTHERPKGDIR}/dkms" +( cd "${OSIMAGE_OTHERPKGDIR}" && createrepo . ) + makedhcp -n rinstall "${COMPUTE_NODE}" "osimage=${OSIMAGE_NAME}" -NETBOOT_TIMEOUT=600 +INSTALL_TIMEOUT=1800 declare -i WAIT=0 while sleep 10 @@ -152,8 +154,8 @@ do (( WAIT += 10 )) nodestat "${COMPUTE_NODE}" | grep ': sshd$' [ "$?" -eq "0" ] && break - [ "${WAIT}" -le "${NETBOOT_TIMEOUT}" ] - [ "$?" -ne "0" ] && echo "Netboot failed" >&2 && exit 1 + [ "${WAIT}" -le "${INSTALL_TIMEOUT}" ] + [ "$?" -ne "0" ] && echo "Operating system installation failed" >&2 && exit 1 done # For workaround the GitHub issue #3549 @@ -162,7 +164,7 @@ sleep 5 xdsh "${COMPUTE_NODE}" date [ "$?" -ne "0" ] && echo "Failed connect to compute node via SSH." >&2 && exit 1 -xdsh "${COMPUTE_NODE}" 'rpm -qa' | grep 'mlnx' -[ "$?" -ne "0" ] && echo "MLNX OFED installation checking failed" >&2 && exit 1 +xdsh "${COMPUTE_NODE}" 'rpm -qa' | grep 'mlnx' +[ "$?" -ne "0" ] && echo "MLNX OFED installation checking failed." >&2 && exit 1 exit 0 diff --git a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh index a5aad0e07..216ebaa63 100755 --- a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh +++ b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh @@ -180,7 +180,7 @@ sleep 5 xdsh "${COMPUTE_NODE}" date [ "$?" -ne "0" ] && echo "Failed connect to compute node via SSH." >&2 && exit 1 -xdsh "${COMPUTE_NODE}" 'rpm -qa' | grep 'mlnx' -[ "$?" -ne "0" ] && echo "MLNX OFED installation checking failed" >&2 && exit 1 +xdsh "${COMPUTE_NODE}" 'rpm -qa' | grep 'mlnx' +[ "$?" -ne "0" ] && echo "MLNX OFED installation checking failed." >&2 && exit 1 exit 0 From 06c3ad5b3739ce7d4db3b5c24cef46882257413c Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Thu, 24 Aug 2017 15:34:09 +0800 Subject: [PATCH 084/251] Revise the test case confignetwork_static_installnic --- xCAT-test/autotest/testcase/confignetwork/cases0 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-test/autotest/testcase/confignetwork/cases0 b/xCAT-test/autotest/testcase/confignetwork/cases0 index f468fae74..4615c4555 100644 --- a/xCAT-test/autotest/testcase/confignetwork/cases0 +++ b/xCAT-test/autotest/testcase/confignetwork/cases0 @@ -945,8 +945,8 @@ cmd:xdsh $$CN "mkdir -p /tmp/backupnet" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi check:rc==0 -cmd:xdsh $$CN "kill $(ps -A | awk '/dhclient/ { print $1 }')" -cmd:xdsh $$CN "kill -KILL $(ps -A | awk '/dhclient/ { print $1 }')" +cmd:xdsh $$CN "ps -A --format pid,comm | awk '/dhclient/ { print \$1 }' | xargs -r -n 1 kill" +cmd:xdsh $$CN "ps -A --format pid,comm | awk '/dhclient/ { print \$1 }' | xargs -r -n 1 kill -KILL" cmd:xdsh $$CN 'rm -f /var/lib/dhcp/dhclient*.lease* /var/lib/dhclient/dhclient*.lease*' check:rc==0 cmd:updatenode $$CN 'confignetwork -s' @@ -957,5 +957,5 @@ check:rc==0 cmd:test -e /tmp/CN.stanza && rmdef $$CN && mkdef -z Date: Thu, 24 Aug 2017 04:25:45 -0400 Subject: [PATCH 085/251] fix bug 3753 typo in confignetworks cases, refine cases --- .../autotest/testcase/confignetwork/cases0 | 51 ++++++++++++++----- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/xCAT-test/autotest/testcase/confignetwork/cases0 b/xCAT-test/autotest/testcase/confignetwork/cases0 index f0a21ea0e..9f4ef47b3 100644 --- a/xCAT-test/autotest/testcase/confignetwork/cases0 +++ b/xCAT-test/autotest/testcase/confignetwork/cases0 @@ -151,6 +151,7 @@ start:confignetwork_s_installnic_secondarynic_updatenode description: this case is to test confignetwork -s could configure installnic and secondarynic successfully with updatenode. cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi @@ -181,6 +182,7 @@ start:confignetwork_secondarynic_updatenode description: this case is to test confignetwork could configure secondarynic successfully with updatenode. cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi @@ -209,6 +211,7 @@ start: confignetwork_secondarynic_nicaliases_updatenode description: this case is to test confignetwork could config secondarynic nicaliases successfully with updatenode. cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi @@ -250,6 +253,7 @@ start:confignetwork_secondarynic_nicextraparams_updatenode description: this case is to test confignetwork could configure secondarynic nicextraparams successfully with updatenode. cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi @@ -408,6 +412,7 @@ start:confignetwork_secondarynic_thirdnic_multiplevalue_updatenode description:this case is to verify if confignetwork could config serveral nics' multiple value at the same time. cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi @@ -466,9 +471,11 @@ start:confignetwork_vlan_eth0 description: this case is to verify if confignetwork could config vlan for CN.When CN has Ethernet nic eth0, user wants to confgure 2 vlans, Configure vlan eth0.6 60.5.106.9 and eth0.7 70.5.106.9 based on ethernet nic eth0 cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +cmd:if grep "Red Hat" /etc/*release;then xdsh $$CN "yum -y install bridge-utils";fi cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 @@ -514,9 +521,11 @@ start:confignetwork_vlan_false description:this case is to verify if confignetwork could process the false value when vlan nicdevice is not correctly set cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +cmd:if grep "Red Hat" /etc/*release;then xdsh $$CN "yum -y install bridge-utils";fi cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1500 check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 @@ -556,20 +565,22 @@ start:confignetwork_bond_eth2_eth3 description: this case is to verify if confignetwork could config bond for CN.CN has 2 Ethernet nics, eth2 and eth3, user configures bond bond0 using ethernet nic eth2 and eth3. cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +cmd:if grep "Red Hat" /etc/*release;then xdsh $$CN "yum -y install bridge-utils";fi cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 check:rc==0 cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC check:rc==0 -cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0 +cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$THIRDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0 check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc==0 -cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= nicips.$$THIRDNIC= nictypes.$$SECONDNIC= nicnetworks.$$THIRDNIC= +cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= nicips.$$THIRDNIC= nictypes.$$THIRDNIC= nicnetworks.$$THIRDNIC= check:rc==0 cmd:mkdef -t network -o 30_5_0_0-255_255_0_0 net=30.5.0.0 mask=255.255.0.0 check:rc==0 @@ -608,20 +619,22 @@ start:confignetwork_bond_false description: this case is to verify if confignetwork could process when bond is not correctly set. cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +cmd:if grep "Red Hat" /etc/*release;then xdsh $$CN "yum -y install bridge-utils";fi cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 check:rc==0 cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC check:rc==0 -cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0 +cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$THIRDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0 check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc==0 -cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= nicips.$$THIRDNIC= nictypes.$$SECONDNIC= nicnetworks.$$THIRDNIC= +cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= nicips.$$THIRDNIC= nictypes.$$THIRDNIC= nicnetworks.$$THIRDNIC= check:rc==0 cmd:mkdef -t network -o 30_5_0_0-255_255_0_0 net=30.5.0.0 mask=255.255.0.0 check:rc==0 @@ -652,20 +665,22 @@ start:confignetwork_vlan_bond description: this case is to verify if confignetwork could config bond for CN.CN has 2 Ethernet nic eth2 and eth3, user wants to bond them to bond0, then make 2 vlan bond0.2 and bond0.3 for data network. cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +cmd:if grep "Red Hat" /etc/*release;then xdsh $$CN "yum -y install bridge-utils";fi cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1500 check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 check:rc==0 cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC mtu=1500 check:rc==0 -cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0 +cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$THIRDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0 check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc==0 -cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= nicips.$$THIRDNIC= nictypes.$$SECONDNIC= nicnetworks.$$THIRDNIC= +cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= nicips.$$THIRDNIC= nictypes.$$THIRDNIC= nicnetworks.$$THIRDNIC= check:rc==0 cmd:mkdef -t network -o 30_5_0_0-255_255_0_0 net=30.5.0.0 mask=255.255.0.0 mtu=1500 check:rc==0 @@ -713,20 +728,22 @@ start:confignetwork_2eth_bridge_br0 description:this case is to verify if confignetwork could config bridge for CN.CN has 2 Ethernet nics eth2 and eth3, user want to configure bond bond0 using eth2 and eth3, creates bridge br0 based on bond0. cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +cmd:if grep "Red Hat" /etc/*release;then xdsh $$CN "yum -y install bridge-utils";fi cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 check:rc==0 cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC check:rc==0 -cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0 +cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$THIRDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0 check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc==0 -cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= nicips.$$THIRDNIC= nictypes.$$SECONDNIC= nicnetworks.$$THIRDNIC= +cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= nicips.$$THIRDNIC= nictypes.$$THIRDNIC= nicnetworks.$$THIRDNIC= check:rc==0 cmd:mkdef -t network -o 30_5_0_0-255_255_0_0 net=30.5.0.0 mask=255.255.0.0 check:rc==0 @@ -763,20 +780,22 @@ start:confignetwork_2eth_bridge_br22_br33 description:this case is to verify if confignetwork could config bridge for CN.CN has 2 Ethernet nics eth2 and eth3, user wants to bond them as bond0, then make vlan bond0.2 and bond0.3, using bond0.2 create bridge br22,using bond0.3 create bridge br33. Use confignetwork to configure bond bond0, create vlan bond0.2 and bond0.3, create bridge br22 and br33. cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +cmd:if grep "Red Hat" /etc/*release;then xdsh $$CN "yum -y install bridge-utils";fi cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 check:rc==0 cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC check:rc==0 -cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0 +cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$THIRDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0 check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc==0 -cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= nicips.$$THIRDNIC= nictypes.$$SECONDNIC= nicnetworks.$$THIRDNIC= +cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= nicips.$$THIRDNIC= nictypes.$$THIRDNIC= nicnetworks.$$THIRDNIC= check:rc==0 cmd:mkdef -t network -o 30_5_0_0-255_255_0_0 net=30.5.0.0 mask=255.255.0.0 check:rc==0 @@ -825,20 +844,22 @@ start:confignetwork_installnic_2eth_bridge_br22_br33 description:this case is to test if confignetwork could config installnic and 2 bridges at the same time cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +cmd:if grep "Red Hat" /etc/*release;then xdsh $$CN "yum -y install bridge-utils";fi cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 check:rc==0 cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC check:rc==0 -cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0 +cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$THIRDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0 check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc==0 -cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= nicips.$$THIRDNIC= nictypes.$$SECONDNIC= nicnetworks.$$THIRDNIC= +cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= nicips.$$THIRDNIC= nictypes.$$THIRDNIC= nicnetworks.$$THIRDNIC= check:rc==0 cmd:mkdef -t network -o 30_5_0_0-255_255_0_0 net=30.5.0.0 mask=255.255.0.0 check:rc==0 @@ -891,20 +912,22 @@ start:confignetwork__bridge_false description:this case is to test if confignetwork could process false value when the bridge is not correctly set. cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +cmd:if grep "Red Hat" /etc/*release;then xdsh $$CN "yum -y install bridge-utils";fi cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 check:rc==0 cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC check:rc==0 -cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0 +cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$THIRDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0 check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc==0 -cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= nicips.$$THIRDNIC= nictypes.$$SECONDNIC= nicnetworks.$$THIRDNIC= +cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= nicips.$$THIRDNIC= nictypes.$$THIRDNIC= nicnetworks.$$THIRDNIC= check:rc==0 cmd:mkdef -t network -o 30_5_0_0-255_255_0_0 net=30.5.0.0 mask=255.255.0.0 check:rc==0 From 820fd10cc98ff6c67a7171556481883b83aea4e7 Mon Sep 17 00:00:00 2001 From: bybai Date: Thu, 24 Aug 2017 04:35:16 -0400 Subject: [PATCH 086/251] polished --- xCAT/postscripts/confignetwork | 8 ++++---- xCAT/postscripts/nicutils.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/xCAT/postscripts/confignetwork b/xCAT/postscripts/confignetwork index 645de5d95..816c67692 100755 --- a/xCAT/postscripts/confignetwork +++ b/xCAT/postscripts/confignetwork @@ -406,12 +406,12 @@ function sort_nics_device_order { vlan_slot=$vlan_slot" "$num fi else - echo "Error: nicdevices.$nic_dev base nic device cannot be $base_nic_type $base_nic_dev.(nicdevices is only required on vlan/bond/bridge)" + echo "Error: nicdevices.$nic_dev base nic device cannot be $base_nic_type $base_nic_dev.(nicdevices is only required on Bond/VLAN/Bridge)" fi ((num+=1)) done else - log_error "only support configure bond/vlan/bridge on redhat." + log_error "only support configuration of Bond/VLAN/Bridge on Red Hat." fi fi new_order=$eth_slot" "$bond_slot" "$vlan_slot @@ -555,7 +555,7 @@ function configure_nicdevice { errorcode=1 fi else - log_error "please check nic data in nics table." + log_error "Check the NIC data in the 'nics' table." errorcode=1 fi @@ -647,7 +647,7 @@ sorted_nicdevice_list=`sort_nics_device_order "$new_nicdevice"` #If there is invalid nics pair, errorcode is 1 invalid_nicdevice_pair=`echo "$sorted_nicdevice_list" | grep "Error"` if [ $? -eq 0 ]; then - echo "$invalid_nicdevice_pair"|log_lines error + echo "$invalid_nicdevice_pair"|sed 's/Error://g'|log_lines error errorcode=1 fi diff --git a/xCAT/postscripts/nicutils.sh b/xCAT/postscripts/nicutils.sh index d57598512..472bba2d9 100755 --- a/xCAT/postscripts/nicutils.sh +++ b/xCAT/postscripts/nicutils.sh @@ -1473,7 +1473,7 @@ function create_bond_interface { wait_for_ifstate $ifname UP 200 1 rc=$? if [ $rc -ne 0 ]; then - log_error "Interface \"$ifname\" was NOT in \"UP\" state eventually." + log_error "Interface \"$ifname\" could not be brought to \"UP\"." $ip link show $ifname \ | $sed -e 's/^/['$ifname' ip out >> /g' \ | log_lines info From 00d947a1fa5dcf18d9625bfa16cacd91d2184d63 Mon Sep 17 00:00:00 2001 From: chenglch Date: Thu, 24 Aug 2017 17:20:11 +0800 Subject: [PATCH 087/251] Fix the bug due to the race condition about the pipe usage (#3719) This commit disable the ACK mechanism in xCATd as now it will cause the race condition if multiple child processes are waiting for the response. fix-issue: #3698 --- xCAT-server/sbin/xcatd | 36 +++++++----------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index f2b7027f4..726f38f24 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -2441,35 +2441,12 @@ sub convey_response { # sanitize the response, to avoid being killed by non-printable bytes #$resp =~ tr/\011-\177/?/c; # seeing if using utf-8 offloads potential issues to client terminal, it didn't - store_fd($resp, $parent_fd); - yield; # parent must get timeslice anyway before an ack could possibly return - my $parsel = new IO::Select; - $parsel->add($parent_fd); - my $selbits = $parsel->bits; - my $rsp; - while ($selbits && ($rsp = select($selbits, undef, undef, 5))) { # block up to five seconds - - if ($quit) { # Obey quit flag - xexit 0; - } - if ($rsp == 0) { # This means the filedescriptor was removed - last; - } - if ($rsp < 0) { # A signal caused select to skip out, do-over - next; - } - - # At this point, the only possibility is a positive return, meaning parent_fd requires attention of some sort - $rsp = <$parent_fd>; - if ($rsp) { # If data actually came in, last, otherwise, remove it from the IO::Select, but both should amount to the same thing - last; - } else { - $parsel->remove($parent_fd); - last; - } + eval { + store_fd($resp, $parent_fd); + }; + if ($@) { + xCAT::MsgUtils->message("S", "Failed to store into socketpair: $@"); } - yield; # If still around, it means a peer process still hasn't gotten to us, so might as well yield - $selbits = $parsel->bits; } sub build_response { @@ -2992,9 +2969,10 @@ sub relay_fds { # Relays file descriptors from pipes to children to the SSL sock if ($@ and $@ =~ /^Magic number checking on storable file/) { # this most likely means we ran over the end of available input $fds->remove($rfh); close($rfh); + } elsif ($@) { + xCAT::MsgUtils->message("S", "Failed to retrieve from socketpair: $@"); } else { push @$replyqueue, $resp; - print $rfh "nfin\n"; } } foreach my $rin ($clientselect->can_read(0)) { From 32404bcc9aaec5cadf36df050f004f8048060072 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Thu, 24 Aug 2017 17:00:07 +0800 Subject: [PATCH 088/251] Revise InfiniBand test case --- xCAT-test/autotest/testcase/infiniband/cases0 | 4 ++-- .../rhel-infiniband-diskfull-install.sh | 21 +++++++++++++++---- .../rhel-infiniband-diskless-install.sh | 21 +++++++++++++++---- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/xCAT-test/autotest/testcase/infiniband/cases0 b/xCAT-test/autotest/testcase/infiniband/cases0 index f634bae17..568dfc1b1 100644 --- a/xCAT-test/autotest/testcase/infiniband/cases0 +++ b/xCAT-test/autotest/testcase/infiniband/cases0 @@ -1,10 +1,10 @@ start:rhel_infiniband_diskless_install -cmd:RHEL_ISO="$$ISO" LINUX_DISTRO="$$OS" COMPUTE_NODE="$$CN" MLNX_ISO="$$MLNX" DKMS_RPM="$$DKMS" /opt/xcat/share/xcat/tools/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh +cmd:RHEL_ISO="$$ISO" LINUX_DISTRO="GETNODEATTR($$CN, os)" COMPUTE_NODE="$$CN" MLNX_ISO="$$MLNX" DKMS_RPM="$$DKMS" /opt/xcat/share/xcat/tools/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh check:rc==0 end start:rhel_infiniband_diskfull_install -cmd:RHEL_ISO="$$ISO" LINUX_DISTRO="$$OS" COMPUTE_NODE="$$CN" MLNX_ISO="$$MLNX" DKMS_RPM="$$DKMS" /opt/xcat/share/xcat/tools/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh +cmd:RHEL_ISO="$$ISO" LINUX_DISTRO="GETNODEATTR($$CN, os)" COMPUTE_NODE="$$CN" MLNX_ISO="$$MLNX" DKMS_RPM="$$DKMS" /opt/xcat/share/xcat/tools/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh check:rc==0 end diff --git a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh index ede9f8aa4..3bc6fc7d0 100755 --- a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh +++ b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh @@ -1,7 +1,14 @@ #!/bin/bash ######## -# Set all the variables below +# +# For manually run this script in a standalone test environment without xCAT-test, +# do the following steps. +# +# * Set all the variables in LINE 11, 13, 16, and 17. +# * Download all the ISO files, RPMs needed, and put them in ${SOURCE_DIR} +# * If you intend to specify all the packages explicitly, set variable in LINE 61, 62, 63. +# [ -n "$LINUX_DISTRO" ] && LINUX_DISTRO="rhels7.4" @@ -9,8 +16,8 @@ LINUX_DISTRO="rhels7.4" LINUX_ARCH="ppc64le" [ -n "$COMPUTE_NODE" ] && -COMPUTE_NODE="c910f03c01p10" -SOURCE_DIR="/media/xcat" +COMPUTE_NODE="nonexistent" +SOURCE_DIR="/path/to/source" ######## @@ -155,7 +162,7 @@ do nodestat "${COMPUTE_NODE}" | grep ': sshd$' [ "$?" -eq "0" ] && break [ "${WAIT}" -le "${INSTALL_TIMEOUT}" ] - [ "$?" -ne "0" ] && echo "Operating system installation failed" >&2 && exit 1 + [ "$?" -ne "0" ] && echo "Operating system installation failed." >&2 && exit 1 done # For workaround the GitHub issue #3549 @@ -167,4 +174,10 @@ xdsh "${COMPUTE_NODE}" date xdsh "${COMPUTE_NODE}" 'rpm -qa' | grep 'mlnx' [ "$?" -ne "0" ] && echo "MLNX OFED installation checking failed." >&2 && exit 1 +xdsh "${COMPUTE_NODE}" 'lspci' +xdsh "${COMPUTE_NODE}" 'lsslot -c pci' +xdsh "${COMPUTE_NODE}" 'lsslot' +xdsh "${COMPUTE_NODE}" 'ibv_devinfo' +xdsh "${COMPUTE_NODE}" 'iblinkinfo' + exit 0 diff --git a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh index 216ebaa63..014ef8082 100755 --- a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh +++ b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh @@ -1,7 +1,14 @@ #!/bin/bash ######## -# Set all the variables below +# +# For manually run this script in a standalone test environment without xCAT-test, +# do the following steps. +# +# * Set all the variables in LINE 11, 13, 16, and 17. +# * Download all the ISO files, RPMs needed, and put them in ${SOURCE_DIR} +# * If you intend to specify all the packages explicitly, set variable in LINE 61, 62, 63 +# [ -n "$LINUX_DISTRO" ] && LINUX_DISTRO="rhels7.4" @@ -9,8 +16,8 @@ LINUX_DISTRO="rhels7.4" LINUX_ARCH="ppc64le" [ -n "$COMPUTE_NODE" ] && -COMPUTE_NODE="c910f03c01p10" -SOURCE_DIR="/media/xcat" +COMPUTE_NODE="nonexistent" +SOURCE_DIR="/path/to/source" ######## @@ -171,7 +178,7 @@ do nodestat "${COMPUTE_NODE}" | grep ': sshd$' [ "$?" -eq "0" ] && break [ "${WAIT}" -le "${NETBOOT_TIMEOUT}" ] - [ "$?" -ne "0" ] && echo "Netboot failed" >&2 && exit 1 + [ "$?" -ne "0" ] && echo "Netboot failed." >&2 && exit 1 done # For workaround the GitHub issue #3549 @@ -183,4 +190,10 @@ xdsh "${COMPUTE_NODE}" date xdsh "${COMPUTE_NODE}" 'rpm -qa' | grep 'mlnx' [ "$?" -ne "0" ] && echo "MLNX OFED installation checking failed." >&2 && exit 1 +xdsh "${COMPUTE_NODE}" 'lspci' +xdsh "${COMPUTE_NODE}" 'lsslot -c pci' +xdsh "${COMPUTE_NODE}" 'lsslot' +xdsh "${COMPUTE_NODE}" 'ibv_devinfo' +xdsh "${COMPUTE_NODE}" 'iblinkinfo' + exit 0 From 698d1f1bd9dc45021d05f30bd3d3e076f6cad042 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 24 Aug 2017 15:58:53 -0400 Subject: [PATCH 089/251] Remove the message when doing rinv on OpenBMC nodes. Values without Present are associations --- xCAT-server/lib/xcat/plugins/openbmc.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 86ec9903f..ad00bb276 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1359,8 +1359,8 @@ sub rinv_response { } } else { if (! defined $content{Present}) { - # This should never happen, but if we find this, contact firmware team to fix... - xCAT::SvrUtils::sendmsg("ERROR: Invalid data for $key_url, contact firmware team!", $callback, $node); + # If the Present field is not part of the attribute, then it's most likely a callout + # Do not print as part of the inventory response next; } From 680470c1493392de7074860d84eedffa1755d90f Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 25 Aug 2017 02:45:12 -0400 Subject: [PATCH 090/251] fix bug #3772, refine cases for encrypted_passwd to reduce the false error --- xCAT-test/autotest/testcase/passwd/case0 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/passwd/case0 b/xCAT-test/autotest/testcase/passwd/case0 index 656898d2a..583c1eff0 100644 --- a/xCAT-test/autotest/testcase/passwd/case0 +++ b/xCAT-test/autotest/testcase/passwd/case0 @@ -4,6 +4,8 @@ cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod check:rc==0 cmd:chtab key=system passwd.cryptmethod=md5 check:rc==0 +cmd:copycds $$ISO +check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 cmd:grep '\$1\$' /install/autoinst/$$CN @@ -76,6 +78,8 @@ cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod check:rc==0 cmd:chtab key=system passwd.cryptmethod=sha256 check:rc==0 +cmd:copycds $$ISO +check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 cmd:grep '\$5\$' /install/autoinst/$$CN @@ -148,6 +152,8 @@ cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod check:rc==0 cmd:chtab key=system passwd.cryptmethod=sha512 check:rc==0 +cmd:copycds $$ISO +check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 cmd:grep '\$6\$' /install/autoinst/$$CN @@ -225,9 +231,12 @@ cmd:chtab key=system passwd.username=root passwd.password=`openssl passwd -1 abc check:rc==0 cmd:gettab key=system passwd.password > /tmp/tmpcryptedpasswd check:rc==0 +cmd:copycds $$ISO +check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 -cmd:grep '\$1\$' /install/autoinst/$$CN |awk -F " " '{print $3}' > /tmp/instcryptedpasswd +cmd:if grep SUSE /etc/*release;then grep '\$1\$' /install/autoinst/c910f03c11k11 | awk 'gsub(/^ *| *$/,"")'| awk -v head="" -v tail="" '{print substr($0, index($0,head)+length(head),index($0,tail)-index($0,head)-length(head))}' > /tmp/instcryptedpasswd; elif grep "Red Hat" /etc/*release;then grep '\$1\$' /install/autoinst/$$CN |awk -F " " '{print $3}' > /tmp/instcryptedpasswd; elif grep Ubuntu /etc/*release;then grep '\$1\$' /install/autoinst/$$CN |awk -F " " '{print $4}' > /tmp/instcryptedpasswd;else echo "Sorry,this is not supported os"; fi +#cmd:grep '\$1\$' /install/autoinst/$$CN |awk -F " " '{print $3}' > /tmp/instcryptedpasswd check:rc==0 cmd:diff /tmp/tmpcryptedpasswd /tmp/instcryptedpasswd check:rc==0 From 2991ec1e59d386888f91142214a42d00bedb9336 Mon Sep 17 00:00:00 2001 From: Bin Xu Date: Fri, 25 Aug 2017 15:13:51 +0800 Subject: [PATCH 091/251] Fix 3749, handle '+' and '-' in id when merging /etc/passwd (#3771) * Fix 3749, handle '+' and '-' in id when merging /etc/passwd * Add some comments --- xCAT-server/share/xcat/scripts/xdcpmerge.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/scripts/xdcpmerge.sh b/xCAT-server/share/xcat/scripts/xdcpmerge.sh index 3941d79ad..b7724e9f1 100755 --- a/xCAT-server/share/xcat/scripts/xdcpmerge.sh +++ b/xCAT-server/share/xcat/scripts/xdcpmerge.sh @@ -76,7 +76,9 @@ for i in $*; do delim="|" for u in $removeusers do - userlist=$userlist$u$delim + # For special char +/-, need to escape + [[ "${u:0:1}x" =~ ^\+|\-x ]] && uu="\\$u" || uu="$u" + userlist=$userlist$uu$delim done # remove the last delimiter userlisttmp="${userlist%?}" From 90fca0212e2a90c613d5d0b3cca6ecd72358a059 Mon Sep 17 00:00:00 2001 From: Samveen Gulati Date: Fri, 25 Aug 2017 07:32:57 +0000 Subject: [PATCH 092/251] Fix `sed` leaving `dracut_install` without parameters --- xCAT-genesis-builder/buildrpm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-genesis-builder/buildrpm b/xCAT-genesis-builder/buildrpm index 2b4a42964..ff350d901 100755 --- a/xCAT-genesis-builder/buildrpm +++ b/xCAT-genesis-builder/buildrpm @@ -42,7 +42,7 @@ if [ $BUILDARCH = "x86_64" ]; then sed -i 's/\/lib64\/libpanel.so.5//' $DRACUTMODDIR/install sed -i 's/\/lib64\/libmenu.so.5//' $DRACUTMODDIR/install sed -i 's/\/lib64\/libsysfs.so.2//' $DRACUTMODDIR/install - sed -i 's/\/usr\/sbin\/iprconfig//' $DRACUTMODDIR/install + sed -i '/\/usr\/sbin\/iprconfig/ d' $DRACUTMODDIR/install sed -i '/hwdb.bin/ d' $DRACUTMODDIR/install sed -i 's/instmods ipr//' $DRACUTMODDIR/installkernel fi @@ -54,7 +54,7 @@ if [ "$HOSTOS" = "mcp" ]; then sed -i 's/dmidecode//' $DRACUTMODDIR/install sed -i 's/\/lib\/ld-linux.so.2/\/usr\/lib64\/ld-2.17.so/' $DRACUTMODDIR/install sed -i 's/\/lib64\/libsysfs.so.2//' $DRACUTMODDIR/install - sed -i 's/\/usr\/sbin\/iprconfig//' $DRACUTMODDIR/install + sed -i '/\/usr\/sbin\/iprconfig/ d' $DRACUTMODDIR/install else sed -i 's/\/lib\/ld-linux.so.2/\/usr\/lib64\/ld-linux-x86-64.so.2/' $DRACUTMODDIR/install fi From 89cb4ecdf1c6dd3f3fd0aa75729e8e59edd5ad74 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Fri, 25 Aug 2017 15:18:39 +0800 Subject: [PATCH 093/251] Revise InfiniBand test case --- xCAT-test/autotest/testcase/infiniband/cases0 | 2 ++ .../testcase/infiniband/rhel-infiniband-diskfull-install.sh | 2 +- .../testcase/infiniband/rhel-infiniband-diskless-install.sh | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/infiniband/cases0 b/xCAT-test/autotest/testcase/infiniband/cases0 index 568dfc1b1..4f8c043a1 100644 --- a/xCAT-test/autotest/testcase/infiniband/cases0 +++ b/xCAT-test/autotest/testcase/infiniband/cases0 @@ -1,9 +1,11 @@ start:rhel_infiniband_diskless_install +description:Intigration test of RHEL 7 and MLNX OFED for diskless installation. Need to set MLNX variable in the test configuration file. cmd:RHEL_ISO="$$ISO" LINUX_DISTRO="GETNODEATTR($$CN, os)" COMPUTE_NODE="$$CN" MLNX_ISO="$$MLNX" DKMS_RPM="$$DKMS" /opt/xcat/share/xcat/tools/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh check:rc==0 end start:rhel_infiniband_diskfull_install +description:Intigration test of RHEL 7 and MLNX OFED for diskfull installation. Need to set MLNX variable in the test configuration file. cmd:RHEL_ISO="$$ISO" LINUX_DISTRO="GETNODEATTR($$CN, os)" COMPUTE_NODE="$$CN" MLNX_ISO="$$MLNX" DKMS_RPM="$$DKMS" /opt/xcat/share/xcat/tools/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh check:rc==0 end diff --git a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh index 3bc6fc7d0..7085a7545 100755 --- a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh +++ b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh @@ -145,7 +145,7 @@ mkdir -p "${OSIMAGE_OTHERPKGDIR}" mkdir -p "${OSIMAGE_OTHERPKGDIR}"/dkms [ -f "${DKMS_RPM}" ] -[ "$?" -ne "0" ] && echo "File ${DKMS_RPM} not found." >&2 && exit 1 +[ "$?" -ne "0" ] && echo "File ${DKMS_RPM} not found." >&2 cp "${DKMS_RPM}" "${OSIMAGE_OTHERPKGDIR}/dkms" ( cd "${OSIMAGE_OTHERPKGDIR}" && createrepo . ) diff --git a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh index 014ef8082..f29cc891e 100755 --- a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh +++ b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh @@ -154,7 +154,7 @@ mkdir -p "${OSIMAGE_OTHERPKGDIR}" mkdir -p "${OSIMAGE_OTHERPKGDIR}"/dkms [ -f "${DKMS_RPM}" ] -[ "$?" -ne "0" ] && echo "File ${DKMS_RPM} not found." >&2 && exit 1 +[ "$?" -ne "0" ] && echo "File ${DKMS_RPM} not found." >&2 cp "${DKMS_RPM}" "${OSIMAGE_OTHERPKGDIR}/dkms" ( cd "${OSIMAGE_OTHERPKGDIR}" && createrepo . ) From f65c4e7862bb14608cad9c648f9215b1e2c6979c Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Fri, 25 Aug 2017 15:51:07 +0800 Subject: [PATCH 094/251] Revise InfiniBand test case --- xCAT-test/autotest/testcase/infiniband/cases0 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/infiniband/cases0 b/xCAT-test/autotest/testcase/infiniband/cases0 index 4f8c043a1..2da6c8d92 100644 --- a/xCAT-test/autotest/testcase/infiniband/cases0 +++ b/xCAT-test/autotest/testcase/infiniband/cases0 @@ -1,11 +1,11 @@ start:rhel_infiniband_diskless_install -description:Intigration test of RHEL 7 and MLNX OFED for diskless installation. Need to set MLNX variable in the test configuration file. +description:Integration test of RHEL 7 and MLNX OFED for diskless installation. Following variables need to be set in the test configuration file, ISO, CN, MLNX, DKMS. Read comments in rhel-infiniband-diskless-install.sh for details. cmd:RHEL_ISO="$$ISO" LINUX_DISTRO="GETNODEATTR($$CN, os)" COMPUTE_NODE="$$CN" MLNX_ISO="$$MLNX" DKMS_RPM="$$DKMS" /opt/xcat/share/xcat/tools/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh check:rc==0 end start:rhel_infiniband_diskfull_install -description:Intigration test of RHEL 7 and MLNX OFED for diskfull installation. Need to set MLNX variable in the test configuration file. +description:Integration test of RHEL 7 and MLNX OFED for diskfull installation. Following variables need to be set in the test configuration file, ISO, CN, MLNX, DKMS. Read comments in rhel-infiniband-diskfull-install.sh for details. cmd:RHEL_ISO="$$ISO" LINUX_DISTRO="GETNODEATTR($$CN, os)" COMPUTE_NODE="$$CN" MLNX_ISO="$$MLNX" DKMS_RPM="$$DKMS" /opt/xcat/share/xcat/tools/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh check:rc==0 end From deb96f3346b57e15bcb0ca7a849966a527cb7d14 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Fri, 25 Aug 2017 16:29:51 +0800 Subject: [PATCH 095/251] Revise InfiniBand test case --- .../testcase/infiniband/rhel-infiniband-diskfull-install.sh | 6 +++--- .../testcase/infiniband/rhel-infiniband-diskless-install.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh index 7085a7545..5729e2f56 100755 --- a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh +++ b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskfull-install.sh @@ -10,12 +10,12 @@ # * If you intend to specify all the packages explicitly, set variable in LINE 61, 62, 63. # -[ -n "$LINUX_DISTRO" ] && +[ -n "$LINUX_DISTRO" ] || LINUX_DISTRO="rhels7.4" -[ -n "$LINUX_ARCH" ] && +[ -n "$LINUX_ARCH" ] || LINUX_ARCH="ppc64le" -[ -n "$COMPUTE_NODE" ] && +[ -n "$COMPUTE_NODE" ] || COMPUTE_NODE="nonexistent" SOURCE_DIR="/path/to/source" diff --git a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh index f29cc891e..393f41f75 100755 --- a/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh +++ b/xCAT-test/autotest/testcase/infiniband/rhel-infiniband-diskless-install.sh @@ -10,12 +10,12 @@ # * If you intend to specify all the packages explicitly, set variable in LINE 61, 62, 63 # -[ -n "$LINUX_DISTRO" ] && +[ -n "$LINUX_DISTRO" ] || LINUX_DISTRO="rhels7.4" -[ -n "$LINUX_ARCH" ] && +[ -n "$LINUX_ARCH" ] || LINUX_ARCH="ppc64le" -[ -n "$COMPUTE_NODE" ] && +[ -n "$COMPUTE_NODE" ] || COMPUTE_NODE="nonexistent" SOURCE_DIR="/path/to/source" From 7e14a543fee032d1ce88a6a9b7d84c33b78c68d9 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Fri, 25 Aug 2017 04:35:48 -0400 Subject: [PATCH 096/251] modify description of "--sn" option for "bmcdiscover" according to Baiyuan's comments --- .../guides/admin-guides/references/man1/bmcdiscover.1.rst | 4 ++-- xCAT-client/pods/man1/bmcdiscover.1.pod | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/bmcdiscover.1.rst b/docs/source/guides/admin-guides/references/man1/bmcdiscover.1.rst index 60b3f6499..6fde20bb8 100644 --- a/docs/source/guides/admin-guides/references/man1/bmcdiscover.1.rst +++ b/docs/source/guides/admin-guides/references/man1/bmcdiscover.1.rst @@ -58,7 +58,7 @@ OPTIONS \ **-**\ **-sn**\ - Specify one or more service node on which bmcdiscover will run. In hierarchical cluster, the MN may not be able to access the BMC of CN directly, but SN can. With this option, bmcdiscover will be dispatched to the specified SN and set them as the 'servicenode' attribute of the discovered BMC node. + Specify one or more service nodes on which bmcdiscover will run. In hierarchical cluster, the MN may not be able to access the BMC of CN directly, but SN can. With this option, bmcdiscover will be dispatched to the specified SNs. Then, the nodename of the service node that 'bmcdiscover' is running on will be set to the 'servicenode' attribute of the discovered BMC node. @@ -156,7 +156,7 @@ Note: Input for IP range can be in the form: scanme.nmap.org, microsoft.com/24, bmcdiscover -s nmap --range "10.4.22-23.100-254" -z -3. To discovery BMCs through sn01: +3. To discover BMCs through sn01: .. code-block:: perl diff --git a/xCAT-client/pods/man1/bmcdiscover.1.pod b/xCAT-client/pods/man1/bmcdiscover.1.pod index d7a203f67..fc9ddfe5a 100644 --- a/xCAT-client/pods/man1/bmcdiscover.1.pod +++ b/xCAT-client/pods/man1/bmcdiscover.1.pod @@ -35,7 +35,7 @@ Specify one or more IP ranges acceptable to nmap. IP range can be hostnames, IP =item B<--sn> -Specify one or more service node on which bmcdiscover will run. In hierarchical cluster, the MN may not be able to access the BMC of CN directly, but SN can. With this option, bmcdiscover will be dispatched to the specified SN and set them as the 'servicenode' attribute of the discovered BMC node. +Specify one or more service nodes on which bmcdiscover will run. In hierarchical cluster, the MN may not be able to access the BMC of CN directly, but SN can. With this option, bmcdiscover will be dispatched to the specified SNs. Then, the nodename of the service node that 'bmcdiscover' is running on will be set to the 'servicenode' attribute of the discovered BMC node. =item B<-s> @@ -98,7 +98,7 @@ Note: Input for IP range can be in the form: scanme.nmap.org, microsoft.com/24, bmcdiscover -s nmap --range "10.4.22-23.100-254" -z -3. To discovery BMCs through sn01: +3. To discover BMCs through sn01: bmcdiscover --sn sn01 -s nmap --range "10.4.22-23.100-254" -z From 1fe4eb0e4195831dac8dcde947e6422122c55d78 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 25 Aug 2017 04:49:00 -0400 Subject: [PATCH 097/251] update for ubuntu cases --- xCAT-test/autotest/testcase/passwd/case0 | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/xCAT-test/autotest/testcase/passwd/case0 b/xCAT-test/autotest/testcase/passwd/case0 index 583c1eff0..040575164 100644 --- a/xCAT-test/autotest/testcase/passwd/case0 +++ b/xCAT-test/autotest/testcase/passwd/case0 @@ -4,8 +4,7 @@ cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod check:rc==0 cmd:chtab key=system passwd.cryptmethod=md5 check:rc==0 -cmd:copycds $$ISO -check:rc==0 +cmd:if grep Ubuntu /etc/*release;then if [ ! -e /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz ]; then copycds $$ISO;touch /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz;fi;fi cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 cmd:grep '\$1\$' /install/autoinst/$$CN @@ -78,8 +77,7 @@ cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod check:rc==0 cmd:chtab key=system passwd.cryptmethod=sha256 check:rc==0 -cmd:copycds $$ISO -check:rc==0 +cmd:if grep Ubuntu /etc/*release;then if [ ! -e /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz ]; then copycds $$ISO;touch /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz;fi;fi cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 cmd:grep '\$5\$' /install/autoinst/$$CN @@ -152,8 +150,7 @@ cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod check:rc==0 cmd:chtab key=system passwd.cryptmethod=sha512 check:rc==0 -cmd:copycds $$ISO -check:rc==0 +cmd:if grep Ubuntu /etc/*release;then if [ ! -e /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz ]; then copycds $$ISO;touch /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz;fi;fi cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 cmd:grep '\$6\$' /install/autoinst/$$CN @@ -231,8 +228,7 @@ cmd:chtab key=system passwd.username=root passwd.password=`openssl passwd -1 abc check:rc==0 cmd:gettab key=system passwd.password > /tmp/tmpcryptedpasswd check:rc==0 -cmd:copycds $$ISO -check:rc==0 +cmd:if grep Ubuntu /etc/*release;then if [ ! -e /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz ]; then copycds $$ISO;touch /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz;fi;fi cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 cmd:if grep SUSE /etc/*release;then grep '\$1\$' /install/autoinst/c910f03c11k11 | awk 'gsub(/^ *| *$/,"")'| awk -v head="" -v tail="" '{print substr($0, index($0,head)+length(head),index($0,tail)-index($0,head)-length(head))}' > /tmp/instcryptedpasswd; elif grep "Red Hat" /etc/*release;then grep '\$1\$' /install/autoinst/$$CN |awk -F " " '{print $3}' > /tmp/instcryptedpasswd; elif grep Ubuntu /etc/*release;then grep '\$1\$' /install/autoinst/$$CN |awk -F " " '{print $4}' > /tmp/instcryptedpasswd;else echo "Sorry,this is not supported os"; fi From 491bf3682ea2f78d4c72a6d8fa96b72a80b50e22 Mon Sep 17 00:00:00 2001 From: XuWei Date: Fri, 25 Aug 2017 05:17:49 -0400 Subject: [PATCH 098/251] Fix a bug that if children process over 32, sleep 1 second --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index b0ebd90c8..af01fb47b 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -686,9 +686,9 @@ sub scan_process { $pipe_map{$child} = $cfd; } - do { + while ($children >= 32) { sleep(1); - } until ($children < 32); + } } while($children > 0) { sleep(1); From 221fe30c5a5fb64f60433efcc6f7529702281642 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 25 Aug 2017 07:50:39 -0400 Subject: [PATCH 099/251] modify rspconfig testcase for get more debug information --- xCAT-test/autotest/testcase/rspconfig/cases0 | 2 +- .../autotest/testcase/rspconfig/rspconfig.sh | 95 +++++++++++-------- 2 files changed, 57 insertions(+), 40 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/cases0 b/xCAT-test/autotest/testcase/rspconfig/cases0 index a62796ae1..838b21171 100644 --- a/xCAT-test/autotest/testcase/rspconfig/cases0 +++ b/xCAT-test/autotest/testcase/rspconfig/cases0 @@ -44,7 +44,7 @@ end start:rspconfig_ip description:rspconfig change openbmc ip Attribute: $$CN-The operation object of rspconfig command -cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -i $$CN +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -i $$CN $NODEIP check:rc==0 cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -c $$CN ip check:rc==0 diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index 35cebceed..562739cca 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -16,57 +16,55 @@ function test_ip() } function net() { - a=$(echo "$1" | awk -F "." '{print $1" "$2" "$3" "$4}') - for num in $a; - do - while (($num!=0));do - echo -n $(($num%2)) >> /tmp/$$.num; - num=$(($num/2)); - done - done - rc=$(grep -o "1" /tmp/$$.num | wc -l) - rm /tmp/$$.num - ip="$2/$rc" - A=($(echo "$ip"|sed 's/[./;]/ /g')) - B=$(echo $((2**(32-${A[4]})-1))) - C=($(echo "obase=256;ibase=10; $B"|bc|awk '{if(NF==4)a=$0;if(NF==3)a="0"$0;if(NF==2)a="0 0"$0;if(NF==1)a="0 0 0"$0;print a}')) - D=$(echo ${A[*]} ${C[*]}) - rc2=echo echo $D|awk 'BEGIN{OFS="."}{print $1,$2,$3,$4"-"$1+$6,$2+$7,$3+$8,$4+$9}' |awk -F '-' '{print $2}' + LASTIP=`echo "$1 $2"|awk -F '[ .]+' 'BEGIN{OFS="."} END{print or($1,xor($5,255)),or($2,xor($6,255)),or($3,xor($7,255)),or($4,xor($8,255))}'` + FIRSTIP=`echo "$1 $2"|awk -F '[ .]+' 'BEGIN{OFS="."} END{print and($1,$5),and($2,$6),and($3,$7),and($4,$8)}'` + echo lastip is $LASTIP + echo first ip is $FIRSTIP + } function change_ip() { + echo "Prepare to change ip." + echo "Start to check ip valid ." + $NODEIP=$4; test_ip $1; - if [[ $? -ne 0 ]];then return 1;fi + if [[ $? -ne 0 ]];then echo "ip is invalid";return 1;fi + echo "ip is valid."; echo $1 > /tmp/BMCIP + net $1 $3 ip1=`echo $1|awk -F. '{print $1}'` ip2=`echo $1|awk -F. '{print $2}'` ip3=`echo $1|awk -F. '{print $3}'` - ip4=`echo $1|awk -F. '{print $4}'` - echo ip is $ip1.$ip2.$ip3.$ip4 - rc=$(net $3 $1) - rc4=`echo $rc |awk -F. '{print $4}'` - rc4=`expr "$rc4"` - if [[ $rc4 > 255 ]];then rc4=255;fi - ip=$ip4 + ip4=`echo $1|awk -F. '{print $4}'` + ipfirst=`echo $FIRSTIP|awk -F. '{print $4}'` + ip=`expr "$ipfirst" "+" "1"` + iplast=`echo $LASTIP|awk -F. '{print $4}'` + ip5=`expr "$iplast" "-" "1"` + echo ip is $ip ,ip5 is $ip5 while true; - do [[ $ip == "$rc4" ]] && return 1; + do [[ $ip == "$ip5" ]] && echo "exit for using last ip."&&return 1; ping $ip1.$ip2.$ip3.$ip -c 2 >/dev/null ; - if [[ $? != 0 ]]; then + if [[ $? != 0 && "$ip" != "$ip4" && "$ip1.$ip2.$ip3.$ip" != "$NODEIP" ]]; then coutip="$ip1.$ip2.$ip3.$ip" BMCNEWIP=$coutip; echo $1,$2,$3 + echo "Start to set ip for node." rspconfig $2 ip=$BMCNEWIP if [[ $? -eq 0 ]];then - echo right command; + echo "Could set ip for node."; else + echo "Could not set ip for node"; return 1; fi chdef $2 bmc=$BMCNEWIP + echo "Start to check ip setted successfully or not." check_result $2 ip $BMCNEWIP if [[ $? -ne 0 ]] ;then + echo "Ip could not be setted."; return 1; else - return 0; + echo "Ip could be setted."; + return 0; fi fi ip=`expr "$ip" "+" "1"` @@ -90,21 +88,25 @@ function check_result() } function clear_env() { +echo "Start to clear test environment."; if [[ -f /tmp/BMCIP ]];then originip=$(cat /tmp/BMCIP); echo originip is $originip; rspconfig $2 ip=$originip if [[ $? -eq 0 ]];then - echo right command; + echo "Could set the node's bmc ip to originip"; else + echo "Could not set the node's bmc ip to originip"; return 1; fi rm -rf /tmp/BMCIP chdef $2 bmc=$originip check_result $2 $3 $originip if [[ $? -ne 0 ]] ;then + echo "Could set the node's bmc ip to originip sucessfully."; return 1; else + echo "Could set the node's bmc ip to originip successfully."; return 0; fi fi @@ -112,41 +114,56 @@ function clear_env() } function change_gateway { - test_ip $1; - if [[ $? -ne 0 ]];then return 1;fi + echo "Prepare to change gateway."; + echo "Start to check gateway valid or not."; + test_ip $1; + if [[ $? -ne 0 ]];then echo "Gateway is invalid";return 1;fi + echo "Start to change gateway."; rspconfig $2 gateway=$1; if [[ $? -eq 0 ]];then - echo set gateway ok; + echo "Could set gateway."; else - return 1; + echo "Could not set gateway."; + return 1; fi + echo "Start to check gateway setted successfully or not."; check_result $2 $3 $1 if [[ $? -ne 0 ]] ;then + echo "Could not set gateway successfully."; return 1; else - return 0; + echo "Could set gateway successfully."; + return 0; fi } function change_netmask { - test_ip $1; - if [[ $? -ne 0 ]];then return 1;fi + echo "Prepare to change netmask"; + echo "Start to check netmask valid or not."; + test_ip $1; + if [[ $? -ne 0 ]];then echo "Net mask is invalid.";return 1;fi rspconfig $2 netmask=$1; if [[ $? -eq 0 ]];then - echo set netmask ok; + echo "Could set netmask."; else + echo "Could not set netmask."; return 1; fi check_result $2 $3 $1 if [[ $? -ne 0 ]] ;then + echo "Could not set netmask successfully."; return 1; else - return 0; + echo "Could set netmask successfully."; + return 0; fi } BMCIP="" BMCGTEWAT="" BMCNETMASK="" +FIRSTIP="" +LASTIP="" +NODEIP="" while [ "$#" -gt "0" ] do case $1 in @@ -158,7 +175,7 @@ do else exit 1; fi - change_ip $BMCIP $2 $BMCNETMASK + change_ip $BMCIP $2 $BMCNETMASK $3 if [[ $? -eq 1 ]];then exit 1 else From 0f971dda0cd385665ada717f4ebcd354e7267700 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 25 Aug 2017 09:01:32 -0400 Subject: [PATCH 100/251] modify rspconfig testcase for get more debug information --- xCAT-test/autotest/testcase/rspconfig/rspconfig.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index 562739cca..c359d173d 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -26,7 +26,7 @@ function change_ip() { echo "Prepare to change ip." echo "Start to check ip valid ." - $NODEIP=$4; + NODEIP=$4; test_ip $1; if [[ $? -ne 0 ]];then echo "ip is invalid";return 1;fi echo "ip is valid."; From 9f5fdabe98858ae338482e4096383d2f717893d5 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Sun, 27 Aug 2017 20:47:42 -0400 Subject: [PATCH 101/251] fix a typo --- xCAT-test/autotest/testcase/passwd/case0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/passwd/case0 b/xCAT-test/autotest/testcase/passwd/case0 index 040575164..2e17861ac 100644 --- a/xCAT-test/autotest/testcase/passwd/case0 +++ b/xCAT-test/autotest/testcase/passwd/case0 @@ -231,7 +231,7 @@ check:rc==0 cmd:if grep Ubuntu /etc/*release;then if [ ! -e /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz ]; then copycds $$ISO;touch /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz;fi;fi cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 -cmd:if grep SUSE /etc/*release;then grep '\$1\$' /install/autoinst/c910f03c11k11 | awk 'gsub(/^ *| *$/,"")'| awk -v head="" -v tail="" '{print substr($0, index($0,head)+length(head),index($0,tail)-index($0,head)-length(head))}' > /tmp/instcryptedpasswd; elif grep "Red Hat" /etc/*release;then grep '\$1\$' /install/autoinst/$$CN |awk -F " " '{print $3}' > /tmp/instcryptedpasswd; elif grep Ubuntu /etc/*release;then grep '\$1\$' /install/autoinst/$$CN |awk -F " " '{print $4}' > /tmp/instcryptedpasswd;else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then grep '\$1\$' /install/autoinst/$$CN | awk 'gsub(/^ *| *$/,"")'| awk -v head="" -v tail="" '{print substr($0, index($0,head)+length(head),index($0,tail)-index($0,head)-length(head))}' > /tmp/instcryptedpasswd; elif grep "Red Hat" /etc/*release;then grep '\$1\$' /install/autoinst/$$CN |awk -F " " '{print $3}' > /tmp/instcryptedpasswd; elif grep Ubuntu /etc/*release;then grep '\$1\$' /install/autoinst/$$CN |awk -F " " '{print $4}' > /tmp/instcryptedpasswd;else echo "Sorry,this is not supported os"; fi #cmd:grep '\$1\$' /install/autoinst/$$CN |awk -F " " '{print $3}' > /tmp/instcryptedpasswd check:rc==0 cmd:diff /tmp/tmpcryptedpasswd /tmp/instcryptedpasswd From beeb80cfdeb201f00e8e53286802a1fef680790c Mon Sep 17 00:00:00 2001 From: bybai Date: Sun, 27 Aug 2017 22:32:35 -0400 Subject: [PATCH 102/251] polished based on comments. --- xCAT/postscripts/confignetwork | 2 +- xCAT/postscripts/nicutils.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT/postscripts/confignetwork b/xCAT/postscripts/confignetwork index 816c67692..f51132727 100755 --- a/xCAT/postscripts/confignetwork +++ b/xCAT/postscripts/confignetwork @@ -411,7 +411,7 @@ function sort_nics_device_order { ((num+=1)) done else - log_error "only support configuration of Bond/VLAN/Bridge on Red Hat." + log_error "Only support configuration of Bond/VLAN/Bridge on Red Hat." fi fi new_order=$eth_slot" "$bond_slot" "$vlan_slot diff --git a/xCAT/postscripts/nicutils.sh b/xCAT/postscripts/nicutils.sh index 472bba2d9..f750aa68e 100755 --- a/xCAT/postscripts/nicutils.sh +++ b/xCAT/postscripts/nicutils.sh @@ -1473,7 +1473,7 @@ function create_bond_interface { wait_for_ifstate $ifname UP 200 1 rc=$? if [ $rc -ne 0 ]; then - log_error "Interface \"$ifname\" could not be brought to \"UP\"." + log_error "Interface \"$ifname\" could not be brought \"UP\"." $ip link show $ifname \ | $sed -e 's/^/['$ifname' ip out >> /g' \ | log_lines info From 816c9a941026036b5222ab38fff895f877e5544a Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Mon, 28 Aug 2017 01:21:06 -0400 Subject: [PATCH 103/251] Add debug information for isntallation failed case in automation --- .../testcase/installation/customize_sleep_for_sn | 13 ++++++++++--- .../autotest/testcase/installation/pre_deploy_sn | 15 +++++++++++---- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/customize_sleep_for_sn b/xCAT-test/autotest/testcase/installation/customize_sleep_for_sn index 7cc8b5790..75be09f11 100755 --- a/xCAT-test/autotest/testcase/installation/customize_sleep_for_sn +++ b/xCAT-test/autotest/testcase/installation/customize_sleep_for_sn @@ -1,13 +1,18 @@ #!/usr/bin/env perl +use File::Basename; +my $program_name = basename($0); + my $os = $ARGV[0]; my $arch = $ARGV[1]; -my $log = "/tmp/pre_deploy_sn.log"; +#my $log = "/tmp/pre_deploy_sn.log"; +print ">>>Enter $program_name\n"; my $orgclusterconffile = "/opt/xcat/share/xcat/tools/autotest/default.conf"; my $snnodename = `cat $orgclusterconffile |grep -E '^SN\s*='|awk -F'=' '{print \$2}'`; chomp($snnodename); -`echo "SN=$snnodename" >> $log`; +#`echo "SN=$snnodename" >> $log`; +print "The target SN = $snnodename\n"; sleep 300; my $timecnt = 0; @@ -18,11 +23,13 @@ while ($timecnt < 120) { if ($os =~ /rhel/i && $arch =~ /^ppc64$/i) { my $booting = system("lsdef -l $snnodename|grep status|grep booting > /dev/null 2>&1"); system("xdsh $snnodename \"echo 1\"") if ($booting == 0); - `echo "send signal to $snnodename for the $timecnt times" >> $log`; + print "send signal to $snnodename for the $timecnt times\n"; + #`echo "send signal to $snnodename for the $timecnt times" >> $log`; } sleep 30; $timecnt++; } +print ">>>Leave $program_name\n"; exit 0; diff --git a/xCAT-test/autotest/testcase/installation/pre_deploy_sn b/xCAT-test/autotest/testcase/installation/pre_deploy_sn index ea12ed759..21c18413b 100755 --- a/xCAT-test/autotest/testcase/installation/pre_deploy_sn +++ b/xCAT-test/autotest/testcase/installation/pre_deploy_sn @@ -4,15 +4,22 @@ $ENV{TERM} = "xterm-256color"; my $os = $ARGV[0]; my $arch = $ARGV[1]; -my $log = "/tmp/pre_deploy_sn.log"; sub runcmd { my $cmd = shift; - `$cmd >> $log 2>&1`; - if ($?) { - #print "run $cmd ....[error]\n"; + my $case_start_time = timelocal(localtime()); + my $case_start_time_str = scalar(localtime()); + print ">>>To run: $cmd [$case_start_time_str]\n"; + + my @output = `$cmd 2>&1`; + chomp(@output); + print "$_\n" foreach (@output); + if ($?) { + print ">>>To run $cmd ....[error]\n"; exit 1; + }else{ + print ">>>To run: $cmd ....[ok]\n"; } } From c499e7e9fd6ac7984b927e46b57aff85bd384fc9 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Mon, 28 Aug 2017 02:25:46 -0400 Subject: [PATCH 104/251] change the order of confignetworks test case in rhels7.4_x86_64.bundle --- .../autotest/bundle/rhels7.4_x86_64.bundle | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/xCAT-test/autotest/bundle/rhels7.4_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.4_x86_64.bundle index b90ff26e0..3b30ba820 100644 --- a/xCAT-test/autotest/bundle/rhels7.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.4_x86_64.bundle @@ -16,6 +16,15 @@ confignetwork_secondarynic_thirdnic_multiplevalue_updatenode confignetwork_secondarynic_nicnetworks_updatenode_false confignetwork_secondarynic_nicips_updatenode_false confignetwork_secondarynic_nictype_updatenode_false +confignetwork_2eth_bridge_br0 +confignetwork_2eth_bridge_br22_br33 +confignetwork_bond_eth2_eth3 +confignetwork_bond_false +confignetwork__bridge_false +confignetwork_installnic_2eth_bridge_br22_br33 +confignetwork_vlan_bond +confignetwork_vlan_eth0 +confignetwork_vlan_false chdef_null chdef_z chdef_t_o_error @@ -232,15 +241,6 @@ bmcdiscover_help bmcdiscover_q bmcdiscover_version chdef_nicips -confignetwork_2eth_bridge_br0 -confignetwork_2eth_bridge_br22_br33 -confignetwork_bond_eth2_eth3 -confignetwork_bond_false -confignetwork__bridge_false -confignetwork_installnic_2eth_bridge_br22_br33 -confignetwork_vlan_bond -confignetwork_vlan_eth0 -confignetwork_vlan_false encrypted_passwd_md5_diskfull encrypted_passwd_openssl_diskfull encrypted_passwd_sha256_diskfull From 4e007444323acacbb93a57af715ebd3b477fc003 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Mon, 28 Aug 2017 15:03:44 +0800 Subject: [PATCH 105/251] rsync xcat-dep to http://xcat.org/files/xcat/repos/yum/devel/xcat-dep/ --- builddep.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builddep.sh b/builddep.sh index 84ca78e40..1413dcca2 100755 --- a/builddep.sh +++ b/builddep.sh @@ -225,7 +225,7 @@ if [ "$OSNAME" == "AIX" ]; then else # Linux SYSGRP=root - YUM=yum + YUM=yum/devel FRSDIR='2.x_Linux' fi chgrp -R -h $SYSGRP * From e7e18f46b63c9172241b1640042e46bfb5c9abbc Mon Sep 17 00:00:00 2001 From: immarvin Date: Mon, 28 Aug 2017 04:21:49 -0400 Subject: [PATCH 106/251] fix issue [FVT]:rmimage output is not consistent on rhels and sles/ubuntu #3783 --- xCAT-server/lib/xcat/plugins/debian.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index 8260874ea..374c37067 100644 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -957,6 +957,8 @@ sub mknetboot my $xcatdport = "3001"; my $xcatiport = "3002"; my $nodestatus = "y"; + my @myself = xCAT::NetworkUtils->determinehostname(); + my $myname = $myself[ (scalar @myself) - 1 ]; if ($sitetab) { @@ -1170,7 +1172,7 @@ sub mknetboot if ($statelite) { unless (-r "$rootimgdir/kernel") { $callback->({ - error => [qq{Did you run "genimage" before running "liteimg"? kernel cannot be found...}], + error => [qq{Did you run "genimage" before running "liteimg"? kernel cannot be found at $rootimgdir/kernel on $myname}], errorcode => [1] }); next; @@ -1197,7 +1199,7 @@ sub mknetboot } else { unless (-r "$rootimgdir/kernel") { $callback->({ - error => [qq{Did you run "genimage" before running "packimage"? kernel cannot be found}], + error => [qq{Did you run "genimage" before running "packimage"? kernel cannot be found at $rootimgdir/kernel on $myname}], errorcode => [1] }); next; From 254cf2b2bfe44f23a453c2da753c2e55b6f924f0 Mon Sep 17 00:00:00 2001 From: Bin Xu Date: Mon, 28 Aug 2017 17:07:20 +0800 Subject: [PATCH 107/251] Fix 3787, code error when missing -l option for makedhcp in nodeset (#3788) --- xCAT-server/lib/xcat/plugins/grub2.pm | 2 +- xCAT-server/lib/xcat/plugins/petitboot.pm | 2 +- xCAT-server/lib/xcat/plugins/xnba.pm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/grub2.pm b/xCAT-server/lib/xcat/plugins/grub2.pm index 03482eeb4..4f72eb452 100644 --- a/xCAT-server/lib/xcat/plugins/grub2.pm +++ b/xCAT-server/lib/xcat/plugins/grub2.pm @@ -816,7 +816,7 @@ sub process_request { if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command xCAT::MsgUtils->trace($verbose_on_off, "d", "grub2: issue makedhcp request"); $sub_req->({ command => ['makedhcp'], - node => \@{ $osimagenodehash{$osimage} } }, $callback); + node => \@{ $osimagenodehash{$osimage} }, arg => ['-l'] }, $callback); } else { xCAT::MsgUtils->trace($verbose_on_off, "d", "grub2: issue makedhcp request"); $sub_req->({ command => ['makedhcp'], diff --git a/xCAT-server/lib/xcat/plugins/petitboot.pm b/xCAT-server/lib/xcat/plugins/petitboot.pm index af3320ae2..c6c9c7295 100644 --- a/xCAT-server/lib/xcat/plugins/petitboot.pm +++ b/xCAT-server/lib/xcat/plugins/petitboot.pm @@ -656,7 +656,7 @@ sub process_request { } if ($do_dhcpsetup) { my @parameter; - push @parameter, '-l' if ($::request->{'_disparatetftp'}->[0]); + push @parameter, '-l' if ($request->{'_disparatetftp'}->[0]); xCAT::MsgUtils->trace($verbose_on_off, "d", "petitboot: issue makedhcp request"); $sub_req->({ command => ['makedhcp'], diff --git a/xCAT-server/lib/xcat/plugins/xnba.pm b/xCAT-server/lib/xcat/plugins/xnba.pm index 7250f1b6c..1bccc87b9 100644 --- a/xCAT-server/lib/xcat/plugins/xnba.pm +++ b/xCAT-server/lib/xcat/plugins/xnba.pm @@ -711,7 +711,7 @@ sub process_request { } if ($do_dhcpsetup) { my @parameter; - push @parameter, '-l' if ($::request->{'_disparatetftp'}->[0]); + push @parameter, '-l' if ($::XNBA_request->{'_disparatetftp'}->[0]); xCAT::MsgUtils->trace($verbose_on_off, "d", "xnba: issue makedhcp request"); $sub_req->({ command => ['makedhcp'], From 1ab961f083b3ad84b025f557d42c371d96658be5 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Mon, 28 Aug 2017 08:46:09 -0400 Subject: [PATCH 108/251] change rspconfig call in the switchdiscover.pm file --- xCAT-server/lib/xcat/plugins/switchdiscover.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index d590d62ce..2bad5ccc8 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -1459,7 +1459,7 @@ sub switchsetup { $mask=$net->{'mask'}; } } - $cmd = "rspconfig $pdu hostname=$pdu,ip=$otherinterfaces,netmask=$mask"; + $cmd = "rspconfig $pdu hostname=$pdu ip=$otherinterfaces netmask=$mask"; xCAT::Utils->runcmd($cmd, 0); if ($::RUNCMD_RC == 0) { xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$pdu,"ip=$ip","otherinterfaces="] }, $sub_req, 0, 1); From af0d99d8a3547f2de42663fc5a2fbfa08a62e580 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Mon, 28 Aug 2017 08:46:32 -0400 Subject: [PATCH 109/251] modify rspconfig testcase for get more debug information --- .../autotest/testcase/rspconfig/rspconfig.sh | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index c359d173d..992b16d50 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -25,7 +25,7 @@ function net() function change_ip() { echo "Prepare to change ip." - echo "Start to check ip valid ." + echo "Start to check ip valid." NODEIP=$4; test_ip $1; if [[ $? -ne 0 ]];then echo "ip is invalid";return 1;fi @@ -51,19 +51,19 @@ function change_ip() echo "Start to set ip for node." rspconfig $2 ip=$BMCNEWIP if [[ $? -eq 0 ]];then - echo "Could set ip for node."; + echo "Could set bmc's ip for node using rspconfig."; else - echo "Could not set ip for node"; + echo "Could not set bmc's ip for node using rspconfig."; return 1; fi chdef $2 bmc=$BMCNEWIP - echo "Start to check ip setted successfully or not." + echo "Start to check bmc's ip setted successfully or not." check_result $2 ip $BMCNEWIP if [[ $? -ne 0 ]] ;then - echo "Ip could not be setted."; + echo "Set bmc's ip failed."; return 1; else - echo "Ip could be setted."; + echo "Set bmc's ip successfully."; return 0; fi fi @@ -88,25 +88,25 @@ function check_result() } function clear_env() { -echo "Start to clear test environment."; + echo "Start to clear test environment."; if [[ -f /tmp/BMCIP ]];then originip=$(cat /tmp/BMCIP); echo originip is $originip; rspconfig $2 ip=$originip if [[ $? -eq 0 ]];then - echo "Could set the node's bmc ip to originip"; + echo "Could set bmc's ip to originip using rspconfig."; else - echo "Could not set the node's bmc ip to originip"; + echo "Could not set bmc's ip to originip using rspconfig."; return 1; fi rm -rf /tmp/BMCIP chdef $2 bmc=$originip check_result $2 $3 $originip if [[ $? -ne 0 ]] ;then - echo "Could set the node's bmc ip to originip sucessfully."; + echo "Set bmc's ip to originip failed."; return 1; else - echo "Could set the node's bmc ip to originip successfully."; + echo "Set bmc's ip to originip successfully."; return 0; fi fi @@ -114,25 +114,25 @@ echo "Start to clear test environment."; } function change_gateway { - echo "Prepare to change gateway."; - echo "Start to check gateway valid or not."; + echo "Prepare to change gateway."; + echo "Start to check gateway valid or not."; test_ip $1; if [[ $? -ne 0 ]];then echo "Gateway is invalid";return 1;fi - echo "Start to change gateway."; + echo "Start to change bmc's gateway."; rspconfig $2 gateway=$1; if [[ $? -eq 0 ]];then - echo "Could set gateway."; + echo "Could set bmc's gateway."; else - echo "Could not set gateway."; + echo "Could not set bmc's gateway."; return 1; fi - echo "Start to check gateway setted successfully or not."; + echo "Start to check gateway setting successfully or not."; check_result $2 $3 $1 if [[ $? -ne 0 ]] ;then - echo "Could not set gateway successfully."; + echo "Set bmc's gateway failed."; return 1; else - echo "Could set gateway successfully."; + echo "Set bmc's gateway successfully."; return 0; fi } @@ -144,17 +144,17 @@ function change_netmask if [[ $? -ne 0 ]];then echo "Net mask is invalid.";return 1;fi rspconfig $2 netmask=$1; if [[ $? -eq 0 ]];then - echo "Could set netmask."; + echo "Could set bmc's netmask using rspconfig."; else - echo "Could not set netmask."; + echo "Could not set bmc's netmask using rspconfig."; return 1; fi check_result $2 $3 $1 if [[ $? -ne 0 ]] ;then - echo "Could not set netmask successfully."; + echo "Set bmc's netmask failed."; return 1; else - echo "Could set netmask successfully."; + echo "Set bmc's netmask successfully."; return 0; fi } From 067225cfce53f9381d42a1a2c941637a93502883 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 28 Aug 2017 15:45:50 -0400 Subject: [PATCH 110/251] Add code to support display of hostname using rspconfig --- xCAT-server/lib/xcat/plugins/openbmc.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index ad00bb276..865ab75e9 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -583,7 +583,7 @@ sub parse_args { } $setorget = "set"; if (ref($check) eq "ARRAY") { return $check; } - } elsif ($subcommand =~ /^ip$|^netmask$|^gateway$|^vlan$/) { + } elsif ($subcommand =~ /^ip$|^netmask$|^gateway$|^hostname$|^vlan$/) { return ([ 1, "Can not configure and display nodes' value at the same time" ]) if ($setorget and $setorget eq "set"); $setorget = "get"; if (ref($check) eq "ARRAY") { return $check; } @@ -794,7 +794,7 @@ sub parse_command_status { if ($command eq "rspconfig") { my @options = (); foreach $subcommand (@$subcommands) { - if ($subcommand =~ /^ip$|^netmask$|^gateway$|^vlan$/) { + if ($subcommand =~ /^ip$|^netmask$|^gateway$|^hostname$|^vlan$/) { $next_status{LOGIN_RESPONSE} = "RSPCONFIG_GET_REQUEST"; $next_status{RSPCONFIG_GET_REQUEST} = "RSPCONFIG_GET_RESPONSE"; push @options, $subcommand; @@ -1615,6 +1615,7 @@ sub rspconfig_response { my $gateway = "n/a"; my $prefix = "n/a"; my $vlan = "n/a"; + my $hostname = ""; my $default_gateway = "n/a"; my $adapter_id = "n/a"; my $error; @@ -1628,6 +1629,9 @@ sub rspconfig_response { if (defined($content{DefaultGateway}) and $content{DefaultGateway}) { $default_gateway = $content{DefaultGateway}; } + if (defined($content{HostName}) and $content{HostName}) { + $hostname = $content{HostName}; + } } @@ -1673,6 +1677,9 @@ sub rspconfig_response { if ($grep_string =~ "vlan") { push @output, "BMC VLAN ID enabled: $vlan"; } + if ($grep_string =~ "hostname") { + push @output, "BMC Hostname: $hostname"; + } } xCAT::SvrUtils::sendmsg("$_", $callback, $node) foreach (@output); From db08fe8fb2ad6f8c061e2b02fcef1765cb8a3214 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 28 Aug 2017 16:47:18 -0400 Subject: [PATCH 111/251] Add support for setting hostname for the BMC --- xCAT-server/lib/xcat/plugins/openbmc.pm | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 865ab75e9..3468a34d5 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -271,9 +271,9 @@ my %status_info = ( process => \&rspconfig_response, }, RSPCONFIG_SET_REQUEST => { - method => "POST", - init_url => "", - data => "", + method => "PUT", + init_url => "$openbmc_project_url/network", + data => "[]", }, RSPCONFIG_SET_RESPONSE => { process => \&rspconfig_response, @@ -570,7 +570,7 @@ sub parse_args { return ([ 1, "Can not configure and display nodes' value at the same time" ]) if ($setorget and $setorget eq "get"); my $key = $1; my $value = $2; - return ([ 1, "Unsupported command: $command $key" ]) unless ($key =~ /^ip$|^netmask$|^gateway$|^vlan$/); + return ([ 1, "Unsupported command: $command $key" ]) unless ($key =~ /^ip$|^netmask$|^gateway$|^hostname$|^vlan$/); my $nodes_num = @$noderange; return ([ 1, "Invalid parameter for option $key" ]) unless ($value); @@ -814,6 +814,16 @@ sub parse_command_status { $next_status{RSPCONFIG_DHCP_RESPONSE} = "RPOWER_BMCREBOOT_REQUEST"; $next_status{RPOWER_BMCREBOOT_REQUEST} = "RPOWER_RESET_RESPONSE"; $status_info{RPOWER_RESET_RESPONSE}{argv} = "bmcreboot"; + } elsif ($key =~ /^hostname$/) { + $next_status{LOGIN_RESPONSE} = "RSPCONFIG_SET_REQUEST"; + $next_status{RSPCONFIG_SET_REQUEST} = "RSPCONFIG_SET_RESPONSE"; + $next_status{RSPCONFIG_SET_RESPONSE} = "RSPCONFIG_GET_REQUEST"; + $next_status{RSPCONFIG_GET_REQUEST} = "RSPCONFIG_GET_RESPONSE"; + + $status_info{RSPCONFIG_SET_REQUEST}{data} = "$value"; + $status_info{RSPCONFIG_SET_REQUEST}{init_url} .= "/config/attr/HostName"; + push @options, $key; + } else { $next_status{LOGIN_RESPONSE} = "RSPCONFIG_SET_REQUEST"; $next_status{RSPCONFIG_SET_REQUEST} = "RSPCONFIG_SET_RESPONSE"; @@ -1685,6 +1695,11 @@ sub rspconfig_response { xCAT::SvrUtils::sendmsg("$_", $callback, $node) foreach (@output); } + if ($node_info{$node}{cur_status} eq "RSPCONFIG_SET_RESPONSE") { + if ($response_info->{'message'} eq $::RESPONSE_OK) { + xCAT::SvrUtils::sendmsg("Setting BMC Hostname (requires bmcreboot to take effect)...", $callback, $node); + } + } if ($node_info{$node}{cur_status} eq "RSPCONFIG_DHCP_RESPONSE") { if ($response_info->{'message'} eq $::RESPONSE_OK) { my $bmc_node = "$node BMC"; From f50604d7188c210b16bcc43bc75550960a678641 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Mon, 28 Aug 2017 21:55:09 -0400 Subject: [PATCH 112/251] Add missing dependency package for pre_deploy_sn used by SN setup test case --- xCAT-test/autotest/testcase/installation/pre_deploy_sn | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/pre_deploy_sn b/xCAT-test/autotest/testcase/installation/pre_deploy_sn index 21c18413b..82efebb82 100755 --- a/xCAT-test/autotest/testcase/installation/pre_deploy_sn +++ b/xCAT-test/autotest/testcase/installation/pre_deploy_sn @@ -1,4 +1,5 @@ #!/usr/bin/env perl +use Time::Local; $ENV{TERM} = "xterm-256color"; @@ -16,10 +17,10 @@ sub runcmd { chomp(@output); print "$_\n" foreach (@output); if ($?) { - print ">>>To run $cmd ....[error]\n"; + print ">>>Run $cmd ....[error]\n"; exit 1; }else{ - print ">>>To run: $cmd ....[ok]\n"; + print ">>>Run: $cmd ....[ok]\n"; } } From ce9ae7fa977b0a8790908a76f396ec346580d529 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Tue, 29 Aug 2017 10:35:14 +0800 Subject: [PATCH 113/251] rsync xcat-dep to http://xcat.org/files/xcat/repos/apt/devel/xcat-dep/ for Debian/Ubuntu --- build-ubunturepo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-ubunturepo b/build-ubunturepo index 65e44c88d..729067680 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -524,7 +524,7 @@ __EOF__ FILES_PATH="files" FRS="/var/www/${SERVER}/${FILES_PATH}" APT_DIR="${FRS}/xcat" - APT_REPO_DIR="${APT_DIR}/repos/apt" + APT_REPO_DIR="${APT_DIR}/repos/apt/devel" # Decide whether to upload the xcat-dep package or NOT (default is to NOT upload xcat-dep if [ "$UP" != "1" ]; then From bc66d437332572400887d7d616224d9a0a64cfd3 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Mon, 28 Aug 2017 23:28:49 -0400 Subject: [PATCH 114/251] refine passwd test cases --- xCAT-test/autotest/testcase/passwd/case0 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/passwd/case0 b/xCAT-test/autotest/testcase/passwd/case0 index 2e17861ac..0631a0b20 100644 --- a/xCAT-test/autotest/testcase/passwd/case0 +++ b/xCAT-test/autotest/testcase/passwd/case0 @@ -4,7 +4,7 @@ cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod check:rc==0 cmd:chtab key=system passwd.cryptmethod=md5 check:rc==0 -cmd:if grep Ubuntu /etc/*release;then if [ ! -e /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz ]; then copycds $$ISO;touch /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz;fi;fi +cmd:if grep Ubuntu /etc/*release;then if [ ! -e /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz ]; then copycds $$ISO;mkdir -p /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/;touch /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz;fi;fi cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 cmd:grep '\$1\$' /install/autoinst/$$CN @@ -77,7 +77,7 @@ cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod check:rc==0 cmd:chtab key=system passwd.cryptmethod=sha256 check:rc==0 -cmd:if grep Ubuntu /etc/*release;then if [ ! -e /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz ]; then copycds $$ISO;touch /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz;fi;fi +cmd:if grep Ubuntu /etc/*release;then if [ ! -e /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz ]; then copycds $$ISO;mkdir -p /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/;touch /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz;fi;fi cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 cmd:grep '\$5\$' /install/autoinst/$$CN @@ -150,7 +150,7 @@ cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod check:rc==0 cmd:chtab key=system passwd.cryptmethod=sha512 check:rc==0 -cmd:if grep Ubuntu /etc/*release;then if [ ! -e /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz ]; then copycds $$ISO;touch /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz;fi;fi +cmd:if grep Ubuntu /etc/*release;then if [ ! -e /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz ]; then copycds $$ISO;mkdir -p /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/;touch /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz;fi;fi cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 cmd:grep '\$6\$' /install/autoinst/$$CN @@ -228,7 +228,7 @@ cmd:chtab key=system passwd.username=root passwd.password=`openssl passwd -1 abc check:rc==0 cmd:gettab key=system passwd.password > /tmp/tmpcryptedpasswd check:rc==0 -cmd:if grep Ubuntu /etc/*release;then if [ ! -e /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz ]; then copycds $$ISO;touch /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz;fi;fi +cmd:if grep Ubuntu /etc/*release;then if [ ! -e /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz ]; then copycds $$ISO;mkdir -p /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/;touch /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz;fi;fi cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 cmd:if grep SUSE /etc/*release;then grep '\$1\$' /install/autoinst/$$CN | awk 'gsub(/^ *| *$/,"")'| awk -v head="" -v tail="" '{print substr($0, index($0,head)+length(head),index($0,tail)-index($0,head)-length(head))}' > /tmp/instcryptedpasswd; elif grep "Red Hat" /etc/*release;then grep '\$1\$' /install/autoinst/$$CN |awk -F " " '{print $3}' > /tmp/instcryptedpasswd; elif grep Ubuntu /etc/*release;then grep '\$1\$' /install/autoinst/$$CN |awk -F " " '{print $4}' > /tmp/instcryptedpasswd;else echo "Sorry,this is not supported os"; fi From 2f609bdb8af439e0d405e64c9d36be1c9188c646 Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 29 Aug 2017 02:46:13 -0400 Subject: [PATCH 115/251] fix issue [FVT]:nodeset against diskless osimage output is not consistent on rhels and sles/ubuntu #3783 --- xCAT-server/lib/xcat/plugins/sles.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index f69689a1e..d367e07cf 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -100,6 +100,8 @@ sub mknetboot $nodestatus = $t_entry; } + my @myself = xCAT::NetworkUtils->determinehostname(); + my $myname = $myself[ (scalar @myself) - 1 ]; #} my $ntents = $ostab->getNodesAttribs($req->{node}, [ 'os', 'arch', 'profile', 'provmethod' ]); @@ -333,7 +335,7 @@ sub mknetboot if ($statelite) { unless (-r "$rootimgdir/kernel") { $callback->({ - error => [qq{Did you run "genimage" before running "liteimg"? kernel cannot be found}], + error => [qq{Did you run "genimage" before running "liteimg"? kernel cannot be found at $rootimgdir/kernel on $myname}], errorcode => [1] }); next; @@ -362,7 +364,7 @@ sub mknetboot } else { unless (-r "$rootimgdir/kernel") { $callback->({ - error => [qq{Did you run "genimage" before running "packimage"? kernel cannot be found}], + error => [qq{Did you run "genimage" before running "packimage"? kernel cannot be found at $rootimgdir/kernel on $myname}], errorcode => [1] }); next; From 5f57e0d3deedced625baf795a214e978b1ea6c65 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Tue, 29 Aug 2017 04:37:43 -0400 Subject: [PATCH 116/251] add log for hardware discovery when no ip address can be resolved for the pre-defined node --- xCAT-server/lib/xcat/plugins/nodediscover.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index 21596f611..3291054f5 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -312,6 +312,9 @@ sub process_request { $hosttag = "$node-$ifinfo[1]"; push @hostnames_to_update, $hosttag; } + elsif (!inet_aton($node)) { + xCAT::MsgUtils->message("S", "xcat.discovery.nodediscover: Can not resolve IP for the matching node:$node, please makesure \"makehost $node\" and \"makedns $node\" have run before starting hardware discovery."); + } } #print Dumper($hosttag) . "\n"; if ($hosttag) { From 7f773f4294e0fbc3de30e8d221b4cbfdafd26189 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Tue, 29 Aug 2017 04:43:56 -0400 Subject: [PATCH 117/251] update for confignetwork debug --- xCAT-test/autotest/bundle/rhels6.9_x86_64.bundle | 4 ++-- xCAT-test/autotest/bundle/rhels7.4_ppc64le.bundle | 4 ++-- xCAT-test/autotest/bundle/rhels7.4_x86_64.bundle | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/xCAT-test/autotest/bundle/rhels6.9_x86_64.bundle b/xCAT-test/autotest/bundle/rhels6.9_x86_64.bundle index b0ece8695..71c0b3784 100644 --- a/xCAT-test/autotest/bundle/rhels6.9_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.9_x86_64.bundle @@ -219,11 +219,9 @@ confignetwork_2eth_bridge_br0 confignetwork_2eth_bridge_br22_br33 confignetwork_bond_eth2_eth3 confignetwork_bond_false -confignetwork__bridge_false confignetwork_installnic_2eth_bridge_br22_br33 confignetwork_vlan_bond confignetwork_vlan_eth0 -confignetwork_vlan_false encrypted_passwd_md5_diskfull encrypted_passwd_openssl_diskfull encrypted_passwd_sha256_diskfull @@ -249,6 +247,8 @@ packimage_m_tar_c_gzip packimage_m_tar_c_xz packimage_m_invalid_archive_method packimage_m_invalid_compress_method +confignetwork_vlan_false +confignetwork__bridge_false reg_linux_statelite_installation_flat SN_setup_case reg_linux_diskfull_installation_hierarchy diff --git a/xCAT-test/autotest/bundle/rhels7.4_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.4_ppc64le.bundle index a63c77516..cc5378efa 100644 --- a/xCAT-test/autotest/bundle/rhels7.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.4_ppc64le.bundle @@ -302,11 +302,9 @@ confignetwork_2eth_bridge_br0 confignetwork_2eth_bridge_br22_br33 confignetwork_bond_eth2_eth3 confignetwork_bond_false -confignetwork__bridge_false confignetwork_installnic_2eth_bridge_br22_br33 confignetwork_vlan_bond confignetwork_vlan_eth0 -confignetwork_vlan_false encrypted_passwd_md5_diskfull encrypted_passwd_openssl_diskfull encrypted_passwd_sha256_diskfull @@ -333,6 +331,8 @@ packimage_m_tar_c_gzip packimage_m_tar_c_xz packimage_m_invalid_archive_method packimage_m_invalid_compress_method +confignetwork_vlan_false +confignetwork__bridge_false reg_linux_statelite_installation_flat SN_setup_case reg_linux_diskfull_installation_hierarchy diff --git a/xCAT-test/autotest/bundle/rhels7.4_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.4_x86_64.bundle index 3b30ba820..2f07463d9 100644 --- a/xCAT-test/autotest/bundle/rhels7.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.4_x86_64.bundle @@ -20,11 +20,9 @@ confignetwork_2eth_bridge_br0 confignetwork_2eth_bridge_br22_br33 confignetwork_bond_eth2_eth3 confignetwork_bond_false -confignetwork__bridge_false confignetwork_installnic_2eth_bridge_br22_br33 confignetwork_vlan_bond confignetwork_vlan_eth0 -confignetwork_vlan_false chdef_null chdef_z chdef_t_o_error @@ -260,6 +258,8 @@ rmimage_diskless updatenode_diskful_syncfiles_failing xdcp_nonroot_user xdsh_permission_denied +confignetwork_vlan_false +confignetwork__bridge_false reg_linux_diskless_installation_flat reg_linux_statelite_installation_flat SN_setup_case From 2a36f20fdd61304532049685f4e024a01bfbc075 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 29 Aug 2017 16:29:18 -0400 Subject: [PATCH 118/251] Adding changes to the man pages regarding hostname changing in rspconfig --- .../guides/admin-guides/references/man1/rspconfig.1.rst | 8 +++++++- xCAT-client/pods/man1/rspconfig.1.pod | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst b/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst index c2a4d365c..038709fe0 100644 --- a/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst @@ -47,7 +47,7 @@ OpenBMC specific: ================= -\ **rspconfig**\ \ *noderange*\ {\ **ip | netmask | gateway | vlan | sshcfg**\ } +\ **rspconfig**\ \ *noderange*\ {\ **ip | netmask | gateway | hostname | vlan | sshcfg**\ } MPA specific: @@ -394,6 +394,12 @@ OPTIONS +\ **hostname**\ + + Get or set hostname on the service processor. + + + \ **vlan**\ Get or set vlan ID. For get vlan ID, if vlan is not enabled, 'BMC VLAN disabled' will be outputed. For set vlan ID, the valid value are [1-4096]. diff --git a/xCAT-client/pods/man1/rspconfig.1.pod b/xCAT-client/pods/man1/rspconfig.1.pod index 972aa649b..3f88d1152 100644 --- a/xCAT-client/pods/man1/rspconfig.1.pod +++ b/xCAT-client/pods/man1/rspconfig.1.pod @@ -24,7 +24,7 @@ B I B=I" |& server while (server |& getline) { - print $0 + if (match($0,"") == 0) { + print $0 + } if (match($0,"")) { quit = "yes" } diff --git a/xCAT/postscripts/getpostscript.awk b/xCAT/postscripts/getpostscript.awk index 99725d4a4..b4ae4e633 100755 --- a/xCAT/postscripts/getpostscript.awk +++ b/xCAT/postscripts/getpostscript.awk @@ -22,7 +22,9 @@ BEGIN { start = 1 } if (start == 1) { - print $0 + if (match($0,"") == 0) { + print $0 + } } if (match($0,"")) { @@ -31,6 +33,6 @@ BEGIN { if (match($0,"") && match(quit,"yes")) { close(server) exit - } + } } } From b6099e86ef8da2d31f6583ab52bda884735dc638 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 8 Sep 2017 08:10:54 -0400 Subject: [PATCH 162/251] modify ppping testcase for issue:#3639 --- xCAT-test/autotest/testcase/ppping/cases0 | 38 +++++++++++++---------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/xCAT-test/autotest/testcase/ppping/cases0 b/xCAT-test/autotest/testcase/ppping/cases0 index b98e64c7d..b36f9f62f 100644 --- a/xCAT-test/autotest/testcase/ppping/cases0 +++ b/xCAT-test/autotest/testcase/ppping/cases0 @@ -1,36 +1,48 @@ start:ppping_h +description:get ppping help information cmd:ppping -h check:rc==0 check:output=~Usage end start:ppping_v +description:Display verbose output cmd:ppping -v check:rc==0 check:output=~Version end start:ppping_node +description:ppping node +Attribute: $$CN-The operation object of ppping command cmd:ping -c 3 $$CN > /dev/null 2>&1;if [[ $? -eq 1 ]]; then output=`ppping $$CN`;if [[ $? -eq 1 ]]&&[[ $output =~ "noping" ]];then exit 0;else exit 1;fi;else output=`ppping $$CN`; if [[ $? -eq 0 ]]&&[[ $output =~ "pinged all nodes successfully" ]];then exit 0;else exit 1;fi;fi check:rc==0 end start:ppping_V_node +description:Display verbose output of ppping node. +Attribute: $$CN-The operation object of ppping command cmd:ping -c 3 $$CN > /dev/null 2>&1;if [[ $? -eq 1 ]]; then output=`ppping -V $$CN`;if [[ $? -eq 1 ]]&&[[ $output =~ "$$CN: noping" ]];then exit 0;else exit 1;fi;else output=`ppping -V $$CN`; if [[ $? -eq 0 ]]&&[[ $output =~ "$$CN: $$CN: ping" ]];then exit 0;else exit 1;fi;fi check:rc==0 end start:ppping_q_node +description:Display minimum output of ppping node. +Attribute: $$CN-The operation object of ppping command cmd:ping -c 3 $$CN > /dev/null 2>&1;if [[ $? -eq 1 ]]; then output=`ppping -q $$CN`;if [[ $? -eq 1 ]]&&[[ $output =~ "$$CN: noping" ]];then exit 0;else exit 1;fi;else output=`ppping -q $$CN`; if [[ $? -eq 0 ]]&&[[ $output =~ "" ]];then exit 0;else exit 1;fi;fi check:rc==0 end start:ppping_d_node +description:Print debug information of ppping node. +Attribute: $$CN-The operation object of ppping command cmd:ping -c 3 $$CN > /dev/null 2>&1;if [[ $? -eq 1 ]]; then output=`ppping -d $$CN`;if [[ $? -eq 1 ]]&&[[ $output =~ "start" ]]&&[[ $output =~ "stop" ]];then exit 0;else exit 1;fi;else output=`ppping -d $$CN`; if [[ $? -eq 0 ]]&&[[ $output =~ "start" ]]&&[[ $output =~ "stop" ]];then exit 0;else exit 1;fi;fi check:rc==0 end start:ppping_i_node +description:A comma separated list of network interface names that should be pinged instead of the interface represented by the nodename/hostname +Attribute: $$CN-The operation object of ppping command cmd:cp /etc/hosts /etc/hosts.bak check:rc==0 cmd:a=`cat /etc/hosts |grep ' $$CN.'|awk '{print $1}'`;b=`cat /etc/resolv.conf |grep search|awk '{print $2}'`;echo "$a $$CN-eth0.$b $$CN-eth0" >> /etc/hosts @@ -46,34 +58,26 @@ check:rc==0 end start:ppping_nodes -cmd:rc1=`ping -c 3 $$CN > /dev/null 2>&1`;rc2=`ping -c 3 $$SN > /dev/null 2>&1`;if [[ $rc1 -eq 1 ]]&&[[ $rc2 -eq 1 ]];then output=`ppping $$CN,$$SN`;if [[ $? -eq 1 ]]&&[[ $output =~ "$$CN: noping" ]]&&[[ $output =~ "$$SN: noping" ]];then exit 0;else exit 1;fi;elif [[ $rc1 -eq 0 ]]&&[[ $rc2 -eq 1 ]]; then output=`ppping $$CN,$$SN`; if [[ $? -eq 0 ]]&&[[ $output =~ "$$SN: noping" ]]&&[[ "$$CN: $$SN: noping" ]];then exit 0;else exit 1;fi;elif [[ $rc1 -eq 1 ]]&&[[ $rc2 -eq 0 ]]; then output=`ppping $$CN,$$SN`; if [[ $? -eq 0 ]]&&[[ $output =~ "$$CN: noping" ]]&&[[ "$$SN: $$CN: noping" ]];then exit 0;else exit 1;fi;else output=`ppping $$CN,$$SN`; if [[ $? -eq 0 ]]&&[[ $output =~ "$$CN: pinged all nodes successfully" ]]&&[[ "$$SN: pinged all nodes successfully" ]];then exit 0;else exit 1;fi;fi - +description:test the connectivity between nodes in the noderange using ping +Attribute: $$CN,$$SN-The operation object of ppping command +cmd:ping -c 3 $$CN > /dev/null 2>&1;rc1=$?;ping -c 3 $$SN > /dev/null 2>&1;rc2=$?;if [[ $rc1 -eq 1 ]]&&[[ $rc2 -eq 1 ]];then output=`ppping $$CN,$$SN`;if [[ $? -eq 1 ]]&&[[ $output =~ "$$CN: noping" ]]&&[[ $output =~ "$$SN: noping" ]];then exit 0;else exit 1;fi;elif [[ $rc1 -eq 0 ]]&&[[ $rc2 -eq 1 ]]; then output=`ppping $$CN,$$SN`; if [[ $? -eq 0 ]]&&[[ $output =~ "$$SN: noping" ]]&&[[ "$$CN: $$SN: noping" ]];then exit 0;else exit 1;fi;elif [[ $rc1 -eq 1 ]]&&[[ $rc2 -eq 0 ]]; then output=`ppping $$CN,$$SN`; if [[ $? -eq 0 ]]&&[[ $output =~ "$$CN: noping" ]]&&[[ "$$SN: $$CN: noping" ]];then exit 0;else exit 1;fi;else output=`ppping $$CN,$$SN`; if [[ $? -eq 0 ]]&&[[ $output =~ "$$CN: pinged all nodes successfully" ]]&&[[ "$$SN: pinged all nodes successfully" ]];then exit 0;else exit 1;fi;fi check:rc==0 end start:ppping_V_nodes -cmd:ping -c 3 $$CN > /dev/null 2>&1 +description:test the connectivity between nodes in the noderange using ping and print verbose output. +Attribute: $$CN,$$SN-The operation object of ppping command +cmd:ping -c 3 $$CN > /dev/null 2>&1;rc1=$?;ping -c 3 $$SN > /dev/null 2>&1;rc2=$?;if [[ $rc1 -eq 1 ]]&&[[ $rc2 -eq 1 ]];then output=`ppping -V $$CN,$$SN`;if [[ $? -eq 1 ]]&&[[ $output =~ "$$CN: noping" ]]&&[[ $output =~ "$$SN: noping" ]];then exit 0;else exit 1;fi;elif [[ $rc1 -eq 0 ]]&&[[ $rc2 -eq 1 ]]; then output=`ppping -V $$CN,$$SN`; if [[ $? -eq 0 ]]&&[[ $output =~ "$$SN: noping" ]]&&[[ $output =~ "$$CN: $$SN: noping" ]]&&[[ $output =~ "$$CN: $$CN: ping" ]];then exit 0;else exit 1;fi;elif [[ $rc1 -eq 1 ]]&&[[ $rc2 -eq 0 ]]; then output=`ppping -V $$CN,$$SN`; if [[ $? -eq 0 ]]&&[[ $output =~ "$$CN: noping" ]]&&[[ $output =~ "$$SN: $$CN: noping" ]];then exit 0;else exit 1;fi;else output=`ppping -V $$CN,$$SN`; if [[ $? -eq 0 ]]&&[[ $output =~ "$$SN: $$CN: ping" ]]&&[[ $output =~ "$$SN: $$SN: ping" ]]&&[[ $output =~ "$$CN: $$SN: ping" ]]&&[[ $output =~ "$$CN: $$CN: ping" ]];then exit 0;else exit 1;fi;fi check:rc==0 -cmd:ping -c 3 $$SN > /dev/null 2>&1 -check:rc==0 -cmd:ppping -V $$SN,$$CN -check:rc==0 -check:output=~$$CN: $$CN: ping -check:output=~$$CN: $$SN: ping -check:output=~$$SN: $$SN: ping -check:output=~$$SN: $$CN: ping end start:ppping_V_s_nodes -cmd:ping -c 3 $$CN > /dev/null 2>&1 +description:test the connectivity between nodes in the noderange using ping and print Ping serially instead of in parallel information. +Attribute: $$CN,$$SN-The operation object of ppping command +cmd:ping -c 3 $$CN > /dev/null 2>&1;rc1=$?;ping -c 3 $$SN > /dev/null 2>&1;rc2=$?;if [[ $rc1 -eq 1 ]]&&[[ $rc2 -eq 1 ]];then output=`ppping -V -s $$CN,$$SN`;if [[ $? -eq 1 ]]&&[[ $output =~ "$$CN: noping" ]]&&[[ $output =~ "$$SN: noping" ]];then exit 0;else exit 1;fi;elif [[ $rc1 -eq 0 ]]&&[[ $rc2 -eq 1 ]]; then output=`ppping -V -s $$CN,$$SN`; if [[ $? -eq 0 ]]&&[[ $output =~ "$$SN: noping" ]]&&[[ $output =~ "$$CN: $$SN: noping" ]]&&[[ $output =~ "$$CN: $$CN: ping" ]];then exit 0;else exit 1;fi;elif [[ $rc1 -eq 1 ]]&&[[ $rc2 -eq 0 ]]; then output=`ppping -V -s $$CN,$$SN`; if [[ $? -eq 0 ]]&&[[ $output =~ "$$CN: noping" ]]&&[[ $output =~ "$$SN: $$CN: noping" ]];then exit 0;else exit 1;fi;else output=`ppping -V -s $$CN,$$SN`; if [[ $? -eq 0 ]]&&[[ $output =~ "$$SN: $$CN: ping" ]]&&[[ $output =~ "$$SN: $$SN: ping" ]]&&[[ $output =~ "$$CN: $$SN: ping" ]]&&[[ $output =~ "$$CN: $$CN: ping" ]];then exit 0;else exit 1;fi;fi check:rc==0 -cmd:ping -c 3 $$SN > /dev/null 2>&1 -check:rc==0 -cmd:ppping -V -s $$SN,$$CN -check:rc==0 -check:output=~$$SN: $$SN: ping*\n$$SN: $$CN: ping*\n$$CN: $$SN: ping*\n$$CN: $$CN: ping end From 2304b0ef5059ee1d5ac670200692d3405411360c Mon Sep 17 00:00:00 2001 From: Matt Ezell Date: Sun, 10 Sep 2017 23:01:24 -0400 Subject: [PATCH 163/251] Add regex helpers a2idx: Turns an ASCII character into an index (a=1, b=2, etc) a2zidx: Turns an ASCII character into a 0-index (a=0, b=1, etc) dim2idx: Turns dimensions (eg row, column, rack-unit) into an index skip: Return an index where some items are 'skipped' ipadd: Add a value to an IP address --- .../admin-guides/references/man5/xcatdb.5.rst | 21 +++ perl-xCAT/xCAT/Table.pm | 146 ++++++++++++++++++ 2 files changed, 167 insertions(+) diff --git a/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst b/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst index e2cb86603..b4a9ba93e 100644 --- a/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst +++ b/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst @@ -157,6 +157,27 @@ Before you panic, let me explain each column: See http://www.perl.com/doc/manual/html/pod/perlre.html for information on perl regular expressions. +Regular Expression Helper Functions +============================ + +xCAT provides several functions that can simplify regular expressions. + +\ **a2idx(character) **\ + Turns a single character into a 1-indexed index. ‘a’ maps to 1 and ‘z’ maps to 26. + +\ **a2zidx(character) **\ + Turns a single character into a 0-indexed index. ‘a’ maps to 0 and ‘z’ maps to 25. + +\ **dim2idx(value, [count, value...]) **\ + Converts dimensions (such as row, column, chassis, etc) into an index. If each rack has 18 nodes, use dim2idx(racknum, 18, nodenum). Additional dimensions should be added at the beginning. All values are 1-indexed. + +\ **skip(index, skiplist) **\ + Return an index with certain values skipped. The skip list uses the format start[:count][,start[:count]...] + +\ **ipadd(octet1, octet2, octet3, octet4, toadd, skipstart, skipend) **\ + Add to an IP address. Generally only necessary when you cross octets. Optionally skip addresses at the start and end of octets (like .0 or .255). Technically those are valid IP addresses, but sometimes software makes poor assumptions about which broadcast and gateway addresses. + + Easy Regular Expressions ======================== diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index b4f8f75e5..b61786685 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -2464,7 +2464,153 @@ sub mknum { return $number; } +#-------------------------------------------------------------------------------- + +=head3 a2idx + Description: + Turns a character into a 1-indexed index + Arguments: + character: The character to convert + Returns: + The index + Example: + a2zidx('a') returns 1 + a2zidx('b') returns 2 +=cut + +#-------------------------------------------------------------------------------- +sub a2idx { + return ord(lc(shift)) - 96; +} + +#-------------------------------------------------------------------------------- + +=head3 a2zidx + Description: + Turns a character into a 0-indexed index + Arguments: + character: The character to convert + Returns: + The index + Example: + a2zidx('a') returns 0 + a2zidx('b') returns 1 +=cut + +#-------------------------------------------------------------------------------- +sub a2zidx { + return ord(lc(shift)) - 97; +} + +#-------------------------------------------------------------------------------- + +=head3 dim2idx + Description: + Converts dimensions into an index + Arguments: + dim_value: the value of the current dimension + dim_total: the total number of elements in that dimension + Returns: + The index + Example: + A cluster has 4 rows + A row has 10 racks + A rack has 8 chassis + A chassis has 8 nodes + + Row 2, rack 3, chassis 4, node 5 + dim2idx(2, 10, 3, 8, 4, 8, 5) returns 797 + + Note the highest dimension is not needed and all values are 1-indexed +=cut + +#-------------------------------------------------------------------------------- +sub dim2idx { + my $val = 0; # value to return + my $fn = 0; # math function to apply, 0 is add, 1 is multiply + while (defined(my $element = shift)) { + $val += $element - 1 if !$fn; + $val *= $element if $fn; + $fn = 1 - $fn; + } + return $val + 1; +} + +#-------------------------------------------------------------------------------- + +=head3 skip + Description: + Return an index with certain values skipped + Arguments: + index: The initial index + skips: Index values to skip + format start[:count][,start[:count]...] + Returns: + The updated index + Example: + skip(10, '3') returns 9 + skip(10, '3:2') returns 8 + skip(10, '3:2,6') returns 7 +=cut + +#-------------------------------------------------------------------------------- +sub skip { + my $idx = my $val = shift; + my $skips = shift; + foreach my $element (split /,/, $skips) { + my ($start, $count) = split /:/, $element; + $count = 1 if ! defined($count); + if ($idx >= $start) { + if ($idx < $start + $count) {return -1;} + $val-= $count; + } else { + last; + } + } + return $val; +} + +#-------------------------------------------------------------------------------- + +=head3 ipadd + Description: + Add to an IP address. Useful when you cross octets. + Optionally skip addresses at the start and end of octets (like .0 or .255). + Technically those are valid IP addresses, but sometimes software makes + poor assumptions about which broadcast and gateway addresses. + Arguments: + b1: Starting IP address first octet + b2: Starting IP address second octet + b3: Starting IP address third octet + b4: Starting IP address fourth octet + toadd: Value to add to the starting address + skipstart: Number of addresses to skip at the start of the last octet + skipend: Number of addresses to skip at the end of the last octet + Returns: + The new IP address + Example: + ipadd(10, 10, 10, 10, 0, 0, 0) returns 10.10.10.10 + ipadd(10, 10, 10, 10, 10, 0, 0) returns 10.10.10.20 + ipadd(10, 10, 10, 10, 245, 0, 0) returns 10.10.10.255 + ipadd(10, 10, 10, 10, 246, 0, 0) returns 10.10.11.0 +=cut + +#-------------------------------------------------------------------------------- +sub ipadd { + use integer; + my ($b1, $b2, $b3, $b4, $toadd, $skipstart, $skipend) = @_; + my $offset = ($b4 >= $skipstart) ? $b4 - $skipstart : 0; + $b3 += ($offset + $toadd) / (256-$skipstart-$skipend); + $b4 = ($offset + $toadd) % (256-$skipstart-$skipend) + $skipstart; + return join('.', $b1, $b2, $b3, $b4); +} + $evalcpt->share('&mknum'); +$evalcpt->share('&a2idx'); +$evalcpt->share('&a2zidx'); +$evalcpt->share('&dim2idx'); +$evalcpt->share('&skip'); +$evalcpt->share('&ipadd'); $evalcpt->permit('require'); #-------------------------------------------------------------------------- From 64ab7dbd2772cf9a67dff150f9c8c6c8670dec37 Mon Sep 17 00:00:00 2001 From: chenglch Date: Fri, 8 Sep 2017 10:08:40 +0800 Subject: [PATCH 164/251] Add rflash recovery support for Supermicro based firmware This commit add recover option for rflash command to upload bmc image with tftp when the BMC is in Brick Protection state. Example: ``` rflash --recover ``` implement #3873 --- .../admin-guides/references/man1/rflash.1.rst | 8 ++++ perl-xCAT/xCAT/Usage.pm | 1 + xCAT-client/pods/man1/rflash.1.pod | 8 ++++ xCAT-server/lib/xcat/plugins/ipmi.pm | 41 +++++++++++++++++++ 4 files changed, 58 insertions(+) diff --git a/docs/source/guides/admin-guides/references/man1/rflash.1.rst b/docs/source/guides/admin-guides/references/man1/rflash.1.rst index 928102d6e..12833968e 100644 --- a/docs/source/guides/admin-guides/references/man1/rflash.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rflash.1.rst @@ -52,6 +52,8 @@ OpenPOWER BMC specific (using IPMI): \ **rflash**\ \ *noderange*\ [\ *hpm_file_path*\ | \ **-d**\ \ *data_directory*\ ] [\ **-c | -**\ **-check**\ ] [\ **-**\ **-retry=**\ \ *count*\ ] [\ **-V**\ ] +\ **rflash**\ \ *noderange*\ \ **-**\ **-recover**\ \ *bmc_file_path*\ + OpenPOWER OpenBMC specific : ============================ @@ -196,8 +198,14 @@ The command will update firmware for OpenPOWER OpenBMC when given an OpenPOWER n \ **-**\ **-recover**\ + PPC (with HMC) and PPC (without HMC, using Direct FSP Management) specific: + Used to recover the flash image in the permanent side of the chip to the temporary side for both managed systems and power subsystems. + OpenPOWER BMC specific (using IPMI): + + Used for IBM Power S822LC for Big Data systems only. Used to recover the BMC with a BMC image downloaded from FixCentral. + \ **-**\ **-retry=**\ \ *count*\ diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index fb19d3802..3392e2668 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -344,6 +344,7 @@ my %usage = ( rflash [--bpa_acdl] OpenPOWER BMC specific (using IPMI): rflash [|-d ] [-c|--check] [--retry=] [-V] + rflash --recover OpenPOWER OpenBMC specific: rflash {[-c|--check] | [-l|--list]} rflash {[-c|--check] | [-a|--activate] | [-u|--upload]} diff --git a/xCAT-client/pods/man1/rflash.1.pod b/xCAT-client/pods/man1/rflash.1.pod index cc544efbb..ee2b29da1 100644 --- a/xCAT-client/pods/man1/rflash.1.pod +++ b/xCAT-client/pods/man1/rflash.1.pod @@ -26,6 +26,8 @@ B I I B I [I | B<-d> I] [B<-c>|B<--check>] [B<--retry=>I] [B<-V>] +B I B<--recover> I + =head2 OpenPOWER OpenBMC specific : B I {[B<-c>|B<--check>] | [B<-l>|B<--list>]} @@ -133,8 +135,14 @@ Used to commit the flash image in the temporary side of the chip to the permanen =item B<--recover> +PPC (with HMC) and PPC (without HMC, using Direct FSP Management) specific: + Used to recover the flash image in the permanent side of the chip to the temporary side for both managed systems and power subsystems. +OpenPOWER BMC specific (using IPMI): + +Used for IBM Power S822LC for Big Data systems only. Used to recover the BMC with a BMC image downloaded from FixCentral. + =item B<--retry=>I Specify number of times to retry the update if failure is detected. Default value is 2. Value of 0 can be used to indicate no retries. diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 2e9f4f582..923aad072 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -20,6 +20,7 @@ use xCAT_monitoring::monitorctrl; use xCAT::SPD qw/decode_spd/; use xCAT::IPMI; use xCAT::PasswordUtils; +use File::Basename; my %needbladeinv; use POSIX qw(ceil floor); @@ -2494,6 +2495,46 @@ sub do_rflash_process { $callback, $node, %allerrornodes); exit(1); } + my $recover_image; + if (grep(/^(--recover)$/, @{ $extra })) { + if (@{ $extra } != 2) { + xCAT::SvrUtils::sendmsg([ 1, "The command format for recovery is invalid. Only support 'rflash --recover '" ], + $callback, $node); + exit(1); + } + my @argv = @{ $extra }; + if ($argv[0] eq "--recover") { + $recover_image = $argv[1]; + } elsif ($argv[1] eq "--recover") { + $recover_image = $argv[0]; + } + } + if (defined($recover_image)) { + if ($recover_image !~ /^\//) { + $recover_image = xCAT::Utils->full_path($recover_image, $::cwd); + } + unless(-x "/usr/bin/tftp") { + $callback->({ error => "Could not find executable file /usr/bin/tftp, please setup tftp client.", + errorcode => 1 }); + exit(1); + } + my $bmcip = $_[0]; + my $cmd = "/usr/bin/tftp $bmcip -m binary -c put $recover_image ".basename($recover_image); + my $output = xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) { + $callback->({ error => "Running tftp command \'$cmd\' failed. Error Code: $::RUNCMD_RC. Output: $output.", + errorcode => 1 }); + exit(1); + } + # Sometimes tftp command retrun error message but without nonzero error code + if($output) { + $callback->({ error => "Running tftp command \'$cmd\' failed. Output: $output", + errorcode => 1 }); + exit(1); + } + $callback->({ data => "$node: Successfully updated recovery image. BMC is restarting and will not be reachable for 5-10 minutes."}); + exit(0); + } donode($node, @_); while (xCAT::IPMI->waitforrsp()) { yield } xCAT::Utils->release_lock($lock, $NON_BLOCK); From e83ad2b08ebae15025b5bcaaf0702dc80b970327 Mon Sep 17 00:00:00 2001 From: immarvin Date: Mon, 11 Sep 2017 05:26:37 -0400 Subject: [PATCH 165/251] refine cumulus discovery procedure to handle the different response from the MN --- xCAT/postscripts/documulusdiscovery | 30 +++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/xCAT/postscripts/documulusdiscovery b/xCAT/postscripts/documulusdiscovery index 8b0c612b1..db82ef84e 100755 --- a/xCAT/postscripts/documulusdiscovery +++ b/xCAT/postscripts/documulusdiscovery @@ -96,22 +96,37 @@ if [ -z "$XCATMASTER" ] || [ -z "$XCATPORT" ]; then fi -#send the find me request ot xcatd on MN -MAX_RETRY=10 +#send the find me request to xcatd on MN +MAX_RETRY=1000 RETRY=0 DISCOVERED=0 while [ $RETRY -lt $MAX_RETRY ]; do logger -s -t $log_label -p local4.info "Sending the discovery packet to xCAT ($XCATMASTER:$XCATPORT) [ RETRY= $RETRY ] ..." + echo >/tmp/result.socat.out (cat /tmp/discopacket.gz | socat STDIN UDP:$XCATMASTER:$XCATPORT,sourceport=301 ) & WAITRETRY=0 - while [ $WAITRETRY -lt 100 ]; do - if [ -f "/tmp/result.socat.out" ] && grep "restart" /tmp/result.socat.out; then - DISCOVERED=1 - break; + while [ $WAITRETRY -lt 60 ]; do + if [ -f "/tmp/result.socat.out" ];then + if grep "restart" /tmp/result.socat.out; then + DISCOVERED=1 + break; + elif grep "processing" /tmp/result.socat.out; then + echo "My findme request is still under processing, do not send new request" + logger -s -t $log_label -p local4.info "My findme request is still under processing, do not send new request" + sleep 5 + elif grep "processed" /tmp/result.socat.out; then + echo "Fail to discover me, retry to send findme request 10 second later!" + logger -s -t $log_label -p local4.info "Fail to discover me, retry to send findme request 10 seconds later" + sleep 10 + break; + else + echo "no response from $XCATMASTER, wait for 1 second" + logger -s -t $log_label -p local4.info "no response from $XCATMASTER, wait for 1 second" + sleep 1 + fi fi - sleep 1 ((WAITRETRY=WAITRETRY+1)) done @@ -119,7 +134,6 @@ while [ $RETRY -lt $MAX_RETRY ]; do break fi - sleep 2 ((RETRY=RETRY+1)) done From 7fdffddf9b443bbb5f23d41887a35a04157b9c77 Mon Sep 17 00:00:00 2001 From: Yuan Bai Date: Mon, 11 Sep 2017 17:33:02 +0800 Subject: [PATCH 166/251] fix missing graphics label (#3892) --- xCAT-server/lib/xcat/plugins/kvm.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index de8ff6273..55ae358a7 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -1397,12 +1397,14 @@ sub makedom { } my $parseddom = $parser->parse_string($xml); my ($graphics) = $parseddom->findnodes("//graphics"); - if ($confdata->{vm}->{$node}->[0]->{vidpassword}) { - $graphics->setAttribute("passwd", $confdata->{vm}->{$node}->[0]->{vidpassword}); - } else { - $graphics->setAttribute("passwd", genpassword(20)); + if (defined($graphics)) { + if ($confdata->{vm}->{$node}->[0]->{vidpassword}) { + $graphics->setAttribute("passwd", $confdata->{vm}->{$node}->[0]->{vidpassword}); + } else { + $graphics->setAttribute("passwd", genpassword(20)); + } + $graphics->setAttribute("listen", '0.0.0.0'); } - $graphics->setAttribute("listen", '0.0.0.0'); $xml = $parseddom->toString(); eval { if ($::XCATSITEVALS{persistkvmguests}) { From 5255b79a138e0151a0989cb27e209cbec8004f1e Mon Sep 17 00:00:00 2001 From: junxiawang Date: Mon, 11 Sep 2017 09:48:17 -0400 Subject: [PATCH 167/251] modify rspconfig testcase for get more debug information --- .../autotest/testcase/rspconfig/rspconfig.sh | 265 ++++++++++-------- 1 file changed, 151 insertions(+), 114 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index b540a5650..6b7657d68 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -1,4 +1,39 @@ #!/bin/bash +function usage() +{ + local script="${0##*/}" + while read -r ; do echo "${REPLY}" ; done <<-EOF +Usage: ${script} [OPTION]... [ACTION] + Test rspconfig automatically + +Options: + Mandatory arguments to long options are mandatory for short options too. + -h, --help display this help and exit + -i|--ip To test rspconfig could change bmc's ip + -lip|--list ip To test rspconfig could get bmc's ip + -g|--gateway To test rspconfig could change bmc's gateway + -lg|--list gateway To test rspconfig could list bmc's gateway + -n|--netmask To test rspconfig could change bmc's netmask + -ln|--list netmask To test rspconfig could list bmc's netmask + -v|--vlan To test rspconfig could change bmc's vlan + -lv|--list vlan To test rspconfig could list bmc's vlan + -a|--all To test rspconfig could change bmc's ip,gateway,netmask,vlan + -la|--list all To test rspconfig could list bmc's ip,gateway,netmask,vlan + -c|--clear To clear test environment +Examples: + ${script} -i noderange nodeip=node's ip + ${script} -n noderange netmask + ${script} -g noderange gateway + ${script} -v noderange vlan + ${script} -lip noderange + ${script} -ln noderange + ${script} -lg noderange + ${script} -lv noderange + ${script} -a noderange + ${script} -la noderange + +EOF +} function test_ip() { IP=$1 @@ -20,27 +55,26 @@ function net() FIRSTIP=`echo "$1 $2"|awk -F '[ .]+' 'BEGIN{OFS="."} END{print and($1,$5),and($2,$6),and($3,$7),and($4,$8)}'` echo lastip is $LASTIP echo first ip is $FIRSTIP - } function change_ip() { - echo "Prepare to change ip." - echo "Start to check ip valid." - NODEIP=$4; + echo "Prepare to change ip." + echo "Start to check ip valid." + NODEIP=$4; test_ip $1; if [[ $? -ne 0 ]];then echo "ip is invalid";return 1;fi - echo "ip is valid."; + echo "ip is valid."; echo $1 > /tmp/BMCIP - net $1 $3 + net $1 $3 ip1=`echo $1|awk -F. '{print $1}'` ip2=`echo $1|awk -F. '{print $2}'` ip3=`echo $1|awk -F. '{print $3}'` - ip4=`echo $1|awk -F. '{print $4}'` + ip4=`echo $1|awk -F. '{print $4}'` ipfirst=`echo $FIRSTIP|awk -F. '{print $4}'` - ip=`expr "$ipfirst" "+" "1"` + ip=`expr "$ipfirst" "+" "1"` iplast=`echo $LASTIP|awk -F. '{print $4}'` - ip5=`expr "$iplast" "-" "1"` - echo ip is $ip ,ip5 is $ip5 + ip5=`expr "$iplast" "-" "1"` + echo ip is $ip ,ip5 is $ip5 while true; do [[ $ip == "$ip5" ]] && echo "exit for using last ip."&&return 1; ping $ip1.$ip2.$ip3.$ip -c 2 >/dev/null ; @@ -48,23 +82,23 @@ function change_ip() coutip="$ip1.$ip2.$ip3.$ip" BMCNEWIP=$coutip; echo $1,$2,$3 - echo "Start to set ip for node." + echo "Start to set ip for node." rspconfig $2 ip=$BMCNEWIP if [[ $? -eq 0 ]];then echo "Could set bmc's ip for node using rspconfig."; else - echo "Could not set bmc's ip for node using rspconfig."; + echo "Could not set bmc's ip for node using rspconfig."; return 1; fi chdef $2 bmc=$BMCNEWIP - echo "Start to check bmc's ip setted successfully or not." + echo "Start to check bmc's ip setting." check_result $2 ip $BMCNEWIP if [[ $? -ne 0 ]] ;then - echo "Set bmc's ip failed."; + echo "Set bmc's ip failed."; return 1; else echo "Set bmc's ip successfully."; - return 0; + return 0; fi fi ip=`expr "$ip" "+" "1"` @@ -114,8 +148,8 @@ function clear_env() } function change_nonip { -echo "Prepare to change $4."; -echo "Start to check $4 valid or not."; + echo "Prepare to change $4."; + echo "Start to check $4 valid or not."; if [[ $4 =~ "gateway" ]]||[[ $4 =~ "netmask" ]];then test_ip $1; if [[ $? -ne 0 ]];then @@ -126,45 +160,45 @@ echo "Start to check $4 valid or not."; echo "Start to change bmc's $4."; rspconfig $2 $4=$1; if [[ $? -eq 0 ]];then - echo "Could set bmc's $4."; - else - echo "Could not set bmc's $4."; - return 1; - fi - echo "Start to check $4 setting successfully or not."; - check_result $2 $3 $1 - if [[ $? -ne 0 ]] ;then - echo "Set bmc's $4 failed."; - return 1; - else - echo "Set bmc's $4 successfully."; - return 0; - fi + echo "Could set bmc's $4."; + else + echo "Could not set bmc's $4."; + return 1; + fi + echo "Start to check $4 setting."; + check_result $2 $3 $1 + if [[ $? -ne 0 ]] ;then + echo "Set bmc's $4 failed."; + return 1; + else + echo "Set bmc's $4 successfully."; + return 0; + fi } function change_all { -echo "Prepare to change all for bmc." -echo "Start to change all for bmc." + echo "Prepare to change all for bmc." + echo "Start to change all for bmc." rspconfig $2 gateway netmask vlan ip if [[ $? -eq 0 ]];then BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'`; BMCNETMASK=`rspconfig $2 netmask |awk -F":" '{print $3}'`; BMCGGATEWAY=`rspconfig $2 gateway |awk -F":" '{print $3}'`; - output=`rspconfig $2 vlan` - if [[ $output =~ "BMC VLAN ID enabled" ]];then - BMCVLAN=`rspconfig $2 vlan |awk -F":" '{print $3}'` - else - echo "------------------Bmc vlan disabled so could not change vlan id using rspconfig.--------------------" - return 1; - fi + output=`rspconfig $2 vlan` + if [[ $output =~ "BMC VLAN ID enabled" ]];then + BMCVLAN=`rspconfig $2 vlan |awk -F":" '{print $3}'` + else + echo "------------------Bmc vlan disabled so could not change vlan id using rspconfig.--------------------" + return 1; + fi rspconfig $2 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY vlan=$BMCVLAN if [[ $? -eq 0 ]];then - echo "Could set bmc's all options."; - else - echo "Could not set bmc's all options."; - return 1; - fi + echo "Could set BMC IP/netmask/gateway/vlan."; + else + echo "Could not set BMC IP/netmask/gateway/vlan."; + return 1; + fi fi } @@ -198,11 +232,11 @@ do fi ;; "-lip"|"--list ip" ) - echo "--------------------To test bmc ip could be listed using rspconfig.--------------------" - BMCIP_LSDEF=`lsdef $2 |grep "bmc=" |awk -F "=" '{print $2}'` - rspconfig $2 ip - if [[ $? -eq 0 ]];then - BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'` + echo "--------------------To test bmc ip could be listed using rspconfig.--------------------" + BMCIP_LSDEF=`lsdef $2 |grep "bmc=" |awk -F "=" '{print $2}'` + rspconfig $2 ip + if [[ $? -eq 0 ]];then + BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'` if [[ $BMCIP =~ "$BMCIP_LSDEF" ]];then echo "-----------------To test bmc ip could be listed using rspconfig successfully.-----------------" exit 0; @@ -210,11 +244,11 @@ do echo "-------------------To test bmc ip could be listed using rspconfig failed.----------------" exit 1; fi - else + else echo "------------------To test bmc ip could be listed using rspconfig failed.-------------------" - exit 1; - fi - ;; + exit 1; + fi + ;; "-g"|"--gateway" ) echo "--------------------To test bmc gateway could be changed using rspconfig.---------------------" @@ -222,11 +256,11 @@ do if [[ $? -eq 0 ]];then BMCGATEWAYE=`rspconfig $2 gateway |awk -F":" '{print $3}'` else - exit 1; + exit 1; fi change_nonip $BMCGATEWAYE $2 $3 gateway if [[ $? -eq 1 ]];then - echo "--------------------To test bmc gateway could be changed using rspconfig failed.--------------------" + echo "--------------------To test bmc gateway could be changed using rspconfig failed.--------------------" exit 1 else echo "--------------------To test bmc gateway could be changed using rspconfig successfully.--------------------" @@ -235,7 +269,6 @@ do ;; "-lg"|"--list gateway" ) output=`rspconfig $2 gateway` -echo "output is $output" if [[ $? -eq 0 ]];then if [[ $output =~ "$2: BMC Gateway:" ]];then echo "--1-----------------To test bmc gateway could be listed using rspconfig successfully.-----------------" @@ -266,70 +299,69 @@ echo "output is $output" exit 0 fi ;; - "-ln"|"--list netmask" ) - output=`rspconfig $2 netmask` - if [[ $? -eq 0 ]];then - if [[ $output =~ "$2: BMC Netmask:" ]];then - echo "-------------------To test bmc Netmask could be listed using rspconfig successfully.-----------------" - exit 0; - else - echo "-----------------To test bmc Netmask could be listed using rsconfig failed.-------------------" - exit 1; - fi - else - echo "-------------------To test bmc Netmask could be listed using rspconfig failed.---------------" - exit 1; - fi - ;; - "-v"|"--vlan" ) - output=`rspconfig $2 vlan` - echo "---------------------To test bmc vlan could be changed using rspconfig.--------------------" - if [[ $? -eq 0 ]]&&[[ $output =~ "BMC VLAN ID enabled" ]];then - BMCVLAN=`rspconfig $2 vlan |awk -F":" '{print $3}'` - else - echo "------------------Bmc vlan disabled so could not change vlan id using rspconfig.--------------------" + "-ln"|"--list netmask" ) + output=`rspconfig $2 netmask` + if [[ $? -eq 0 ]];then + if [[ $output =~ "$2: BMC Netmask:" ]];then + echo "-------------------To test bmc Netmask could be listed using rspconfig successfully.-----------------" + exit 0; + else + echo "-----------------To test bmc Netmask could be listed using rsconfig failed.-------------------" + exit 1; + fi + else + echo "-------------------To test bmc Netmask could be listed using rspconfig failed.---------------" exit 1; - fi - change_nonip $BMCVLAN $2 $3 vlan - if [[ $? -eq 1 ]];then - echo "--------------------To test bmc vlan could be changed using rspconfig failed.------------------" - exit 1 - else - echo "--------------------To test bmc vlan could be changed using rspconfig successfully.-------------------" - exit 0 - fi - ;; - "-lv"|"--list vlan" ) - output=`rspconfig $2 vlan` - if [[ $? -eq 0 ]];then - if [[ $output =~ "$2: BMC VLAN ID" ]];then - echo "-------------------To test bmc Vlan could be listed using rspconfig successfully.-----------------" - exit 0; - else - echo "-----------------To test bmc Vlan could be listed using rsconfig failed.-------------------" - exit 1; - fi - else - echo "-------------------To test bmc Vlan could be listed using rspconfig failed.---------------" - exit 1; - fi - ;; - "-a"|"--all" ) - change_all $2 + fi + ;; + "-v"|"--vlan" ) + output=`rspconfig $2 vlan` + echo "---------------------To test bmc vlan could be changed using rspconfig.--------------------" + if [[ $? -eq 0 ]]&&[[ $output =~ "BMC VLAN ID enabled" ]];then + BMCVLAN=`rspconfig $2 vlan |awk -F":" '{print $3}'` + else + echo "------------------Bmc vlan disabled so could not change vlan id using rspconfig.--------------------" + exit 1; + fi + change_nonip $BMCVLAN $2 $3 vlan if [[ $? -eq 1 ]];then - echo "--------------------To test bmc's all options could be changed using rspconfig failed.------------------" - exit 1 + echo "--------------------To test bmc vlan could be changed using rspconfig failed.------------------" + exit 1 + else + echo "--------------------To test bmc vlan could be changed using rspconfig successfully.-------------------" + exit 0 + fi + ;; + "-lv"|"--list vlan" ) + output=`rspconfig $2 vlan` + if [[ $? -eq 0 ]];then + if [[ $output =~ "$2: BMC VLAN ID" ]];then + echo "-------------------To test bmc Vlan could be listed using rspconfig successfully.-----------------" + exit 0; + else + echo "-----------------To test bmc Vlan could be listed using rsconfig failed.-------------------" + exit 1; + fi + else + echo "-------------------To test bmc Vlan could be listed using rspconfig failed.---------------" + exit 1; + fi + ;; + "-a"|"--all" ) + change_all $2 + if [[ $? -eq 1 ]];then + echo "--------------------To test BMC IP/netmask/gateway/vlan could be changed using rspconfig failed.------------------" + exit 1 else - echo "--------------------To test bmc's all options could be changed using rspconfig successfully.-------------------" - exit 0 - fi + echo "--------------------To test BMC IP/netmask/gateway/vlan could be changed using rspconfig successfully.-------------------" + exit 0 + fi ;; "-la"|"--list all" ) BMCIP_LSDEF=`lsdef $2 |grep "bmc=" |awk -F "=" '{print $2}'` BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'` output=`rspconfig $2 ip gateway netmask vlan` if [[ $? -eq 0 ]];then - #if [[ $output =~ "BMC VLAN ID:" ]]&&[[ $output =~ "BMC Netmask:" ]]&&[[ $output =~ "BMC Gateway:" ]]&&[[ $BMCIP =~ "$BMCIP_LSDEF" ]];then if [[ $output =~ "$2: BMC VLAN ID" ]]&&[[ $output =~ "BMC Netmask:" ]]&&[[ $output =~ "BMC Gateway:" ]]&&[[ $BMCIP =~ "$BMCIP_LSDEF" ]];then echo "------------------To test bmc's all option could be listed using rspconfig succssfully.-----------------" exit 0 @@ -340,7 +372,7 @@ echo "output is $output" fi ;; "-c"|"--clear" ) - echo "--------------------To clear the test envionment.--------------------" + echo "--------------------To clear the test envionment.--------------------" clear_env $1 $2 $3 if [[ $? -eq 1 ]];then echo "--------------------To clear the test environment failed.-----------------" @@ -350,11 +382,16 @@ echo "output is $output" exit 0 fi ;; + "-h"|"--help" ) + usage + exit 0 + ;; *) echo - echo "Please Insert $0: -i|-g|-n|-c" + echo "Please Insert $0: -i|-lip|-g|-lg|-n|-ln|-v|-lv|-c|-a|-la" echo exit 1; ;; esac + shift done From e5623c7663b39e16a7ff409149be4a7ee4716634 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 11 Sep 2017 10:15:55 -0400 Subject: [PATCH 168/251] Indicate software at priority 0 with a '*' --- xCAT-server/lib/xcat/plugins/openbmc.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 0a76ce69f..16599a1e4 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1399,15 +1399,20 @@ sub rinv_response { my $purpose_value = uc ((split(/\./, $content{Purpose}))[-1]); $purpose_value = "[$sw_id]$purpose_value"; my $activation_value = (split(/\./, $content{Activation}))[-1]; + my $priority_value = $content{Priority}; # # For 'rinv firm', only print Active software, unless verbose is specified # - if ($activation_value =~ "Active" or $::VERBOSE) { + if (($activation_value =~ "Active" and $priority_value == 0) or $::VERBOSE) { # # The space below between "Firmware Product Version:" and $content{Version} is intentional # to cause the sorting of this line before any additional info lines # $content_info = "$purpose_value Firmware Product: $content{Version} ($activation_value)"; + if ($priority_value == 0) { + # For now, indicate priority 0 software levels with an '*' + $content_info .= "*"; + } push (@sorted_output, $content_info); if (defined($content{ExtendedVersion}) and $content{ExtendedVersion} ne "") { From 1118a047db686039952829f3f8395be741c84831 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 11 Sep 2017 14:10:19 -0400 Subject: [PATCH 169/251] BMC update image check and upload+activate rflash options --- xCAT-server/lib/xcat/plugins/openbmc.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 0a76ce69f..14b9dcdd3 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -898,7 +898,7 @@ sub parse_command_status { my $file_id = undef; my $grep_cmd = "/usr/bin/grep -a"; - my $version_tag = '"version=IBM"'; + my $version_tag = '"^version="'; my $purpose_tag = '"purpose="'; my $purpose_value; my $version_value; From 7ce22fbe6f8495f725ba7314ac00aeba10214f9b Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 11 Sep 2017 14:36:09 -0400 Subject: [PATCH 170/251] Add check for priority before using the value --- xCAT-server/lib/xcat/plugins/openbmc.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 16599a1e4..064b19fdf 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1399,7 +1399,10 @@ sub rinv_response { my $purpose_value = uc ((split(/\./, $content{Purpose}))[-1]); $purpose_value = "[$sw_id]$purpose_value"; my $activation_value = (split(/\./, $content{Activation}))[-1]; - my $priority_value = $content{Priority}; + my $priority_value = -1; + if (defined($content{Priority})) { + $priority_value = $content{Priority}; + } # # For 'rinv firm', only print Active software, unless verbose is specified # From ab464a1e8754d4929167b0fc315f0b90db2d1cbc Mon Sep 17 00:00:00 2001 From: XuWei Date: Mon, 11 Sep 2017 23:08:57 -0400 Subject: [PATCH 171/251] Fix xcatprobe discovery pre-check issues --- xCAT-probe/subcmds/discovery | 64 +++++++++++++++--------------------- 1 file changed, 27 insertions(+), 37 deletions(-) diff --git a/xCAT-probe/subcmds/discovery b/xCAT-probe/subcmds/discovery index 56ed145c3..b7a6e4cc6 100755 --- a/xCAT-probe/subcmds/discovery +++ b/xCAT-probe/subcmds/discovery @@ -242,12 +242,19 @@ sub check_pre_defined_node { $vpd_line =~ s/"//g; my @split_vpd = split(",", $vpd_line); if (($split_vpd[1] ne "") and ($split_vpd[2] ne "")) { - my $mtmsvpd = "$split_vpd[2]*$split_vpd[1]"; - push @{ $mtms_node{$mtmsvpd} }, $split_vpd[0]; + my $mtms = uc ("$split_vpd[2]*$split_vpd[1]"); + my $tmp_node = $split_vpd[0]; + my $tmp_type = `lsdef $tmp_node -i hwtype,nodetype -c`; + if ($tmp_type =~ /hwtype=bmc/ and $tmp_type =~ /nodetype=mp/) { + push @{ $mtms_node{$mtms}{bmc} }, $tmp_node; + } else { + push @{ $mtms_node{$mtms}{node} }, $tmp_node; + } } } my @error_mtms; + my @error_mtms_bmc; foreach my $node (keys %nodecheckrst) { # check pre-define node whether has mtm and serial @@ -259,26 +266,13 @@ sub check_pre_defined_node { # check if there is one or more node has the same mtms with current node my $mtms = "$nodecheckrst{$node}{\"mtm\"}*$nodecheckrst{$node}{\"serial\"}"; - my $mtms_num = @{$mtms_node{$mtms}}; - if ($mtms_num > 2) { + my $mtms_node_num = @{ $mtms_node{$mtms}{node} }; + my $mtms_bmc_num = @{ $mtms_node{$mtms}{bmc} }; + if ($mtms_node_num >= 2) { push @error_mtms, $mtms if (!grep {$_ eq $mtms} @error_mtms); - } elsif ($mtms_num == 2) { - foreach my $mtmsnode (@{$mtms_node{$mtms}}) { - next if ($mtmsnode eq $node); - if (exists($nodecheckrst{$mtmsnode})) { - if (($nodecheckrst{$mtmsnode}{"nodetype"} eq $nodecheckrst{$node}{"nodetype"}) and ($nodecheckrst{$mtmsnode}{"hwtype"} eq $nodecheckrst{$node}{"hwtype"})) { - push @error_mtms, $mtms if (!grep {$_ eq $mtms} @error_mtms); - } - } else { - my $nodetype = `lsdef $mtmsnode -i nodetype -c |awk -F"=" '{print \$2}'`; - my $hwtype = `lsdef $mtmsnode -i hwtype -c |awk -F"=" '{print \$2}'`; - chomp($nodetype); - chomp($hwtype); - if (($nodetype eq $nodecheckrst{$node}{"nodetype"}) and ($hwtype eq $nodecheckrst{$node}{"hwtype"})) { - push @error_mtms, $mtms if (!grep {$_ eq $mtms} @error_mtms); - } - } - } + } + if ($mtms_bmc_num >= 2) { + push @error_mtms_bmc, $mtms if (!grep {$_ eq $mtms} @error_mtms_bmc); } } } @@ -291,11 +285,20 @@ sub check_pre_defined_node { if (@error_mtms) { foreach (@error_mtms) { - my $errornode = join(",", @{$mtms_node{$_}}); + my $errornode = join(",", @{$mtms_node{$_}{node}}); probe_utils->send_msg("stdout", "f", "[$errornode] : Duplicate node definition found for the same mtms $_."); $rst = 1; } } + + if (@error_mtms_bmc) { + foreach (@error_mtms_bmc) { + my $errorbmcnode = join(",", @{$mtms_node{$_}{bmc}}); + my $errornode = join(",", @{$mtms_node{$_}{node}}); + probe_utils->send_msg("stdout", "f", "[$errornode] : Duplicate BMC node ($errorbmcnode) definition found for the same mtms $_."); + $rst = 1; + } + } } if ($discovery_type eq "switch") { @@ -356,7 +359,7 @@ sub check_pre_defined_node { next; } - if (!(exists($nodecheckrst{$node}{"switchport"})) or $nodecheckrst{$node}{"switchport"} !~ /^\w/ or $valid_nodes !~ $node) { + if (!(exists($nodecheckrst{$node}{"switchport"})) or $nodecheckrst{$node}{"switchport"} !~ /^\d/ or $valid_nodes !~ $node) { push @error_attribute, "switchport"; } @@ -378,18 +381,6 @@ sub check_pre_defined_node { $keystring = "Missing definition for related switch $nodecheckrst{$node}{\"switch\"}"; last; } - if ($tmpoutput !~ /snmpversion=/) { - $keystring = "Missing attribute 'snmpversion' definition for related switch $nodecheckrst{$node}{\"switch\"}"; - last; - } - if ($tmpoutput !~ /username=/) { - $keystring = "Missing attribute 'username' definition for related switch $nodecheckrst{$node}{\"switch\"}"; - last; - } - if ($tmpoutput !~ /password=/) { - $keystring = "Missing attribute 'password' definition for related switch $nodecheckrst{$node}{\"switch\"}"; - last; - } } if ($keystring) { @@ -649,14 +640,13 @@ sub check_genesis_file { $rst = 1; } - if ($initrd_path =~ /http.+($tftpdir\/.+)/) { + if ($initrd_path =~ /http:\/\/.+:80\/(.+)/) { my $initrd_file = $1; my $initrd_time = `stat $initrd_file | grep Modify | cut -d ' ' -f 2-3`; if ($genesis_time and $initrd_time < $genesis_time) { $genesis_update_flag_p = 1; } } - } if ($genesis_line =~ /^kernel/) { From 95f6e07614f93002ff7a85086baf4cadf159e4c8 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Mon, 11 Sep 2017 23:17:51 -0400 Subject: [PATCH 172/251] Remove the log to output Disabling VLAN configuration information --- xCAT-genesis-scripts/bin/bmcsetup | 1 - 1 file changed, 1 deletion(-) diff --git a/xCAT-genesis-scripts/bin/bmcsetup b/xCAT-genesis-scripts/bin/bmcsetup index ce25520ea..7b712a0d9 100755 --- a/xCAT-genesis-scripts/bin/bmcsetup +++ b/xCAT-genesis-scripts/bin/bmcsetup @@ -369,7 +369,6 @@ fi if [ "$BMCVLAN" = off ]; then TRIES=0 - logger -s -t $log_label -p local4.info "Disabling VLAN configuration in the BMC..." while ! ipmitool raw 0xc 1 $LANCHAN 0x14 0 0; do snooze let TRIES=TRIES+1 From 118d62047e18fa99e796d9aee9c64f5583030da0 Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 12 Sep 2017 02:28:25 -0400 Subject: [PATCH 173/251] modified depending on comments --- xCAT-probe/subcmds/discovery | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-probe/subcmds/discovery b/xCAT-probe/subcmds/discovery index b7a6e4cc6..194bbaa33 100755 --- a/xCAT-probe/subcmds/discovery +++ b/xCAT-probe/subcmds/discovery @@ -359,7 +359,7 @@ sub check_pre_defined_node { next; } - if (!(exists($nodecheckrst{$node}{"switchport"})) or $nodecheckrst{$node}{"switchport"} !~ /^\d/ or $valid_nodes !~ $node) { + if (!(exists($nodecheckrst{$node}{"switchport"})) or $nodecheckrst{$node}{"switchport"} !~ /^\d+$/ or $valid_nodes !~ $node) { push @error_attribute, "switchport"; } @@ -640,7 +640,7 @@ sub check_genesis_file { $rst = 1; } - if ($initrd_path =~ /http:\/\/.+:80\/(.+)/) { + if ($initrd_path =~ /http:\/\/.+:80(\/.+)/) { my $initrd_file = $1; my $initrd_time = `stat $initrd_file | grep Modify | cut -d ' ' -f 2-3`; if ($genesis_time and $initrd_time < $genesis_time) { From b7e4ea5895292b2d6d18a406c9473af7443273a2 Mon Sep 17 00:00:00 2001 From: Samveen Gulati Date: Tue, 12 Sep 2017 07:11:19 +0000 Subject: [PATCH 174/251] minor correction in vm docs --- .../admin-guides/manage_clusters/common/kvm/manage_vm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst b/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst index f383e065d..7e008c357 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst @@ -2,7 +2,7 @@ Manage Virtual Machine (VM) ============================ -Now the MowerKVM hypervisor "kvmhost1" is ready, this section introduces the VM management in xCAT, including examples on how to create, remove and clone VMs. +Now the PowerKVM hypervisor "kvmhost1" is ready, this section introduces the VM management in xCAT, including examples on how to create, remove and clone VMs. Create Virtual Machine ---------------------- From ce8bb55e1d474427164e3a072b7047d2118b48e9 Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 8 Sep 2017 03:01:07 -0400 Subject: [PATCH 175/251] switch based node discovery enhancement: 1)obtain mac table from cumulus switch via ssh;2)remove unnecessary sleep 2 after node discovery --- perl-xCAT/xCAT/MacMap.pm | 81 ++++++++++++++++++-- xCAT-server/lib/xcat/plugins/nodediscover.pm | 2 - 2 files changed, 74 insertions(+), 9 deletions(-) diff --git a/perl-xCAT/xCAT/MacMap.pm b/perl-xCAT/xCAT/MacMap.pm index e1a7df81f..ab10348e0 100644 --- a/perl-xCAT/xCAT/MacMap.pm +++ b/perl-xCAT/xCAT/MacMap.pm @@ -225,7 +225,7 @@ sub rvlan { my $switchestab = xCAT::Table->new('switches', -create => 0); my @switchesents; if ($switchestab) { - foreach (values %{ $switchestab->getNodesAttribs($switches, [qw(switch snmpversion username password privacy auth)]) }) { + foreach (values %{ $switchestab->getNodesAttribs($switches, [qw(switch snmpversion username password privacy auth switchtype)]) }) { push @switchesents, @$_; } } @@ -309,7 +309,7 @@ sub dump_mac_info { } } my $switchestab = xCAT::Table->new('switches', -create => 0); - my @switchesents = $switchestab->getAllNodeAttribs([qw(switch snmpversion username password privacy auth)]); + my @switchesents = $switchestab->getAllNodeAttribs([qw(switch snmpversion username password privacy auth switchtype)]); $self->fill_switchparms(community => $community, switchesents => \@switchesents); my $switchtab = xCAT::Table->new('switch', -create => 0); my @entries = (); @@ -337,7 +337,12 @@ sub dump_mac_info { if ($self->{show_verbose_info}) { xCAT::MsgUtils->message("I", { data => ["$switch: Attempting to refresh switch information..."] }, $self->{callback}); } + my $probestart = time; $self->refresh_switch(undef, $community, $switch); + my $probestop = time; + my $probeduration = $probestop - $probestart; + xCAT::MsgUtils->message("S", "xcatprobe refresh_switch $switch ElapsedTime:$probeduration sec"); + if ($self->{show_verbose_info}) { xCAT::MsgUtils->message("I", { data => ["$switch: Finished refreshing switch information."] }, $self->{callback}); } @@ -403,7 +408,13 @@ sub find_mac { #If requesting a cache only check or the cache is a mere 20 seconds old #don't bother querying switches if ($cachedonly or ($self->{timestamp} > (time() - 20))) { return undef; } + + my $runstart = time; $self->refresh_table($discover_switch); #not cached or stale cache, refresh + my $runstop = time; + my $diffduration = $runstop - $runstart; + xCAT::MsgUtils->message("S", "refresh_table ElapsedTime:$diffduration sec"); + if ($self->{mactable}->{ lc($mac) }) { return $self->{mactable}->{ lc($mac) }; } @@ -419,6 +430,7 @@ sub fill_switchparms { foreach (@switchentries) { my $curswitch = $_->{switch}; $self->{switchparmhash}->{$curswitch} = $_; + $self->{switchparmhash}->{$curswitch}->{switchtype}=$_->{switchtype}; if ($_->{snmpversion}) { if ($_->{snmpversion} =~ /3/) { #clean up to accept things like v3 or ver3 or 3, whatever. $self->{switchparmhash}->{$curswitch}->{snmpversion} = 3; @@ -444,7 +456,7 @@ sub refresh_table { $self->{mactable} = {}; $self->{switchtab} = xCAT::Table->new('switch', -create => 1); $self->{switchestab} = xCAT::Table->new('switches', -create => 1); - my @switchentries = $self->{switchestab}->getAllNodeAttribs([qw(switch snmpversion username password privacy auth)]); + my @switchentries = $self->{switchestab}->getAllNodeAttribs([qw(switch snmpversion username password privacy auth switchtype)]); my $community = "public"; #$self->{sitetab} = xCAT::Table->new('site'); @@ -477,6 +489,9 @@ sub refresh_table { unless (defined $_->{password}) { #if no password set, inherit the community $self->{switchparmhash}->{$curswitch}->{password} = $community; } + if (defined $_->{switchtype}){ + $self->{switchparmhash}->{$curswitch}->{switchtype} =$_->{switchtype}; + } } my %checked_pairs; my @entries = $self->{switchtab}->getAllNodeAttribs([ 'node', 'port', 'switch' ]); @@ -497,7 +512,7 @@ sub refresh_table { my $ntype = $typehash->{$entry->{node}}->[0]->{nodetype}; if ( (($discover_switch) and ( $ntype ne "switch")) or ( !($discover_switch) and ( $ntype eq "switch")) ){ - xCAT::MsgUtils->message("S", "refresh_table: skip $entry->{node} and $entry->{switch}"); + xCAT::MsgUtils->message("S", "refresh_table: skip $entry->{node} and $entry->{switch}, $discover_switch , $ntype\n"); next; } if (defined($entry->{switch}) and $entry->{switch} ne "" and defined($entry->{port}) and $entry->{port} ne "") { @@ -534,7 +549,11 @@ sub refresh_table { if ($cpid == 0) { close($child); + my $runstart = time; $self->refresh_switch($parent, $community, $entry->{switch}); + my $runstop = time; + my $diffduration = $runstop - $runstart; + xCAT::MsgUtils->message("S", "refresh_switch $entry->{switch} ElapsedTime:$diffduration sec"); exit(0); } close($parent); @@ -615,6 +634,9 @@ sub walkoid { return $retmap; } + + + sub getsnmpsession { #gets an snmp v3 session appropriate for a switch using the switches table for guidance on the hows @@ -688,7 +710,54 @@ sub refresh_switch { my $community = shift; my $switch = shift; - #if ($error) { die $error; } + unless($self->{collect_mac_info}) + { + if($self->{switchparmhash}->{$switch}->{switchtype} eq 'onie'){ + #for cumulus switch, the MAC table can be retrieved with ssh + #which is much faster than snmp + my $mymac; + my $myport; + + my @res=xCAT::Utils->runcmd("ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no $switch 'bridge fdb show|grep -i -v permanent|tr A-Z a-z 2>/dev/null' 2>/dev/null",-1); + unless (@res) { + xCAT::MsgUtils->message("S", "Failed to get mac table with ssh to $switch, fall back to snmp! To obtain mac table with ssh, please make sure the passwordless root ssh to $switch is available"); + }else{ + foreach (@res){ + if($_ =~ m/^([0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}) dev swp([0-9]+) .*/){ + $mymac=$1; + $myport=$2; + $myport=sprintf("%d",$myport); + + #try all the possible port number formats + #e.g, "5","swp5","05","swp05" + unless(exists $self->{switches}->{$switch}->{$myport}){ + if(exists $self->{switches}->{$switch}->{"swp".$myport}){ + $myport="swp".$myport; + }else{ + $myport=sprintf("%02d",$myport); + unless(exists $self->{switches}->{$switch}->{$myport}){ + if(exists $self->{switches}->{$switch}->{"swp".$myport}){ + $myport="swp".$myport; + }else{ + $myport=""; + } + } + } + } + + if($myport){ + if($output){ + printf $output "$mymac|%s\n", $self->{switches}->{$switch}->{$myport}; + } + } + } + + } + return; + } + } + } + my $session = $self->getsnmpsession('community' => $community, 'switch' => $switch); unless ($session) { xCAT::MsgUtils->message("S", "Failed to communicate with $switch"); @@ -789,7 +858,6 @@ sub refresh_switch { xCAT::MsgUtils->message("S", "Error communicating with " . $session->{DestHost} . ": failed to get a valid response to BRIDGE-MIB request"); return; } - # my $mactoindexmap = walkoid($session,'.1.3.6.1.2.1.17.4.3.1.2'); my $mactoindexmap = walkoid($session, '.1.3.6.1.2.1.17.7.1.2.2.1.2', silentfail => 1, verbose => $self->{show_verbose_info}, switch => $switch, callback => $self->{callback}); unless (defined($mactoindexmap)) { #if no qbridge defined, try bridge mib, probably cisco @@ -800,7 +868,6 @@ sub refresh_switch { xCAT::MsgUtils->message("S", "Error communicating with " . $session->{DestHost} . ": Unable to get MAC entries via either BRIDGE or Q-BRIDE MIB"); return; } - if (defined($self->{collect_mac_info})) { my %index_to_mac = (); my %index_to_vlan = (); diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index 9714f3843..b6b78383a 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -477,8 +477,6 @@ sub process_request { print $sock $restartstring; close($sock); - # sleep 2 seconds for genesis to complete the disocvery process - sleep(2); #Update the discoverydata table to indicate the successful discovery xCAT::DiscoveryUtils->update_discovery_data($request); From 6fe93b9cb83488cbe083e141f3d11fadcd28d0d1 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Tue, 12 Sep 2017 04:46:24 -0400 Subject: [PATCH 176/251] modify rspconfig testcase for get more debug information --- xCAT-test/autotest/testcase/rspconfig/cases0 | 31 +++++++++++++++++++ .../autotest/testcase/rspconfig/rspconfig.sh | 15 ++++----- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/cases0 b/xCAT-test/autotest/testcase/rspconfig/cases0 index 32cf4618b..8266cc402 100644 --- a/xCAT-test/autotest/testcase/rspconfig/cases0 +++ b/xCAT-test/autotest/testcase/rspconfig/cases0 @@ -91,6 +91,13 @@ Attribute: $$CN-The operation object of rspconfig command cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -v $$CN vlan check:rc==0 end + +start:rspconfig_set_all +description:rspconfig change openbmc ip/netmask/gateway/vlan +Attribute: $$CN-The operation object of rspconfig command +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -a $$CN +check:rc==0 +end start:rspconfig_gateway_invalid despcription:rspconfig could not change openbmc gatway using invalid gateway @@ -99,6 +106,20 @@ cmd:rspconfig $$CN gateway=ddd check:rc!=0 end +start:rspconfig_set_vlan_invalid +despcription:rspconfig could not change openbmc gatway using invalid vlan +Attribute: $$CN-The operation object of rspconfig command +cmd:rspconfig $$CN vlan=dddsdsdfs +check:rc!=0 +end + +start:rspconfig_set_all_invalid +despcription:rspconfig could not change openbmc gatway using invalid vlan +Attribute: $$CN-The operation object of rspconfig command +cmd:rspconfig $$CN ip=dsd gateway=ooo netmask=asfsf vlan=dddsdsdfs +check:rc!=0 +end + start:rspconfig_node_invalid despcription:rspconfig could not do any action using invalid node cmd:test=$(lsdef testnode);if [[ $? -eq 0 ]]; then lsdef -l testnode -z >/tmp/testnode.stanza ;rmdef testnode;fi @@ -109,6 +130,16 @@ cmd:if [[ -e /tmp/testnode.stanza ]]; then cat /tmp/testnode.stanza | chdef -z;r check:rc==0 end +start:rspconfig_noderange_invalid +despcription:rspconfig could not do any action using invalid node +cmd:test=$(lsdef testnode);if [[ $? -eq 0 ]]; then lsdef -l testnode -z >/tmp/testnode.stanza ;rmdef testnode;fi +check:rc==0 +cmd:rspconfig testnode,$$CN ip +check:rc!=0 +cmd:if [[ -e /tmp/testnode.stanza ]]; then cat /tmp/testnode.stanza | chdef -z;rm -rf /tmp/testnode.stanza;fi +check:rc==0 +end + start:rspconfig_list_ip despcription:rspconfig list bmc ip cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -lip $$CN diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index 6b7657d68..1a5ea8667 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -180,19 +180,20 @@ function change_all { echo "Prepare to change all for bmc." echo "Start to change all for bmc." - rspconfig $2 gateway netmask vlan ip + rspconfig $1 gateway netmask vlan ip if [[ $? -eq 0 ]];then - BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'`; - BMCNETMASK=`rspconfig $2 netmask |awk -F":" '{print $3}'`; - BMCGGATEWAY=`rspconfig $2 gateway |awk -F":" '{print $3}'`; - output=`rspconfig $2 vlan` + BMCIP=`rspconfig $1 ip |awk -F":" '{print $3}'|sed s/[[:space:]]//g`; + BMCNETMASK=`rspconfig $1 netmask |awk -F":" '{print $3}'|sed s/[[:space:]]//g`; + BMCGGATEWAY=`rspconfig $1 gateway |awk -F":" '{print $3}'|sed s/[[:space:]]//g`; + output=`rspconfig $1 vlan` if [[ $output =~ "BMC VLAN ID enabled" ]];then - BMCVLAN=`rspconfig $2 vlan |awk -F":" '{print $3}'` + BMCVLAN=`rspconfig $1 vlan |awk -F":" '{print $3}'|sed s/[[:space:]]//g` else echo "------------------Bmc vlan disabled so could not change vlan id using rspconfig.--------------------" return 1; fi - rspconfig $2 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY vlan=$BMCVLAN + + rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY vlan=$BMCVLAN if [[ $? -eq 0 ]];then echo "Could set BMC IP/netmask/gateway/vlan."; else From 0497e158b17d25e4338d9e420d7fc3bc5ef9a4f8 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 12 Sep 2017 14:19:05 -0400 Subject: [PATCH 177/251] Resolve the issue where the rpmbuild directories are not created causing the build to fail. Pull in dependencies using the spec file --- xCAT-genesis-builder/buildrpm | 2 ++ xCAT-genesis-builder/xCAT-genesis-builder.spec | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT-genesis-builder/buildrpm b/xCAT-genesis-builder/buildrpm index ff350d901..580691050 100755 --- a/xCAT-genesis-builder/buildrpm +++ b/xCAT-genesis-builder/buildrpm @@ -13,6 +13,8 @@ DIR=`dirname $0` DIR=`readlink -f $DIR` BUILDARCH=`uname -m` +rpmdev-setuptree + #For Openpower if [ $BUILDARCH = "ppc64le" ]; then BUILDARCH="ppc64" diff --git a/xCAT-genesis-builder/xCAT-genesis-builder.spec b/xCAT-genesis-builder/xCAT-genesis-builder.spec index 4f85cde25..f8f645b41 100644 --- a/xCAT-genesis-builder/xCAT-genesis-builder.spec +++ b/xCAT-genesis-builder/xCAT-genesis-builder.spec @@ -4,7 +4,7 @@ Version: %{?version:%{version}}%{!?version:%(cat Version)} Release: %{?release:%{release}}%{!?release:%(cat Release)} Epoch: 1 AutoReq: false -Requires: ipmitool screen btrfs-progs lldpad rpm-build compat-libstdc++-33 mstflint xfsprogs nc reiserfs-utils +Requires: ipmitool screen btrfs-progs lldpad rpm-build mstflint xfsprogs nc rpmdevtools libstdc++-devel pciutils bridge-utils ntp iprutils psmisc mdadm bind-utils dosfstools usbutils libusbx Prefix: /opt/xcat AutoProv: false From e52f3e34eca10089baada5bab3ea3214c1bee27c Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Tue, 12 Sep 2017 16:36:07 -0400 Subject: [PATCH 178/251] re-modify the error message from switch_macmap output --- perl-xCAT/xCAT/MacMap.pm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/perl-xCAT/xCAT/MacMap.pm b/perl-xCAT/xCAT/MacMap.pm index ab10348e0..103ef87d4 100644 --- a/perl-xCAT/xCAT/MacMap.pm +++ b/perl-xCAT/xCAT/MacMap.pm @@ -725,14 +725,14 @@ sub refresh_switch { foreach (@res){ if($_ =~ m/^([0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}) dev swp([0-9]+) .*/){ $mymac=$1; - $myport=$2; + $myport=$2; $myport=sprintf("%d",$myport); - + #try all the possible port number formats #e.g, "5","swp5","05","swp05" unless(exists $self->{switches}->{$switch}->{$myport}){ if(exists $self->{switches}->{$switch}->{"swp".$myport}){ - $myport="swp".$myport; + $myport="swp".$myport; }else{ $myport=sprintf("%02d",$myport); unless(exists $self->{switches}->{$switch}->{$myport}){ @@ -743,7 +743,7 @@ sub refresh_switch { } } } - } + } if($myport){ if($output){ @@ -834,6 +834,10 @@ sub refresh_switch { $self->{nodeinfo}->{ $self->{switches}->{$switch}->{$portname} }->{vlans}->{$portname} = $trunktovlanmap->{$portid}; } } + #still needs output if there are no switchport defined on the nodes + if (not defined $portname) { + $vlans_to_check{'NA'} = 1; + } } } else { $vlans_to_check{'NA'} = 1; @@ -856,6 +860,9 @@ sub refresh_switch { my $bridgetoifmap = walkoid($session, '.1.3.6.1.2.1.17.1.4.1.2', ciscowarn => $iscisco, verbose => $self->{show_verbose_info}, switch => $switch, callback => $self->{callback}); # Good for all switches if (not ref $bridgetoifmap or !keys %{$bridgetoifmap}) { xCAT::MsgUtils->message("S", "Error communicating with " . $session->{DestHost} . ": failed to get a valid response to BRIDGE-MIB request"); + if ($self->{collect_mac_info}) { + $self->{macinfo}->{$switch}->{ErrorStr} = "Failed to get a valid response to BRIDGE-MIB request"; + } return; } # my $mactoindexmap = walkoid($session,'.1.3.6.1.2.1.17.4.3.1.2'); @@ -866,6 +873,9 @@ sub refresh_switch { } #Ok, time to process the data if (not ref $mactoindexmap or !keys %{$mactoindexmap}) { xCAT::MsgUtils->message("S", "Error communicating with " . $session->{DestHost} . ": Unable to get MAC entries via either BRIDGE or Q-BRIDE MIB"); + if ($self->{collect_mac_info}) { + $self->{macinfo}->{$switch}->{ErrorStr} = "Unable to get MAC entries via either BRIDGE or Q-BRIDE MIB"; + } return; } if (defined($self->{collect_mac_info})) { From e4b2ae6528442289f538c9035369f260a59af9bb Mon Sep 17 00:00:00 2001 From: XuWei Date: Wed, 13 Sep 2017 01:17:38 -0400 Subject: [PATCH 179/251] expose rspconfig get options and rflash command --- xCAT-server/lib/xcat/plugins/openbmc.pm | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index a71ce95d1..3ae295673 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -581,10 +581,10 @@ sub parse_args { my $nodes_num = @$noderange; return ([ 1, "Invalid parameter for option $key" ]) unless ($value); - return ([ 1, "Invalid parameter for option $key: $value" ]) if ($key != "ip" and !xCAT::NetworkUtils->isIpaddr($value)); + return ([ 1, "Invalid parameter for option $key: $value" ]) if ($key =~ /^netmask$|^gateway$/ and !xCAT::NetworkUtils->isIpaddr($value)); if ($key eq "ip") { - return ([ 1, "Can not configure more than 1 nodes' ip at the same time" ]) if ($nodes_num >= 2); - if ($value != "dhcp" and !xCAT::NetworkUtils->isIpaddr($value)) { + return ([ 1, "Can not configure more than 1 nodes' ip at the same time" ]) if ($nodes_num >= 2 and $value ne "dhcp"); + if ($value ne "dhcp" and !xCAT::NetworkUtils->isIpaddr($value)) { return ([ 1, "Invalid parameter for option $key: $value" ]); } } @@ -592,20 +592,12 @@ sub parse_args { # # disable function until fully tested # - unless ($key eq "ip" or !($subcommand =~ /^hostname$/)) { + unless (($key eq "ip" and $value eq "dhcp") or $key eq "hostname") { $check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; } } - if (ref($check) eq "ARRAY") { return $check; } } elsif ($subcommand =~ /^ip$|^netmask$|^gateway$|^hostname$|^vlan$/) { return ([ 1, "Can not configure and display nodes' value at the same time" ]) if ($setorget and $setorget eq "set"); $setorget = "get"; - # - # disable function until fully tested - # - unless ($subcommand =~ /^hostname$/) { - $check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; } - } - if (ref($check) eq "ARRAY") { return $check; } } elsif ($subcommand =~ /^sshcfg$/) { $setorget = ""; # SSH Keys are copied using a RShellAPI, not REST API } else { @@ -618,11 +610,6 @@ sub parse_args { return ([ 1, "Unsupported command: $command $subcommand" ]); } } elsif ($command eq "rflash") { - # - # disable function until fully supported by openbmc - # Currently waiting for issue https://github.com/openbmc/openbmc/issues/2074 to be fixed - # - $check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; } my $filename_passed = 0; my $updateid_passed = 0; my $option_flag; From 4833502bc2f75f87b7f1e6c2d9d882abcc8c0810 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 13 Sep 2017 07:08:06 -0400 Subject: [PATCH 180/251] modify rspconfig testcase for get more debug information --- .../autotest/testcase/rspconfig/rspconfig.sh | 165 +++++++++++------- 1 file changed, 99 insertions(+), 66 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index 1a5ea8667..4dbcbc14b 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -58,12 +58,12 @@ function net() } function change_ip() { - echo "Prepare to change ip." - echo "Start to check ip valid." + echo "Prepare to change node's bmc ip." + echo "Start to check node's bmc original ip valid." NODEIP=$4; test_ip $1; - if [[ $? -ne 0 ]];then echo "ip is invalid";return 1;fi - echo "ip is valid."; + if [[ $? -ne 0 ]];then echo "node's bmc original ip is invalid";return 1;fi + echo "node's bmc original ip is valid."; echo $1 > /tmp/BMCIP net $1 $3 ip1=`echo $1|awk -F. '{print $1}'` @@ -74,30 +74,28 @@ function change_ip() ip=`expr "$ipfirst" "+" "1"` iplast=`echo $LASTIP|awk -F. '{print $4}'` ip5=`expr "$iplast" "-" "1"` - echo ip is $ip ,ip5 is $ip5 while true; do [[ $ip == "$ip5" ]] && echo "exit for using last ip."&&return 1; ping $ip1.$ip2.$ip3.$ip -c 2 >/dev/null ; if [[ $? != 0 && "$ip" != "$ip4" && "$ip1.$ip2.$ip3.$ip" != "$NODEIP" ]]; then coutip="$ip1.$ip2.$ip3.$ip" BMCNEWIP=$coutip; - echo $1,$2,$3 - echo "Start to set ip for node." + echo "Start to set node's bmc ip to $BMCNEWIP." rspconfig $2 ip=$BMCNEWIP if [[ $? -eq 0 ]];then - echo "Could set bmc's ip for node using rspconfig."; + echo "Set node's bmc ip for node using rspconfig successfully."; else - echo "Could not set bmc's ip for node using rspconfig."; + echo "Set node's bmc ip for node using rspconfig failed."; return 1; fi chdef $2 bmc=$BMCNEWIP - echo "Start to check bmc's ip setting." + echo "Start to check node's bmc's ip really setted using rspconfig." check_result $2 ip $BMCNEWIP if [[ $? -ne 0 ]] ;then - echo "Set bmc's ip failed."; + echo "Node's bmc ip really setted failed ."; return 1; else - echo "Set bmc's ip successfully."; + echo "Node's bmc ip really setted successfully."; return 0; fi fi @@ -109,9 +107,7 @@ function check_result() a=0; while true; do [ $a -eq 20 ] && return 1; output=`rspconfig $1 $2 |awk -F: '{print $3}'`; - echo output is $output; if [[ $(echo $output|tr '.' '+'|bc) -eq $(echo $3|tr '.' '+'|bc) ]];then - echo checkresult is $output; return 0 ; else a=$[$a+1]; @@ -125,22 +121,21 @@ function clear_env() echo "Start to clear test environment."; if [[ -f /tmp/BMCIP ]];then originip=$(cat /tmp/BMCIP); - echo originip is $originip; rspconfig $2 ip=$originip if [[ $? -eq 0 ]];then - echo "Could set bmc's ip to originip using rspconfig."; + echo "Set node's bmc ip to originip using rspconfig successfully."; else - echo "Could not set bmc's ip to originip using rspconfig."; + echo "Set node's bmc ip to originip using rspconfig failed."; return 1; fi rm -rf /tmp/BMCIP chdef $2 bmc=$originip check_result $2 $3 $originip if [[ $? -ne 0 ]] ;then - echo "Set bmc's ip to originip failed."; + echo "Node's bmc ip really setted to originip failed."; return 1; else - echo "Set bmc's ip to originip successfully."; + echo "Node's bmc ip really setted to originip successfully."; return 0; fi fi @@ -148,38 +143,38 @@ function clear_env() } function change_nonip { - echo "Prepare to change $4."; - echo "Start to check $4 valid or not."; + echo "Prepare to change node's bmc $4."; + echo "Start to check node's bmc $4 valid or not."; if [[ $4 =~ "gateway" ]]||[[ $4 =~ "netmask" ]];then test_ip $1; if [[ $? -ne 0 ]];then - echo "$4 is invalid"; + echo "Node's bmc $4 is invalid"; return 1; fi fi echo "Start to change bmc's $4."; rspconfig $2 $4=$1; if [[ $? -eq 0 ]];then - echo "Could set bmc's $4."; + echo "Set node's bmc $4 using rspconfig successfully."; else - echo "Could not set bmc's $4."; + echo "Set node's bmc $4 using rspconfig failed."; return 1; fi - echo "Start to check $4 setting."; + echo "Start to check node's bmc $4 really setted using rspconfig."; check_result $2 $3 $1 if [[ $? -ne 0 ]] ;then - echo "Set bmc's $4 failed."; + echo "Node's bmc $4 really setted failed."; return 1; else - echo "Set bmc's $4 successfully."; + echo "Node's bmc $4 really setted successfully."; return 0; fi } function change_all { - echo "Prepare to change all for bmc." - echo "Start to change all for bmc." + echo "Prepare to change ip/netmask/gateway/vlan for node's bmc." + echo "Start to change ip/netmask/gatway/vlan for node's bmc." rspconfig $1 gateway netmask vlan ip if [[ $? -eq 0 ]];then BMCIP=`rspconfig $1 ip |awk -F":" '{print $3}'|sed s/[[:space:]]//g`; @@ -188,17 +183,55 @@ function change_all output=`rspconfig $1 vlan` if [[ $output =~ "BMC VLAN ID enabled" ]];then BMCVLAN=`rspconfig $1 vlan |awk -F":" '{print $3}'|sed s/[[:space:]]//g` + rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY vlan=$BMCVLAN + if [[ $? -eq 0 ]];then + echo "Node's BMC IP/netmask/gateway/vlan setted successfully using rspconfig."; + else + echo "Node's BMC IP/netmask/gateway/vlan setted failed using rspconfig."; + return 1; + fi + echo "Start to check node's BMC IP/netmask/gateway/vlan really setted using rspconfig."; + check_result $1 ip $BMCIP + rc1=$?; + check_result $1 netmask $BMCNETMASK + rc2=$?; + check_result $1 gateway $BMCGGATEWAY + rc3=$?; + check_result $1 vlan $BMCVLAN + rc4=$?; + if [[ $rc1 -eq 0 ]] && [[ $rc2 -eq 0 ]] && [[ $rc3 -eq 0 ]] && [[ $rc4 -eq 0 ]];then + echo "Node's bmc IP/netmask/gateway/vlan really setted successfully." + return 0; + else + echo "Node's bmc IP/netmask/gateway really setted failed." + return 1; + fi + + else echo "------------------Bmc vlan disabled so could not change vlan id using rspconfig.--------------------" - return 1; - fi + rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY + if [[ $? -eq 0 ]];then + echo "Node's BMC IP/netmask/gateway setted successfully using rspconfig."; + else + echo "Node's BMC IP/netmask/gateway setted failed using rspconfig."; + return 1; + fi + echo "Start to check node's BMC IP/netmask/gateway really setted using rspconfig."; + check_result $1 ip $BMCIP + rc1=$?; + check_result $1 netmask $BMCNETMASK + rc2=$?; + check_result $1 gateway $BMCGGATEWAY + rc3=$?; + if [[ $rc1 -eq 0 ]] && [[ $rc2 -eq 0 ]] && [[ $rc3 -eq 0 ]];then + echo "Node's bmc IP/netmask/gateway really setted successfully." + return 0; + else + echo "Node's bmc IP/netmask/gateway really setted failed." + return 1; + fi - rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY vlan=$BMCVLAN - if [[ $? -eq 0 ]];then - echo "Could set BMC IP/netmask/gateway/vlan."; - else - echo "Could not set BMC IP/netmask/gateway/vlan."; - return 1; fi fi @@ -215,7 +248,7 @@ while [ "$#" -gt "0" ] do case $1 in "-i"|"--ip" ) - echo "--------------------To test bmc ip could be changed using rspconfig.--------------------" + echo "--------------------Start to test rspconfig change node's bmc ip .--------------------" rspconfig $2 ip if [[ $? -eq 0 ]];then BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'` @@ -225,34 +258,34 @@ do fi change_ip $BMCIP $2 $BMCNETMASK $3 if [[ $? -eq 1 ]];then - echo "--------------------To test bmc ip could be changed using rspconfig failed.--------------------" + echo "--------------------Result for test rspconfig change node's bmc ip failed.--------------------" exit 1 else - echo "--------------------To test bmc ip could be change using rspconfig successfully.-------------------" + echo "--------------------Restult for test rspconfig change node's bmc ip successfully.-------------------" exit 0 fi ;; "-lip"|"--list ip" ) - echo "--------------------To test bmc ip could be listed using rspconfig.--------------------" + echo "--------------------Start to test rspconfig list node's bmc ip .--------------------" BMCIP_LSDEF=`lsdef $2 |grep "bmc=" |awk -F "=" '{print $2}'` rspconfig $2 ip if [[ $? -eq 0 ]];then BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'` if [[ $BMCIP =~ "$BMCIP_LSDEF" ]];then - echo "-----------------To test bmc ip could be listed using rspconfig successfully.-----------------" + echo "-----------------Result for test rspconfig list node's bmc ip successfully.-----------------" exit 0; else - echo "-------------------To test bmc ip could be listed using rspconfig failed.----------------" + echo "-------------------Result for test rspconfig list node's bmc ip failed.----------------" exit 1; fi else - echo "------------------To test bmc ip could be listed using rspconfig failed.-------------------" + echo "------------------Result for test rspconfig list node's bmc ip failed.-------------------" exit 1; fi ;; "-g"|"--gateway" ) - echo "--------------------To test bmc gateway could be changed using rspconfig.---------------------" + echo "--------------------Start to test rspconfig change node's bmc gateway .---------------------" rspconfig $2 gateway if [[ $? -eq 0 ]];then BMCGATEWAYE=`rspconfig $2 gateway |awk -F":" '{print $3}'` @@ -261,10 +294,10 @@ do fi change_nonip $BMCGATEWAYE $2 $3 gateway if [[ $? -eq 1 ]];then - echo "--------------------To test bmc gateway could be changed using rspconfig failed.--------------------" + echo "--------------------Result for test rspconfig change node's bmc gateway failed.--------------------" exit 1 else - echo "--------------------To test bmc gateway could be changed using rspconfig successfully.--------------------" + echo "--------------------Result for test rspconfig change node's bmc gateway successfully.--------------------" exit 0 fi ;; @@ -272,20 +305,20 @@ do output=`rspconfig $2 gateway` if [[ $? -eq 0 ]];then if [[ $output =~ "$2: BMC Gateway:" ]];then - echo "--1-----------------To test bmc gateway could be listed using rspconfig successfully.-----------------" + echo "--------------------Result for test rspconfig list node's bmc gateway successfully.-----------------" exit 0; else - echo "---2--------------To test bmc gateway could be listed using rsconfig failed.-------------------" + echo "------------------Result for test rspconfig list node's bmc gateway failed.-------------------" exit 1; fi else - echo "------------3-------To test bmc gateway could be listed using rspconfig failed.---------------" + echo "-------------------Result for test rspconfig list node's bmc gateway failed.---------------" exit 1; fi ;; "-n"|"--netmask" ) rspconfig $2 netmask - echo "---------------------To test bmc netmask could be changed using rspconfig.--------------------" + echo "---------------------Start to test rspconfig change node's bmc netmask .--------------------" if [[ $? -eq 0 ]];then BMCNETMASK=`rspconfig $2 netmask |awk -F":" '{print $3}'` else @@ -293,10 +326,10 @@ do fi change_nonip $BMCNETMASK $2 $3 netmask if [[ $? -eq 1 ]];then - echo "--------------------To test bmc netmask could be changed using rspconfig failed.------------------" + echo "--------------------Result for rspconfig change node's bmc netmask failed.------------------" exit 1 else - echo "--------------------To test bmc netmask could be changed using rspconfig successfully.-------------------" + echo "--------------------Result for rspconfig change node's bmc netmask successfully.-------------------" exit 0 fi ;; @@ -304,20 +337,20 @@ do output=`rspconfig $2 netmask` if [[ $? -eq 0 ]];then if [[ $output =~ "$2: BMC Netmask:" ]];then - echo "-------------------To test bmc Netmask could be listed using rspconfig successfully.-----------------" + echo "-------------------Result for test rspconfig list node's bmc Netmask successfully.-----------------" exit 0; else - echo "-----------------To test bmc Netmask could be listed using rsconfig failed.-------------------" + echo "-----------------Result for test rspconfig list node's bmc Netmask failed.-------------------" exit 1; fi else - echo "-------------------To test bmc Netmask could be listed using rspconfig failed.---------------" + echo "-------------------Result for test rspconfig list node's bmc Netmask failed.---------------" exit 1; fi ;; "-v"|"--vlan" ) output=`rspconfig $2 vlan` - echo "---------------------To test bmc vlan could be changed using rspconfig.--------------------" + echo "---------------------Start to test rspconfig change node's bmc vlan .--------------------" if [[ $? -eq 0 ]]&&[[ $output =~ "BMC VLAN ID enabled" ]];then BMCVLAN=`rspconfig $2 vlan |awk -F":" '{print $3}'` else @@ -326,10 +359,10 @@ do fi change_nonip $BMCVLAN $2 $3 vlan if [[ $? -eq 1 ]];then - echo "--------------------To test bmc vlan could be changed using rspconfig failed.------------------" + echo "--------------------Result for rpsconfig change node's bmc vlan failed.------------------" exit 1 else - echo "--------------------To test bmc vlan could be changed using rspconfig successfully.-------------------" + echo "--------------------Result for rspconfig change node's bmc vlan successfully.-------------------" exit 0 fi ;; @@ -337,24 +370,24 @@ do output=`rspconfig $2 vlan` if [[ $? -eq 0 ]];then if [[ $output =~ "$2: BMC VLAN ID" ]];then - echo "-------------------To test bmc Vlan could be listed using rspconfig successfully.-----------------" + echo "-------------------Result for rspconfig list node's bmc Vlan successfully.-----------------" exit 0; else - echo "-----------------To test bmc Vlan could be listed using rsconfig failed.-------------------" + echo "-----------------Result for rspconfig list node's bmc Vlan failed.-------------------" exit 1; fi else - echo "-------------------To test bmc Vlan could be listed using rspconfig failed.---------------" + echo "-------------------Result for rspconfig list node's bmc Vlan failed.---------------" exit 1; fi ;; "-a"|"--all" ) change_all $2 if [[ $? -eq 1 ]];then - echo "--------------------To test BMC IP/netmask/gateway/vlan could be changed using rspconfig failed.------------------" + echo "--------------------Result for rspconfig change node's BMC IP/netmask/gateway/vlan failed.------------------" exit 1 else - echo "--------------------To test BMC IP/netmask/gateway/vlan could be changed using rspconfig successfully.-------------------" + echo "--------------------Result for rspconfig change node's BMC IP/netmask/gateway/vlan successfully.-------------------" exit 0 fi ;; @@ -364,10 +397,10 @@ do output=`rspconfig $2 ip gateway netmask vlan` if [[ $? -eq 0 ]];then if [[ $output =~ "$2: BMC VLAN ID" ]]&&[[ $output =~ "BMC Netmask:" ]]&&[[ $output =~ "BMC Gateway:" ]]&&[[ $BMCIP =~ "$BMCIP_LSDEF" ]];then - echo "------------------To test bmc's all option could be listed using rspconfig succssfully.-----------------" + echo "------------------Result for rspconfig list node's BMC IP/netmask/gateway/vlan succssfully.-----------------" exit 0 else - echo "--------------------To test bmc's all options could be listed using rspconfig failed.--------------------" + echo "--------------------Result for rspconfig list node's BMC IP/netmask/gateway/vlan failed.--------------------" exit 1 fi fi From e9e2604ea83238ac0eeb2441e30d604f8da5622f Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 13 Sep 2017 07:23:51 -0400 Subject: [PATCH 181/251] rspconfig.sh modify rspconfig testcase for get more debug info --- xCAT-test/autotest/testcase/rspconfig/rspconfig.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index 4dbcbc14b..f7c5ef182 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -40,7 +40,7 @@ function test_ip() VALID_CHECK=$(echo $IP|awk -F. '$1<=255&&$2<=255&&$3<=255&&$4<=255{print "yes"}') if echo $IP|grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$">/dev/null; then if [ ${VALID_CHECK:-no} == "yes" ]; then - echo $1; + echo $1 is valid; else return 1; fi @@ -53,8 +53,6 @@ function net() { LASTIP=`echo "$1 $2"|awk -F '[ .]+' 'BEGIN{OFS="."} END{print or($1,xor($5,255)),or($2,xor($6,255)),or($3,xor($7,255)),or($4,xor($8,255))}'` FIRSTIP=`echo "$1 $2"|awk -F '[ .]+' 'BEGIN{OFS="."} END{print and($1,$5),and($2,$6),and($3,$7),and($4,$8)}'` - echo lastip is $LASTIP - echo first ip is $FIRSTIP } function change_ip() { From fddc0f64fa489357b6ae89ac78feb18d3675e9fa Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 13 Sep 2017 07:45:10 -0400 Subject: [PATCH 182/251] modify rspconfig testcase for get more debug info --- .../autotest/testcase/rspconfig/rspconfig.sh | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index f7c5ef182..8b8cda8ad 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -81,9 +81,9 @@ function change_ip() echo "Start to set node's bmc ip to $BMCNEWIP." rspconfig $2 ip=$BMCNEWIP if [[ $? -eq 0 ]];then - echo "Set node's bmc ip for node using rspconfig successfully."; + echo "Run rspconfig $2 ip=$BMCNEWIP and return value is 0."; else - echo "Set node's bmc ip for node using rspconfig failed."; + echo "Run rspconfig $2 ip=$BMCNEWIP and return value is 1."; return 1; fi chdef $2 bmc=$BMCNEWIP @@ -121,9 +121,9 @@ function clear_env() originip=$(cat /tmp/BMCIP); rspconfig $2 ip=$originip if [[ $? -eq 0 ]];then - echo "Set node's bmc ip to originip using rspconfig successfully."; + echo "Run rspconfig $2 ip=$originip and return value is 0."; else - echo "Set node's bmc ip to originip using rspconfig failed."; + echo "Run rspconfig $2 ip=$originip and return value is 1."; return 1; fi rm -rf /tmp/BMCIP @@ -153,9 +153,9 @@ function change_nonip echo "Start to change bmc's $4."; rspconfig $2 $4=$1; if [[ $? -eq 0 ]];then - echo "Set node's bmc $4 using rspconfig successfully."; + echo "Run rspconfig $2 $4=$1 and return value is 0."; else - echo "Set node's bmc $4 using rspconfig failed."; + echo "Run rspconfig $2 $4=$1 and return value is 1."; return 1; fi echo "Start to check node's bmc $4 really setted using rspconfig."; @@ -183,9 +183,9 @@ function change_all BMCVLAN=`rspconfig $1 vlan |awk -F":" '{print $3}'|sed s/[[:space:]]//g` rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY vlan=$BMCVLAN if [[ $? -eq 0 ]];then - echo "Node's BMC IP/netmask/gateway/vlan setted successfully using rspconfig."; + echo "Run rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY vlan=$BMCVLAN and return value is 0."; else - echo "Node's BMC IP/netmask/gateway/vlan setted failed using rspconfig."; + echo "Run rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY vlan=$BMCVLAN and return value is 1."; return 1; fi echo "Start to check node's BMC IP/netmask/gateway/vlan really setted using rspconfig."; @@ -210,9 +210,9 @@ function change_all echo "------------------Bmc vlan disabled so could not change vlan id using rspconfig.--------------------" rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY if [[ $? -eq 0 ]];then - echo "Node's BMC IP/netmask/gateway setted successfully using rspconfig."; + echo "Run rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY and return value is 0."; else - echo "Node's BMC IP/netmask/gateway setted failed using rspconfig."; + echo "Run rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY and return value is 1."; return 1; fi echo "Start to check node's BMC IP/netmask/gateway really setted using rspconfig."; From 91ed1e1ab8a93fddd19128ff1138c4300c116bd9 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 13 Sep 2017 07:55:41 -0400 Subject: [PATCH 183/251] modify rspconfig testcase for get more debug info --- xCAT-test/autotest/testcase/rspconfig/rspconfig.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index 8b8cda8ad..b24c11cec 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -252,6 +252,7 @@ do BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'` BMCNETMASK=`rspconfig $2 netmask |awk -F":" '{print $3}'` else + echo "Run rspconfig $2 ip and return value is 1. " exit 1; fi change_ip $BMCIP $2 $BMCNETMASK $3 @@ -288,6 +289,7 @@ do if [[ $? -eq 0 ]];then BMCGATEWAYE=`rspconfig $2 gateway |awk -F":" '{print $3}'` else + echo "Run rspconfig $2 gateway and return value is 1." exit 1; fi change_nonip $BMCGATEWAYE $2 $3 gateway @@ -320,6 +322,7 @@ do if [[ $? -eq 0 ]];then BMCNETMASK=`rspconfig $2 netmask |awk -F":" '{print $3}'` else + echo "Run rspconfig $2 netmask and return value is 1." exit 1; fi change_nonip $BMCNETMASK $2 $3 netmask From 7d3ebe35835d38382348a3aa1f26835642d36b81 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 13 Sep 2017 08:44:30 -0400 Subject: [PATCH 184/251] OpenBMC reventlog output formatting and sorting --- xCAT-server/lib/xcat/plugins/openbmc.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index a71ce95d1..5d021fa1a 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1629,27 +1629,28 @@ sub reventlog_response { foreach my $key_url (keys %{$response_info->{data}}) { my %content = %{ ${ $response_info->{data} }{$key_url} }; + my $timestamp = $content{Timestamp}; my $id_num = 0 + $content{Id} if ($content{Id}); if ($content{Message}) { my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($content{Timestamp}/1000); $mon += 1; $year += 1900; my $UTC_time = sprintf ("%02d/%02d/%04d %02d:%02d:%02d", $mon, $mday, $year, $hour, $min, $sec); - my $content_info = "Entry $content{Id}:" . $UTC_time . " " . $content{Message}; - $output{$id_num} = $content_info; + my $content_info = $UTC_time . " [$content{Id}] " . $content{Message}; + $output{$timestamp} = $content_info; } } my $count = 0; if ($option_s) { foreach my $key ( sort { $b <=> $a } keys %output) { - xCAT::SvrUtils::sendmsg($output{$key}, $callback, $node); + xCAT::MsgUtils->message("I", { data => [$output{$key}] }, $callback, $node) if ($output{$key}); $count++; last if ($entry_string ne "all" and $count >= $entry_num); } } else { - foreach my $key (keys %output) { - xCAT::SvrUtils::sendmsg("$output{$key}", $callback, $node) if ($output{$key}); + foreach my $key (sort keys %output) { + xCAT::MsgUtils->message("I", { data => [$output{$key}] }, $callback, $node) if ($output{$key}); $count++; last if ($entry_string ne "all" and $count >= $entry_num); } From 8bfbb5e2586f89de3b44cd1d05182f71a55fb05d Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 13 Sep 2017 15:06:56 -0400 Subject: [PATCH 185/251] Handle more than one node for openbmc rflash --- xCAT-server/lib/xcat/plugins/openbmc.pm | 36 ++++++++++++++----------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index a71ce95d1..9b0dadc7d 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -161,6 +161,7 @@ my %status_info = ( RFLASH_UPDATE_ACTIVATE_REQUEST => { method => "PUT", init_url => "$openbmc_project_url/software", + orig_url => "$openbmc_project_url/software", data => "xyz.openbmc_project.Software.Activation.RequestedActivations.Active", }, RFLASH_UPDATE_ACTIVATE_RESPONSE => { @@ -169,6 +170,7 @@ my %status_info = ( RFLASH_UPDATE_CHECK_STATE_REQUEST => { method => "GET", init_url => "$openbmc_project_url/software", + orig_url => "$openbmc_project_url/software", }, RFLASH_UPDATE_CHECK_STATE_RESPONSE => { process => \&rflash_response, @@ -183,6 +185,7 @@ my %status_info = ( RFLASH_SET_PRIORITY_REQUEST => { method => "PUT", init_url => "$openbmc_project_url/software", + orig_url => "$openbmc_project_url/software", data => "false", # Priority state of 0 sets image to active }, RFLASH_SET_PRIORITY_RESPONSE => { @@ -2082,24 +2085,27 @@ sub rflash_response { $update_id = (split(/\//, $key_url))[ -1 ]; if (defined($content{Version}) and $content{Version}) { $update_version = $content{Version}; - } - if ($update_version eq $::UPLOAD_FILE_VERSION) { - # Found a match of uploaded file version with the image in software/enumerate + if ($update_version eq $::UPLOAD_FILE_VERSION) { + # Found a match of uploaded file version with the image in software/enumerate - # Set the image id for the activation request - $status_info{RFLASH_UPDATE_ACTIVATE_REQUEST}{init_url} .= "/$update_id/attr/RequestedActivation"; - $status_info{RFLASH_UPDATE_CHECK_STATE_REQUEST}{init_url} .= "/$update_id"; - $status_info{RFLASH_SET_PRIORITY_REQUEST}{init_url} .= "/$update_id/attr/Priority"; + # Set the image id for the activation request + $status_info{RFLASH_UPDATE_ACTIVATE_REQUEST}{init_url} = + $status_info{RFLASH_UPDATE_ACTIVATE_REQUEST}{orig_url} . "/$update_id/attr/RequestedActivation"; + $status_info{RFLASH_UPDATE_CHECK_STATE_REQUEST}{init_url} = + $status_info{RFLASH_UPDATE_CHECK_STATE_REQUEST}{orig_url} . "/$update_id"; + $status_info{RFLASH_SET_PRIORITY_REQUEST}{init_url} = + $status_info{RFLASH_SET_PRIORITY_REQUEST}{orig_url} . "/$update_id/attr/Priority"; - # Set next steps to activate the image - $next_status{ $node_info{$node}{cur_status} } = "RFLASH_UPDATE_ACTIVATE_REQUEST"; - $next_status{"RFLASH_UPDATE_ACTIVATE_REQUEST"} = "RFLASH_UPDATE_ACTIVATE_RESPONSE"; - $next_status{"RFLASH_UPDATE_ACTIVATE_RESPONSE"} = "RFLASH_UPDATE_CHECK_STATE_REQUEST"; - $next_status{"RFLASH_UPDATE_CHECK_STATE_REQUEST"} = "RFLASH_UPDATE_CHECK_STATE_RESPONSE"; + # Set next steps to activate the image + $next_status{ $node_info{$node}{cur_status} } = "RFLASH_UPDATE_ACTIVATE_REQUEST"; + $next_status{"RFLASH_UPDATE_ACTIVATE_REQUEST"} = "RFLASH_UPDATE_ACTIVATE_RESPONSE"; + $next_status{"RFLASH_UPDATE_ACTIVATE_RESPONSE"} = "RFLASH_UPDATE_CHECK_STATE_REQUEST"; + $next_status{"RFLASH_UPDATE_CHECK_STATE_REQUEST"} = "RFLASH_UPDATE_CHECK_STATE_RESPONSE"; - $next_status{"RFLASH_SET_PRIORITY_REQUEST"} = "RFLASH_SET_PRIORITY_RESPONSE"; - $next_status{"RFLASH_SET_PRIORITY_RESPONSE"} = "RFLASH_UPDATE_CHECK_STATE_REQUEST"; - last; + $next_status{"RFLASH_SET_PRIORITY_REQUEST"} = "RFLASH_SET_PRIORITY_RESPONSE"; + $next_status{"RFLASH_SET_PRIORITY_RESPONSE"} = "RFLASH_UPDATE_CHECK_STATE_REQUEST"; + last; + } } } } From fecc2298bba2b2ff7cc2b77fae2d637ba1281d5a Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 13 Sep 2017 22:54:01 -0400 Subject: [PATCH 186/251] Make changes specific for Pegas --- xCAT-genesis-builder/buildrpm | 17 ++++++++++++----- xCAT-genesis-builder/xCAT-genesis-builder.spec | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/xCAT-genesis-builder/buildrpm b/xCAT-genesis-builder/buildrpm index 580691050..8253ce5d1 100755 --- a/xCAT-genesis-builder/buildrpm +++ b/xCAT-genesis-builder/buildrpm @@ -16,12 +16,13 @@ BUILDARCH=`uname -m` rpmdev-setuptree #For Openpower -if [ $BUILDARCH = "ppc64le" ]; then - BUILDARCH="ppc64" -fi - if [ -z $1 ]; then - HOSTOS="fedora26" + if [ $BUILDARCH = "ppc64le" ]; then + HOSTOS="Pegas1.0" + BUILDARCH="ppc64" + else + HOSTOS="fedora26" + fi fi # get the input files for dracut in the right place @@ -107,6 +108,12 @@ if [ "$HOSTOS" = "mcp" ]; then # For ppc64 platform, needs to remove some files, # # and some files are in different directories elif [ $BUILDARCH = "ppc64" ]; then + if [ "$HOSTOS" = "Pegas1.0" ]; then + sed -i 's/ mkreiserfs//' $DRACUTMODDIR/install + sed -i 's/ reiserfstune//' $DRACUTMODDIR/install + sed -i 's/ vconfig//' $DRACUTMODDIR/install + sed -i 's/ ntp-wait//' $DRACUTMODDIR/install + fi sed -i 's/ efibootmgr//' $DRACUTMODDIR/install sed -i 's/ dmidecode//' $DRACUTMODDIR/install sed -i 's/\/lib\/terminfo\/l\/linux/\/usr\/share\/terminfo\/l\/linux/g' $DRACUTMODDIR/install diff --git a/xCAT-genesis-builder/xCAT-genesis-builder.spec b/xCAT-genesis-builder/xCAT-genesis-builder.spec index f8f645b41..e1704f8fc 100644 --- a/xCAT-genesis-builder/xCAT-genesis-builder.spec +++ b/xCAT-genesis-builder/xCAT-genesis-builder.spec @@ -4,7 +4,7 @@ Version: %{?version:%{version}}%{!?version:%(cat Version)} Release: %{?release:%{release}}%{!?release:%(cat Release)} Epoch: 1 AutoReq: false -Requires: ipmitool screen btrfs-progs lldpad rpm-build mstflint xfsprogs nc rpmdevtools libstdc++-devel pciutils bridge-utils ntp iprutils psmisc mdadm bind-utils dosfstools usbutils libusbx +Requires: ipmitool screen btrfs-progs lldpad rpm-build mstflint xfsprogs nc rpmdevtools libstdc++-devel pciutils bridge-utils ntp ntp-perl iprutils psmisc mdadm bind-utils dosfstools usbutils libusbx Prefix: /opt/xcat AutoProv: false From cb7be092b309a810f470fd585d50773d974cdc6e Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 14 Sep 2017 01:41:00 -0400 Subject: [PATCH 187/251] Delete genesis base built check in xcatprobe discovery pre-check --- xCAT-probe/subcmds/discovery | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/xCAT-probe/subcmds/discovery b/xCAT-probe/subcmds/discovery index 194bbaa33..10c52b10c 100755 --- a/xCAT-probe/subcmds/discovery +++ b/xCAT-probe/subcmds/discovery @@ -524,7 +524,6 @@ sub check_genesis_file { my $rst = 0; my @warn_msg; - my $genesis_v; my $os = probe_utils->get_os(); if ($os =~ "unknown") { probe_utils->send_msg("stdout", "f", $msg); @@ -540,7 +539,6 @@ sub check_genesis_file { probe_utils->send_msg("stdout", "d", "xCAT-genesis is not installed."); return 1; } - $genesis_v = `dpkg -s xcat-genesis-base-ppc64`; } else { my $genesis_output = `rpm -qa | grep -i "xcat-genesis"`; unless (($genesis_output =~ /base/ and $genesis_output =~ /ppc64/) and @@ -551,15 +549,6 @@ sub check_genesis_file { probe_utils->send_msg("stdout", "d", "xCAT-genesis is not installed."); return 1; } - $genesis_v = `rpm -qi xCAT-genesis-base-ppc64`; - } - - if ($genesis_v =~ /Built in environment .+fc(\d*).+ on (.+)\./) { - my $ver = $1; - my $arch = $2; - push @warn_msg, "xcat-genesis-base-ppc64 is not built in environment fedora 26 or higher version on $arch." if ($ver < 26); - } else { - push @warn_msg, "xcat-genesis-base-ppc64 is not built in environment fedora."; } my $genesis_update_flag_p; From 9dc33e6e8430aa78dfac2e9058d12039457195bf Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 14 Sep 2017 06:27:21 -0400 Subject: [PATCH 188/251] modify bmcdiscover testcase --- xCAT-test/autotest/testcase/bmcdiscover/cases0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/bmcdiscover/cases0 b/xCAT-test/autotest/testcase/bmcdiscover/cases0 index 2c05b3904..f3917fea5 100644 --- a/xCAT-test/autotest/testcase/bmcdiscover/cases0 +++ b/xCAT-test/autotest/testcase/bmcdiscover/cases0 @@ -69,7 +69,7 @@ end start:bmcdiscover_range_w cmd:bmcdiscover --range $$bmcrange -u $$bmcusername -p $$bmcpasswd -w check:rc==0 -check:output=~bmc=$$bmcrange +check:output=~Writing node end start:bmcdiscover_range_u_p_i_ipsource From 685a9b99a511d697635edfa4174ada6d52c85c9c Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 14 Sep 2017 06:53:10 -0400 Subject: [PATCH 189/251] modify bmcdiscover testcase --- xCAT-test/autotest/testcase/bmcdiscover/cases0 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/bmcdiscover/cases0 b/xCAT-test/autotest/testcase/bmcdiscover/cases0 index f3917fea5..da39b4d41 100644 --- a/xCAT-test/autotest/testcase/bmcdiscover/cases0 +++ b/xCAT-test/autotest/testcase/bmcdiscover/cases0 @@ -69,7 +69,8 @@ end start:bmcdiscover_range_w cmd:bmcdiscover --range $$bmcrange -u $$bmcusername -p $$bmcpasswd -w check:rc==0 -check:output=~Writing node +check:output=~Writing node +check:output=~$$bmcrange,\w*,\w*,$$bmcusername,$$bmcpasswd end start:bmcdiscover_range_u_p_i_ipsource From 8ad7e70aea3008d8c37c3066ca759148f226a49f Mon Sep 17 00:00:00 2001 From: ertaozh Date: Thu, 14 Sep 2017 04:25:23 -0400 Subject: [PATCH 190/251] Modify the ip/bmc ip setting mistakes in mtm based discovery document --- .../mtms/discovery_using_defined.rst | 22 ++++++++-------- .../discovery/mtms/discovery_using_dhcp.rst | 25 +++++++++---------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/mtms/discovery_using_defined.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/mtms/discovery_using_defined.rst index f12aa1354..9ea41fc17 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/mtms/discovery_using_defined.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/mtms/discovery_using_defined.rst @@ -12,7 +12,7 @@ The following example outlines the MTMS based hardware discovery for a single IP +------------------------------+------------+ | Hostname | cn01 | +------------------------------+------------+ -| IP address | 10.1.2.1 | +| IP address | 10.0.101.1 | +------------------------------+------------+ The BMC IP address is obtained by the open range dhcp server and the plan in this scenario is to change the IP address for the BMC to a static IP address in a different subnet than the open range addresses. The static IP address in this example is in the same subnet as the open range to simplify the networking configuration on the xCAT management node. @@ -20,9 +20,9 @@ The BMC IP address is obtained by the open range dhcp server and the plan in thi +------------------------------+------------+ | BMC Information | Value | +==============================+============+ -| IP address - dhcp | 172.30.0.1 | +| IP address - dhcp | 50.0.100.1 | +------------------------------+------------+ -| IP address - static | 172.20.2.1 | +| IP address - static | 50.0.101.1 | +------------------------------+------------+ #. Detect the BMCs and add the node definitions into xCAT. @@ -44,9 +44,9 @@ The BMC IP address is obtained by the open range dhcp server and the plan in thi Use the ``bmcdiscover`` command to help discover the nodes over an IP range and easily create a starting file to define the compute nodes into xCAT. - To discover the compute nodes for the BMCs with an IP address of 172.30.0.1, use the command: :: + To discover the compute nodes for the BMCs with an IP address of 50.0.100.1, use the command: :: - bmcdiscover --range 172.30.0.1 -z > predefined.stanzas + bmcdiscover --range 50.0.100.1 -z > predefined.stanzas The discovered nodes have the naming convention: node-<*model-type*>-<*serial-number*> :: @@ -54,7 +54,7 @@ The BMC IP address is obtained by the open range dhcp server and the plan in thi node-8247-22l-10112ca: objtype=node groups=all - bmc=172.30.0.1 + bmc=50.0.100.1 cons=ipmi mgt=ipmi mtm=8247-22L @@ -73,7 +73,7 @@ The BMC IP address is obtained by the open range dhcp server and the plan in thi #. Add a ``ip`` attribute and give it the compute node IP address: :: - ip=10.1.2.1 + ip=10.0.101.1 #. Remove ``nodetype`` and ``hwtype`` if defined in the ``predefined.stanza``. @@ -86,12 +86,12 @@ The BMC IP address is obtained by the open range dhcp server and the plan in thi cn01: objtype=node groups=all - bmc=172.30.0.1 + bmc=50.0.100.1 cons=ipmi mgt=ipmi mtm=8247-22L serial=10112CA - ip=10.1.2.1 + ip=10.0.101.1 #. Define the compute nodes into xCAT: :: @@ -109,9 +109,9 @@ The BMC IP address is obtained by the open range dhcp server and the plan in thi Set the BMC IP address to a different value for the **predefined** compute node definitions. - To change the dhcp obtained IP address of 172.30.0.1 to a static IP address of 172.20.2.1, run the following command: :: + To change the dhcp obtained IP address of 50.0.100.1 to a static IP address of 50.0.101.1, run the following command: :: - chdef cn01 bmc=172.20.2.1 + chdef cn01 bmc=50.0.101.1 #. Add the compute node IP information to ``/etc/hosts``: :: diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/mtms/discovery_using_dhcp.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/mtms/discovery_using_dhcp.rst index 3634c067b..5b22af650 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/mtms/discovery_using_dhcp.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/discovery/mtms/discovery_using_dhcp.rst @@ -12,7 +12,7 @@ The following example outlines the MTMS based hardware discovery for a single IP +------------------------------+------------+ | Hostname | cn01 | +------------------------------+------------+ -| IP address | 10.1.2.1 | +| IP address | 10.0.101.1 | +------------------------------+------------+ The BMC IP address is obtained by the open range dhcp server and the plan is to leave the IP address the same, except we want to change the IP address to be static in the BMC. @@ -20,9 +20,9 @@ The BMC IP address is obtained by the open range dhcp server and the plan is to +------------------------------+------------+ | BMC Information | Value | +==============================+============+ -| IP address - dhcp | 172.30.0.1 | +| IP address - dhcp | 50.0.100.1 | +------------------------------+------------+ -| IP address - static | 172.30.0.1 | +| IP address - static | 50.0.100.1 | +------------------------------+------------+ @@ -30,9 +30,9 @@ The BMC IP address is obtained by the open range dhcp server and the plan is to Use the ``bmcdiscover`` command to help discover the nodes over an IP range and easily create a starting file to define the compute nodes into xCAT. - To discover the compute nodes for the BMCs with an IP address of 172.30.0.1, use the command: :: + To discover the compute nodes for the BMCs with an IP address of 50.0.100.1, use the command: :: - bmcdiscover --range 172.30.0.1 -z > predefined.stanzas + bmcdiscover --range 50.0.100.1 -z > predefined.stanzas The discovered nodes have the naming convention: node-<*model-type*>-<*serial-number*> :: @@ -40,7 +40,7 @@ The BMC IP address is obtained by the open range dhcp server and the plan is to node-8247-22l-10112ca: objtype=node groups=all - bmc=172.30.0.1 + bmc=50.0.100.1 cons=ipmi mgt=ipmi mtm=8247-22L @@ -59,7 +59,7 @@ The BMC IP address is obtained by the open range dhcp server and the plan is to #. Add a ``ip`` attribute and give it the compute node IP address: :: - ip=10.1.2.1 + ip=10.0.101.1 #. Repeat for additional nodes in the ``predefined.stanza`` file based on the MTMS mapping. @@ -70,13 +70,16 @@ The BMC IP address is obtained by the open range dhcp server and the plan is to cn01: objtype=node groups=all - bmc=172.30.0.1 + bmc=50.0.100.1 cons=ipmi mgt=ipmi mtm=8247-22L serial=10112CA - ip=10.1.2.1 + ip=10.0.101.1 +#. Define the compute nodes into xCAT: :: + + cat predefined.stanzas | mkdef -z #. Set the chain table to run the ``bmcsetup`` script, this will set the BMC IP to static. :: @@ -86,10 +89,6 @@ The BMC IP address is obtained by the open range dhcp server and the plan is to chdef cn01 -p chain="osimage=" -#. Define the compute nodes into xCAT: :: - - cat predefined.stanzas | mkdef -z - #. Add the compute node IP information to ``/etc/hosts``: :: makehosts cn01 From d45f7d450881b0916e69282a5e7468d23739ed45 Mon Sep 17 00:00:00 2001 From: Yuan Bai Date: Thu, 14 Sep 2017 17:15:47 +0800 Subject: [PATCH 191/251] Add new PCI format support for pcipassthrough (#3916) * add devpassthrough support * add new pci format for pcipassthrough * add new pci format support * polished * update doc --- .../manage_clusters/common/kvm/manage_vm.rst | 22 ++++++++++++++++++- perl-xCAT/xCAT/Schema.pm | 2 +- xCAT-server/lib/xcat/plugins/kvm.pm | 9 ++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst b/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst index 7e008c357..6aa25256c 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/kvm/manage_vm.rst @@ -82,7 +82,27 @@ After the VM object is created, several key attributes need to be specified with chtab node=vm1 vm.vidpassword=abc123 -10. Set **netboot** attribute +10. (optional)For assigning PCI devices to the VM, set **othersettings** value: :: + + chtab node=vm1 vm.othersettings="devpassthrough:0000:01:00.2" + + Or: :: + + chtab node=vm1 vm.othersettings="devpassthrough:pci_0000_01_00_2" + + Take assigning SR-IOV VFs to the VM as an example: + + * Use ``lspci`` to get VFs PCI from hypervisor: :: + + lspci|grep -i "Virtual Function" + 0000:01:00.1 Infiniband controller: Mellanox Technologies MT27700 Family [ConnectX-4 Virtual Function] + 0000:01:00.2 Infiniband controller: Mellanox Technologies MT27700 Family [ConnectX-4 Virtual Function] + + * Set the VFs PCI into ``vm`` table on MN: :: + + chtab node=vm1 vm.othersettings="devpassthrough:0000:01:00.1,0000:01:00.2" + +11. Set **netboot** attribute * **[x86_64]** :: diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 1da0353f7..cfd0930df 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -226,7 +226,7 @@ qq{ link,ro - The file is readonly, and will be placed in tmpfs on the booted no 'vncport' => 'Tracks the current VNC display port (currently not meant to be set', 'textconsole' => 'Tracks the Psuedo-TTY that maps to the serial port or console of a VM', 'powerstate' => "This flag is used by xCAT to track the last known power state of the VM.", -'othersettings' => "This allows specifying a semicolon delimited list of key->value pairs to include in a vmx file of VMware or KVM. For partitioning on normal power machines, this option is used to specify the hugepage and/or bsr information, the value is like:'hugepage:1,bsr=2'. For KVM cpu pinning, this option is used to specify the physical cpu set on the host, the value is like:\"vcpupin:'0-15,^8'\",Its syntax is a comma separated list and a special markup using '-' and '^' (ex. '0-4', '0-3,^2') can also be allowed, the '-' denotes the range and the '^' denotes exclusive. For KVM memory binding, the value is like:'membind:0', restrict a guest to allocate memory from the specified set of NUMA nodes. For PCI passthrough, the value is like:'devpassthrough:pci_0001_01_00_0,pci_0000_03_00_0',the PCI devices are assigned to a virtual machine, and the virtual machine can use this I/O exclusively, the devices list are a list of PCI device names delimited with comma, the PCI device names can be obtained by running B on the host.", +'othersettings' => "This allows specifying a semicolon delimited list of key->value pairs to include in a vmx file of VMware or KVM. For partitioning on normal power machines, this option is used to specify the hugepage and/or bsr information, the value is like:'hugepage:1,bsr=2'. For KVM cpu pinning, this option is used to specify the physical cpu set on the host, the value is like:\"vcpupin:'0-15,^8'\",Its syntax is a comma separated list and a special markup using '-' and '^' (ex. '0-4', '0-3,^2') can also be allowed, the '-' denotes the range and the '^' denotes exclusive. For KVM memory binding, the value is like:'membind:0', restrict a guest to allocate memory from the specified set of NUMA nodes. For PCI passthrough, the value is like:'devpassthrough:pci_0001_01_00_0,pci_0000_03_00_0', the value for PCI device format also can be like:'devpassthrough:0001:01:00.1', the PCI devices are assigned to a virtual machine, and the virtual machine can use this I/O exclusively, the devices list are a list of PCI device names delimited with comma, the PCI device names can be obtained by running B on the host.", 'guestostype' => "This allows administrator to specify an identifier for OS to pass through to virtualization stack. Normally this should be ignored as xCAT will translate from nodetype.os rather than requiring this field be used\n", 'beacon' => "This flag is used by xCAT to track the state of the identify LED with respect to the VM.", 'datacenter' => "Optionally specify a datacenter for the VM to exist in (only applicable to VMWare)", diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 55ae358a7..7df93472a 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -783,6 +783,15 @@ sub build_xmldesc { #prepare the xml hash for pci passthrough my @prdevarray; foreach my $devname (@passthrudevices) { + #This is for SR-IOV vfio + #Change vfio format 0000:01:00.2 to pci_0000_01_00_2 + if ( $devname =~ m/(\w:)+(\w)+.(\w)/ ){ + $devname =~ s/[:|.]/_/g; + if ( $devname !~ /^pci_/ ) { + $devname ="pci_".$devname + } + } + my $devobj = $hypconn->get_node_device_by_name($devname); unless ($devobj) { return -1; From f61a794da8c263d2b4f5f5be640aa5978f207359 Mon Sep 17 00:00:00 2001 From: Yuan Bai Date: Thu, 14 Sep 2017 17:34:24 +0800 Subject: [PATCH 192/251] enhance packimage (#3919) --- xCAT-server/lib/xcat/plugins/packimage.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 6d5d723a5..fa450e7c9 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -484,7 +484,7 @@ sub process_request { unlink glob("$destdir/rootimg.*"); if ($method =~ /cpio/) { - if (!$exlistloc) { + if (!$excludestr) { $excludestr = "find . -xdev -print0 | cpio -H newc -o -0 | $compress -c - > ../rootimg.$suffix"; } else { chdir("$rootimg_dir"); @@ -505,7 +505,7 @@ sub process_request { if ($checkoption2 !~ /unrecognized/) { $option .= "--selinux "; } - if (!$exlistloc) { + if (!$excludestr) { $excludestr = "find . -xdev -print0 | tar $option --no-recursion --use-compress-program=$compress --null -T - -cf ../rootimg.$suffix"; } else { chdir("$rootimg_dir"); @@ -526,7 +526,6 @@ sub process_request { } $excludestr = "cat $xcat_packimg_tmpfile|cpio -dump $temppath"; } - chdir("$rootimg_dir"); my $outputmsg = `$excludestr 2>&1`; unless($?){ From db37fd5dc0ab9ad8b1bbda70c4b63cc09cff0d78 Mon Sep 17 00:00:00 2001 From: chenglch Date: Thu, 14 Sep 2017 17:36:54 +0800 Subject: [PATCH 193/251] Add script to analyze the db performance of xcat command (#3899) This patch add a python script to calculate the time and the call times from the command log file and syslog file. Note: To get the correct data, the `dbtracelevel` option in site table should be set to 4 implement: #3713 Support option: ``` usage: dbstats [--clusterlog CLUSTERLOG] [--commandlog COMMANDLOG] [-n NUM] [-c COMMAND] Optional arguments: --clusterlog CLUSTERLOG The syslog file of xcat. --commandlog COMMANDLOG The command log file of xcat. -n NUM, --num NUM The recent count of commands to analyze -c COMMAND, --command COMMAND The specified command to track ``` --- xCAT-probe/scripts/dbstats.py | 354 ++++++++++++++++++++++++++++++++++ xCAT-probe/xCAT-probe.spec | 1 + 2 files changed, 355 insertions(+) create mode 100644 xCAT-probe/scripts/dbstats.py diff --git a/xCAT-probe/scripts/dbstats.py b/xCAT-probe/scripts/dbstats.py new file mode 100644 index 000000000..69187fe76 --- /dev/null +++ b/xCAT-probe/scripts/dbstats.py @@ -0,0 +1,354 @@ +# -*- encoding: utf-8 -*- +# !/usr/bin/python +from __future__ import print_function +import argparse +import json +import os +import sys +import time + +BUF_SIZE = 8192 + + +class Reader(object): + def __init__(self, file): + self.f_size = os.stat(file).st_size + self.f_pos = self.f_size + self.file = file + self.buf_list = [] + self.remain = None + self.f = None + + def open(self): + if self.f is None: + self.f = open(self.file) + + def close(self): + if self.f is not None: + self.f.close() + self.f = None + + def __enter__(self): + self.open() + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.close() + + def _read(self): + if self.f_pos == 0: + return None + + size = BUF_SIZE + if self.f_pos - BUF_SIZE >= 0: + self.f.seek(self.f_pos - BUF_SIZE) + else: + self.f.seek(0) + size = self.f_pos - 0 + buf = self.f.read(size) + if self.remain is not None: + self.buf_list = (buf + self.remain).split('\n') + else: + self.buf_list = buf.split('\n') + if size == BUF_SIZE: + self.remain = self.buf_list[0] + self.buf_list = self.buf_list[1:] + else: + self.remain = None + self.f_pos -= size + + return self.buf_list + + def get_next(self): + ret = self._get_next() + if ret is not None: + return ret + + while self._read() is not None: + ret = self._get_next() + if ret is not None: + return ret + + return None + + +class CommandReader(Reader): + def __init__(self, file): + super(CommandReader, self).__init__(file) + self.cmd = {} + + def _get_next(self): + """ Extract data from the commands log file of xcat + Format:: + + [Date] 2017-09-04 17:52:10 + [ClientType] cli + [Request] xdsh c910f04x35v07 'echo "nameserver 9.0.2.1" >> /etc/resolv.conf' + [Response] + [ElapsedTime] 0 s + :return: command dict if found, None if not found + """ + for i, b in enumerate(self.buf_list[::-1]): + if b.find('[ElapsedTime]') == 0: + self.cmd['elapsed'] = float(b.split(' ')[1]) + elif b.find('[Request]') == 0: + self.cmd['request'] = " ".join( + b.rstrip().split(' ')[1:]).strip().replace(',', ' ') + elif b.find('[Date]') == 0: + temp = b.split(' ') + self.cmd['date'] = '%s %s' % (temp[-2], temp[-1]) + + if all(k in self.cmd for k in ('date', 'request', 'elapsed')): + cmd = self.cmd + self.cmd = {} + self.buf_list = self.buf_list[0:len(self.buf_list) - i - 1] + return cmd + return None + + +class DBTraceReader(Reader): + def __init__(self, file): + super(DBTraceReader, self).__init__(file) + self.year = str(time.localtime().tm_year) + + def _get_next(self): + """Extract information from syslog file of xcat + Format:: + + Sep 4 22:16:38 c910f04x12v02 xcat[6692]: [DB Trace]: {"msg":{"table":"nodegroup","method":"xCAT::Table::getAllEntries"},"type":"end_sql","elapsed":"0.00042s"} + + :return: A dict contains the time stamp and db dict if db trace log is + found. None if nothing about db trace log found. + """ + for i, b in enumerate(self.buf_list[::-1]): + pos = b.find('[DB Trace]:') + if pos == -1: + continue + date = b[0:15] + conv = time.strptime('%s %s' % (self.year, date), + "%Y %b %d %H:%M:%S") + # TODO: the year value is not included in the current syslog + try: + ret = {'stamp': int(time.mktime(conv)), + 'db': json.loads(b[pos + 12:])} + except ValueError: + if b.find('message repeated') != -1: + # syslog will add [ ] around the json message. + ret = {'stamp': int(time.mktime(conv)), + 'db': json.loads(b[pos + 12:-1])} + else: + raise + + self.buf_list = self.buf_list[0:len(self.buf_list) - i - 1] + return ret + + return None + + +class TimeStamp(object): + def __init__(self, kwargs): + if 'date' in kwargs: + a = time.strptime(kwargs['date'], "%Y-%m-%d %H:%M:%S") + self.start = int(time.mktime(a)) + else: + raise + if 'elapsed' in kwargs: + self.end = self.start + int(kwargs['elapsed']) + 1 + else: + raise + + +class Analysis(object): + def __init__(self, command_log_file, cluster_log_file): + self.command_log_file = command_log_file + self.cluster_log_file = cluster_log_file + + def _stat(self, record, data): + elapsed = 0 + if 'elapsed' in data: + # elapsed = float('%.3f' % float(data['elapsed'][:-1])) + elapsed = float(data['elapsed'][:-1]) + if data['type'] == 'end_sql': + if data['msg']['method'].startswith('xCAT::Table::get'): + record['get_sql_time'] += elapsed + elif data['msg']['method'].startswith('xCAT::Table::set'): + record['set_sql_time'] += elapsed + elif data['msg']['method'].startswith('xCAT::Table::del'): + record['del_sql_time'] += elapsed + elif data['type'] == 'end': + if data['msg']['method'].startswith('xCAT::Table::get'): + record['get_sub_time'] += elapsed + elif data['msg']['method'].startswith('xCAT::Table::set'): + record['set_sub_time'] += elapsed + elif data['msg']['method'].startswith('xCAT::Table::del'): + record['del_sub_time'] += elapsed + elif data['type'] == 'start_sql': + if data['msg']['method'].startswith('xCAT::Table::get'): + if data['msg']['table'] not in record['get_tables']: + record['get_tables'][data['msg']['table']] = 1 + else: + record['get_tables'][data['msg']['table']] += 1 + elif data['msg']['method'].startswith('xCAT::Table::set'): + if data['msg']['table'] not in record['set_tables']: + record['set_tables'][data['msg']['table']] = 1 + else: + record['set_tables'][data['msg']['table']] += 1 + elif data['msg']['method'].startswith('xCAT::Table::del'): + if data['msg']['table'] not in record['del_tables']: + record['del_tables'][data['msg']['table']] = 1 + else: + record['del_tables'][data['msg']['table']] += 1 + elif data['type'] == 'build_cache': + if data['msg']['table'] not in record['build_cache']: + record['build_cache'][data['msg']['table']] = 1 + else: + record['build_cache'][data['msg']['table']] += 1 + elif data['type'] == 'cache_hit': + if data['msg']['table'] not in record['cache_hit']: + record['cache_hit'][data['msg']['table']] = 1 + else: + record['cache_hit'][data['msg']['table']] += 1 + + def process(self, latest, specific_cmd): + if specific_cmd is not None: + latest = None + + self._print_header() + with CommandReader(self.command_log_file) as cmd_reader: + cmd = cmd_reader.get_next() + trace = None + index = 0 + db_reader = DBTraceReader(self.cluster_log_file) + db_reader.open() + while cmd is not None: + if specific_cmd is not None and not cmd['request'].startswith( + specific_cmd): + cmd = cmd_reader.get_next() + continue + + stamp = TimeStamp(cmd) + if trace is None: + trace = db_reader.get_next() + + while trace and trace['stamp'] > stamp.end: + trace = db_reader.get_next() + key = '%s(%s)' % (cmd['request'], cmd['date']) + + record = {'command': key, + 'elapsed': cmd['elapsed'], + 'get_sql_time': float(0), + 'set_sql_time': float(0), + 'del_sql_time': float(0), + 'set_sub_time': float(0), + 'get_sub_time': float(0), + 'del_sub_time': float(0), + 'get_tables': {}, + 'set_tables': {}, + 'del_tables': {}, + 'build_cache': {}, + 'cache_hit': {}} + + while trace and trace['stamp'] >= stamp.start: + self._stat(record, trace['db']) + trace = db_reader.get_next() + + self._print_csv(record) + index += 1 + if latest is not None and index == latest: + break + cmd = cmd_reader.get_next() + db_reader.close() + + def _print_header(self): + print("command,elapsed(precision: 1s)," + "get_sub_time(s),set_sub_time(s),del_sub_time(s)," + "get_sql_time(s),set_sql_time(s),del_sql_time(s)," + "build_cache(times),cache_hit(times)," + "get_tables(times),set_tables(times),del_tables(times)") + + def _print_csv(self, record): + print("%(command)s,%(elapsed)f," + "%(get_sub_time)f,%(set_sub_time)f,%(del_sub_time)f," + "%(get_sql_time)f,%(set_sql_time)f,%(del_sql_time)f," + "%(build_cache)s,%(cache_hit)s," + "%(get_tables)s,%(set_tables)s,%(del_tables)s\n" % + {'command': record['command'], + 'elapsed': record['elapsed'], + 'get_sub_time': float('%.3f' % record['get_sub_time']), + 'set_sub_time': float('%.3f' % record['set_sub_time']), + 'del_sub_time': float('%.3f' % record['del_sub_time']), + 'get_sql_time': float('%.3f' % record['get_sql_time']), + 'set_sql_time': float('%.3f' % record['set_sql_time']), + 'del_sql_time': float('%.3f' % record['del_sql_time']), + 'build_cache': self._format_dict(record['build_cache']), + 'cache_hit': self._format_dict(record['cache_hit']), + 'get_tables': self._format_dict(record['get_tables']), + 'set_tables': self._format_dict(record['set_tables']), + 'del_tables': self._format_dict(record['del_tables'])}) + + def _format_list(self, a): + return " ".join(a) + + def _format_dict(self, d): + ret = [] + for k, v in d.items(): + if type(v) is list: + ret.append('%s:[%s]', k, " ".join(v)) + elif type(v) is str or type(v) is int: + ret.append('%s:%s' % (k, str(v))) + return " ".join(ret) + + +class StatsShell(object): + def get_base_parser(self): + parser = argparse.ArgumentParser( + prog='dbstats', + add_help=False, + formatter_class=HelpFormatter, + ) + parser.add_argument('-h', '--help', + action='store_true', + help=argparse.SUPPRESS, + ) + parser.add_argument('--clusterlog', + help="The syslog file of xcat.", + default='/var/log/xcat/cluster.log', + type=str) + parser.add_argument('--commandlog', + help="The command log file of xcat.", + default='/var/log/xcat/commands.log', + type=str) + parser.add_argument('-n', '--num', + help="The recent count of commands to analyze", + type=int, + default=10) + parser.add_argument('-c', '--command', + help="The specified command to track", + type=str, + default=None) + return parser + + def do_help(self, args): + self.parser.print_help() + + def main(self, argv): + self.parser = self.get_base_parser() + (options, args) = self.parser.parse_known_args(argv) + + if options.help: + self.do_help(options) + return 0 + + a = Analysis(options.commandlog, options.clusterlog) + a.process(options.num, options.command) + + +class HelpFormatter(argparse.HelpFormatter): + def start_section(self, heading): + # Title-case the headings + heading = '%s%s' % (heading[0].upper(), heading[1:]) + super(HelpFormatter, self).start_section(heading) + + +if __name__ == "__main__": + StatsShell().main(sys.argv[1:]) diff --git a/xCAT-probe/xCAT-probe.spec b/xCAT-probe/xCAT-probe.spec index 8a1fda11b..c46700694 100644 --- a/xCAT-probe/xCAT-probe.spec +++ b/xCAT-probe/xCAT-probe.spec @@ -44,6 +44,7 @@ mkdir -p $RPM_BUILD_ROOT/%{prefix}/probe/ cp xcatprobe $RPM_BUILD_ROOT/%{prefix}/bin cp -r subcmds $RPM_BUILD_ROOT/%{prefix}/probe/ cp -r lib $RPM_BUILD_ROOT/%{prefix}/probe/ +cp -r scripts $RPM_BUILD_ROOT/%{prefix}/probe/ %clean # This step does not happen until *after* the %files packaging below From 1938bd9a87d9694035729bb01813e18ca4509648 Mon Sep 17 00:00:00 2001 From: chenglch Date: Thu, 14 Sep 2017 18:02:41 +0800 Subject: [PATCH 194/251] Add description for the issue that may lose log This commit add descritpion for `dbtracelevel` entry in site table to help the user find the detail solution if the log is lost due to the issue from rsyslog side. partial-issue: #3910 --- docs/source/guides/admin-guides/references/man5/site.5.rst | 3 +++ perl-xCAT/xCAT/Schema.pm | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/source/guides/admin-guides/references/man5/site.5.rst b/docs/source/guides/admin-guides/references/man5/site.5.rst index 992ea778f..94259601d 100644 --- a/docs/source/guides/admin-guides/references/man5/site.5.rst +++ b/docs/source/guides/admin-guides/references/man5/site.5.rst @@ -399,6 +399,9 @@ site Attributes: 2: Besides the log from level 1, trace the event to build the cache for the table 3: Besides the log from level 2, trace the event with cache hit 4: Besides the log from level 3, trace the SQL statement for the db access + With this configuration, xcat will send the log to syslog very frequently, some of the + log may be lost if imjournal is enabled by rsyslog. + Please see https://github.com/xcat2/xcat-core/issues/3910 for the detail. ----------------------- VIRTUALIZATION ATTRIBUTES diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index cfd0930df..f4f9965cc 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -1252,7 +1252,10 @@ passed as argument rather than by table value', " 1: trace the calls of database subroutines \n" . " 2: Besides the log from level 1, trace the event to build the cache for the table \n" . " 3: Besides the log from level 2, trace the event with cache hit \n" . -" 4: Besides the log from level 3, trace the SQL statement for the db access \n\n" . +" 4: Besides the log from level 3, trace the SQL statement for the db access \n" . +" With this configuration, xcat will send the log to syslog very frequently, some of the \n". +" log may be lost if imjournal is enabled by rsyslog. \n". +" Please see https://github.com/xcat2/xcat-core/issues/3910 for the detail.\n\n" . " -----------------------\n" . "VIRTUALIZATION ATTRIBUTES\n" . " -----------------------\n" . From 555eef779406bf05e7fc9c99c7e7a4493f47aaf0 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 14 Sep 2017 09:50:44 -0400 Subject: [PATCH 195/251] modify netcfg and add rinv and rvitals command --- perl-xCAT/xCAT/Usage.pm | 4 +- xCAT-server/lib/xcat/plugins/pdu.pm | 171 ++++++++++++++---- .../lib/xcat/plugins/switchdiscover.pm | 4 +- 3 files changed, 140 insertions(+), 39 deletions(-) diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 871d3802b..77e0162b7 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -85,7 +85,9 @@ my %usage = ( OpenPOWER (OpenBMC) specific: rvitals noderange [temp|voltage|wattage|fanspeed|power|altitude|all] MIC specific: - rvitals noderange {thermal|all}", + rvitals noderange {thermal|all}" + pdu specific: + rvitals noderange ", "reventlog" => "Usage: reventlog [all [-s]|clear| [-s]] [-V|--verbose] reventlog [-h|--help|-v|--version]", diff --git a/xCAT-server/lib/xcat/plugins/pdu.pm b/xCAT-server/lib/xcat/plugins/pdu.pm index 5441b87e0..8fab55a0d 100644 --- a/xCAT-server/lib/xcat/plugins/pdu.pm +++ b/xCAT-server/lib/xcat/plugins/pdu.pm @@ -7,6 +7,7 @@ Supported command: rpower rinv + rvitals =cut @@ -63,6 +64,7 @@ sub handled_commands return { rpower => ["nodehm:mgt","pduoutlet:pdu=\.\*"], rinv => ["nodehm:mgt"], + rvitals => ["nodehm:mgt"], nodeset => ["nodehm:mgt"], rspconfig => ["nodehm:mgt"], pdudiscover => "pdu", @@ -138,11 +140,13 @@ sub process_request #fill in the total outlet count for each pdu $pdutab = xCAT::Table->new('pdu'); @pduents = $pdutab->getAllNodeAttribs(['node', 'outlet']); - fill_outletCount(\@pduents, $callback); + #fill_outletCount(\@pduents, $callback); if( $command eq "rinv") { #for higher performance, handle node in batch - return powerstat($noderange, $callback); + return showMFR($noderange, $callback); + }elsif ($command eq "rvitals") { + return showMonitorData($noderange, $callback); }elsif ($command eq "rpower") { my $subcmd = $exargs[0]; if (($subcmd eq 'pduoff') || ($subcmd eq 'pduon') || ($subcmd eq 'pdustat')|| ($subcmd eq 'pdureset') ){ @@ -178,6 +182,7 @@ sub process_request if ($subcmd eq 'sshcfg') { process_sshcfg($noderange, $subcmd, $callback); }elsif ($subcmd =~ /ip|netmask|hostname/) { + print "prcess_netcfg\n"; process_netcfg($request, $subreq, $subcmd, $callback); } else { $callback->({ errorcode => [1],error => "The input $command $subcmd is not support for pdu"}); @@ -495,6 +500,8 @@ sub process_netcfg { my $ip; my $netmask; my $args; + my $ret; + my $err; my $extrargs = $request->{arg}; my @exargs = ($request->{arg}); @@ -503,18 +510,24 @@ sub process_netcfg { } my $nodes = $request->{node}; + my $pdu = @$nodes; my $rsp = {}; + my $nodetab = xCAT::Table->new('hosts'); + my $nodehash = $nodetab->getNodesAttribs($nodes,['ip','otherinterfaces']); + + # connect to PDU + my $static_ip = $nodehash->{$pdu}->[0]->{ip}; + my $discover_ip = $nodehash->{$pdu}->[0]->{otherinterfaces}; + my ($exp, $errstr) = session_connect($static_ip, $discover_ip); + foreach my $cmd (@exargs) { my ($key, $value) = split(/=/, $cmd); if ($key =~ /hostname/) { $hostname = $value; - $args = "echo $hostname > /etc/hostname;/etc/init.d/hostname.sh"; - xCAT::Utils->runxcmd({ command => ['xdsh'], - node => $nodes, - arg => [ $args ] }, $subreq, 0, 1); - if ($::RUNCMD_RC != 0) { - xCAT::SvrUtils::sendmsg("xdsh command to set hostname failed", $callback); + ($ret, $err) = session_exec($exp, "echo $hostname > /etc/hostname;/etc/init.d/hostname.sh"); + if (defined $err) { + xCAT::SvrUtils::sendmsg("Failed to set hostname", $callback); } }elsif ($key =~ /ip/) { $ip = $value; @@ -537,11 +550,12 @@ sub process_netcfg { my $dshcmd = $args . $opt ; xCAT::SvrUtils::sendmsg($dshcmd, $callback); #comment this for now, coralPDU on the lab is not support PduManager yet - my $output = xCAT::Utils->runxcmd({ command => ['xdsh'], node => $nodes, arg => [ $dshcmd ] }, $subreq, 0, 1); - if ($::RUNCMD_RC != 0) { - xCAT::SvrUtils::sendmsg("@$output", $callback); + ($ret, $err) = session_exec($exp, $dshcmd); + if (defined $err) { + xCAT::SvrUtils::sendmsg("Failed to run $dshcmd", $callback); } } + $exp->hard_close(); } #------------------------------------------------------- @@ -560,6 +574,7 @@ sub process_sshcfg { my $subcmd = shift; my $callback = shift; + #this is default password for CoralPDU my $password = "password8"; my $userid = "root"; my $timeout = 10; @@ -580,20 +595,7 @@ sub process_sshcfg { my $static_ip = $nodehash->{$pdu}->[0]->{ip}; my $discover_ip = $nodehash->{$pdu}->[0]->{otherinterfaces}; - my $ssh_ip; - - my $p = Net::Ping->new(); - if ($p->ping($static_ip)) { - $ssh_ip = $static_ip; - } elsif ($p->ping($discover_ip)) { - $ssh_ip = $discover_ip; - } else { - $msg = " is not reachable"; - xCAT::SvrUtils::sendmsg($msg, $callback, $pdu, %allerrornodes); - next; - } - - my ($exp, $errstr) = session_connect($ssh_ip, $userid, $password, $timeout); + my ($exp, $errstr) = session_connect($static_ip, $discover_ip); if (!defined $exp) { $msg = " Failed to connect $errstr"; xCAT::SvrUtils::sendmsg($msg, $callback, $pdu, %allerrornodes); @@ -607,10 +609,6 @@ sub process_sshcfg { ($ret, $err) = session_exec($exp, "chmod 700 /home/root/.ssh"); ($ret, $err) = session_exec($exp, "echo \"$rootkey\" >/home/root/.ssh/authorized_keys"); ($ret, $err) = session_exec($exp, "chmod 644 /home/root/.ssh/authorized_keys"); - #config dhcp ip address to static - if ($ssh_ip eq $discover_ip) { - # ($ret, $err) = session_exec($exp, "ifconfig eth0 $static_ip"); - } $exp->hard_close(); } @@ -619,14 +617,27 @@ sub process_sshcfg { } sub session_connect { - my $server = shift; - my $userid = shift; - my $password = shift; - my $timeout = shift; + my $static_ip = shift; + my $discover_ip = shift; - my $ssh = Expect->new; - my $command = 'ssh'; - my @parameters = ($userid . "@" . $server); + #default password for coral pdu + my $password = "password8"; + my $userid = "root"; + my $timeout = 10; + + my $ssh_ip; + my $p = Net::Ping->new(); + if ($p->ping($static_ip)) { + $ssh_ip = $static_ip; + } elsif ($p->ping($discover_ip)) { + $ssh_ip = $discover_ip; + } else { + return(undef, " is not reachable\n"); + } + + my $ssh = Expect->new; + my $command = 'ssh'; + my @parameters = ($userid . "@" . $ssh_ip); $ssh->debug(0); $ssh->log_stdout(0); # suppress stdout output.. @@ -717,6 +728,94 @@ sub process_pdudiscover { xCAT::MsgUtils->message("I", $rsp, $callback); } +#------------------------------------------------------- + +=head3 showMFR + + show MFR information of PDU via PduManager command + PduManager is a tool for CoralPdu to manager the PDU. + * /dev/shm/bin/PduManager -h + '-m' show MFR info + + example: rinv coralpdu + +=cut + +#------------------------------------------------------- + +sub showMFR { + my $noderange = shift; + my $callback = shift; + my $output; + + my $nodetab = xCAT::Table->new('hosts'); + my $nodehash = $nodetab->getNodesAttribs($noderange,['ip','otherinterfaces']); + + foreach my $pdu (@$noderange) { + # connect to PDU + my $static_ip = $nodehash->{$pdu}->[0]->{ip}; + my $discover_ip = $nodehash->{$pdu}->[0]->{otherinterfaces}; + my ($exp, $errstr) = session_connect($static_ip, $discover_ip); + if (defined $errstr) { + xCAT::SvrUtils::sendmsg("Failed to connect: $errstr", $callback); + } + + my ($ret, $err) = session_exec($exp, "/dev/shm/bin/PduManager -m"); + if (defined $err) { + xCAT::SvrUtils::sendmsg("Failed to list MFR information: $err", $callback); + } + if (defined $ret) { + xCAT::SvrUtils::sendmsg("$ret", $callback); + } + + $exp->hard_close(); + } +} + + +#------------------------------------------------------- + +=head3 showMonitorData + + Show realtime monitor data(input voltage, current, power) + of PDU via PduManager command + PduManager is a tool for CoralPdu to manager the PDU. + * /dev/shm/bin/PduManager -h + '-d' show realtime monitor data(input voltage, current, power) + + example: rvitals coralpdu + +=cut + +#------------------------------------------------------- +sub showMonitorData { + my $noderange = shift; + my $callback = shift; + my $output; + + my $nodetab = xCAT::Table->new('hosts'); + my $nodehash = $nodetab->getNodesAttribs($noderange,['ip','otherinterfaces']); + + foreach my $pdu (@$noderange) { + # connect to PDU + my $static_ip = $nodehash->{$pdu}->[0]->{ip}; + my $discover_ip = $nodehash->{$pdu}->[0]->{otherinterfaces}; + my ($exp, $errstr) = session_connect($static_ip, $discover_ip); + + my $ret; + my $err; + + ($ret, $err) = session_exec($exp, "/dev/shm/bin/PduManager -d"); + if (defined $err) { + xCAT::SvrUtils::sendmsg("Failed to show monitor data: $err", $callback); + } + if (defined $ret) { + xCAT::SvrUtils::sendmsg("$ret", $callback,$pdu); + } + + $exp->hard_close(); + } +} 1; diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index 2bad5ccc8..edf5ce5ae 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -1452,14 +1452,14 @@ sub switchsetup { foreach my $pdu(@{${nodes_to_config}->{$mytype}}) { my $cmd = "rspconfig $pdu sshcfg"; xCAT::Utils->runcmd($cmd, 0); - my $ip = $nodehash->{$pdu}->[0]->{otherinterfaces}; + my $ip = $nodehash->{$pdu}->[0]->{ip}; my $mask; foreach my $net (@nets) { if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $ip, $net->{'mask'}, 0)) { $mask=$net->{'mask'}; } } - $cmd = "rspconfig $pdu hostname=$pdu ip=$otherinterfaces netmask=$mask"; + $cmd = "rspconfig $pdu hostname=$pdu ip=$ip netmask=$mask"; xCAT::Utils->runcmd($cmd, 0); if ($::RUNCMD_RC == 0) { xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$pdu,"ip=$ip","otherinterfaces="] }, $sub_req, 0, 1); From f781063624f2f2423889d5af12e1b717be3fe728 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 14 Sep 2017 11:30:06 -0400 Subject: [PATCH 196/251] remove " in the Usage.pm for rvitals --- perl-xCAT/xCAT/Usage.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 77e0162b7..8b0f839c0 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -85,7 +85,7 @@ my %usage = ( OpenPOWER (OpenBMC) specific: rvitals noderange [temp|voltage|wattage|fanspeed|power|altitude|all] MIC specific: - rvitals noderange {thermal|all}" + rvitals noderange {thermal|all} pdu specific: rvitals noderange ", "reventlog" => From 85957476f9ecacf4cd8e0e0e8d04526ba9b77f58 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 14 Sep 2017 16:43:31 -0400 Subject: [PATCH 197/251] Add netmask to configonie script for change ip --- xCAT-server/share/xcat/scripts/configonie | 20 ++++++++++++++++++-- xCAT/postscripts/hardeths | 11 +++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/xCAT-server/share/xcat/scripts/configonie b/xCAT-server/share/xcat/scripts/configonie index 4e386b9d4..b3ba6ce27 100755 --- a/xCAT-server/share/xcat/scripts/configonie +++ b/xCAT-server/share/xcat/scripts/configonie @@ -120,12 +120,19 @@ if ($::VLAN) sub config_ssh { my $password = "CumulusLinux!"; my $userid = "cumulus"; - my $timeout = 10; + my $timeout = 30; my $keyfile = "/root/.ssh/id_rsa.pub"; my $rootkey = `cat /root/.ssh/id_rsa.pub`; my $cmd; my @config_switches; + # get netmask from network table + my $nettab = xCAT::Table->new("networks"); + my @nets; + if ($nettab) { + @nets = $nettab->getAllAttribs('net','mask'); + } + my $nodetab = xCAT::Table->new('hosts'); my $nodehash = $nodetab->getNodesAttribs(\@nodes,['ip','otherinterfaces']); @@ -160,9 +167,18 @@ sub config_ssh { ($ret, $err) = cumulus_exec($exp, "chmod 700 /root/.ssh"); ($ret, $err) = cumulus_exec($exp, "echo \"$rootkey\" >/root/.ssh/authorized_keys"); ($ret, $err) = cumulus_exec($exp, "chmod 644 /root/.ssh/authorized_keys"); + #config dhcp ip address to static if ($ssh_ip eq $discover_ip) { - ($ret, $err) = cumulus_exec($exp, "ifconfig eth0 $static_ip"); + #get netmask + my $mask; + foreach my $net (@nets) { + if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $static_ip, $net->{'mask'}, 0)) { + $mask=$net->{'mask'}; + last; + } + } + ($ret, $err) = cumulus_exec($exp, "ifconfig eth0 $static_ip netmask $mask"); } $exp->hard_close(); diff --git a/xCAT/postscripts/hardeths b/xCAT/postscripts/hardeths index 94b21140d..46765f673 100755 --- a/xCAT/postscripts/hardeths +++ b/xCAT/postscripts/hardeths @@ -99,6 +99,13 @@ for nic in `ip link |grep "BROADCAST" |awk '{print $2}' | sed s/://`; do NETWORK=`network_ipv4calc $IPADDR $NETMASK` #BROADCAST=`ifconfig $nic | grep Bcast | awk '{print $3}' | awk -F: '{print $2}'` BROADCAST=`ip -4 -oneline addr show $nic|grep brd| awk -F ' ' '{print $6}'` + + if [ ! -z "$BROADCAST" ]; then + broadcast_line="broadcast $BROADCAST" + else + broadcast_line="" + fi + if [ ! -z "$defgw" ]; then gateway_line="gateway $defgw" @@ -114,7 +121,7 @@ auto $nic iface $nic inet static address $IPADDR netmask $NETMASK - broadcast $BROADCAST + $broadcast_line $gateway_line @@ -126,7 +133,7 @@ iface $nic inet static address $IPADDR network $NETWORK netmask $NETMASK - broadcast $BROADCAST + $broadcast_line $gateway_line From 8f0f59c373817e8e50ac8a9375995a70513948e7 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 14 Sep 2017 16:57:09 -0400 Subject: [PATCH 198/251] Handle TIMEOUT error message for change pdu ip address --- xCAT-server/lib/xcat/plugins/pdu.pm | 49 ++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/pdu.pm b/xCAT-server/lib/xcat/plugins/pdu.pm index 8fab55a0d..5ebead0ce 100644 --- a/xCAT-server/lib/xcat/plugins/pdu.pm +++ b/xCAT-server/lib/xcat/plugins/pdu.pm @@ -182,7 +182,6 @@ sub process_request if ($subcmd eq 'sshcfg') { process_sshcfg($noderange, $subcmd, $callback); }elsif ($subcmd =~ /ip|netmask|hostname/) { - print "prcess_netcfg\n"; process_netcfg($request, $subreq, $subcmd, $callback); } else { $callback->({ errorcode => [1],error => "The input $command $subcmd is not support for pdu"}); @@ -500,8 +499,8 @@ sub process_netcfg { my $ip; my $netmask; my $args; - my $ret; - my $err; + my $exp; + my $errstr; my $extrargs = $request->{arg}; my @exargs = ($request->{arg}); @@ -510,7 +509,13 @@ sub process_netcfg { } my $nodes = $request->{node}; - my $pdu = @$nodes; + my $node_number = @$nodes; + if ($node_number gt "1") { + xCAT::SvrUtils::sendmsg("Can not configure more than 1 nodes", $callback); + return; + } + + my $pdu = @$nodes[0]; my $rsp = {}; my $nodetab = xCAT::Table->new('hosts'); @@ -519,13 +524,17 @@ sub process_netcfg { # connect to PDU my $static_ip = $nodehash->{$pdu}->[0]->{ip}; my $discover_ip = $nodehash->{$pdu}->[0]->{otherinterfaces}; - my ($exp, $errstr) = session_connect($static_ip, $discover_ip); + ($exp, $errstr) = session_connect($static_ip, $discover_ip); + if (defined $errstr) { + xCAT::SvrUtils::sendmsg("Failed to connect", $callback); + return; + } foreach my $cmd (@exargs) { my ($key, $value) = split(/=/, $cmd); if ($key =~ /hostname/) { $hostname = $value; - ($ret, $err) = session_exec($exp, "echo $hostname > /etc/hostname;/etc/init.d/hostname.sh"); + my ($ret, $err) = session_exec($exp, "echo $hostname > /etc/hostname;/etc/init.d/hostname.sh"); if (defined $err) { xCAT::SvrUtils::sendmsg("Failed to set hostname", $callback); } @@ -548,14 +557,24 @@ sub process_netcfg { } if ($opt) { my $dshcmd = $args . $opt ; - xCAT::SvrUtils::sendmsg($dshcmd, $callback); - #comment this for now, coralPDU on the lab is not support PduManager yet - ($ret, $err) = session_exec($exp, $dshcmd); + my ($ret, $err) = session_exec($exp, $dshcmd); if (defined $err) { - xCAT::SvrUtils::sendmsg("Failed to run $dshcmd", $callback); - } + #session will be hung if ip address changed + my $p = Net::Ping->new(); + if ( ($p->ping($ip)) && ($err =~ /TIMEOUT/) ) { + xCAT::SvrUtils::sendmsg("$ip is reachable", $callback); + } else { + xCAT::SvrUtils::sendmsg("Failed to run $dshcmd, error=$err", $callback); + return; + } + } + xCAT::SvrUtils::sendmsg("$dshcmd ran successfully", $callback); + xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$pdu,"ip=$ip","otherinterfaces="] }, $subreq, 0, 1); + xCAT::Utils->runxcmd({ command => ['makehosts'], node => [$pdu] }, $subreq, 0, 1); + } + if (defined $exp) { + $exp->hard_close(); } - $exp->hard_close(); } #------------------------------------------------------- @@ -577,7 +596,7 @@ sub process_sshcfg { #this is default password for CoralPDU my $password = "password8"; my $userid = "root"; - my $timeout = 10; + my $timeout = 30; my $keyfile = "/root/.ssh/id_rsa.pub"; my $rootkey = `cat /root/.ssh/id_rsa.pub`; my $cmd; @@ -623,7 +642,7 @@ sub session_connect { #default password for coral pdu my $password = "password8"; my $userid = "root"; - my $timeout = 10; + my $timeout = 30; my $ssh_ip; my $p = Net::Ping->new(); @@ -670,7 +689,7 @@ sub session_exec { my $timeout = shift; my $prompt = shift; - $timeout = 10 unless defined $timeout; + $timeout = 30 unless defined $timeout; $prompt = qr/.*#/ unless defined $prompt; From 5216f62d4b5901fa15c3c82d875fb3bc572f06cc Mon Sep 17 00:00:00 2001 From: Samveen Gulati Date: Fri, 15 Sep 2017 00:06:32 +0000 Subject: [PATCH 199/251] Fix #3904 : Add ability to list discoverydata by type `mtms` --- .../admin-guides/references/man1/nodediscoverls.1.rst | 8 ++++++-- xCAT-server/lib/xcat/plugins/seqdiscovery.pm | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/nodediscoverls.1.rst b/docs/source/guides/admin-guides/references/man1/nodediscoverls.1.rst index 8d1458b64..666477d78 100644 --- a/docs/source/guides/admin-guides/references/man1/nodediscoverls.1.rst +++ b/docs/source/guides/admin-guides/references/man1/nodediscoverls.1.rst @@ -19,7 +19,7 @@ SYNOPSIS ******** -\ **nodediscoverls**\ [\ **-t seq | profile | switch | blade | manual | undef | all**\ ] [\ **-l**\ ] +\ **nodediscoverls**\ [\ **-t seq | profile | switch | blade | manual | mtms | undef | all**\ ] [\ **-l**\ ] \ **nodediscoverls**\ [\ **-u**\ \ *uuid*\ ] [\ **-l**\ ] @@ -47,7 +47,7 @@ OPTIONS -\ **-t seq|profile|switch|blade|manual|undef|all**\ +\ **-t seq|profile|switch|blade|manual|mtms|undef|all**\ Display the nodes that have been discovered by the specified discovery method: @@ -72,6 +72,10 @@ OPTIONS + \* \ **mtms**\ - MTMS discovery (used when node mtm and serial fields are filled in). + + + \* \ **undef**\ - Display the nodes that were in the discovery pool, but for which xCAT has not yet received a discovery request. diff --git a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm index ea114681f..0a18969cc 100755 --- a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm +++ b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm @@ -808,7 +808,7 @@ sub nodediscoverls { Usage: nodediscoverls nodediscoverls [-h|--help|-v|--version] - nodediscoverls [-t seq|profile|switch|blade|manual|undef|all] [-l] + nodediscoverls [-t seq|profile|switch|blade|manual|mtms|undef|all] [-l] nodediscoverls [-u uuid] [-l] "; $rsp = (); @@ -843,7 +843,7 @@ Usage: # If the type is specified, display the corresponding type of nodes my @SEQDiscover; if ($type) { - if ($type !~ /^(seq|profile|switch|blade|manual|undef|all)$/) { + if ($type !~ /^(seq|profile|switch|blade|manual|mtms|undef|all)$/) { $usage->($callback, "The discovery type \'$type\' is not supported."); return; } From ecc6af989b85a7e30b86d71f3ca736b0757abccd Mon Sep 17 00:00:00 2001 From: Samveen Gulati Date: Fri, 15 Sep 2017 00:09:37 +0000 Subject: [PATCH 200/251] Add single space between MTM and serial --- xCAT-server/lib/xcat/plugins/seqdiscovery.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm index 0a18969cc..128164279 100755 --- a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm +++ b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm @@ -917,7 +917,7 @@ Usage: } else { $ent->{'node'} = 'undef' unless ($ent->{'node'}); $ent->{'method'} = 'undef' unless ($ent->{'method'}); - push @discoverednodes, sprintf(" %-40s%-20s%-15s%-10s%-20s", $ent->{'uuid'}, $ent->{'node'}, $ent->{'method'}, $ent->{'mtm'}, substr($ent->{'serial'}, 0, 19)); + push @discoverednodes, sprintf(" %-40s%-20s%-15s%-10s %-20s", $ent->{'uuid'}, $ent->{'node'}, $ent->{'method'}, $ent->{'mtm'}, substr($ent->{'serial'}, 0, 19)); } } @@ -927,7 +927,7 @@ Usage: } if (@discoverednodes) { unless ($long) { - push @{ $rsp->{data} }, sprintf(" %-40s%-20s%-15s%-10s%-13s", 'UUID', 'NODE', 'METHOD', 'MTM', 'SERIAL'); + push @{ $rsp->{data} }, sprintf(" %-40s%-20s%-15s%-10s %-20s", 'UUID', 'NODE', 'METHOD', 'MTM', 'SERIAL'); } foreach (@discoverednodes) { push @{ $rsp->{data} }, "$_"; From c88fe766b4da1a7e41e8e4926396c50e2868643e Mon Sep 17 00:00:00 2001 From: Yuan Bai Date: Fri, 15 Sep 2017 11:07:31 +0800 Subject: [PATCH 201/251] makenetworks only ignore existed network entry. (#3928) --- xCAT-server/lib/xcat/plugins/networks.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/networks.pm b/xCAT-server/lib/xcat/plugins/networks.pm index d4db7d8a4..6a05726b0 100644 --- a/xCAT-server/lib/xcat/plugins/networks.pm +++ b/xCAT-server/lib/xcat/plugins/networks.pm @@ -551,7 +551,7 @@ sub donets # if this net entry exists, go to next line in networks table if ($netnamematch) { $callback->({ warning => "The network entry \'$netname\' already exists in xCAT networks table. Cannot create a definition for \'$netname\'" }); - last; + next; } if (!$foundmatch) { $nettab->setAttribs({ 'net' => $net, 'mask' => $mask }, { 'netname' => $netname, 'mgtifname' => $mgtifname, 'gateway' => $gw, 'mtu' => $mtu }); From 852e996eff7b3e58e4b8b5094ebd9472c3561571 Mon Sep 17 00:00:00 2001 From: zet809 Date: Fri, 15 Sep 2017 15:58:38 +0800 Subject: [PATCH 202/251] enhance clusterstatus to report cluster status (#3900) * enhance clusterstatus to report cluster status * modify usage for clusterstatus --- xCAT-probe/subcmds/clusterstatus | 224 +++++++++++++++++++++++++++++-- 1 file changed, 211 insertions(+), 13 deletions(-) diff --git a/xCAT-probe/subcmds/clusterstatus b/xCAT-probe/subcmds/clusterstatus index 23b542cd1..bc3836772 100755 --- a/xCAT-probe/subcmds/clusterstatus +++ b/xCAT-probe/subcmds/clusterstatus @@ -14,25 +14,70 @@ use warnings; my $program_name = basename("$0"); my $help; -my $noderange = "compute"; +my $noderange = undef; my $test; my $output = "stdout"; my $verbose = 0; my $rst = 0; +my $interval = 5; +my $terminal = 0; +my $timeout = 0; +my $start_time; + +#----------------------------- +# To store the node number of a specified type +# May like this: +# $type_nodesnum{pdu} = 2; +# {switch} = 3; +# {node} = 10; +#----------------------------- +my %type_nodesnum = (); + +#----------------------------- +# To store the type, state hash +# May like this: +# $state_node_hash{pdu}{state1}{pdu1} = 1; +# $state_node_hash{pdu}{state1}{pdu2} = 1; +# $state_node_hash{pdu}{state2}{pdu3} = 1; +# $state_node_hash{pdu}{state3}{pdu4} = 1; +# The state include but not limited to below: +# matching --> matched --> configured (For PDU/Switch) +# matching --> matched --> installing --> booting --> booted +# matching --> matched --> booting --> installing --> xxx --> booted +# The terminal state is configured(For PDU/Switch) or booted(for Node) +#----------------------------- +my %state_node_hash = (); + +# $state_node_hash{pdu}{state1}{number} = xx; +my %state_node_number = (); + +#---------------------------- +# To store the node based current state +# May like this: +# $node_info{node1}{state} = "install"; +# $node_info{node1}{type} = "node"; +#---------------------------- +my %node_info = (); + +#--------------------------- +# To store nodes who haven't finished the status +#--------------------------- +my %unfinished_nodes = (); +my %unmatched_nodes = (); $::USAGE = "Usage: $program_name -h - $program_name {-d|-g} [-n noderange] [-V|--verbose] + $program_name [-n noderange] [-V|--verbose] [-i|--interval ] [--timeout ] Description: Use this command to get a summary of the cluster. Options: -h : Get usage information of $program_name - -n : Range of nodes to check. Default is \"compute\". - -d : Discovery. Display count of discovered nodes. - -g : Group count. Display count of nodes in each group. + -n : Range of nodes to check. All node objects will be used if not specified. + -i : The interval for screen refreshing, unit is second(s), 5 seconds by default. -V : To print additional debug information. + --timeout: The timout if not all nodes finish, unit is second(s), no timeout by default. "; #------------------------------------- @@ -44,6 +89,8 @@ if ( "V|verbose" => \$VERBOSE, "d|discovery" => \$DISCOVERY, "g|groupcount" => \$GROUPCOUNT, + "i|interval=s" => \$interval, + "timeout=s" => \$timeout, "n=s" => \$noderange)) { probe_utils->send_msg("$output", "f", "Invalid parameter for $program_name"); @@ -65,12 +112,6 @@ if ($test) { exit 0; } -if ((!$DISCOVERY) and (!$GROUPCOUNT)) { - probe_utils->send_msg("$output", "f", "Discovery or groupcount option is required for $program_name"); - probe_utils->send_msg("$output", "d", "$::USAGE"); - exit 1; -} - if (scalar(@ARGV) >= 1) { # After processing all the expected flags and arguments, @@ -79,10 +120,42 @@ if (scalar(@ARGV) >= 1) { probe_utils->send_msg("$output", "d", "$::USAGE"); exit 1; } +if (!$DISCOVERY and !$GROUPCOUNT) { + if(!defined($noderange)) { + $noderange = "all"; + } +} else { + if (!defined($noderange)) { + $noderange = "compute"; + } + check_for_discovered_nodes() if ($DISCOVERY); + groupcount_nodes() if ($GROUPCOUNT); + exit 0; +} -check_for_discovered_nodes() if ($DISCOVERY); -groupcount_nodes() if ($GROUPCOUNT); +$SIG{TERM} = $SIG{INT} = sub { + $terminal = 1; +}; +unless ($interval) { + $interval = 5; +} +&check_nodes_attributes(); +$start_time = time; +while (1) { + update_nodes_info(); + alarm_output(1); + if ($terminal) { + alarm_output(0); + last; + } + if ($timeout and (time() - $start_time > $timeout)) { + alarm_output(0); + last; + } + sleep $interval; +} +exit 0; # Check for node definitions with MAC address defined sub check_for_discovered_nodes { my $na = "N/A"; @@ -132,3 +205,128 @@ sub groupcount_nodes { probe_utils->send_msg("$output", "w", "Group count function is not yet implemented."); return $rc; } + +sub alarm_output { + my $flag = shift; + if ($flag) { + probe_utils->send_msg("$output", "xx", `clear`); + my $time_elapsed = time - $start_time; + probe_utils->send_msg("$output", "xx", "====".localtime()."($time_elapsed seconds Elapsed)"); + } else { + probe_utils->send_msg("$output", "xx", "\nThe cluster state==============================="); + } + foreach my $type (keys(%state_node_hash)) { + unless ($type_nodesnum{$type}) { + probe_utils->send_msg("$output", "w", "$type Total number: $type_nodesnum{$type}"); + next; + } + probe_utils->send_msg("$output", "xx", "$type(Total: $type_nodesnum{$type})--------------------------"); + foreach my $state (keys(%{$state_node_hash{$type}})) { + my $node_number = scalar(keys %{$state_node_hash{$type}{$state}}); + if ($flag) { + my $number = sprintf("%.2f", $node_number * 100.0/ $type_nodesnum{$type}); + probe_utils->send_msg("$output", "xx", "\t$state : $node_number($number%)"); + } else { + probe_utils->send_msg("$output", "xx", "\t$state($node_number): ". join(",",keys %{$state_node_hash{$type}{$state}}) ); + } + } + } +} + +sub update_nodes_info { + if (keys(%unmatched_nodes)) { + my $unmatched_noderange = join(",", keys(%unmatched_nodes)); + my @unmatched_nodes_attributes = `lsdef -i mac -c $unmatched_noderange 2> /dev/null`; + foreach (@unmatched_nodes_attributes) { + if (/^(.*):\s*mac=(.*)$/) { + if ($2) { + update_node_info($1, "Matched"); + } + } + } + } + if (keys(%unfinished_nodes)) { + my $unfinished_noderange = join(",", keys(%unfinished_nodes)); + my @unfinished_nodes_attributes = `lsdef -i status -c $unfinished_noderange 2> /dev/null`; + foreach (@unfinished_nodes_attributes) { + if (/^(.*):\s*status=(.*)$/) { + if ($2) { + update_node_info($1, "$2"); + } + } + } + } + unless(scalar keys(%unfinished_nodes)) { + $terminal = 1; + } +} + +sub update_node_info { + my $node = shift; + my $state = shift; + my $node_type = $node_info{$node}{type}; + my $node_state = $node_info{$node}{state}; + if ($state and $state ne '') { + if (exists($unmatched_nodes{$node})) { + delete($unmatched_nodes{$node}); + $unfinished_nodes{$node} = 1; + } + } + if ($state eq $node_state) { + return; + } + + if (exists($state_node_hash{$node_type}{$node_state}{$node})) { + delete($state_node_hash{$node_type}{$node_state}{$node}); + } + unless (scalar keys ($state_node_hash{$node_type}{$node_state})) { + delete($state_node_hash{$node_type}{$node_state}); + } + + $state_node_hash{$node_type}{$state}{$node} = 1; + + $node_info{$node}{state} = $state; + if ($state eq 'booted' or $state eq 'configured') { + delete $unfinished_nodes{$node}; + } +} +sub check_nodes_attributes { + my @nodes_attributes = `lsdef -i status,mac,mgt -c $noderange 2> /dev/null`; + my %nodehash = (); + foreach (@nodes_attributes) { + if (/^(.*):\s*([^=]*)=(.*)$/) { + $nodehash{$1}{$2}=$3; + } + } + foreach (keys %nodehash) { + if (!defined($nodehash{$_}{mgt})) { + probe_utils->send_msg("$output", "w", "No 'mgt' set for node:$_"); + next; + } + if ($nodehash{$_}{status}) { + $node_info{$_}{state} = $nodehash{$_}{status}; + $unfinished_nodes{$_} = 1; + } elsif ($nodehash{$_}{mac}) { + $node_info{$_}{state} = "Matched"; + $unfinished_nodes{$_} = 1; + } else { + $node_info{$_}{state} = "matching"; + $unmatched_nodes{$_} = 1; + } + if ($nodehash{$_}{mgt} eq 'pdu') { + $node_info{$_}{type} = 'pdu'; + } elsif($nodehash{$_}{mgt} eq 'switch') { + $node_info{$_}{type} = 'switch'; + } else { + $node_info{$_}{type} = 'node'; + } + my $node_type = $node_info{$_}{type}; + if (!exists($type_nodesnum{$node_type})) { + $type_nodesnum{$node_type} = 1; + } else { + $type_nodesnum{$node_type} += 1; + } + $state_node_hash{$node_type}{$node_info{$_}{state}}{$_} = 1; + } +} +exit 0; From a183e3b8f241fb168b830dbe3f8f6f5b40fe1834 Mon Sep 17 00:00:00 2001 From: yangsong Date: Fri, 15 Sep 2017 16:03:43 +0800 Subject: [PATCH 203/251] support local syslog:1)ship logrotate and log filter rule files in xCATsn;2)refine syslog script to enable log filter and rotate rules (#3921) --- makerpm | 2 ++ .../netboot/rh/service.rhels7.ppc64le.pkglist | 1 + .../xcat/netboot/rh/service.rhels7.x86_64.pkglist | 1 + xCAT/postscripts/syslog | 15 +++++++++++++++ xCATsn/xCATsn.spec | 6 ++++++ 5 files changed, 25 insertions(+) diff --git a/makerpm b/makerpm index 4fc2bab20..b093e116d 100755 --- a/makerpm +++ b/makerpm @@ -145,6 +145,8 @@ function makexcat { cp xcat.conf $RPMROOT/SOURCES cp xcat.conf.apach24 $RPMROOT/SOURCES cp xCATSN $RPMROOT/SOURCES + cp -a ../xCAT/etc/rsyslog.d $RPMROOT/ + cp -a ../xCAT/etc/logrotate.d $RPMROOT/ cd - >/dev/null elif [ "$RPMNAME" = "xCAT-buildkit" ]; then ARCH="noarch" diff --git a/xCAT-server/share/xcat/netboot/rh/service.rhels7.ppc64le.pkglist b/xCAT-server/share/xcat/netboot/rh/service.rhels7.ppc64le.pkglist index 1936c3097..d76968a29 100644 --- a/xCAT-server/share/xcat/netboot/rh/service.rhels7.ppc64le.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/service.rhels7.ppc64le.pkglist @@ -45,3 +45,4 @@ vim-minimal vsftpd wget xz +rsyslog diff --git a/xCAT-server/share/xcat/netboot/rh/service.rhels7.x86_64.pkglist b/xCAT-server/share/xcat/netboot/rh/service.rhels7.x86_64.pkglist index b39021ae2..4b965a656 100644 --- a/xCAT-server/share/xcat/netboot/rh/service.rhels7.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/service.rhels7.x86_64.pkglist @@ -44,3 +44,4 @@ vim-minimal vsftpd wget xz +rsyslog diff --git a/xCAT/postscripts/syslog b/xCAT/postscripts/syslog index 2cb1a7824..e8286121f 100755 --- a/xCAT/postscripts/syslog +++ b/xCAT/postscripts/syslog @@ -243,6 +243,14 @@ config_rsyslog_V8() s/#module(load="imtcp")/module(load="imtcp")/; s/#input(type="imtcp" port="514")/input(type="imtcp" port="514")/' $conf_file fi + + if [ $isSN -eq 1 ] ; then + [ -d "/etc/xcat/rsyslog.conf" ] && cp -a /etc/xcat/rsyslog.conf/* /etc/rsyslog.d/ + if [ -d "/etc/xcat/logrotate.conf" ];then + mkdir -p "/etc/logrotate.d/" + cp -a /etc/xcat/logrotate.conf/* /etc/logrotate.d/ + fi + fi # Mark the end of xCAT section echo "# $xCATSettingsEND" >> $conf_file @@ -261,6 +269,13 @@ config_rsyslog_V8() [ -f "$conf_file" ] && sed -i '/#\$ModLoad \+imudp\|imtcp\|imudp.so\|imtcp.so/s/^#//; /#\$InputTCPServerRun\|UDPServerRun.*/s/^#//' $conf_file + + [ -f "/etc/rsyslog.d/xcat-cluster.conf" ] && rm -f "/etc/rsyslog.d/xcat-cluster.conf" ; + [ -f "/etc/rsyslog.d/xcat-compute.conf" ] && rm -f "/etc/rsyslog.d/xcat-compute.conf" ; + [ -f "/etc/rsyslog.d/xcat-debug.conf" ] && rm -f "/etc/rsyslog.d/xcat-debug.conf" ; + + [ -f "/etc/logrotate.d/xcat" ] && rm -f "/etc/logrotate.d/xcat" + fi diff --git a/xCATsn/xCATsn.spec b/xCATsn/xCATsn.spec index be4ebb3ac..f87fc923a 100644 --- a/xCATsn/xCATsn.spec +++ b/xCATsn/xCATsn.spec @@ -93,6 +93,8 @@ tar -xf license.tar %install %ifos linux mkdir -p $RPM_BUILD_ROOT/etc/xcat/conf.orig +mkdir -p $RPM_BUILD_ROOT/etc/xcat/rsyslog.conf +mkdir -p $RPM_BUILD_ROOT/etc/xcat/logrotate.conf mkdir -p $RPM_BUILD_ROOT/etc/apache2/conf.d mkdir -p $RPM_BUILD_ROOT/etc/httpd/conf.d/ mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/ @@ -102,6 +104,8 @@ cp %{SOURCE1} $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat.conf cp %{SOURCE3} $RPM_BUILD_ROOT/etc/xCATSN cp %{SOURCE1} $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat.conf.apach22 cp %{SOURCE6} $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat.conf.apach24 +cp -a etc/rsyslog.d/* $RPM_BUILD_ROOT/etc/xcat/rsyslog.conf/ +cp -a etc/logrotate.d/* $RPM_BUILD_ROOT/etc/xcat/logrotate.conf/ mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT cp LICENSE.html $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT @@ -249,6 +253,8 @@ fi /etc/xcat/conf.orig/xcat.conf.apach22 /etc/httpd/conf.d/xcat.conf /etc/apache2/conf.d/xcat.conf +/etc/xcat/logrotate.conf/ +/etc/xcat/rsyslog.conf/ %endif /etc/xCATSN %defattr(-,root,root) From 3396e3c9a0d660413b4fae700db6e5a18995fe92 Mon Sep 17 00:00:00 2001 From: chenglch Date: Fri, 15 Sep 2017 03:59:44 -0500 Subject: [PATCH 204/251] Disable the ssh prompt when connecting the openbmc console (#3815) This patch force the ssh client to use the ssh key only. It also disable the known host check to avoid of the error after rflash. Fix-issue: #3543 --- xCAT-server/share/xcat/cons/openbmc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/xCAT-server/share/xcat/cons/openbmc b/xCAT-server/share/xcat/cons/openbmc index 52160df8e..1c503839c 100755 --- a/xCAT-server/share/xcat/cons/openbmc +++ b/xCAT-server/share/xcat/cons/openbmc @@ -93,12 +93,11 @@ if ($ENV{SSHCONSOLEPORT}) { # To automatically connect to the console without the need to send over the ssh keys, # ensure sshpass is installed on the Management and/or Service Nodes. +print "If unable to open the console, ensure sshpass is installed or ssh keys have been configured on the BMC.\n"; if (-x '/usr/bin/sshpass') { - exec "/usr/bin/sshpass -p $password ssh -p $sshport -l $username $bmcip"; + exec "/usr/bin/sshpass -p $password ssh -p $sshport -l $username -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $bmcip"; } else { - # This will prompt the user to enter the password for the BMC - # if ssh keys are not sent and sshpass is not being used - exec "ssh -p $sshport -l $username $bmcip"; + exec "ssh -p $sshport -l $username -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $bmcip"; } From ec7ca5d330fa2b965e8e58b9a3ac07e1580963d5 Mon Sep 17 00:00:00 2001 From: Matt Ezell Date: Fri, 15 Sep 2017 11:20:53 -0400 Subject: [PATCH 205/251] Fix the documentation from #3891 --- .../basic_concepts/xcat_db/regexp_db.rst | 57 +++++++++++++++++ .../admin-guides/references/man5/xcatdb.5.rst | 61 ++++++++++++------- perl-xCAT/db2man | 30 +++++++++ 3 files changed, 127 insertions(+), 21 deletions(-) diff --git a/docs/source/guides/admin-guides/basic_concepts/xcat_db/regexp_db.rst b/docs/source/guides/admin-guides/basic_concepts/xcat_db/regexp_db.rst index 1e3c8482b..a39bf7c9d 100644 --- a/docs/source/guides/admin-guides/basic_concepts/xcat_db/regexp_db.rst +++ b/docs/source/guides/admin-guides/basic_concepts/xcat_db/regexp_db.rst @@ -95,6 +95,63 @@ Using easy regular expression support you would put this in the hosts table. :: In the easy regx example, the expression only has the 2nd part of the expression from the previous example. xCAT will evaluate the node name, matching the number part of the node name, and create the 1st part of the expression . The 2nd part supplied is what value to give the ip attribute. The resulting output is the same. +Regular Expression Helper Functions +----------------------------------- + +xCAT provides several functions that can simplify regular expressions. + +\ **a2idx** ASCII Character to Index\ + Usage: ``a2idx(character)`` + + Turns a single character into a 1-indexed index. ‘a’ maps to 1 and ‘z’ maps to 26. + +\ **a2zidx** ASCII Character to 0-Index\ + Usage: ``a2zidx(character)`` + + Turns a single character into a 0-indexed index. ‘a’ maps to 0 and ‘z’ maps to 25. + +\ **dim2idx** Dimensions to Index\ + Usage: ``dim2idx(value, [count, value...])`` + + Converts dimensions (such as row, column, chassis, etc) into an index. An example system consists of 8 racks, two rows with four columns each. + + +-----------+-----------+-----------+-----------+ + | row1-col1 | row1-col2 | row1-col3 | row1-col4 | + +-----------+-----------+-----------+-----------+ + | row2-col1 | row2-col2 | row2-col3 | row2-col4 | + +-----------+-----------+-----------+-----------+ + To obtain the rack index, use ``|row(\d+)-col(\d+)|(dim2idx($1, 4, $2))|``. This maps the racks to: + + +---+---+---+---+ + | 1 | 2 | 3 | 4 | + +---+---+---+---+ + | 5 | 6 | 7 | 8 | + +---+---+---+---+ + Note that the size of the highest dimension (2 rows) is not needed, and all values are one-indexed. + + If each rack contains 20 nodes, use ``|row(\d+)-col(\d+)-node(\d+)|(dim2idx($1, 4, $2, 20, $3)`` to determine a node index (useful for determining IP addresses). + +\ **skip** Skip indices\ + Usage: ``skip(index, skiplist)`` + + Return an index with certain values skipped. The skip list uses the format ``start[:count][,start[:count]...]``. Using the example above, to skip racks 3 and 4, use: + + ``|row(\d+)-col(\d+)|(skip(dim2idx($1, 4, $2),'3:2')|`` + + The result would be: + + +---+---+---+---+ + | 1 | 2 | | | + +---+---+---+---+ + | 3 | 4 | 5 | 6 | + +---+---+---+---+ + +\ **ipadd** Add to an IP address\ + Usage: ``ipadd(octet1, octet2, octet3, octet4, toadd, skipstart, skipend)`` + + This function is useful when you need to cross octets. Optionally skip addresses at the start and end of octets (like .0 or .255 - technically those are valid IP addresses, but sometimes software makes poor assumptions about which broadcast and gateway addresses). + + Verify your regular expression ------------------------------ diff --git a/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst b/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst index b4a9ba93e..6fd7f9b94 100644 --- a/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst +++ b/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst @@ -157,27 +157,6 @@ Before you panic, let me explain each column: See http://www.perl.com/doc/manual/html/pod/perlre.html for information on perl regular expressions. -Regular Expression Helper Functions -============================ - -xCAT provides several functions that can simplify regular expressions. - -\ **a2idx(character) **\ - Turns a single character into a 1-indexed index. ‘a’ maps to 1 and ‘z’ maps to 26. - -\ **a2zidx(character) **\ - Turns a single character into a 0-indexed index. ‘a’ maps to 0 and ‘z’ maps to 25. - -\ **dim2idx(value, [count, value...]) **\ - Converts dimensions (such as row, column, chassis, etc) into an index. If each rack has 18 nodes, use dim2idx(racknum, 18, nodenum). Additional dimensions should be added at the beginning. All values are 1-indexed. - -\ **skip(index, skiplist) **\ - Return an index with certain values skipped. The skip list uses the format start[:count][,start[:count]...] - -\ **ipadd(octet1, octet2, octet3, octet4, toadd, skipstart, skipend) **\ - Add to an IP address. Generally only necessary when you cross octets. Optionally skip addresses at the start and end of octets (like .0 or .255). Technically those are valid IP addresses, but sometimes software makes poor assumptions about which broadcast and gateway addresses. - - Easy Regular Expressions ======================== @@ -187,6 +166,46 @@ As of xCAT 2.8.1, you can use a modified version of the regular expression suppo http://xcat-docs.readthedocs.org/en/latest/guides/admin-guides/basic_concepts/xcat_db/regexp_db.html#easy-regular-expressions +Regular Expression Helper Functions +=================================== + + +xCAT provides several functions that can simplify regular expressions. + + +\ **a2idx**\ + + ASCII Character to Index + + + +\ **a2zidx**\ + + ASCII Character to 0-Index + + + +\ **dim2idx**\ + + Dimensions to Index + + + +\ **skip**\ + + Skip indices + + + +\ **ipadd**\ + + Add to an IP address + + + +http://xcat-docs.readthedocs.org/en/latest/guides/admin-guides/basic_concepts/xcat_db/regexp_db.html#regular-expression-helper-functions + + ****************** OBJECT DEFINITIONS diff --git a/perl-xCAT/db2man b/perl-xCAT/db2man index da35965e9..ee73edc5e 100755 --- a/perl-xCAT/db2man +++ b/perl-xCAT/db2man @@ -271,6 +271,36 @@ As of xCAT 2.8.1, you can use a modified version of the regular expression suppo http://xcat-docs.readthedocs.org/en/latest/guides/admin-guides/basic_concepts/xcat_db/regexp_db.html#easy-regular-expressions +=head2 Regular Expression Helper Functions + +xCAT provides several functions that can simplify regular expressions. + +=over 4 + +=item B + +ASCII Character to Index + +=item B + +ASCII Character to 0-Index + +=item B + +Dimensions to Index + +=item B + +Skip indices + +=item B + +Add to an IP address + +=back + +http://xcat-docs.readthedocs.org/en/latest/guides/admin-guides/basic_concepts/xcat_db/regexp_db.html#regular-expression-helper-functions + =head1 OBJECT DEFINITIONS Because it can get confusing what attributes need to go in what tables, the xCAT database can also From 14b5c39d89b4ae9113e5da13181dad933a3ba12d Mon Sep 17 00:00:00 2001 From: XuWei Date: Sun, 17 Sep 2017 22:48:42 -0400 Subject: [PATCH 206/251] Add node name in output of reventlog for OpenBMC --- xCAT-server/lib/xcat/plugins/openbmc.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 40a9e3508..dc975e641 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1631,13 +1631,13 @@ sub reventlog_response { my $count = 0; if ($option_s) { foreach my $key ( sort { $b <=> $a } keys %output) { - xCAT::MsgUtils->message("I", { data => [$output{$key}] }, $callback, $node) if ($output{$key}); + xCAT::MsgUtils->message("I", { data => ["$node: $output{$key}"] }, $callback) if ($output{$key}); $count++; last if ($entry_string ne "all" and $count >= $entry_num); } } else { foreach my $key (sort keys %output) { - xCAT::MsgUtils->message("I", { data => [$output{$key}] }, $callback, $node) if ($output{$key}); + xCAT::MsgUtils->message("I", { data => ["$node: $output{$key}"] }, $callback) if ($output{$key}); $count++; last if ($entry_string ne "all" and $count >= $entry_num); } From 5ac1f04791007a6d414b5b16ce3e76a46e99ef74 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 18 Sep 2017 11:42:36 -0400 Subject: [PATCH 207/251] Simplify code based on review comment --- xCAT-server/lib/xcat/plugins/openbmc.pm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 9b0dadc7d..7f6fb3c8d 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -96,6 +96,7 @@ my %sensor_units = ( my $http_protocol="https"; my $openbmc_url = "/org/openbmc"; my $openbmc_project_url = "/xyz/openbmc_project"; +$::SOFTWARE_URL = "$openbmc_project_url/software"; #------------------------------------------------------- # The hash table to store method and url for request, @@ -161,7 +162,6 @@ my %status_info = ( RFLASH_UPDATE_ACTIVATE_REQUEST => { method => "PUT", init_url => "$openbmc_project_url/software", - orig_url => "$openbmc_project_url/software", data => "xyz.openbmc_project.Software.Activation.RequestedActivations.Active", }, RFLASH_UPDATE_ACTIVATE_RESPONSE => { @@ -170,7 +170,6 @@ my %status_info = ( RFLASH_UPDATE_CHECK_STATE_REQUEST => { method => "GET", init_url => "$openbmc_project_url/software", - orig_url => "$openbmc_project_url/software", }, RFLASH_UPDATE_CHECK_STATE_RESPONSE => { process => \&rflash_response, @@ -185,7 +184,6 @@ my %status_info = ( RFLASH_SET_PRIORITY_REQUEST => { method => "PUT", init_url => "$openbmc_project_url/software", - orig_url => "$openbmc_project_url/software", data => "false", # Priority state of 0 sets image to active }, RFLASH_SET_PRIORITY_RESPONSE => { @@ -2090,11 +2088,11 @@ sub rflash_response { # Set the image id for the activation request $status_info{RFLASH_UPDATE_ACTIVATE_REQUEST}{init_url} = - $status_info{RFLASH_UPDATE_ACTIVATE_REQUEST}{orig_url} . "/$update_id/attr/RequestedActivation"; + $::SOFTWARE_URL . "/$update_id/attr/RequestedActivation"; $status_info{RFLASH_UPDATE_CHECK_STATE_REQUEST}{init_url} = - $status_info{RFLASH_UPDATE_CHECK_STATE_REQUEST}{orig_url} . "/$update_id"; + $::SOFTWARE_URL . "/$update_id"; $status_info{RFLASH_SET_PRIORITY_REQUEST}{init_url} = - $status_info{RFLASH_SET_PRIORITY_REQUEST}{orig_url} . "/$update_id/attr/Priority"; + $::SOFTWARE_URL . "/$update_id/attr/Priority"; # Set next steps to activate the image $next_status{ $node_info{$node}{cur_status} } = "RFLASH_UPDATE_ACTIVATE_REQUEST"; From 743df92e446462838cac116399280d1390db29d1 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 18 Sep 2017 14:15:45 -0400 Subject: [PATCH 208/251] Treat 5104-22C as a ESS Boston node for rflash command --- xCAT-server/lib/xcat/plugins/ipmi.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 923aad072..5bf64ea70 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1991,10 +1991,10 @@ sub do_firmware_update { } # For IBM Power S822LC for Big Data (Supermicro) machines such as - # P9 Boston (9006-22C, 9006-12) or P8 Briggs (8001-22C) + # P9 Boston (9006-22C, 9006-12C, 5104-22C) or P8 Briggs (8001-22C) # firmware update is done using pUpdate utility expected to be in the # specified data directory along with the update files .bin for BMC or .pnor for Host - if ($output =~ /8001-22C|9006-22C|9006-12C/) { + if ($output =~ /8001-22C|9006-22C|5104-22C|9006-12C/) { # Verify valid data directory was specified unless ($pUpdate_directory) { $exit_with_error_func->($sessdata->{node}, $callback, From cb7babd8683c884a20d8e317463d9fc3c5993f3d Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Mon, 18 Sep 2017 16:52:05 -0400 Subject: [PATCH 209/251] Discover Coral PDUs with same default hostname --- .../lib/xcat/plugins/switchdiscover.pm | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index edf5ce5ae..c3a16ea61 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -350,7 +350,6 @@ sub process_request { } #consolidate the results by merging the swithes with the same ip or same mac - #or same hostname my $result; my $merged; my $counter=0; @@ -366,12 +365,11 @@ sub process_request { my $new_ip = $result->{$new_mac}->{ip}; my $new_name = $result->{$new_mac}->{name}; my $new_vendor = $result->{$new_mac}->{vendor}; + my $key =$new_mac; if (($old_mac eq $new_mac) || - ($old_ip && ($old_ip eq $new_ip)) || - ($old_name && ($old_name eq $new_name))) { + ($old_ip && ($old_ip eq $new_ip))) { $same = 1; - my $key =$new_mac; if ($new_mac =~ /nomac/) { if ($old_mac =~ /nomac/) { $key = "nomac_$counter"; @@ -380,9 +378,6 @@ sub process_request { $key = $old_mac; } } - if ($old_name) { - $result->{$key}->{name} = $old_name; - } if ($old_ip) { $result->{$key}->{ip} = $old_ip; } @@ -399,6 +394,12 @@ sub process_request { delete $result->{$new_mac}; } } + if ( $old_name && ($old_name eq $new_name)) { + #appending mac address to end of hostname + my $mac_str = lc($old_mac); + $mac_str =~ s/\://g; + $result->{$key}->{name} = "$old_name-$mac_str"; + } } if (!$same) { $result->{$old_mac} = $tmp_result->{$old_mac}; @@ -1107,7 +1108,7 @@ sub get_snmphostname { my ($desc,$hostname) = split /: /, $result; if (exists($globalopt{verbose})) { - send_msg($request, 0, "switch hostname = $hostname\n" ); + send_msg($request, 0, "$device hostname = $hostname\n" ); } return $hostname; @@ -1140,7 +1141,7 @@ sub get_hostname { if ( !$host ) { my $ip_str = $ip; $ip_str =~ s/\./\-/g; - $host = "switch-$ip_str"; + $host = "$device-$ip_str"; } } return $host; From 0d31efdd6459f6e886bb3246e38efbc1ae4b9f19 Mon Sep 17 00:00:00 2001 From: immarvin Date: Mon, 18 Sep 2017 23:30:20 -0400 Subject: [PATCH 210/251] add another several mac prefixes for edgecore network devices --- perl-xCAT/xCAT/data/switchinfo.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/data/switchinfo.pm b/perl-xCAT/xCAT/data/switchinfo.pm index 79c36abfa..cf8f1af80 100644 --- a/perl-xCAT/xCAT/data/switchinfo.pm +++ b/perl-xCAT/xCAT/data/switchinfo.pm @@ -18,7 +18,10 @@ our %global_mac_identity = ( "fc:cf:62" => "BNT G8124 switch", "7c:fe:90" => "Mellanox IB switch", "cc:37:ab" => "Edgecore Networks Switch", - "8c:ea:1b" => "Edgecore Networks Switch" + "8c:ea:1b" => "Edgecore Networks Switch", + "a8:2b:b5" => "Edgecore Networks Switch", + "3c:2c:99" => "Edgecore Networks Switch", + "70:72:cf" => "Edgecore Networks Switch" ); #the hash to lookup switch type with vendor From 8a66d843815fd0f486133277c8ac43abbe7de755 Mon Sep 17 00:00:00 2001 From: Bin Xu Date: Tue, 19 Sep 2017 15:35:59 +0800 Subject: [PATCH 211/251] Fix 3930, 1, only re-distribute to accessible dhcpsrv; 2, for non-sharedtftp mode, run makedhcp -d -l for offline (#3954) --- xCAT-server/lib/xcat/plugins/dhcp.pm | 2 +- xCAT-server/lib/xcat/plugins/grub2.pm | 9 ++++++--- xCAT-server/lib/xcat/plugins/petitboot.pm | 15 +++++---------- xCAT-server/lib/xcat/plugins/xnba.pm | 14 +++++--------- 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 6494e555e..62671753b 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -1128,7 +1128,7 @@ sub preprocess_request $callback->({ error => [ "Hierarchy requested, therefore networks.dhcpserver must be set for net=" . $_->{net} . "" ], errorcode => [1] }); return []; } - push @dhcpsvrs, $_->{dhcpserver}; + push @dhcpsvrs, $_->{dhcpserver} if (xCAT::NetworkUtils->nodeonmynet($_->{dhcpserver})); xCAT::MsgUtils->trace($verbose_on_off, "d", "dhcp: dhcp server on $_->{net}: $_->{dhcpserver}"); } } diff --git a/xCAT-server/lib/xcat/plugins/grub2.pm b/xCAT-server/lib/xcat/plugins/grub2.pm index 4f72eb452..8906d15f6 100644 --- a/xCAT-server/lib/xcat/plugins/grub2.pm +++ b/xCAT-server/lib/xcat/plugins/grub2.pm @@ -504,8 +504,7 @@ sub preprocess_request { if ($ntab) { foreach (@{ $ntab->getAllEntries() }) { next unless ($_->{dynamicrange}); - # if dynamicrange specified but dhcpserver was not - issue error message - push @dhcpsvrs, $_->{dhcpserver} if ($_->{dhcpserver}) + push @dhcpsvrs, $_->{dhcpserver} if ($_->{dhcpserver} && xCAT::NetworkUtils->nodeonmynet($_->{dhcpserver})); } } return xCAT::Scope->get_broadcast_disjoint_scope_with_parallel($req, $sn_hash, \@dhcpsvrs); @@ -854,7 +853,11 @@ sub process_request { push(@rmdhcp_nodes, $tmp_node); } } - $sub_req->({ command => ['makedhcp'], arg => ['-d'], node => \@rmdhcp_nodes }, $callback); + if ($request->{'_disparatetftp'}->[0]) { + $sub_req->({ command => ['makedhcp'], arg => ['-d', '-l'], node => \@rmdhcp_nodes }, $callback); + } else { + $sub_req->({ command => ['makedhcp'], arg => ['-d'], node => \@rmdhcp_nodes }, $callback); + } } #now run the end part of the prescripts diff --git a/xCAT-server/lib/xcat/plugins/petitboot.pm b/xCAT-server/lib/xcat/plugins/petitboot.pm index c6c9c7295..a307fab3a 100644 --- a/xCAT-server/lib/xcat/plugins/petitboot.pm +++ b/xCAT-server/lib/xcat/plugins/petitboot.pm @@ -390,8 +390,7 @@ sub preprocess_request { if ($ntab) { foreach (@{ $ntab->getAllEntries() }) { next unless ($_->{dynamicrange}); - # if dynamicrange specified but dhcpserver was not - issue error message - push @dhcpsvrs, $_->{dhcpserver} if ($_->{dhcpserver}) + push @dhcpsvrs, $_->{dhcpserver} if ($_->{dhcpserver} && xCAT::NetworkUtils->nodeonmynet($_->{dhcpserver})); } } return xCAT::Scope->get_broadcast_disjoint_scope_with_parallel($req, $sn_hash, \@dhcpsvrs); @@ -645,7 +644,7 @@ sub process_request { } #Don't bother to try dhcp binding changes if sub_req not passed, i.e. service node build time - unless (($inittime) || ($args[0] eq 'offline')) { + unless ($inittime) { #dhcp stuff my $do_dhcpsetup = 1; @@ -654,9 +653,11 @@ sub process_request { if (defined($t_entry)) { if ($t_entry =~ /0|n|N/) { $do_dhcpsetup = 0; } } - if ($do_dhcpsetup) { + # For offline operation, remove the dhcp entries whatever dhcpset is disabled in site ( existing code logic, just keep it as is) + if ($do_dhcpsetup || $args[0] eq 'offline') { my @parameter; push @parameter, '-l' if ($request->{'_disparatetftp'}->[0]); + push @parameter, '-d' if ($args[0] eq 'offline'); xCAT::MsgUtils->trace($verbose_on_off, "d", "petitboot: issue makedhcp request"); $sub_req->({ command => ['makedhcp'], @@ -668,12 +669,6 @@ sub process_request { } - if ($args[0] eq 'offline') { - - # If nodeset directive was offline we need to remove dhcp entries - $sub_req->({ command => ['makedhcp'], arg => ['-d'], node => \@normalnodeset }, $callback); - } - #now run the end part of the prescripts unless ($args[0] eq '') { # or $args[0] eq 'enact') $errored = 0; diff --git a/xCAT-server/lib/xcat/plugins/xnba.pm b/xCAT-server/lib/xcat/plugins/xnba.pm index 1bccc87b9..7410eeb42 100644 --- a/xCAT-server/lib/xcat/plugins/xnba.pm +++ b/xCAT-server/lib/xcat/plugins/xnba.pm @@ -442,8 +442,7 @@ sub preprocess_request { if ($ntab) { foreach (@{ $ntab->getAllEntries() }) { next unless ($_->{dynamicrange}); - # if dynamicrange specified but dhcpserver was not - issue error message - push @dhcpsvrs, $_->{dhcpserver} if ($_->{dhcpserver}) + push @dhcpsvrs, $_->{dhcpserver} if ($_->{dhcpserver} && xCAT::NetworkUtils->nodeonmynet($_->{dhcpserver})); } } return xCAT::Scope->get_broadcast_disjoint_scope_with_parallel($req, $sn_hash, \@dhcpsvrs); @@ -696,22 +695,19 @@ sub process_request { } xCAT::MsgUtils->trace($verbose_on_off, "d", "xnba: Finish to handle configurations"); - # for offline operation, remove the dhcp entries - if ($args[0] eq 'offline') { - $sub_req->({ command => ['makedhcp'], arg => ['-d'], node => \@nodes }, $::XNBA_callback); - } - #dhcp stuff -- inittime is set when xcatd on sn is started - unless (($inittime) || ($args[0] eq 'offline')) { + unless ($inittime) { my $do_dhcpsetup = 1; my @entries = xCAT::TableUtils->get_site_attribute("dhcpsetup"); my $t_entry = $entries[0]; if (defined($t_entry)) { if ($t_entry =~ /0|n|N/) { $do_dhcpsetup = 0; } } - if ($do_dhcpsetup) { + # For offline operation, remove the dhcp entries whatever dhcpset is disabled in site ( existing code logic, just keep it as is) + if ($do_dhcpsetup || $args[0] eq 'offline') { my @parameter; push @parameter, '-l' if ($::XNBA_request->{'_disparatetftp'}->[0]); + push @parameter, '-d' if ($args[0] eq 'offline'); xCAT::MsgUtils->trace($verbose_on_off, "d", "xnba: issue makedhcp request"); $sub_req->({ command => ['makedhcp'], From 41fc149dc97c37e812d4589f60828abb85b8d895 Mon Sep 17 00:00:00 2001 From: bybai Date: Tue, 19 Sep 2017 04:36:58 -0400 Subject: [PATCH 212/251] nic interface check to avoid dot in short host name --- perl-xCAT/xCAT/Schema.pm | 4 ++-- xCAT-server/lib/xcat/plugins/hosts.pm | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index f4f9965cc..c38db16d2 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -1551,14 +1551,14 @@ passed as argument rather than by table value', If multiple ip addresses are associated with each NIC: !|,!|,..., for example, eth0!-eth0|-eth0-ipv6,ib0!-ib0|-ib0-ipv6. The xCAT object definition commands support to use nichostnamesuffixes. as the sub attributes. - Note: According to DNS rules a hostname must be a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus sign (-),and period (.). When you are specifying "nichostnamesuffixes" or "nicaliases" make sure the resulting hostnames will conform to this naming convention', + Note: According to DNS rules a hostname must be a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9) and minus sign (-). When you are specifying "nichostnamesuffixes" or "nicaliases" make sure the resulting hostnames will conform to this naming convention', nichostnameprefixes => 'Comma-separated list of hostname prefixes per NIC. If only one ip address is associated with each NIC: !,!,..., for example, eth0!eth0-,ib0!ib- If multiple ip addresses are associated with each NIC: !|,!|,..., for example, eth0!eth0-|eth0-ipv6i-,ib0!ib-|ib-ipv6-. The xCAT object definition commands support to use nichostnameprefixes. as the sub attributes. - Note: According to DNS rules a hostname must be a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus sign (-),and period (.). When you are specifying "nichostnameprefixes" or "nicaliases" make sure the resulting hostnames will conform to this naming convention', + Note: According to DNS rules a hostname must be a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9) and minus sign (-). When you are specifying "nichostnameprefixes" or "nicaliases" make sure the resulting hostnames will conform to this naming convention', nictypes => 'Comma-separated list of NIC types per NIC. !,!, e.g. eth0!Ethernet,ib0!Infiniband. The xCAT object definition commands support to use nictypes. as the sub attributes.', niccustomscripts => 'Comma-separated list of custom scripts per NIC. !,!, e.g. eth0!configeth eth0, ib0!configib ib0. The xCAT object definition commands support to use niccustomscripts. as the sub attribute .', diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index f2a8f3327..0ef05ace2 100755 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -165,7 +165,7 @@ sub build_line $longname = "$node.$domain"; } - # if shortname contains a dot then we have a bad syntax for name + # if shortname contains a dot then we have a bad syntax for name if ($shortname =~ /\./) { my $rsp; push @{ $rsp->{data} }, "Invalid short node name \'$shortname\'. The short node name may not contain a dot. The short node name is considered to be anything preceeding the network domain name in the fully qualified node name \'$longname\'.\n"; @@ -729,9 +729,28 @@ sub donics for (my $i = 0 ; $i < $nicindex{$nic} ; $i++) { if (!$nich->{$nic}->{nicsufx}->[$i] && !$nich->{$nic}->{nicprfx}->[$i]) { + if ($nic =~ /\./) { + my $rsp; + push @{ $rsp->{data} }, "$node: since \'$nic\' contains dot, nics.nichostnamesuffixes should be configured without dot for \'$nic\' interface."; + xCAT::MsgUtils->message("E", $rsp, $callback); + next; + } # then we have no suffix at all for this # so set a default $nich->{$nic}->{nicsufx}->[$i] = "-$nic"; + + } elsif ($nich->{$nic}->{nicsufx}->[$i] && $nich->{$nic}->{nicsufx}->[$i] =~ /\./) { + my $rsp; + push @{ $rsp->{data} }, "$node: the value \'$nich->{$nic}->{nicsufx}->[$i]\' of nics.nichostnamesuffixes should not contain dot."; + xCAT::MsgUtils->message("E", $rsp, $callback); + delete $nich->{$nic}->{nicsufx}->[$i]; + next; + } elsif ($nich->{$nic}->{nicprfx}->[$i] && $nich->{$nic}->{nicprfx}->[$i] =~ /\./) { + my $rsp; + push @{ $rsp->{data} }, "$node: the value \'$nich->{$nic}->{nicprfx}->[$i]\' of nics.nichostnameprefixes should not contain dot."; + xCAT::MsgUtils->message("E", $rsp, $callback); + delete $nich->{$nic}->{nicprfx}->[$i]; + next; } } } From be81e218c649de3e499abfd22dbed70da049f26d Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 19 Sep 2017 04:51:48 -0400 Subject: [PATCH 213/251] Fix issue 3951, rm all bmc nodes when discovered --- xCAT-server/lib/xcat/plugins/nodediscover.pm | 14 ++++++++++---- xCAT-server/lib/xcat/plugins/seqdiscovery.pm | 16 ++++++++-------- xCAT-server/lib/xcat/plugins/switch.pm | 16 ++++++++-------- xCAT-server/lib/xcat/plugins/typemtms.pm | 18 +++++++++--------- 4 files changed, 35 insertions(+), 29 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index b6b78383a..fcb4e9db5 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -454,10 +454,16 @@ sub process_request { } } } else { - - # Only BMC that doesn't support in-band configuration need to run rspconfig out-of-band, such as S822L running in OPAL model - xCAT::MsgUtils->message("S", "No bmcinband specified, need to configure BMC out-of-band"); - xCAT::Utils->cleanup_for_powerLE_hardware_discovery($request, $doreq); + if (defined($request->{bmc_node}) and defined($request->{bmc_node}->[0])) { + my $bmc_node = $request->{bmc_node}->[0]; + if ($bmc_node =~ /\,/) { + xCAT::MsgUtils->message("W", "Multiple BMC nodes matched with no bmcinband specified, please remove manually"); + } else { + # Only BMC that doesn't support in-band configuration need to run rspconfig out-of-band, such as S822L running in OPAL model + xCAT::MsgUtils->message("S", "No bmcinband specified, need to configure BMC out-of-band"); + xCAT::Utils->cleanup_for_powerLE_hardware_discovery($request, $doreq); + } + } } diff --git a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm index 128164279..413382266 100755 --- a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm +++ b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm @@ -131,25 +131,25 @@ sub findme { } } my $bmc_node = undef; + my @bmc_nodes = (); if ($request->{'mtm'}->[0] and $request->{'serial'}->[0]) { my $mtms = $request->{'mtm'}->[0] . "*" . $request->{'serial'}->[0]; my $tmp_nodes = $::XCATVPDHASH{$mtms}; foreach (@$tmp_nodes) { if ($::XCATMPHASH{$_}) { - $bmc_node = $_; + push @bmc_nodes, $_; } } } - unless ($bmc_node) { - if ($request->{'bmcmac'}->[0]) { - my $bmcmac = lc($request->{'bmcmac'}->[0]); - $bmcmac =~ s/\://g; - my $tmp_node = "node-$bmcmac"; - $bmc_node = $tmp_node if ($::XCATMPHASH{$tmp_node}); - } + if ($request->{'bmcmac'}->[0]) { + my $bmcmac = lc($request->{'bmcmac'}->[0]); + $bmcmac =~ s/\://g; + my $tmp_node = "node-$bmcmac"; + push @bmc_nodes, $tmp_node if ($::XCATMPHASH{$tmp_node}); } + $bmc_node = join(",", @bmc_nodes); if ($node) { my $skiphostip; my $skipbmcip; diff --git a/xCAT-server/lib/xcat/plugins/switch.pm b/xCAT-server/lib/xcat/plugins/switch.pm index 523932036..024070b67 100644 --- a/xCAT-server/lib/xcat/plugins/switch.pm +++ b/xCAT-server/lib/xcat/plugins/switch.pm @@ -336,25 +336,25 @@ sub process_request { } } my $bmc_node = undef; + my @bmc_nodes = (); if ($req->{'mtm'}->[0] and $req->{'serial'}->[0]) { my $mtms = $req->{'mtm'}->[0] . "*" . $req->{'serial'}->[0]; my $tmp_nodes = $::XCATVPDHASH{$mtms}; foreach (@$tmp_nodes) { if ($::XCATMPHASH{$_}) { - $bmc_node = $_; + push @bmc_nodes, $_; } } } - unless ($bmc_node) { - if ($req->{'bmcmac'}->[0]) { - my $bmcmac = lc($req->{'bmcmac'}->[0]); - $bmcmac =~ s/\://g; - my $tmp_node = "node-$bmcmac"; - $bmc_node = $tmp_node if ($::XCATMPHASH{$tmp_node}); - } + if ($req->{'bmcmac'}->[0]) { + my $bmcmac = lc($req->{'bmcmac'}->[0]); + $bmcmac =~ s/\://g; + my $tmp_node = "node-$bmcmac"; + push @bmc_nodes, $tmp_node if ($::XCATMPHASH{$tmp_node}); } + $bmc_node = join(",", @bmc_nodes); if ($node) { xCAT::MsgUtils->message("S", "xcat.discovery.switch: ($req->{_xcat_clientmac}->[0]) Found node: $node"); diff --git a/xCAT-server/lib/xcat/plugins/typemtms.pm b/xCAT-server/lib/xcat/plugins/typemtms.pm index b6bcb9817..d8bbc5e54 100644 --- a/xCAT-server/lib/xcat/plugins/typemtms.pm +++ b/xCAT-server/lib/xcat/plugins/typemtms.pm @@ -26,24 +26,24 @@ sub findme { my $mtms = $request->{'mtm'}->[0] . "*" . $request->{'serial'}->[0]; my $tmp_nodes = $::XCATVPDHASH{$mtms}; my @nodes = (); - my $bmc_node; + my @bmc_nodes = (); + my $bmc_node = undef; foreach (@$tmp_nodes) { if ($::XCATMPHASH{$_}) { - $bmc_node = $_; + push @bmc_nodes, $_; } else { push @nodes, $_; } } - unless ($bmc_node) { - if ($request->{'bmcmac'}->[0]) { - my $bmcmac = lc($request->{'bmcmac'}->[0]); - $bmcmac =~ s/\://g; - my $tmp_node = "node-$bmcmac"; - $bmc_node = $tmp_node if ($::XCATMPHASH{$tmp_node}); - } + if ($request->{'bmcmac'}->[0]) { + my $bmcmac = lc($request->{'bmcmac'}->[0]); + $bmcmac =~ s/\://g; + my $tmp_node = "node-$bmcmac"; + push @bmc_nodes, $tmp_node if ($::XCATMPHASH{$tmp_node}); } + $bmc_node = join(",", @bmc_nodes); my $nodenum = $#nodes; if ($nodenum < 0) { xCAT::MsgUtils->message("S", "xcat.discovery.mtms: ($request->{_xcat_clientmac}->[0]) Warning: Could not find any node for $mtms using mtms-based discovery"); From c7ea492e6bfebb49ce1c58c56336b38ab853ab65 Mon Sep 17 00:00:00 2001 From: bybai Date: Tue, 19 Sep 2017 05:21:07 -0400 Subject: [PATCH 214/251] polished --- xCAT-server/lib/xcat/plugins/hosts.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index 0ef05ace2..945509f36 100755 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -731,7 +731,7 @@ sub donics if ($nic =~ /\./) { my $rsp; - push @{ $rsp->{data} }, "$node: since \'$nic\' contains dot, nics.nichostnamesuffixes should be configured without dot for \'$nic\' interface."; + push @{ $rsp->{data} }, "$node: since \'$nic\' contains dot, nics.nichostnamesuffixes.$nic should be configured without dot for \'$nic\' interface."; xCAT::MsgUtils->message("E", $rsp, $callback); next; } @@ -741,13 +741,13 @@ sub donics } elsif ($nich->{$nic}->{nicsufx}->[$i] && $nich->{$nic}->{nicsufx}->[$i] =~ /\./) { my $rsp; - push @{ $rsp->{data} }, "$node: the value \'$nich->{$nic}->{nicsufx}->[$i]\' of nics.nichostnamesuffixes should not contain dot."; + push @{ $rsp->{data} }, "$node: the value \'$nich->{$nic}->{nicsufx}->[$i]\' of nics.nichostnamesuffixes.$nic should not contain dot."; xCAT::MsgUtils->message("E", $rsp, $callback); delete $nich->{$nic}->{nicsufx}->[$i]; next; } elsif ($nich->{$nic}->{nicprfx}->[$i] && $nich->{$nic}->{nicprfx}->[$i] =~ /\./) { my $rsp; - push @{ $rsp->{data} }, "$node: the value \'$nich->{$nic}->{nicprfx}->[$i]\' of nics.nichostnameprefixes should not contain dot."; + push @{ $rsp->{data} }, "$node: the value \'$nich->{$nic}->{nicprfx}->[$i]\' of nics.nichostnameprefixes.$nic should not contain dot."; xCAT::MsgUtils->message("E", $rsp, $callback); delete $nich->{$nic}->{nicprfx}->[$i]; next; From bf9a96014018de6827798cd69f8ef1a1f75175c6 Mon Sep 17 00:00:00 2001 From: Samveen Gulati Date: Mon, 18 Sep 2017 12:24:59 +0000 Subject: [PATCH 215/251] xHRM: fix minor code bug --- xCAT-server/share/xcat/scripts/xHRM | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/scripts/xHRM b/xCAT-server/share/xcat/scripts/xHRM index a4cb41592..d85549cdb 100755 --- a/xCAT-server/share/xcat/scripts/xHRM +++ b/xCAT-server/share/xcat/scripts/xHRM @@ -265,7 +265,7 @@ elif [ "bridgeprereq" = "$1" ]; then nwdir="/etc/network/interfaces.d" isDebian=1 getcap /usr/bin/qemu-system-x86_64 | grep cap_net_admin - if [ $? ne 0 ];then + if [ $? -ne 0 ];then setcap cap_net_admin=ei /usr/bin/qemu-system-x86_64 fi else From 553cdd59d0e2bad6ead0e464fc80373392243aa8 Mon Sep 17 00:00:00 2001 From: XuWei Date: Wed, 20 Sep 2017 01:24:05 -0400 Subject: [PATCH 216/251] reventlog clear for OpenBMC --- xCAT-server/lib/xcat/plugins/openbmc.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index dfcd11a89..5676a28d0 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -138,8 +138,8 @@ my %status_info = ( }, REVENTLOG_CLEAR_REQUEST => { method => "POST", - init_url => "$openbmc_project_url/logging//action/delete", - data => '{ "data": [] }', + init_url => "$openbmc_project_url/logging/action/deleteAll", + data => "[]", }, REVENTLOG_CLEAR_RESPONSE => { process => \&reventlog_response, @@ -788,8 +788,6 @@ sub parse_command_status { if ($subcommand eq "clear") { $next_status{LOGIN_RESPONSE} = "REVENTLOG_CLEAR_REQUEST"; $next_status{REVENTLOG_CLEAR_REQUEST} = "REVENTLOG_CLEAR_RESPONSE"; - xCAT::SvrUtils::sendmsg("Command $command is not available now!", $callback); - return 1; } else { $next_status{LOGIN_RESPONSE} = "REVENTLOG_REQUEST"; $next_status{REVENTLOG_REQUEST} = "REVENTLOG_RESPONSE"; @@ -1631,12 +1629,14 @@ sub reventlog_response { my $count = 0; if ($option_s) { + xCAT::SvrUtils::sendmsg("$::NO_ATTRIBUTES_RETURNED", $callback, $node) if (!%output); foreach my $key ( sort { $b <=> $a } keys %output) { xCAT::MsgUtils->message("I", { data => ["$node: $output{$key}"] }, $callback) if ($output{$key}); $count++; last if ($entry_string ne "all" and $count >= $entry_num); } } else { + xCAT::SvrUtils::sendmsg("$::NO_ATTRIBUTES_RETURNED", $callback, $node) if (!%output); foreach my $key (sort keys %output) { xCAT::MsgUtils->message("I", { data => ["$node: $output{$key}"] }, $callback) if ($output{$key}); $count++; From 570daf3fa47e6c43e942245bba522844b5b5ebbd Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 20 Sep 2017 01:37:21 -0400 Subject: [PATCH 217/251] Fix typo in test case --- xCAT-test/autotest/testcase/rpower/cases0 | 7 ++++++- xCAT-test/xcattest | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/xCAT-test/autotest/testcase/rpower/cases0 b/xCAT-test/autotest/testcase/rpower/cases0 index 94fde2054..de57555fa 100644 --- a/xCAT-test/autotest/testcase/rpower/cases0 +++ b/xCAT-test/autotest/testcase/rpower/cases0 @@ -145,7 +145,8 @@ cmd:rpower $$CN onstandby cmd:a=0;while ! `rpower $$CN stat|grep "standby\|Standby" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done check:ouptut=~standby|Standby end -start:rpower__wrongpasswd + +start:rpower_wrongpasswd description:rpower ipmi and openbmc using wrong passwd Attribute: $$CN-The operation object of rpower command cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rpower/rpower_wrongpasswd_test.sh -pt $$CN $$rightbmcpasswd $$rightbmcusername @@ -157,21 +158,25 @@ check:rc==0 cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rpower/rpower_wrongpasswd_test.sh -c $$CN check:rc==0 end + start:rpower_suspend_OpenpowerBmc cmd:rpower $$CN suspend check:output=~Error: unsupported command rpower suspend for OpenPOWER check:rc==1 end + start:rpower_softoff_OpenpowerBmc cmd:rpower $$CN softoff check:output=~Error: unsupported command rpower softoff for OpenPOWER check:rc==1 end + start:rpower_wake_OpenpowerBmc cmd:rpower $$CN wake check:output=~Error: unsupported command rpower wake for OpenPOWER check:rc==1 end + start:rpower_errorcommand_OpenpowerBmc cmd:rpower $$CN ddd check:output=~Unsupported command: diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index f7e1f7450..5bb76bb13 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -1182,18 +1182,18 @@ sub run_case { #to run single line command + log_this($running_log_fd, "RUN:$cmd->[0] [$runstartstr]"); $cmd->[0] = getfunc($cmd->[0]); @output = &runcmd($cmd->[0]); $rc = $::RUNCMD_RC; - log_this($running_log_fd, "RUN:$cmd->[0] [$runstartstr]"); push(@caselog, "RUN:$cmd->[0] [$runstartstr]"); } else { #to run multiple lines command + log_this($running_log_fd, "RUN: [$runstartstr]", @{$cmd}); @output = runscript($cmd); $rc = $::RUNCMD_RC; - log_this($running_log_fd, "RUN: [$runstartstr]", @{$cmd}); push(@caselog, ("RUN: [$runstartstr]", @{$cmd})); } From 46ebe37f182a3f3f09b2384a6dc37d53edf86f97 Mon Sep 17 00:00:00 2001 From: XuWei Date: Wed, 20 Sep 2017 02:50:19 -0400 Subject: [PATCH 218/251] modify rpower reset to hard reset for OpenBMC --- xCAT-server/lib/xcat/plugins/openbmc.pm | 72 +++++++++++++++---------- 1 file changed, 45 insertions(+), 27 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index dfcd11a89..7c2ccca17 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -240,11 +240,6 @@ my %status_info = ( init_url => "$openbmc_project_url/state/host0/attr/RequestedHostTransition", data => "xyz.openbmc_project.State.Host.Transition.Off", }, - RPOWER_RESET_REQUEST => { - method => "PUT", - init_url => "$openbmc_project_url/state/host0/attr/RequestedHostTransition", - data => "xyz.openbmc_project.State.Host.Transition.Reboot", - }, RPOWER_RESET_RESPONSE => { process => \&rpower_response, }, @@ -703,19 +698,24 @@ sub parse_command_status { $next_status{LOGIN_RESPONSE} = "RPOWER_SOFTOFF_REQUEST"; $next_status{RPOWER_SOFTOFF_REQUEST} = "RPOWER_OFF_RESPONSE"; } elsif ($subcommand eq "reset") { - $next_status{LOGIN_RESPONSE} = "RPOWER_RESET_REQUEST"; - $next_status{RPOWER_RESET_REQUEST} = "RPOWER_RESET_RESPONSE"; + $next_status{LOGIN_RESPONSE} = "RPOWER_STATUS_REQUEST"; + $next_status{RPOWER_STATUS_REQUEST} = "RPOWER_STATUS_RESPONSE"; + $next_status{RPOWER_STATUS_RESPONSE}{OFF} = "DO_NOTHING"; + $next_status{RPOWER_STATUS_RESPONSE}{ON} = "RPOWER_OFF_REQUEST"; + $next_status{RPOWER_OFF_REQUEST} = "RPOWER_OFF_RESPONSE"; + $next_status{RPOWER_OFF_RESPONSE} = "RPOWER_ON_REQUEST"; + $next_status{RPOWER_ON_REQUEST} = "RPOWER_ON_RESPONSE"; + $status_info{RPOWER_ON_RESPONSE}{argv} = "$subcommand"; } elsif ($subcommand =~ /^bmcstate$|^status$|^state$|^stat$/) { $next_status{LOGIN_RESPONSE} = "RPOWER_STATUS_REQUEST"; $next_status{RPOWER_STATUS_REQUEST} = "RPOWER_STATUS_RESPONSE"; $status_info{RPOWER_STATUS_RESPONSE}{argv} = "$subcommand"; } elsif ($subcommand eq "boot") { - $next_status{LOGIN_RESPONSE} = "RPOWER_STATUS_REQUEST"; - $next_status{RPOWER_STATUS_REQUEST} = "RPOWER_STATUS_RESPONSE"; - $next_status{RPOWER_STATUS_RESPONSE}{OFF} = "RPOWER_ON_REQUEST"; + $next_status{LOGIN_RESPONSE} = "RPOWER_OFF_REQUEST"; + $next_status{RPOWER_OFF_REQUEST} = "RPOWER_OFF_RESPONSE"; + $next_status{RPOWER_OFF_RESPONSE} = "RPOWER_ON_REQUEST"; $next_status{RPOWER_ON_REQUEST} = "RPOWER_ON_RESPONSE"; - $next_status{RPOWER_STATUS_RESPONSE}{ON} = "RPOWER_RESET_REQUEST"; - $next_status{RPOWER_RESET_REQUEST} = "RPOWER_RESET_RESPONSE"; + $status_info{RPOWER_ON_RESPONSE}{argv} = "$subcommand"; } elsif ($subcommand eq "bmcreboot") { $next_status{LOGIN_RESPONSE} = "RPOWER_BMCREBOOT_REQUEST"; $next_status{RPOWER_BMCREBOOT_REQUEST} = "RPOWER_RESET_RESPONSE"; @@ -1247,14 +1247,18 @@ sub rpower_response { if ($node_info{$node}{cur_status} eq "RPOWER_ON_RESPONSE") { if ($response_info->{'message'} eq $::RESPONSE_OK) { - xCAT::SvrUtils::sendmsg("$::POWER_STATE_ON", $callback, $node); + if ($status_info{RPOWER_ON_RESPONSE}{argv}) { + xCAT::SvrUtils::sendmsg("$::POWER_STATE_RESET", $callback, $node); + } else { + xCAT::SvrUtils::sendmsg("$::POWER_STATE_ON", $callback, $node); + } $new_status{$::STATUS_POWERING_ON} = [$node]; } } if ($node_info{$node}{cur_status} eq "RPOWER_OFF_RESPONSE") { if ($response_info->{'message'} eq $::RESPONSE_OK) { - xCAT::SvrUtils::sendmsg("$::POWER_STATE_OFF", $callback, $node); + xCAT::SvrUtils::sendmsg("$::POWER_STATE_OFF", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} }); $new_status{$::STATUS_POWERING_OFF} = [$node]; } } @@ -1263,8 +1267,6 @@ sub rpower_response { if ($response_info->{'message'} eq $::RESPONSE_OK) { if (defined $status_info{RPOWER_RESET_RESPONSE}{argv} and $status_info{RPOWER_RESET_RESPONSE}{argv} =~ /bmcreboot$/) { xCAT::SvrUtils::sendmsg("BMC $::POWER_STATE_REBOOT", $callback, $node); - } else { - xCAT::SvrUtils::sendmsg("$::POWER_STATE_RESET", $callback, $node); } $new_status{$::STATUS_POWERING_ON} = [$node]; } @@ -1272,7 +1274,8 @@ sub rpower_response { xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%new_status, 1) if (%new_status); - if ($node_info{$node}{cur_status} eq "RPOWER_STATUS_RESPONSE" and !$next_status{ $node_info{$node}{cur_status} }) { + my $all_status; + if ($node_info{$node}{cur_status} eq "RPOWER_STATUS_RESPONSE") { my $bmc_state = ""; my $bmc_transition_state = ""; my $chassis_state = ""; @@ -1299,41 +1302,56 @@ sub rpower_response { xCAT::SvrUtils::sendmsg("BMC $bmc_short_state", $callback, $node); } else { if ($chassis_state =~ /Off$/) { - xCAT::SvrUtils::sendmsg("$::POWER_STATE_OFF", $callback, $node); + xCAT::SvrUtils::sendmsg("$::POWER_STATE_OFF", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} }); + $all_status = $::POWER_STATE_OFF; } elsif ($chassis_state =~ /On$/) { if ($host_state =~ /Off$/) { # State is off, but check if it is transitioning if ($host_transition_state =~ /On$/) { #xCAT::SvrUtils::sendmsg("$::POWER_STATE_POWERING_ON", $callback, $node); # ignore transition state until get stable firmware - xCAT::SvrUtils::sendmsg("$::POWER_STATE_OFF", $callback, $node); + xCAT::SvrUtils::sendmsg("$::POWER_STATE_OFF", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} }); + $all_status = $::POWER_STATE_OFF; } else { - xCAT::SvrUtils::sendmsg("$::POWER_STATE_OFF", $callback, $node); + xCAT::SvrUtils::sendmsg("$::POWER_STATE_OFF", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} }); + $all_status = $::POWER_STATE_OFF; } } elsif ($host_state =~ /Quiesced$/) { - xCAT::SvrUtils::sendmsg("$::POWER_STATE_QUIESCED", $callback, $node); + xCAT::SvrUtils::sendmsg("$::POWER_STATE_QUIESCED", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} }); + $all_status = $::POWER_STATE_ON; } elsif ($host_state =~ /Running$/) { # State is on, but check if it is transitioning if ($host_transition_state =~ /Off$/) { #xCAT::SvrUtils::sendmsg("$::POWER_STATE_POWERING_OFF", $callback, $node); # ignore transition state until get stable firmware - xCAT::SvrUtils::sendmsg("$::POWER_STATE_ON", $callback, $node); + xCAT::SvrUtils::sendmsg("$::POWER_STATE_ON", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} }); + $all_status = $::POWER_STATE_ON; } else { - xCAT::SvrUtils::sendmsg("$::POWER_STATE_ON", $callback, $node); + xCAT::SvrUtils::sendmsg("$::POWER_STATE_ON", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} }); + $all_status = $::POWER_STATE_ON; } } else { - xCAT::SvrUtils::sendmsg("Unexpected host state=$host_state", $callback, $node); + xCAT::SvrUtils::sendmsg("Unexpected host state=$host_state", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} }); + $all_status = $::POWER_STATE_ON; } } else { - xCAT::SvrUtils::sendmsg("Unexpected chassis state=$chassis_state", $callback, $node); + xCAT::SvrUtils::sendmsg("Unexpected chassis state=$chassis_state", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} }); + $all_status = $::POWER_STATE_ON; } } } if ($next_status{ $node_info{$node}{cur_status} }) { if ($node_info{$node}{cur_status} eq "RPOWER_STATUS_RESPONSE") { - if ($response_info->{'data'}->{CurrentHostState} =~ /Off$/) { - $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }{OFF}; + if ($all_status eq "$::POWER_STATE_OFF") { + if ($next_status{ $node_info{$node}{cur_status} }{OFF} eq "DO_NOTHING") { + xCAT::SvrUtils::sendmsg("$::POWER_STATE_RESET", $callback, $node); + $node_info{$node}{cur_status} = ""; + $wait_node_num--; + return; + } else { + $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }{OFF}; + } } else { $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }{ON}; } From 4410d4e282d792590737b514f25041db3af9c7c7 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Wed, 20 Sep 2017 02:51:02 -0400 Subject: [PATCH 219/251] enhance switchdiscover to deal with finding nodes hash --- .../lib/xcat/plugins/switchdiscover.pm | 72 ++++--------------- 1 file changed, 13 insertions(+), 59 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index c3a16ea61..46588cf74 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -339,74 +339,28 @@ sub process_request { @scan_types = @{$globalopt{scan_types}}; } - my $all_result; + my %username_hash = (); + $result = undef; foreach my $st (@scan_types) { no strict; my $fn = $global_scan_type{$st}; my $tmp_result = &$fn(\%request, $callback); if (ref($tmp_result) eq 'HASH') { - $all_result->{$st} = $tmp_result; - } - } - - #consolidate the results by merging the swithes with the same ip or same mac - my $result; - my $merged; - my $counter=0; - foreach my $st (keys %$all_result) { - my $tmp_result = $all_result->{$st}; - #send_msg( \%request, 1, Dumper($tmp_result)); - foreach my $old_mac (keys %$tmp_result) { - $same = 0; - foreach my $new_mac (keys %$result) { - my $old_ip = $tmp_result->{$old_mac}->{ip}; - my $old_name = $tmp_result->{$old_mac}->{name}; - my $old_vendor = $tmp_result->{$old_mac}->{vendor}; - my $new_ip = $result->{$new_mac}->{ip}; - my $new_name = $result->{$new_mac}->{name}; - my $new_vendor = $result->{$new_mac}->{vendor}; - my $key =$new_mac; - - if (($old_mac eq $new_mac) || - ($old_ip && ($old_ip eq $new_ip))) { - $same = 1; - if ($new_mac =~ /nomac/) { - if ($old_mac =~ /nomac/) { - $key = "nomac_$counter"; - $counter++; - } else { - $key = $old_mac; - } - } - if ($old_ip) { - $result->{$key}->{ip} = $old_ip; - } - $result->{$key}->{vendor} = $new_vendor; - if ($old_vendor) { - if ($old_vendor ne $new_vendor) { - $result->{$key}->{vendor} .= " " . $old_vendor; - } else { - $result->{$key}->{vendor} = $old_vendor; - } - } - - if ($key ne $new_mac) { - delete $result->{$new_mac}; - } - } - if ( $old_name && ($old_name eq $new_name)) { - #appending mac address to end of hostname - my $mac_str = lc($old_mac); + foreach (keys %$tmp_result) { + $result->{$_} = $tmp_result->{$_}; + #appending mac address to end of hostname + my $name = $result->{$_}->{name}; + if (exists $username_hash{$name}) { + my $mac_str = lc($_); $mac_str =~ s/\://g; - $result->{$key}->{name} = "$old_name-$mac_str"; + $result->{$_}->{name} = "$name-$mac_str"; + } else { + $username_hash{$name} = 1; } - } - if (!$same) { - $result->{$old_mac} = $tmp_result->{$old_mac}; - } + } } } - + if (!($result)) { send_msg( \%request, 0, " No $device found "); return; From 5c532433a8e3bf30c6a8036120bbe883c072f6c0 Mon Sep 17 00:00:00 2001 From: chenglch Date: Wed, 20 Sep 2017 19:11:31 +0800 Subject: [PATCH 220/251] Do not check the directory if pUpdate is not used fix-issue: #3972 --- xCAT-server/lib/xcat/plugins/ipmi.pm | 44 ++++++++++++---------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 5bf64ea70..77cfdab7e 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1970,24 +1970,6 @@ sub do_firmware_update { } } } - - if (defined $directory_name) { - unless (File::Spec->file_name_is_absolute($directory_name)) { - # Directory name was passed in as relative path, prepend current working dir - $directory_name = xCAT::Utils->full_path($directory_name, $::cwd); - } - # directory was passed in, verify it is valid - if (-d $directory_name) { - # Passed in directory name exists - $pUpdate_directory = $directory_name; - } - else { - $exit_with_error_func->($sessdata->{node}, $callback, "Can not access data directory $directory_name"); - } - } - else { - $exit_with_error_func->($sessdata->{node}, $callback, "Data directory must be specified."); - } } # For IBM Power S822LC for Big Data (Supermicro) machines such as @@ -1996,11 +1978,23 @@ sub do_firmware_update { # specified data directory along with the update files .bin for BMC or .pnor for Host if ($output =~ /8001-22C|9006-22C|5104-22C|9006-12C/) { # Verify valid data directory was specified - unless ($pUpdate_directory) { - $exit_with_error_func->($sessdata->{node}, $callback, - "Directory name is required to update Boston or Briggs machines."); + if (defined $directory_name) { + unless (File::Spec->file_name_is_absolute($directory_name)) { + # Directory name was passed in as relative path, prepend current working dir + $directory_name = xCAT::Utils->full_path($directory_name, $::cwd); + } + # directory was passed in, verify it is valid + if (-d $directory_name) { + # Passed in directory name exists + $pUpdate_directory = $directory_name; + } + else { + $exit_with_error_func->($sessdata->{node}, $callback, "Can not access data directory $directory_name"); + } + } + else { + $exit_with_error_func->($sessdata->{node}, $callback, "Directory name is required to update IBM Power S822LC for Big Data machines."); } - # Verify specified directory contains pUpdate utility unless (-e "$pUpdate_directory/pUpdate") { $exit_with_error_func->($sessdata->{node}, $callback, @@ -2126,7 +2120,7 @@ sub do_firmware_update { $exit_with_error_func->($sessdata->{node}, $callback, "Running ipmitool command $cmd failed: $output"); } - my $grs_version = $output =~ /OP8_v(\d*\.\d*_\d*\.\d*)/; + my $grs_version = $output =~ /OP8_.*v(\d*\.\d*_\d*\.\d*)/; if ($grs_version =~ /\d\.(\d+)_(\d+\.\d+)/) { my $prim_grs_version = $1; my $sec_grs_version = $2; @@ -2148,7 +2142,7 @@ sub do_firmware_update { "Running ipmitool command $cmd failed: $output"); } # Check what firmware version is currently running on the machine - if ($output =~ /OP8_v\d\.\d+_(\d+)\.\d+/) { + if ($output =~ /OP8_.*v\d\.\d+_(\d+)\.\d+/) { my $frs_version = $1; if ($frs_version == 1) { $firestone_update_version = "810"; @@ -2189,7 +2183,7 @@ sub do_firmware_update { } } - if ($is_firestone and + if ($is_firestone and $firestone_update_version and (($firestone_update_version eq "820" and $htm_update_version eq "810") or ($firestone_update_version eq "810" and $htm_update_version eq "820")) ) { From b02df90e023c8498b3781bbbb43f1a85b915bcbe Mon Sep 17 00:00:00 2001 From: ertaozh Date: Wed, 20 Sep 2017 21:52:53 -0400 Subject: [PATCH 221/251] set nodename as pdu or switch incase no name get by snmp or nmap --- xCAT-server/lib/xcat/plugins/switchdiscover.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index 46588cf74..bf3ca0a76 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -351,6 +351,9 @@ sub process_request { #appending mac address to end of hostname my $name = $result->{$_}->{name}; if (exists $username_hash{$name}) { + if ($name eq '') { + $name = "$device"; + } my $mac_str = lc($_); $mac_str =~ s/\://g; $result->{$_}->{name} = "$name-$mac_str"; From 105d472fe6394b48df148dcc94110a35e8318a3d Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Thu, 21 Sep 2017 00:49:56 -0400 Subject: [PATCH 222/251] Use unified attribute in rpower_wrongpasswd test case --- xCAT-test/autotest/testcase/rpower/cases0 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/rpower/cases0 b/xCAT-test/autotest/testcase/rpower/cases0 index de57555fa..485758810 100644 --- a/xCAT-test/autotest/testcase/rpower/cases0 +++ b/xCAT-test/autotest/testcase/rpower/cases0 @@ -149,11 +149,11 @@ end start:rpower_wrongpasswd description:rpower ipmi and openbmc using wrong passwd Attribute: $$CN-The operation object of rpower command -cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rpower/rpower_wrongpasswd_test.sh -pt $$CN $$rightbmcpasswd $$rightbmcusername +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rpower/rpower_wrongpasswd_test.sh -pt $$CN $$bmcpasswd $$bmcusername check:rc==0 cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rpower/rpower_wrongpasswd_test.sh -c $$CN check:rc==0 -cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rpower/rpower_wrongpasswd_test.sh -apt $$CN $$rightbmcpasswd $$rightbmcusername +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rpower/rpower_wrongpasswd_test.sh -apt $$CN $$bmcpasswd $$bmcusername check:rc==0 cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rpower/rpower_wrongpasswd_test.sh -c $$CN check:rc==0 From 23bab5d402225be666bef25a6059935aad46d91c Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 21 Sep 2017 01:46:25 -0400 Subject: [PATCH 223/251] modify rsetboot url based on new interface for 1738 --- xCAT-server/lib/xcat/plugins/openbmc.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 7c2ccca17..a8fd9ddae 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -253,7 +253,7 @@ my %status_info = ( RSETBOOT_SET_REQUEST => { method => "PUT", - init_url => "$openbmc_project_url/control/host0/boot_source/attr/BootSource", + init_url => "$openbmc_project_url/control/host0/boot/attr/BootSource", data => "xyz.openbmc_project.Control.Boot.Source.Sources.", }, RSETBOOT_SET_RESPONSE => { @@ -261,7 +261,7 @@ my %status_info = ( }, RSETBOOT_STATUS_REQUEST => { method => "GET", - init_url => "$openbmc_project_url/control/host0/boot_source", + init_url => "$openbmc_project_url/control/host0/boot", }, RSETBOOT_STATUS_RESPONSE => { process => \&rsetboot_response, @@ -529,7 +529,7 @@ sub parse_args { return ([ 1, "Error parsing arguments." ]) if ($option !~ /V|verbose/); } - if (scalar(@ARGV) >= 2 and ($command =~ /rpower|rinv|rsetboot|rvitals/)) { + if (scalar(@ARGV) >= 2 and ($command =~ /rpower|rinv|rvitals/)) { return ([ 1, "Only one option is supported at the same time for $command" ]); } elsif (scalar(@ARGV) == 0 and $command =~ /rpower|rspconfig|rflash/) { return ([ 1, "No option specified for $command" ]); @@ -747,6 +747,12 @@ sub parse_command_status { } if ($command eq "rsetboot") { + if ($$subcommands[-1] and $$subcommands[-1] eq "-o") { + pop(@$subcommands); + $status_info{RSETBOOT_SET_REQUEST}{init_url} = "$openbmc_project_url/control/host0/boot_source/attr/BootSource"; + $status_info{RSETBOOT_STATUS_REQUEST}{init_url} = "$openbmc_project_url/control/host0/boot_source"; + } + if (defined($$subcommands[0])) { $subcommand = $$subcommands[0]; } else { From 6572e3f59581175945027be9c8a646dc76dd0231 Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 21 Sep 2017 03:03:19 -0400 Subject: [PATCH 224/251] Fix issue 3979, do not set next status if command is getopenbmccons --- xCAT-server/lib/xcat/plugins/openbmc.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 7c2ccca17..b13333755 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -666,6 +666,8 @@ sub parse_command_status { my $subcommands = shift; my $subcommand; + return if ($command eq "getopenbmccons"); + if ($$subcommands[-1] and $$subcommands[-1] =~ /V|verbose/) { $::VERBOSE = 1; pop(@$subcommands); From af33fbe1312663ad363eb00edfd8be93dd432dcf Mon Sep 17 00:00:00 2001 From: XuWei Date: Wed, 20 Sep 2017 22:10:29 -0400 Subject: [PATCH 225/251] disable rpower reset and boot command for OpenBMC --- xCAT-server/lib/xcat/plugins/openbmc.pm | 7 +++++++ xCAT-server/lib/xcat/plugins/rinstall.pm | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 7c2ccca17..36fe74dee 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -545,6 +545,13 @@ sub parse_args { unless ($subcommand =~ /^on$|^off$|^softoff$|^reset$|^boot$|^bmcreboot$|^bmcstate$|^status$|^stat$|^state$/) { return ([ 1, "Unsupported command: $command $subcommand" ]); } + if ($subcommand =~ /^reset$|^boot$/) { + $check = unsupported($callback); + if (ref($check) eq "ARRAY") { + @$check[1] = "Command $command $subcommand is not supported now.\nPlease run 'rpower off' and then 'rpower on' instead."; + return $check; + } + } } elsif ($command eq "rinv") { $subcommand = "all" if (!defined($ARGV[0])); unless ($subcommand =~ /^model$|^serial$|^firm$|^cpu$|^dimm$|^all$/) { diff --git a/xCAT-server/lib/xcat/plugins/rinstall.pm b/xCAT-server/lib/xcat/plugins/rinstall.pm index 003ef2507..735ed9bca 100644 --- a/xCAT-server/lib/xcat/plugins/rinstall.pm +++ b/xCAT-server/lib/xcat/plugins/rinstall.pm @@ -548,11 +548,6 @@ sub rinstall { arg => \@rpowerarg ); - #TODO: When OPENBMC support is finished, this line should be removed - if($hmkey =~ /^openbmc$/){ - $req{environment}{XCAT_OPENBMC_DEVEL} = "YES"; - } - my $res = xCAT::Utils->runxcmd( \%req, From d8fdfaccb536bcd568947e91be39ff7c40f7d5d7 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Thu, 21 Sep 2017 04:23:36 -0400 Subject: [PATCH 226/251] reorder reventlog test case --- xCAT-test/autotest/bundle/hdctrl_general.bundle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/bundle/hdctrl_general.bundle b/xCAT-test/autotest/bundle/hdctrl_general.bundle index 4e77d1625..adeaa7857 100644 --- a/xCAT-test/autotest/bundle/hdctrl_general.bundle +++ b/xCAT-test/autotest/bundle/hdctrl_general.bundle @@ -27,5 +27,5 @@ rvitals_all rvitals_noderange_err reventlog_null reventlog_all -reventlog_clear reventlog_numofentries +reventlog_clear From bb87df4f941eb666ec818ba13875dbcb0863b97a Mon Sep 17 00:00:00 2001 From: Bin Xu Date: Thu, 21 Sep 2017 16:26:08 +0800 Subject: [PATCH 227/251] Add the localdisk document also available diskless osimage (#3971) * Not return directly for nodeset when hit one node failure * Add document to enable localdisk option for diskless * Revert "Not return directly for nodeset when hit one node failure" This reverts commit e5d88570541b308671cbbd2cc081610deb13113a. --- .../common/deployment/enable_localdisk.rst | 85 ++++++++++++++++++ .../diskless/customize_image/index.rst | 1 + .../diskless/customize_image/localdisk.rst | 1 + .../ppc64le/diskless/localdisk.rst | 6 ++ .../ppc64le/statelite/advanced_features.rst | 86 +------------------ 5 files changed, 94 insertions(+), 85 deletions(-) create mode 100644 docs/source/guides/admin-guides/manage_clusters/common/deployment/enable_localdisk.rst create mode 100644 docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/customize_image/localdisk.rst create mode 100644 docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/localdisk.rst diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/enable_localdisk.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/enable_localdisk.rst new file mode 100644 index 000000000..5608abe72 --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/enable_localdisk.rst @@ -0,0 +1,85 @@ +Enabling the localdisk Option +----------------------------- + +``Note``: You can skip this section if not using the ``localdisk`` option in your litefile table. + +Several things need to be done to enable the 'localdisk' support: + +Define how to partition the local disk +`````````````````````````````````````` + +When a node is deployed, the local hard disk needs to be partitioned and formatted before it can be used. This section explains how provide a configuration file that tells xCAT to partition a local disk and make it ready to use for the directories listed in the litefile table with the ``localdisk`` option. + +The configuration file needs to be specified in the ``partitionfile`` attribute of the osimage definition. The configuration file includes several parts: + + * Global parameters to control enabling or disabling the function + * [disk] part to control the partitioning of the disk + * [localspace] part to control which partition will be used to store the localdisk directories listed in the litefile table + * [swapspace] part to control the enablement of the swap space for the node. + +An example localdisk configuration file: :: + + enable=yes + enablepart=no + + [disk] + dev=/dev/sdb + clear=yes + parts=100M-200M,1G-2G + + [disk] + dev=/dev/sda + clear=yes + parts=10,20,30 + + [disk] + dev=/dev/sdc + clear=yes + parts=10,20,30 + + [localspace] + dev=/dev/sda1 + fstype=ext3 + + [swapspace] + dev=/dev/sda2 + +The two global parameters ``enable`` and ``enablepart`` can be used to control the enabling/disabling of the functions: + + * enable: The localdisk feature only works when ``enable`` is set to *yes*. If it is set to *no*, the localdisk configuration will not be run. + * enablepart: The partition action (refer to the ``[disk]`` section) will be run only when ``enablepart=yes``. + +The ``[disk]`` section is used to configure how to partition a hard disk: + + * dev: The path of the device file. + * clear: If set to ``yes`` it will clear all the existing partitions on this disk. + * fstype: The file system type for the new created partitions. ``ext3`` is the default value if not set. + * parts: A comma separated list of space ranges, one for each partition that will be created on the device. The valid format for each space range is ``-`` or ````. For example, you could set it to ``100M-10G`` or ``50``. If you set it to ``50``, that means 50% of the disk space will be assigned to that partition. + +The ``[localspace]`` section is used to specify which partition will be used as local storage for the node. + + * dev: The path of the partition. + * fstype: The file system type on the partition. + +the ``[swapspace]`` section is used to configure the swap space for the statelite node. + + * dev: The path of the partition file which will be used as the swap space. + +To enable the local disk capability, create the configuration file (for example in ``/install/custom``) and set the path in the partitionfile attribute for the osimage: :: + + chdef -t osimage partitionfile=/install/custom/cfglocaldisk + +Now all nodes that use this osimage (i.e. have their provmethod attribute set to this osimage definition name), will have its local disk configured. + +Configure the files in the litefile table +````````````````````````````````````````` + +For the files/directories that you would like xCAT to store on the local disk, add an entry in the litefile table like this: :: + + "ALL","/tmp/","localdisk",, + +``Note``: you do not need to specify the swap space in the litefile table. Just putting it in the partitionfile config file is enough. + +Add an entry in policy table to permit the running of the ``getpartitioin`` command from the node :: + + chtab priority=7.1 policy.commands=getpartition policy.rule=allow diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/customize_image/index.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/customize_image/index.rst index 5d71d4223..7a9554d87 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/customize_image/index.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/customize_image/index.rst @@ -15,3 +15,4 @@ Optional means all the subitems in this page are not necessary to finish an OS d install_new_kernel.rst acc_initrd_rootimg_gen_ppc64le.rst trim_diskless_rootimg.rst + localdisk.rst diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/customize_image/localdisk.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/customize_image/localdisk.rst new file mode 100644 index 000000000..52115d5ef --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/customize_image/localdisk.rst @@ -0,0 +1 @@ +.. include:: ../../../common/deployment/enable_localdisk.rst diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/localdisk.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/localdisk.rst new file mode 100644 index 000000000..54922a50c --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/localdisk.rst @@ -0,0 +1,6 @@ +.. include:: ../../../common/deployment/enable_localdisk.rst + +``Note``: + * `localdisk` feature won't syncronize the files/directories defined in `litefile` table from diskless image to local disk at the node boot time. It might casue issue to the application which depends on some of those directories. For example, the ``httpd`` service cannot be started if ``/var/log/`` is defined in `litefile` table. To work around this, you may copy the required contents to local disk and restart service manually at the first time. + + * To keep the contents on local disk after you use ``enablepart=yes`` to do partitioin, make sure to set ``enablepart=no`` in partitioin configuration file after the node is booted. \ No newline at end of file diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/advanced_features.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/advanced_features.rst index cb5aca4e9..089b1f066 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/advanced_features.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/advanced_features.rst @@ -162,91 +162,7 @@ Obtain you new kernel and kernel modules on the MN, for example here we have a n uname -a -Enabling the localdisk Option ------------------------------ - -``Note``: You can skip this section if not using the ``localdisk`` option in your litefile table. - -Several things need to be done to enable the 'localdisk' support: - -Define how to partition the local disk -`````````````````````````````````````` - -When a node is deployed, the local hard disk needs to be partitioned and formatted before it can be used. This section explains how provide a configuration file that tells xCAT to partition a local disk and make it ready to use for the directories listed in the litefile table with the ``localdisk`` option. - -The configuration file needs to be specified in the ``partitionfile`` attribute of the osimage definition. The configuration file includes several parts: - - * Global parameters to control enabling or disabling the function - * [disk] part to control the partitioning of the disk - * [localspace] part to control which partition will be used to store the localdisk directories listed in the litefile table - * [swapspace] part to control the enablement of the swap space for the node. - -An example localdisk configuration file: :: - - enable=yes - enablepart=no - - [disk] - dev=/dev/sdb - clear=yes - parts=100M-200M,1G-2G - - [disk] - dev=/dev/sda - clear=yes - parts=10,20,30 - - [disk] - dev=/dev/sdc - clear=yes - parts=10,20,30 - - [localspace] - dev=/dev/sda1 - fstype=ext3 - - [swapspace] - dev=/dev/sda2 - -The two global parameters ``enable`` and ``enablepart`` can be used to control the enabling/disabling of the functions: - - * enable: The localdisk feature only works when ``enable`` is set to *yes*. If it is set to *no*, the localdisk configuration will not be run. - * enablepart: The partition action (refer to the ``[disk]`` section) will be run only when ``enablepart=yes``. - -The ``[disk]`` section is used to configure how to partition a hard disk: - - * dev: The path of the device file. - * clear: If set to ``yes`` it will clear all the existing partitions on this disk. - * fstype: The file system type for the new created partitions. ``ext3`` is the default value if not set. - * parts: A comma separated list of space ranges, one for each partition that will be created on the device. The valid format for each space range is ``-`` or ````. For example, you could set it to ``100M-10G`` or ``50``. If you set it to ``50``, that means 50% of the disk space will be assigned to that partition. - -The ``[localspace]`` section is used to specify which partition will be used as local storage for the node. - - * dev: The path of the partition. - * fstype: The file system type on the partition. - -the ``[swapspace]`` section is used to configure the swap space for the statelite node. - - * dev: The path of the partition file which will be used as the swap space. - -To enable the local disk capability, create the configuration file (for example in ``/install/custom``) and set the path in the partitionfile attribute for the osimage: :: - - chdef -t osimage partitionfile=/install/custom/cfglocaldisk - -Now all nodes that use this osimage (i.e. have their provmethod attribute set to this osimage definition name), will have its local disk configured. - -Configure the files in the litefile table -````````````````````````````````````````` - -For the files/directories that you would like xCAT to store on the local disk, add an entry in the litefile table like this: :: - - "ALL","/tmp/","localdisk",, - -``Note``: you do not need to specify the swap space in the litefile table. Just putting it in the partitionfile config file is enough. - -Add an entry in policy table to permit the running of the ``getpartitioin`` command from the node :: - - chtab priority=7.1 policy.commands=getpartition policy.rule=allow +.. include:: ../../common/deployment/enable_localdisk.rst If Using the RAMdisk-based Image ```````````````````````````````` From e0ec727564a13adea87be8e82988b42011007ef9 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 21 Sep 2017 04:30:15 -0400 Subject: [PATCH 228/251] fix issue switchtype didn't set for cumulus switch after discover #3976 --- xCAT-server/lib/xcat/plugins/nodediscover.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index fcb4e9db5..fcc2aa4a4 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -248,8 +248,16 @@ sub process_request { #for onie switch, lookup and set the switchtype via mac of mgt interface my $switchestab = xCAT::Table->new('switches'); if ($switchestab) { - my $switchtype=$xCAT::data::switchinfo::global_mac_identity{substr(lc($request->{_xcat_clientmac}->[0]),0,8)}; - if(defined $switchtype){ + my $switchtype; + my $switchvendor=$xCAT::data::switchinfo::global_mac_identity{substr(lc($request->{_xcat_clientmac}->[0]),0,8)}; + if(defined $switchvendor){ + my $search_string = join '|', keys(%xCAT::data::switchinfo::global_switch_type); + if ($switchvendor =~ /($search_string)/) { + $switchtype=$xCAT::data::switchinfo::global_switch_type{$1}; + } + } + + if($switchtype){ $switchestab->setNodeAttribs($node,{ switchtype => $switchtype }); } $switchestab->close(); From b65f6bca157d9d62e1e3d378a548e38561657414 Mon Sep 17 00:00:00 2001 From: Yuan Bai Date: Thu, 21 Sep 2017 17:30:45 +0800 Subject: [PATCH 229/251] enhance doc for tagged vlan hostname (#3986) --- .../common/deployment/network/cfg_network_bond_vlan.rst | 5 +++++ .../common/deployment/network/cfg_network_vlan.rst | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/network/cfg_network_bond_vlan.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/network/cfg_network_bond_vlan.rst index 84130a096..ba249126f 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/network/cfg_network_bond_vlan.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/network/cfg_network_bond_vlan.rst @@ -31,8 +31,13 @@ Define attributes in the ``nics`` table chdef cn1 nicips.bond0.1=40.0.0.1 nictypes.bond0.1=vlan #. Define ``nicnetworks`` for ``bond0.1`` :: + chdef cn1 nicnetworks.bond0.1=net40 +#. Define ``nichostnamesuffixes`` for ``bond0.1`` in case ``makehosts`` to update ``/etc/hosts``, since the value for ``nichostnamesuffixes`` cannot contain ".", other characters are recommended instead of ".", like following: :: + + chdef cn1 nichostnamesuffixes.bond0.1=-bond0-1 + Enable ``confignetwork`` to configure bridge ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/network/cfg_network_vlan.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/network/cfg_network_vlan.rst index 41ed6a0a9..65ee1de30 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/network/cfg_network_vlan.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/network/cfg_network_vlan.rst @@ -31,6 +31,10 @@ Define attributes in the ``nics`` table chdef cn1 nicnetworks.eth0.6=net60 nicnetworks.eth0.7=net70 +#. Define ``nichostnamesuffixes`` for ``eth0.6`` and ``eth0.7`` in case ``makehosts`` to update ``/etc/hosts``, since the value for ``nichostnamesuffixes`` cannot contain ".", other characters are recommended instead of ".", like following: :: + + chdef cn1 nichostnamesuffixes.eth0.6=-eth0-6 nichostnamesuffixes.eth0.7=-eth0-7 + Enable ``confignetwork`` to configure VLAN ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 86ced369febc9c8a5c28c8c63acb728c989e2d26 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Thu, 21 Sep 2017 05:48:55 -0400 Subject: [PATCH 230/251] Modify release information for 2.13.7 --- docs/source/overview/xcat2_release.rst | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/source/overview/xcat2_release.rst b/docs/source/overview/xcat2_release.rst index 7bec2cfde..b3391d6b6 100644 --- a/docs/source/overview/xcat2_release.rst +++ b/docs/source/overview/xcat2_release.rst @@ -14,14 +14,26 @@ xCAT 2.13.x |xCAT |New OS |New |New Feature | |Version | |Hardware | | +=================================+===============+=============+==================================+ -|| xCAT 2.13.6 |- RHEL 7.4 |-Boston |- OpenBMC support | -|| 2017/8/10 | | server | | +|| xCAT 2.13.7 | | |- OpenBMC support: | +|| 2017/9/22 | | | | +|| | | | rflash for OpenBMC and PNOR | +| `2.13.7 Release Notes `_ | | | | +| | | |- xcatprobe clusterstatus enhance | +| | | | | +| | | |- PDU support: discover, config | +| | | | | +| | | |- SRIOV support for VMs | ++---------------------------------+---------------+-------------+----------------------------------+ +|| xCAT 2.13.6 |- RHEL 7.4 |- Boston |- OpenBMC support | +|| 2017/8/10 | | server | | || | | | rsetboot net/hd/def | | `2.13.6 Release Notes `_ | | | /delete/check | | | | | | -| | | | rspconfig retrieve OpenBCM ip/ | +| | | | rspconfig retrieve OpenBMC ip/ | | | | | netmask/gateway information | | | | |- nodeset performance enhancement | | | | | (Phase 3) | From 80385cc8069667c072e2752407ee11eb7553a520 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 21 Sep 2017 14:37:14 -0400 Subject: [PATCH 231/251] Setting BMC hostname message fix --- xCAT-server/lib/xcat/plugins/openbmc.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 7c2ccca17..3092ce50f 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1766,7 +1766,7 @@ sub rspconfig_response { if ($node_info{$node}{cur_status} eq "RSPCONFIG_SET_RESPONSE") { if ($response_info->{'message'} eq $::RESPONSE_OK) { - xCAT::SvrUtils::sendmsg("BMC Setting Hostname (requires bmcreboot to take effect)...", $callback, $node); + xCAT::SvrUtils::sendmsg("BMC Setting Hostname...", $callback, $node); } } if ($node_info{$node}{cur_status} eq "RSPCONFIG_DHCP_RESPONSE") { From 01a4a494052c84c346d8203334e73cdffc5668cd Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 21 Sep 2017 22:46:20 -0400 Subject: [PATCH 232/251] Delete all '.' in mtm and serial string for OpenBMC --- xCAT-genesis-scripts/bin/dodiscovery | 2 ++ xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index a92c19eb7..29e8ba559 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -159,10 +159,12 @@ fi flag_mtm=`echo '$MTM' | sed 's/0//g'` if [ $flag_mtm ] && [ "$MTM" != "unknown" ]; then + MTM=`echo $MTM | sed 's/\.//g'` echo "$MTM" >> /tmp/discopacket fi flag_serial=`echo '$SERIAL' | sed 's/0//g'` if [ $flag_serial ] && [ "$SERIAL" != "unknown" ]; then + SERIAL=`echo $SERIAL | sed 's/\.//g'` echo "$SERIAL" >> /tmp/discopacket fi if [ "$PLATFORM" != "unknown" ]; then diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 270ab01a1..4264f519d 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -1155,8 +1155,8 @@ sub bmcdiscovery_openbmc{ } # delete space before and after - $mtm =~ s/^\s+|\s+$//g; - $serial =~ s/^\s+|\s+$//g; + $mtm =~ s/^\s+|\s+$|\.+//g; + $serial =~ s/^\s+|\s+$|\.+//g; $mtm = '' if ($mtm =~ /^0+$/); $serial = '' if ($serial =~ /^0+$/); From b6b4914b0adb5f72b0d58900e764f9721eea44fc Mon Sep 17 00:00:00 2001 From: Weihua Hu Date: Fri, 22 Sep 2017 16:17:36 +0800 Subject: [PATCH 233/251] Update Version --- Version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Version b/Version index ea55a03fa..c38dd67f3 100644 --- a/Version +++ b/Version @@ -1 +1 @@ -2.13.7 +2.13.8 From 6d620d95c8d1dd3d5aead8896fa0d992150f5ec4 Mon Sep 17 00:00:00 2001 From: Weihua Hu Date: Fri, 22 Sep 2017 16:18:46 +0800 Subject: [PATCH 234/251] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index d45b6ea6e..a3a6f4ec4 100644 --- a/README.rst +++ b/README.rst @@ -8,7 +8,7 @@ Documentation xCAT documentation is available at: http://xcat-docs.readthedocs.io/en/latest/ -|docs_latest| |docs_2136| |docs_2135| |docs_2134| |docs_2133| |docs_2132| |docs_2131| |docs_2130| |docs_212| +|docs_latest| |docs_2137| |docs_2136| |docs_2135| |docs_2134| |docs_2133| |docs_2132| |docs_2131| |docs_2130| |docs_212| Open Source License ------------------- From 8e9102a057332fc4c251ad49012c1476940ca133 Mon Sep 17 00:00:00 2001 From: Weihua Hu Date: Fri, 22 Sep 2017 16:20:18 +0800 Subject: [PATCH 235/251] Update README.rst --- README.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.rst b/README.rst index a3a6f4ec4..a8377c82e 100644 --- a/README.rst +++ b/README.rst @@ -22,6 +22,11 @@ Developers Developers and prospective contributors are encouraged to read the `Developers Guide `_ In particular the `GitHub `_ related subsection. +.. |docs_2137| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.7 + :alt: 2.13.7 documentation status + :scale: 100% + :target: http://xcat-docs.readthedocs.io/en/2.13.7/ + .. |docs_2136| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.6 :alt: 2.13.6 documentation status :scale: 100% From 5ffaebd6367d375573e85661efa1374ebaca4c37 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Fri, 22 Sep 2017 16:36:06 -0400 Subject: [PATCH 236/251] Add -c option for switchdiscover command to pass in community string --- perl-xCAT/xCAT/Usage.pm | 2 +- .../lib/xcat/plugins/switchdiscover.pm | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index efa72327e..6b1dab41c 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -328,7 +328,7 @@ my %usage = ( pdudiscover [|--range ipranges] [-r|-x|-z] [-w] [-V|--verbose] [--setup]", "switchdiscover" => "Usage: switchdiscover [-h|--help|-v|--version] - switchdiscover [|--range ipranges] [-s scan_methods] [-r|-x|-z] [-w] [-V|--verbose] [--setup]", + switchdiscover [|--range ipranges] [-s scan_methods] [-c community] [-r|-x|-z] [-w] [-V|--verbose] [--setup]", "switchprobe" => "Usage: switchprobe [] [-V|--verbose | -c|--check]", "makentp" => diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index bf3ca0a76..f584f6385 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -25,7 +25,7 @@ use xCAT::data::switchinfo; #global variables for this module my $device; -my $community; +my $community="public"; my %globalopt; my @filternodes; my @iprange; @@ -144,7 +144,7 @@ sub parse_args { # Process command-line flags ############################################# if (!GetOptions( \%opt, - qw(h|help V|verbose v|version x z w r n range=s s=s setup pdu))) { + qw(h|help V|verbose v|version x z w r n range=s s=s c=s setup pdu))) { return( usage() ); } @@ -252,6 +252,14 @@ sub parse_args { $globalopt{n} = 1; } + ######################################################### + # Accept the community string from user + ######################################################### + if ( exists( $opt{c} )) { + $community=$opt{c}; + } + + ######################################################### # setup discover switch ######################################################### @@ -892,13 +900,6 @@ sub snmp_scan { } my @lines = split /\n/, $result; - #set community string for switch - $community = "public"; - my @snmpcs = xCAT::TableUtils->get_site_attribute("snmpc"); - my $tmp = $snmpcs[0]; - if (defined($tmp)) { $community = $tmp } - - foreach my $line (@lines) { my @array = split / /, $line; if ($line =~ /\b(\d{1,3}(?:\.\d{1,3}){3})\b/) From cafc3ba8e400745edbec6fd3e30f1cab4cf1c82e Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Sat, 23 Sep 2017 08:57:20 -0400 Subject: [PATCH 237/251] To support machines with older firmware than OP910 1738, we need to allow for an environment variable that takes care of any URL endpoints that might have changed to maintain backwards compatiability during FW development --- xCAT-server/lib/xcat/plugins/openbmc.pm | 27 +++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index b8477dc26..ec43a3ab7 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -44,6 +44,7 @@ $::POWER_STATE_RESET = "reset"; $::POWER_STATE_REBOOT = "reboot"; $::UPLOAD_FILE = ""; $::UPLOAD_FILE_VERSION = ""; +$::RSETBOOT_URL_PATH = "boot"; $::NO_ATTRIBUTES_RETURNED = "No attributes returned from the BMC."; @@ -253,7 +254,7 @@ my %status_info = ( RSETBOOT_SET_REQUEST => { method => "PUT", - init_url => "$openbmc_project_url/control/host0/boot/attr/BootSource", + init_url => "$openbmc_project_url/control/host0/$::RSETBOOT_URL_PATH/attr/BootSource", data => "xyz.openbmc_project.Control.Boot.Source.Sources.", }, RSETBOOT_SET_RESPONSE => { @@ -261,7 +262,7 @@ my %status_info = ( }, RSETBOOT_STATUS_REQUEST => { method => "GET", - init_url => "$openbmc_project_url/control/host0/boot", + init_url => "$openbmc_project_url/control/host0/$::RSETBOOT_URL_PATH", }, RSETBOOT_STATUS_RESPONSE => { process => \&rsetboot_response, @@ -378,6 +379,15 @@ sub preprocess_request { } else { $::OPENBMC_DEVEL = $request->{environment}->{XCAT_OPENBMC_DEVEL}; } + + if (ref($request->{environment}) eq 'ARRAY' and ref($request->{environment}->[0]->{XCAT_OPENBMC_FIRMWARE}) eq 'ARRAY') { + $::OPENBMC_FW = $request->{environment}->[0]->{XCAT_OPENBMC_FIRMWARE}->[0]; + } elsif (ref($request->{environment}) eq 'ARRAY') { + $::OPENBMC_FW = $request->{environment}->[0]->{XCAT_OPENBMC_FIRMWARE}; + } else { + $::OPENBMC_FW = $request->{environment}->{XCAT_OPENBMC_FIRMWARE}; + } + ############################################## $callback = shift; @@ -758,8 +768,8 @@ sub parse_command_status { if ($command eq "rsetboot") { if ($$subcommands[-1] and $$subcommands[-1] eq "-o") { pop(@$subcommands); - $status_info{RSETBOOT_SET_REQUEST}{init_url} = "$openbmc_project_url/control/host0/boot_source/attr/BootSource"; - $status_info{RSETBOOT_STATUS_REQUEST}{init_url} = "$openbmc_project_url/control/host0/boot_source"; + $status_info{RSETBOOT_SET_REQUEST}{init_url} = "$openbmc_project_url/control/host0/$::RSETBOOT_URL_PATH/attr/BootSource"; + $status_info{RSETBOOT_STATUS_REQUEST}{init_url} = "$openbmc_project_url/control/host0/$::RSETBOOT_URL_PATH"; } if (defined($$subcommands[0])) { @@ -768,6 +778,15 @@ sub parse_command_status { $subcommand = "stat"; } if ($subcommand =~ /^hd$|^net$|^cd$|^default$|^def$/) { + if (defined($::OPENBMC_FW) && ($::OPENBMC_FW < 1738)) { + # + # In 1738, the endpount URL changed. In order to support the older URL as a work around, allow for a environment + # variable to change this value. + # + $::RSETBOOT_URL_PATH = "boot_source"; + $status_info{RSETBOOT_SET_REQUEST}{init_url} = "$openbmc_project_url/control/host0/$::RSETBOOT_URL_PATH/attr/BootSource"; + $status_info{RSETBOOT_STATUS_REQUEST}{init_url} = "$openbmc_project_url/control/host0/$::RSETBOOT_URL_PATH"; + } $next_status{LOGIN_RESPONSE} = "RSETBOOT_SET_REQUEST"; $next_status{RSETBOOT_SET_REQUEST} = "RSETBOOT_SET_RESPONSE"; if ($subcommand eq "net") { From d8d40f184ce5538ba4912aae8c86efe59bba7ddd Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 22 Sep 2017 05:09:33 -0400 Subject: [PATCH 238/251] add cumulus upgrade doc --- .../onie_switches/os_cumulus/index.rst | 1 + .../onie_switches/os_cumulus/install.rst | 2 + .../onie_switches/os_cumulus/upgrade.rst | 62 +++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 docs/source/advanced/networks/onie_switches/os_cumulus/upgrade.rst diff --git a/docs/source/advanced/networks/onie_switches/os_cumulus/index.rst b/docs/source/advanced/networks/onie_switches/os_cumulus/index.rst index d2b369957..82f0e4e38 100644 --- a/docs/source/advanced/networks/onie_switches/os_cumulus/index.rst +++ b/docs/source/advanced/networks/onie_switches/os_cumulus/index.rst @@ -10,3 +10,4 @@ This documentation will focus on installing the Cumulus Network Operating System prepare.rst install.rst manage.rst + upgrade.rst diff --git a/docs/source/advanced/networks/onie_switches/os_cumulus/install.rst b/docs/source/advanced/networks/onie_switches/os_cumulus/install.rst index e0d132dfb..8915d02af 100644 --- a/docs/source/advanced/networks/onie_switches/os_cumulus/install.rst +++ b/docs/source/advanced/networks/onie_switches/os_cumulus/install.rst @@ -78,6 +78,8 @@ Validate the ssh keys are correctly configured by running a ``xdsh`` command: :: xdsh frame01sw1 uptime +.. _activate-the-license: + Activate the License -------------------- diff --git a/docs/source/advanced/networks/onie_switches/os_cumulus/upgrade.rst b/docs/source/advanced/networks/onie_switches/os_cumulus/upgrade.rst new file mode 100644 index 000000000..da079129c --- /dev/null +++ b/docs/source/advanced/networks/onie_switches/os_cumulus/upgrade.rst @@ -0,0 +1,62 @@ +Cumulus OS upgrade +================== + +The Cumulus OS on the ONIE switches can be upgraded in 2 ways: + +* Upgrade only the changed packages, using ``apt-get update`` and ``apt-get upgrade``. If the ONIE switches has internet access, this is the preferred method, otherwise, you need to build up a local cumulus mirror in the cluster. + + Since in a typical cluster setup, the switches usually do not have internet access, you can create a local mirror on the server which has internet access and can be reached from the switches, the steps are :: + + mkdir -p /install/mirror/cumulus + cd /install/mirror/cumulus + #the wget might take a long time, it will be better if you can set up + #a cron job to sync the local mirror with upstream + wget -m --no-parent http://repo3.cumulusnetworks.com/repo/ + + then compose a ``sources.list`` file on MN like this(take 172.21.253.37 as ip address of the local mirror server) :: + + #cat /tmp/sources.list + deb http://172.21.253.37/install/mirror/cumulus/repo3.cumulusnetworks.com/repo CumulusLinux-3 cumulus upstream + deb-src http://172.21.253.37/install/mirror/cumulus/repo3.cumulusnetworks.com/repo CumulusLinux-3 cumulus upstream + + deb http://172.21.253.37/install/mirror/cumulus/repo3.cumulusnetworks.com/repo CumulusLinux-3-security-updates cumulus upstream + deb-src http://172.21.253.37/install/mirror/cumulus/repo3.cumulusnetworks.com/repo CumulusLinux-3-security-updates cumulus upstream + + deb http://172.21.253.37/install/mirror/cumulus/repo3.cumulusnetworks.com/repo CumulusLinux-3-updates cumulus upstream + deb-src http://172.21.253.37/install/mirror/cumulus/repo3.cumulusnetworks.com/repo CumulusLinux-3-updates cumulus upstream + + distribute the ``sources.list`` file to the switches to upgrade with ``xdcp``, take "switch1" as an example here :: + + xdcp switch1 /tmp/sources.list /etc/apt/sources.list + + then invoke ``apt-get update`` and ``apt-get install`` on the switches to start package upgrade, a reboot might be needed after upgrading :: + + xdsh switch1 'apt-get update && apt-get upgrade && reboot' + + check the `/etc/os-release` file to make sure the Cumulus OS has been upgraded :: + + cat /etc/os-release + + + +* Performe a binary (full image) install of the new version, using ONIE. If you expect to upgrade between major versions or if you have the binary image to upgrade to, this way is the recommended one. Make sure to backup your data and configuration files because binary install will erase all the configuration and data on the switch. + + The steps to perform a binary (full image) install of the new version are: + + 1) place the binary image "cumulus-linux-3.4.1.bin" under ``/install`` directory on MN("172.21.253.37") :: + + mkdir -p /install/onie/ + cp cumulus-linux-3.4.1.bin /install/onie/ + + 2) invoke the upgrade on switches with ``xdsh`` :: + + xdsh switch1 "/usr/cumulus/bin/onie-install -a -f -i http://172.21.253.37/install/onie/cumulus-linux-3.4.1.bin && reboot" + + The full upgrade process might cost 30 min, you can ping the switch with ``ping switch1`` to check whether it finishes upgrade. + + 3) After upgrading, the license should be installed, see :ref:`Activate the License ` for detailed steps. + + 4) Restore your data and configuration files on the switch. + + + From dbefcc9f95c8a3ec79bd1cc0548206be991437b7 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Mon, 25 Sep 2017 15:55:57 -0400 Subject: [PATCH 239/251] Modified switchdiscover man page --- .../admin-guides/references/man1/switchdiscover.1.rst | 10 ++++++++-- xCAT-client/pods/man1/switchdiscover.1.pod | 8 ++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/switchdiscover.1.rst b/docs/source/guides/admin-guides/references/man1/switchdiscover.1.rst index e84f3e74d..e219a5ea8 100644 --- a/docs/source/guides/admin-guides/references/man1/switchdiscover.1.rst +++ b/docs/source/guides/admin-guides/references/man1/switchdiscover.1.rst @@ -15,7 +15,7 @@ SYNOPSIS \ **switchdiscover [-v| -**\ **-version]**\ -\ **switchdiscover**\ [\ *noderange*\ | \ **-**\ **-range**\ \ *ip_ranges*\ ] \ **[-V] [-w][-r|-x|-z][-s**\ \ *scan_methods*\ \ **-**\ **-setup**\ ] +\ **switchdiscover**\ [\ *noderange*\ | \ **-**\ **-range**\ \ *ip_ranges*\ ] \ **[-V] [-w][-r|-x|-z][-s**\ \ *scan_methods*\ ] [\ **-**\ **-setup**\ ] [\ **-c**\ \ *community*\ ] *********** @@ -31,7 +31,7 @@ To view all the switches defined in the xCAT database use \ **lsdef -w "nodetype For lldp method, make sure that lldpd package is installed and lldpd is running on the xCAT management node. lldpd comes from xcat-dep package or you can get it from http://vincentbernat.github.io/lldpd/installation.html. -For snmp method, make sure that snmpwalk command is installed and snmp is enabled for switches. To install snmpwalk, "yum install net-snmp-utils" for redhat and sles, "apt-get install snmp" for Ubuntu. +For snmp method, make sure that snmpwalk command is installed and snmp is enabled for switches. To install snmpwalk, "yum install net-snmp-utils" for redhat and sles, "apt-get install snmp" for Ubuntu. The switchdiscover command only check the switches with default community string, if user already configured switch with other commmunity string, need to pass in with \ **-c**\ option for switchdiscover command to be able to discover. ******* @@ -118,6 +118,12 @@ OPTIONS +\ **-c**\ + + User defined community string for snmp scan. + + + ************ RETURN VALUE diff --git a/xCAT-client/pods/man1/switchdiscover.1.pod b/xCAT-client/pods/man1/switchdiscover.1.pod index ec16fcaad..20f8e56e1 100755 --- a/xCAT-client/pods/man1/switchdiscover.1.pod +++ b/xCAT-client/pods/man1/switchdiscover.1.pod @@ -10,7 +10,7 @@ B B -B [I | B<--range> I] B<[-V] [-w][-r|-x|-z][-s> I B<--setup>] +B [I | B<--range> I] B<[-V] [-w][-r|-x|-z][-s> I] [B<--setup>] [B<-c> I] @@ -24,7 +24,7 @@ To view all the switches defined in the xCAT database use B option for switchdiscover command to be able to discover. =head1 OPTIONS @@ -87,6 +87,10 @@ Stanza formatted output. Process switch-based switch discovery. Update discovered switch's ip address, hostname and enable snmpv3 configuration based on the predefined switch. +=item B<-c> + +User defined community string for snmp scan. + =back =head1 RETURN VALUE From a9b23dfa1d580bc21aee37d9a69bdfa165aa5cc7 Mon Sep 17 00:00:00 2001 From: Matt Ezell Date: Mon, 25 Sep 2017 14:45:44 -0400 Subject: [PATCH 240/251] Improvements to Cumulus ZTP - Use the full path to cl-license - Allow configinterface to download files - Run enablesnmp in mypostscript so we have the correct community string --- .../onie_switches/os_cumulus/manage.rst | 6 +- xCAT/postscripts/configinterface | 83 ++++++++++++------- xCAT/postscripts/cumulusztp | 31 ++----- 3 files changed, 63 insertions(+), 57 deletions(-) diff --git a/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst b/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst index 0f3ce1184..512c4b1f4 100644 --- a/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst +++ b/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst @@ -1,10 +1,10 @@ Switch Management ================= -VLAN Configuration ------------------- +Switch Port and VLAN Configuration +---------------------------------- -xCAT ships a simple configuration script that will set all the ports on the switch to be part of VLAN 1. See the Cumulus Networks documentation for more information regarding advanced networking configuration. :: +xCAT expects the configuration for the front-panel ports to be located at ``/etc/network/interfaces.d/xCAT.intf`` on the switch. The ``configinterface`` postscript can download an interface configuration file from the management node. Place the configuration file in the directory ``/install/custom/sw_os/cumulus/interface/`` on the management node. It will first look for a file named the same as the switch's hostname, followed by the name of each group, followed by the word 'default'. If the postscript cannot find a configuration file on the management node, it will set all the ports on the switch to be part of VLAN 1. See the Cumulus Networks documentation for more information regarding advanced networking configuration. :: updatenode -P configinterface diff --git a/xCAT/postscripts/configinterface b/xCAT/postscripts/configinterface index 53d9c720a..9c248b2e4 100755 --- a/xCAT/postscripts/configinterface +++ b/xCAT/postscripts/configinterface @@ -9,45 +9,66 @@ fi xcat_intf="/etc/network/interfaces.d/xCAT.intf" -if [ -f $xcat_intf ] && grep -w '#This is sample interface file provided by xCAT' $xcat_intf ; then - echo "The switch data ports and default brige have been configured. Do nothing..." - exit 0 +if [ -z "$MASTER" ]; then + echo "xCAT Master unset! Cannot download interface description" + exit 2 fi -echo "#This is sample interface file provided by xCAT" > $xcat_intf -echo "# bridge-vlan-aware: set to yes to indicate that the bridge is VLAN-aware. " >> $xcat_intf -echo "# bridge-access: declares the access port. " >> $xcat_intf -echo "# bridge-pvid: specifies native VLANs if the ID is other than 1. " >> $xcat_intf -echo "# bridge-vids: declares the VLANs associated with this bridge. " >> $xcat_intf -echo " " >> $xcat_intf +TMPINT=/tmp/xCAT.intf +rm $TMPINT 2>/dev/null +UPDATED=0 -#create default bridge -echo "auto br0" >> $xcat_intf -echo "iface br0" >> $xcat_intf -echo " bridge-vlan-aware yes" >> $xcat_intf -echo " bridge-ports glob swp1-52" >> $xcat_intf -echo " bridge-stp on" >> $xcat_intf -echo " bridge-vids 1 " >> $xcat_intf -echo " bridge-pvid 1" >> $xcat_intf -echo " " >> $xcat_intf - -#create each interface - -for i in `seq 1 52`; -do - echo "auto swp$i">> $xcat_intf - echo "iface swp$i" >> $xcat_intf - echo " mstpctl-portadminedge yes" >> $xcat_intf - echo " " >> $xcat_intf +for name in $NODE ${GROUP//,/ } default; do + curl -s -o $TMPINT -f http://${MASTER}/install/custom/sw_os/cumulus/interface/$name + if [ -f $TMPINT ]; then + if ! diff $TMPINT $xcat_intf > /dev/null; then + mv $TMPINT $xcat_intf + UPDATED=1 + fi + break + fi done +if [ ! -f $xcat_intf ]; then + UPDATED=1 + + echo "#This is sample interface file provided by xCAT" > $xcat_intf + echo "# bridge-vlan-aware: set to yes to indicate that the bridge is VLAN-aware. " >> $xcat_intf + echo "# bridge-access: declares the access port. " >> $xcat_intf + echo "# bridge-pvid: specifies native VLANs if the ID is other than 1. " >> $xcat_intf + echo "# bridge-vids: declares the VLANs associated with this bridge. " >> $xcat_intf + echo " " >> $xcat_intf + + #create default bridge + echo "auto br0" >> $xcat_intf + echo "iface br0" >> $xcat_intf + echo " bridge-vlan-aware yes" >> $xcat_intf + echo " bridge-ports glob swp1-52" >> $xcat_intf + echo " bridge-stp on" >> $xcat_intf + echo " bridge-vids 1 " >> $xcat_intf + echo " bridge-pvid 1" >> $xcat_intf + echo " " >> $xcat_intf + + #create each interface + + for i in `seq 1 52`; + do + echo "auto swp$i">> $xcat_intf + echo "iface swp$i" >> $xcat_intf + echo " mstpctl-portadminedge yes" >> $xcat_intf + echo " " >> $xcat_intf + done +fi + # license needs to set before start switchd if [ ! -e /etc/cumulus/.license* ]; then - echo "ERROR: cumulus license file is not exist"; + echo "ERROR: cumulus license file does not exist"; exit 1; fi -systemctl enable switchd -systemctl restart switchd -ifreload -a +if [ $UPDATED -eq 1 ]; then + systemctl enable switchd + systemctl start switchd + ifreload -a +fi diff --git a/xCAT/postscripts/cumulusztp b/xCAT/postscripts/cumulusztp index 563016689..bc4b40d9a 100755 --- a/xCAT/postscripts/cumulusztp +++ b/xCAT/postscripts/cumulusztp @@ -104,21 +104,11 @@ done mkdir -p /root/.ssh mv _ssh/authorized_keys /root/.ssh/authorized_keys -#enable and config snmpd -./enablesnmp -rc=$? -if [ "$rc" != "0" ];then - logger -s -t "xcat.cumulusztp" -p local4.err "enablesnmp: failed to enable SNMP" - echo "enablesnmp: failed to enable SNMP" -else - logger -s -t "xcat.cumulusztp" -p local4.info "SNMP enabled!" -fi - #install license, if needed -cl-license > /dev/null 2>&1 +/usr/cumulus/bin/cl-license > /dev/null 2>&1 rc=$? if [ "$rc" != "0" ];then - if cl-license -i http://$server_ip/install/custom/sw_os/cumulus/licensefile.txt; then + if /usr/cumulus/bin/cl-license -i http://$server_ip/install/custom/sw_os/cumulus/licensefile.txt; then logger -s -t "xcat.cumulusztp" -p local4.info "installed Cumulus license" systemctl enable switchd systemctl start switchd @@ -128,15 +118,6 @@ if [ "$rc" != "0" ];then fi fi -#config base interface -./configinterface -rc=$? -if [ "$rc" != "0" ];then - echo "configinterface: failed to config switch data ports" -else - logger -s -t "xcat.cumulusztp" -p local4.info "data ports enabled!" -fi - #obtain myposctscript from MN ./getmypostscript.cumulus $server_ip:3001 rc=$? @@ -147,14 +128,18 @@ if [ "$rc" != "0" ]; then exit 1 fi +#enable snmp +echo './enablesnmp' >> ./mypostscript +#config base interface +echo './configinterface' >> ./mypostscript #config static ip address for mgt interface echo './confignics -s' >> ./mypostscript chmod 700 ./mypostscript ./mypostscript rc=$? if [ "$rc" != "0" ]; then - logger -s -t "xcat.cumulusztp" -p local4.info "failed to set static ip address for mgt interface" - echo "failed to set static ip address for mgt interface" + logger -s -t "xcat.cumulusztp" -p local4.info "failed to complete setup" + echo "failed to complete setup" ztp -R exit 1 fi From 489ee67c6a872b9cbf3390a80bb4e98dd78ba367 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 27 Sep 2017 21:32:17 -0400 Subject: [PATCH 241/251] Oneclipasu (#4020) * Filter out extraneous output of OneCli * Remove extraneous content from pasu * Update pasu filtering * Fix recognizing success to filter * Update for new Lenovo OneCLI rpm The new packaging offers up iflash64 and asu in a consistent location. * Workaround different IPv6 syntax for asu/onecli * Filter out header of new version of OneCLI * Filter out the Invoking SET command output of onecli --- xCAT-client/bin/pasu | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/xCAT-client/bin/pasu b/xCAT-client/bin/pasu index 4139f00de..08b77e746 100755 --- a/xCAT-client/bin/pasu +++ b/xCAT-client/bin/pasu @@ -23,13 +23,24 @@ use Getopt::Long; use POSIX qw(:signal_h :errno_h :sys_wait_h); use Thread qw(yield); + +$::onecli = 0; if ($iam =~ /pasu/) { - $::utilcmd = '/opt/lenovo/toolscenter/asu/asu64'; + $::utilcmd = '/opt/lenovo/onecli/asu'; + $::onecli = 1; + if (!-x $::utilcmd) { + $::onecli = 0; + $::utilcmd = '/opt/lenovo/toolscenter/asu/asu64'; + } if (!-x $::utilcmd) { $::utilcmd = '/opt/ibm/toolscenter/asu/asu64'; } } elsif ($iam =~ /piflash/) { - $::utilcmd = '/opt/xcat/sbin/iflash64 --unattended'; + $::utilcmd = '/opt/lenovo/onecli/iflash64'; + if (!-x $::utilcmd) { + $::utilcmd = '/opt/xcat/sbin/iflash64'; + } + $::utilcmd .= ' --unattended' } my $interface; my $username; @@ -198,7 +209,17 @@ sub processoutput { #This way, one arbiter handles output, no interrupting $line !~ /Licensed Materials - Property of Lenovo/i && $line !~ /\(C\) Copyright IBM Corp. \d+-\d+ All Rights Reserved/i && $line !~ /\(C\) Copyright Lenovo Corp. \d+-\d+ All Rights Reserved/i && - $line !~ /Connected to IMM at IP address/i)) { + $line !~ /Connected to IMM at IP address/i && + $line !~ /Lenovo ASU/i && + $line !~ /^\s*$/i && + $line !~ /Lenovo ToolsCenterSuite CLI/i && + $line !~ /Lenovo XClarity Essentials OneCLI/i && + $line !~ /Invoking SHOW command .../i && + $line !~ /Invoking SET command .../i && + $line !~ /Connected to BMC by IP address/i && + $line !~ /Succeeded running the command /i && + $line !~ /Based on module version /i && + $line !~ /Succeed running command /i)) { print $nodehdl{$readyh} . ": " . $line . "\n"; } } @@ -225,6 +246,9 @@ sub utilnode { } else { foreach my $a (@_) { $args .= ' ' . xCAT::Utils->quote($a); } } + if ($::onecli and $bmc =~ /:/) { + $bmc = "[$bmc]"; + } my $cmd = "$::utilcmd $args --host '$bmc' --user '$username' --password '$passwd' 2>&1 |"; if ($::VERBOSE) { print "forking $cmd\n"; } my $pid = open($$out, $cmd); From cf39880a20ae83c6d6da6a6e01faf313f2ce5f74 Mon Sep 17 00:00:00 2001 From: xuweibj Date: Thu, 28 Sep 2017 09:33:33 +0800 Subject: [PATCH 242/251] fix issue 4008, modify rsetboot command logic (#4017) --- xCAT-server/lib/xcat/plugins/openbmc.pm | 50 +++++++++++++++++++------ 1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index ec43a3ab7..1077d12f8 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -252,9 +252,17 @@ my %status_info = ( process => \&rpower_response, }, + RSETBOOT_ENABLE_REQUEST => { + method => "PUT", + init_url => "$openbmc_project_url/control/host0/boot/one_time/attr/Enabled", + data => '1', + }, + RSETBOOT_ENABLE_RESPONSE => { + process => \&rsetboot_response, + }, RSETBOOT_SET_REQUEST => { method => "PUT", - init_url => "$openbmc_project_url/control/host0/$::RSETBOOT_URL_PATH/attr/BootSource", + init_url => "$openbmc_project_url/control/host0/boot/one_time/attr/BootSource", data => "xyz.openbmc_project.Control.Boot.Source.Sources.", }, RSETBOOT_SET_RESPONSE => { @@ -262,7 +270,7 @@ my %status_info = ( }, RSETBOOT_STATUS_REQUEST => { method => "GET", - init_url => "$openbmc_project_url/control/host0/$::RSETBOOT_URL_PATH", + init_url => "$openbmc_project_url/control/host0/enumerate", }, RSETBOOT_STATUS_RESPONSE => { process => \&rsetboot_response, @@ -766,10 +774,10 @@ sub parse_command_status { } if ($command eq "rsetboot") { - if ($$subcommands[-1] and $$subcommands[-1] eq "-o") { + if ($$subcommands[-1] and $$subcommands[-1] eq "-p") { pop(@$subcommands); - $status_info{RSETBOOT_SET_REQUEST}{init_url} = "$openbmc_project_url/control/host0/$::RSETBOOT_URL_PATH/attr/BootSource"; - $status_info{RSETBOOT_STATUS_REQUEST}{init_url} = "$openbmc_project_url/control/host0/$::RSETBOOT_URL_PATH"; + $status_info{RSETBOOT_ENABLE_REQUEST}{data} = '0'; + $status_info{RSETBOOT_SET_REQUEST}{init_url} = "$openbmc_project_url/control/host0/boot/attr/BootSource"; } if (defined($$subcommands[0])) { @@ -786,8 +794,12 @@ sub parse_command_status { $::RSETBOOT_URL_PATH = "boot_source"; $status_info{RSETBOOT_SET_REQUEST}{init_url} = "$openbmc_project_url/control/host0/$::RSETBOOT_URL_PATH/attr/BootSource"; $status_info{RSETBOOT_STATUS_REQUEST}{init_url} = "$openbmc_project_url/control/host0/$::RSETBOOT_URL_PATH"; + $next_status{LOGIN_RESPONSE} = "RSETBOOT_SET_REQUEST"; + } else { + $next_status{LOGIN_RESPONSE} = "RSETBOOT_ENABLE_REQUEST"; + $next_status{RSETBOOT_ENABLE_REQUEST} = "RSETBOOT_ENABLE_RESPONSE"; + $next_status{RSETBOOT_ENABLE_RESPONSE} = "RSETBOOT_SET_REQUEST"; } - $next_status{LOGIN_RESPONSE} = "RSETBOOT_SET_REQUEST"; $next_status{RSETBOOT_SET_REQUEST} = "RSETBOOT_SET_RESPONSE"; if ($subcommand eq "net") { $status_info{RSETBOOT_SET_REQUEST}{data} .= "Network"; @@ -1112,7 +1124,7 @@ sub gen_send_request { $method = $status_info{ $node_info{$node}{cur_status} }{method}; } - if ($status_info{ $node_info{$node}{cur_status} }{data}) { + if (defined($status_info{ $node_info{$node}{cur_status} }{data})) { # Handle boolean values by create the json objects without wrapping with quotes if ($status_info{ $node_info{$node}{cur_status} }{data} =~ /^1$|^true$|^True$|^0$|^false$|^False$/) { $content = '{"data":' . $status_info{ $node_info{$node}{cur_status} }{data} . '}'; @@ -1572,13 +1584,29 @@ sub rsetboot_response { my $response_info = decode_json $response->content; if ($node_info{$node}{cur_status} eq "RSETBOOT_STATUS_RESPONSE") { - if ($response_info->{'data'}->{BootSource} =~ /Disk$/) { + my $one_time_enabled; + my $bootsource; + if (defined($::OPENBMC_FW) && ($::OPENBMC_FW < 1738)) { + $bootsource = $response_info->{'data'}->{BootSource}; + } else { + foreach my $key_url (keys %{$response_info->{data}}) { + my %content = %{ ${ $response_info->{data} }{$key_url} }; + if ($key_url =~ /boot\/one_time/) { + $one_time_enabled = $content{Enabled}; + $bootsource = $content{BootSource} if ($one_time_enabled); + } elsif ($key_url =~ /\/boot$/) { + $bootsource = $content{BootSource} unless ($one_time_enabled); + } + } + } + + if ($bootsource =~ /Disk$/) { xCAT::SvrUtils::sendmsg("Hard Drive", $callback, $node); - } elsif ($response_info->{'data'}->{BootSource} =~ /Network$/) { + } elsif ($bootsource =~ /Network$/) { xCAT::SvrUtils::sendmsg("Network", $callback, $node); - } elsif ($response_info->{'data'}->{BootSource} =~ /ExternalMedia$/) { + } elsif ($bootsource =~ /ExternalMedia$/) { xCAT::SvrUtils::sendmsg("CD/DVD", $callback, $node); - } elsif ($response_info->{'data'}->{BootSource} =~ /Default$/) { + } elsif ($bootsource =~ /Default$/) { xCAT::SvrUtils::sendmsg("Default", $callback, $node); } else { my $error_msg = "Can not get valid rsetboot status, the data is " . $response_info->{'data'}->{BootSource}; From 2d024b5aeb571668cc6b34f301519c2d268d224e Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 27 Sep 2017 21:36:30 -0400 Subject: [PATCH 243/251] Have xcoll take a try at sorting output groups (#4018) It isn't natural sort, but in many cases it should work. Natural sort in perl is a pain or a dependency. --- xCAT-client/bin/xcoll | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xCAT-client/bin/xcoll b/xCAT-client/bin/xcoll index 03a14a0ef..ffe8005aa 100755 --- a/xCAT-client/bin/xcoll +++ b/xCAT-client/bin/xcoll @@ -8,6 +8,7 @@ use xCAT::Client; use Getopt::Long; use strict; my %output; +my %outputhdrs; my $option; my $printcount; @@ -45,7 +46,7 @@ sub fillerup { } } if ($individual) { - foreach my $node (keys %output) { + foreach my $node (sort { $a <=> $b or $a cmp $b } keys %output) { print "====================================\n"; print "$node\n"; print "====================================\n"; @@ -63,6 +64,11 @@ foreach my $output (keys %collated) { unless ($option) { xCAT::Client::submit_request($cmdref, \&fillerup); } + $outputhdrs{$nodes} = $output; +} +foreach my $hdr (sort { $a <=> $b or $a cmp $b } keys %outputhdrs) { + $nodes = $hdr; + my $output = $outputhdrs{$hdr}; print "====================================\n"; print "$nodes\n"; print "====================================\n"; From f93f5e8e2c908f295f29b439ca1f1628def251cf Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 27 Sep 2017 22:31:30 -0400 Subject: [PATCH 244/251] Workaround switches that report ifindex in bridge (#4019) Some switches report ifindex instead of bridge index. This is not compliant behavior. However, we can detect that every last mac was a dead end, and assume this is the case to try to get better result. This won't work if there is overlap in interface and bridge indexes, so in that case, the spec compliant behavior is assumed. --- perl-xCAT/xCAT/MacMap.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/perl-xCAT/xCAT/MacMap.pm b/perl-xCAT/xCAT/MacMap.pm index 103ef87d4..fe58b585e 100644 --- a/perl-xCAT/xCAT/MacMap.pm +++ b/perl-xCAT/xCAT/MacMap.pm @@ -878,6 +878,21 @@ sub refresh_switch { } return; } + my $bridgeifvalid = 0; + foreach (keys %$mactoindexmap) { + my $index = $mactoindexmap->{$_}; + if (defined($bridgetoifmap->{$index})) { + $bridgeifvalid = 1; + last; + } + } + unless ($bridgeifvalid) { + # create a dummy bridgetoifmap to cover switches that thing it should go straight to ifindex + $bridgetoifmap = {}; + foreach (keys %$namemap) { + $bridgetoifmap->{$_} = $_; + } + } if (defined($self->{collect_mac_info})) { my %index_to_mac = (); my %index_to_vlan = (); From 55e1dde86faeebdb8372e8852f0703c401c02a9b Mon Sep 17 00:00:00 2001 From: yangsong Date: Thu, 28 Sep 2017 01:18:45 -0500 Subject: [PATCH 245/251] fix issue Switch-based node discovery failed on cumulus switch #4007 (#4022) --- perl-xCAT/xCAT/MacMap.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/MacMap.pm b/perl-xCAT/xCAT/MacMap.pm index fe58b585e..7c3d8fe13 100644 --- a/perl-xCAT/xCAT/MacMap.pm +++ b/perl-xCAT/xCAT/MacMap.pm @@ -543,11 +543,19 @@ sub refresh_table { pipe my $child, my $parent; $child->autoflush(1); $parent->autoflush(1); + $children++; my $cpid = xCAT::Utils->xfork; - unless (defined $cpid) { die "Cannot fork" } + unless (defined $cpid) { + $children--; + close($child); + close($parent); + xCAT::MsgUtils->message("S", "refresh_table: failed to fork refresh_switch process for $entry->{switch},skip..."); + next; + } if ($cpid == 0) { + $SIG{CHLD} = 'DEFAULT'; close($child); my $runstart = time; $self->refresh_switch($parent, $community, $entry->{switch}); @@ -556,6 +564,7 @@ sub refresh_table { xCAT::MsgUtils->message("S", "refresh_switch $entry->{switch} ElapsedTime:$diffduration sec"); exit(0); } + close($parent); $inputs->add($child); } @@ -719,7 +728,7 @@ sub refresh_switch { my $myport; my @res=xCAT::Utils->runcmd("ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no $switch 'bridge fdb show|grep -i -v permanent|tr A-Z a-z 2>/dev/null' 2>/dev/null",-1); - unless (@res) { + if ($::RUNCMD_RC) { xCAT::MsgUtils->message("S", "Failed to get mac table with ssh to $switch, fall back to snmp! To obtain mac table with ssh, please make sure the passwordless root ssh to $switch is available"); }else{ foreach (@res){ From 4318da8e7e9af924b09a0e9d8ac1cb533df5500e Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Thu, 28 Sep 2017 04:19:13 -0400 Subject: [PATCH 246/251] test case for testing switch-based switch discovery key process --- .../switch_based_switch_discovery_key_process | 498 ++++++++++++++++++ 1 file changed, 498 insertions(+) create mode 100755 xCAT-test/autotest/testcase/switchdiscover/switch_based_switch_discovery_key_process diff --git a/xCAT-test/autotest/testcase/switchdiscover/switch_based_switch_discovery_key_process b/xCAT-test/autotest/testcase/switchdiscover/switch_based_switch_discovery_key_process new file mode 100755 index 000000000..23d546746 --- /dev/null +++ b/xCAT-test/autotest/testcase/switchdiscover/switch_based_switch_discovery_key_process @@ -0,0 +1,498 @@ +#!/usr/bin/env perl +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +use strict; +use warnings; +use Getopt::Long; +use Data::Dumper; +use Time::Local; +use File::Basename; +use File::Path; +use integer; + +#--------------command line attrbutes-------------- +my $needhelp = 0; +my $discovery_mode = undef; +my $discovery_target_switch = undef; +my $dynamic_ip_range = undef; + +#--------------global attributes---------------- +my $prpgram_path = dirname(File::Spec->rel2abs(__FILE__)); +my $program_name = basename($0); +my $rst = 0; +my @error = (); + +my %node_error_info; +my $original_target_switch_num = 0; +my $failed_switch_num = 0; +my @success_be_discovered_switches; + +#The structure of %discovery_target_node_info +# $discovery_target_switch_info{}{} +my %discovery_target_switch_info; + +my @expected_attrs_for_switch_based_switch_discovery = ("ip", "mac", "switch", "switchport"); +my $expected_attrs_for_switch_based_switch_discovery_str = join(",", @expected_attrs_for_switch_based_switch_discovery); + +#$monitor_switch{}{workingip} +#$monitor_switch{}{workinghostname} +#$monitor_switch{}{mac} +#$monitor_switch{}{discover_status} +my %monitor_switch; + +my %mac_nodename_map; +my $pre_def_node_prefix = "xcattest_predef_"; + +#----------------------usage-------------------- +$::USAGE = "Usage: + To test switch-based switch discovery key process: swtich discovery, predefined node match and predefined node definition update. + +To get help: + $program_name -h +To test switch-based switch discovery key process + $program_name --discovery_target_switch --dynamic_ip_range --discovery_mode + +Options: + discovery_target_switch: Required. The target switches which are used to test switch-based switch discovery key process + dynamic_ip_range: Required. A valid ip range which are working for target switches. They can be dynamic ip range offered by DHCP or static ip configurd by hand. + discovery_mode: The protocol used by discovery process. If not set, using SNMP by default. +"; + + +#============================================================================================== +# main process +#============================================================================================== +if ( + !GetOptions("h" => \$needhelp, + "discovery_mode=s" => \$discovery_mode, + "discovery_target_switch=s" => \$discovery_target_switch, + "dynamic_ip_range=s" => \$dynamic_ip_range) + ) +{ + print "[ERROR] Invalid usage.\n\n$::USAGE"; + exit 1; +} + +if ($needhelp) { + print "$::USAGE\n"; + exit 0; +} + +unless (defined $discovery_target_switch and defined $dynamic_ip_range) { + print "[ERROR] options 'discovery_target_switch' and 'dynamic_ip_range' are required.\n\n$::USAGE"; + exit 1; +} + + +if (!defined $discovery_mode) { + $discovery_mode = "snmp"; +} + +$SIG{TERM} = $SIG{INT} = sub { + to_exit(1); +}; + +print "----------------Check the configuration of test case itself----------------\n"; +$rst = check_test_case_self_conf(\@error); +if ($failed_switch_num == $original_target_switch_num) { + print "All node in noderange $discovery_target_switch have error, there is not a valid swtich to do discovery\n"; + foreach my $node (sort keys %node_error_info) { + print "$node : $node_error_info{$node}\n"; + } + to_exit(1); +} elsif ($failed_switch_num > 0) { + print "There are $failed_switch_num nodes in noderange $discovery_target_switch have error\n"; + print "$_ : $node_error_info{$_}\n" foreach (sort keys %node_error_info); +} + +my $vaildnum = keys %monitor_switch; +print "There are $vaildnum valid switch (" . join(",", (keys %monitor_switch)) . ") will do discvoery test\n"; + +#print Dumper \%monitor_switch; + +print "----------------To clear up old environment and generate predefine node ----------------\n"; +$rst = backup_env(\@error); +if ($rst) { + print "To backup environment......Failed\n"; + to_exit(1); +} else { + print "To backup environment......pass\n"; +} + +print "----------------To discover switches----------------\n"; +$rst = switch_discovery(\@error); +if ($failed_switch_num) { + my @tmp = keys %monitor_switch; + my @discovery_err = deletearray(\@tmp, \@success_be_discovered_switches); + if (@discovery_err) { + print "There are some issue in discovery process\n"; + foreach my $switch (@discovery_err) { + if ($node_error_info{$switch}) { + print "$switch : $node_error_info{$switch}"; + } + } + } + $rst = 1; +} else { + $rst = 0; +} + +foreach (@success_be_discovered_switches) { + print "Below switch finished all switch_based switch discovery process\n"; + my $cmd = "lsdef $pre_def_node_prefix" . join(",$pre_def_node_prefix", @success_be_discovered_switches); + my @output = runcmd("$cmd"); + dump_info(\@output); +} +to_exit($rst); + +#============================================================================================= +# sub functions +#============================================================================================== +#-------------------------------------------------------- +# Fuction name: check_test_case_self_conf +# Description: +# Atrributes: +# Retrun code: +#-------------------------------------------------------- +sub check_test_case_self_conf { + my $error_ref = shift; + @$error_ref = (); + + my $current_node; + my @output = runcmd("lsdef $discovery_target_switch"); + foreach (@output) { + if ($_ =~ /^Error: Could not find an object named '(.+)' of type .+/i) { + $node_error_info{$1} = "without node definition in current mn"; + ++$original_target_switch_num; + ++$failed_switch_num; + } elsif ($_ =~ /^\s*Object name: (\w+)/i) { + $current_node = $1; + ++$original_target_switch_num; + } elsif ($_ =~ /^\s+(\w+)\s*=\s*(.*)/) { + $discovery_target_switch_info{$current_node}{$1} = $2; + if ($1 eq "mac") { + my $tmp_mac = lc($2); + $mac_nodename_map{$2} = $current_node; + } + } + } + + return 1 if ($original_target_switch_num == $failed_switch_num); + + # print "\n"; + # print Dumper \%mac_nodename_map; + # print Dumper \%discovery_target_switch_info; + # print "original_target_switch_num=$original_target_switch_num\n"; + # print "failed_switch_num = $failed_switch_num\n"; + + foreach my $switch (keys %discovery_target_switch_info) { + my @miss_attr; + foreach (@expected_attrs_for_switch_based_switch_discovery) { + unless (defined($discovery_target_switch_info{$switch}{$_})) { + push @miss_attr, $_; + } + } + if (@miss_attr) { + $node_error_info{$switch} = "miss attribute " . join(",", @miss_attr); + ++$failed_switch_num; + } + } + + + foreach my $switch (keys %node_error_info) { + delete $discovery_target_switch_info{$switch} if ($discovery_target_switch_info{$switch}); + } + return 1 if ($original_target_switch_num == $failed_switch_num); + + # print "===========================\n"; + # print Dumper \%discovery_target_switch_info; + # print "original_target_switch_num=$original_target_switch_num\n"; + # print "failed_switch_num = $failed_switch_num\n"; + # print Dumper \%node_error_info; + # print "===========================\n"; + + my @ips = parse_dynamic_ip_range($dynamic_ip_range); + + #print Dumper \@ips; + my $without_working_ip = $original_target_switch_num - $failed_switch_num; + my $trytime = 10; + while ($trytime && $without_working_ip) { + + #print "> try $trytime\n"; + #print Dumper \@ips; + my @matchedip; + foreach my $ip (@ips) { + my $cmd = "ping -c 2 $ip >/dev/null 2>&1"; + + #print "[RUN: $cmd]\n"; + runcmd("$cmd"); + $cmd = "arp $ip"; + + #print "[RUN: $cmd]\n"; + my @output = runcmd("$cmd"); + + #print Dumper \@output; + foreach (@output) { + if ($_ =~ / (\w){2}:(\w){2}:(\w){2}:(\w){2}:(\w){2}:(\w){2} /) { + + #print "-->$_\n"; + my @value = split(" ", $_); + my $arp_mc = lc($value[2]); + if (grep(/$arp_mc/, (keys %mac_nodename_map))) { + $monitor_switch{ $mac_nodename_map{$arp_mc} }{workingip} = $ip; + $monitor_switch{ $mac_nodename_map{$arp_mc} }{mac} = $arp_mc; + $monitor_switch{ $mac_nodename_map{$arp_mc} }{discover_status} = 0b00; + --$without_working_ip; + push @matchedip, $ip; + } + } + } + } + + #print "matchedip dumper\n"; + #print Dumper \@matchedip; + @ips = deletearray(\@ips, \@matchedip); + + #print Dumper \@ips; + --$trytime; + } + + if ($without_working_ip) { + $failed_switch_num += $without_working_ip; + } + + my @left_nodes = keys %discovery_target_switch_info; + my @tmp_monitor_switch = keys %monitor_switch; + my @without_workingip_nodes = deletearray(\@left_nodes, \@tmp_monitor_switch); + + foreach (@without_workingip_nodes) { + $node_error_info{$_} = "has not gotten a working ip from DHCP or configuration manually"; + delete $discovery_target_switch_info{$_}; + } + + if ($failed_switch_num) { + return 1; + } else { + return 0; + } +} + +#-------------------------------------------------------- +# Fuction name: to_exit +# Description: +# Atrributes: +# Retrun code: +#-------------------------------------------------------- +sub to_exit { + my $exit_code = shift; + + print "-----------To restore original environment--------------\n"; + my $cmd; + + #delete predefine node used by test + my @output = runcmd("lsdef"); + my @predefnodes; + foreach (@output) { + if ($_ =~ /^($pre_def_node_prefix.+) \(node\)/) { + push @predefnodes, $1; + } + } + if (@predefnodes) { + $cmd = "rmdef " . join(",", @predefnodes); + print "To run <$cmd>\n"; + runcmd("$cmd"); + } + + #to restore original node definition + foreach my $switch (keys %discovery_target_switch_info) { + $cmd = "chdef $switch "; + foreach my $attr (keys %{ $discovery_target_switch_info{$switch} }) { + if ($attr ne "postscripts" and $attr ne "postbootscripts") { + $cmd .= "$attr='$discovery_target_switch_info{$switch}{$attr}' "; + } + } + print "To run <$cmd>\n"; + runcmd("$cmd"); + } + + exit $exit_code; +} + +#-------------------------------------------------------- +# Fuction name: runcmd +# Description: +# Atrributes: +# Retrun code: +#-------------------------------------------------------- +sub runcmd { + my ($cmd) = @_; + my $rc = 0; + $::RUNCMD_RC = 0; + my $outref = []; + + @$outref = `$cmd 2>&1`; + if ($?) + { + $rc = $?; + $::RUNCMD_RC = $rc; + } + chomp(@$outref); + return @$outref; +} + + +#-------------------------------------------------------- +# Fuction name: dump_info +# Description: +# Atrributes: +# Retrun code: +#-------------------------------------------------------- +sub dump_info { + my $error_ref = shift; + foreach (@$error_ref) { + print "$_\n"; + } +} + +#-------------------------------------------------------- +# Fuction name: switch_discovery +# Description: +# Atrributes: +# Retrun code: +#-------------------------------------------------------- +sub switch_discovery { + my $error_ref = shift; + + my $cmd; + my @output; + + print "To do switch_based switch discovery for below predefined switches:\n"; + foreach my $switch (keys %monitor_switch) { + $cmd = "lsdef $pre_def_node_prefix$switch"; + @output = runcmd("$cmd"); + dump_info(\@output); + } + + $cmd = "switchdiscover --range $dynamic_ip_range -s $discovery_mode -w"; + print "To run <$cmd> ..."; + @output = runcmd("$cmd"); + if ($::RUNCMD_RC) { + print "failed\n"; + dump_info(\@output); + return 1; + } + print "ok\n"; + + dump_info(\@output); + foreach my $line (@output) { + if ($line =~ /^(\d)+\.(\d)+\.(\d)+\.(\d)+/) { + my @values = split(" ", $line); + if (grep(/$values[4]/, (keys %mac_nodename_map))) { + if ($values[0] eq $monitor_switch{ $mac_nodename_map{ $values[4] } }{workingip}) { + $monitor_switch{ $mac_nodename_map{ $values[4] } }{discover_status} |= 0b01; + $monitor_switch{ $mac_nodename_map{ $values[4] } }{workinghostname} = $values[1]; + } + } + } elsif ($line =~ /switch discovered and matched:\s+(.+)\s+to\s+(.+)/) { + my $opt_sw = $1; + my $opt_pre = $2; + if ($opt_pre =~ /$pre_def_node_prefix(.+)/) { + my $sname = $1; + if ($monitor_switch{$sname}{workinghostname} eq $opt_sw) { + $monitor_switch{$sname}{discover_status} |= 0b10; + } + } + } + } + + $cmd = "lsdef $pre_def_node_prefix" . join(",$pre_def_node_prefix", (keys %monitor_switch)) . " -i mac -c"; + @output = runcmd("$cmd"); + foreach my $line (@output) { + my @values = split("=", $line); + my $mac = $values[1]; + my $sname; + if ($values[0] =~ /$pre_def_node_prefix(.+):/) { + $sname = $1; + } + if ($mac) { + if ($monitor_switch{$sname}{mac} eq $mac) { + $monitor_switch{$sname}{discover_status} |= 0b100; + } + } + } + + foreach my $switch (keys %monitor_switch) { + if ($monitor_switch{$switch}{discover_status} == 0b001) { + $node_error_info{$switch} = "be discvoered, but failed to match pre-defined node $pre_def_node_prefix$switch"; + ++$failed_switch_num; + } elsif ($monitor_switch{$switch}{discover_status} == 0b011) { + $node_error_info{$switch} = "be discvoered and matched, but failed to update pre-defined node info in DB"; + ++$failed_switch_num; + } elsif ($monitor_switch{$switch}{discover_status} == 0b111) { + push @success_be_discovered_switches, $switch; + } + } + + return 0; +} + +#-------------------------------------------------------- +# Fuction name: parse_dynamic_ip_range +# Description: +# Atrributes: +# Retrun code: +#-------------------------------------------------------- +sub parse_dynamic_ip_range { + my $original_dynamic_ip_str = shift; + my @sec = split(/\./, $original_dynamic_ip_str); + for (my $i = 0 ; $i <= $#sec ; $i++) { + $sec[$i] = "{$1..$2}" if ($sec[$i] =~ /(\d+)-(\d+)/); + } + my $str = join(".", @sec); + my @output = runcmd("echo $str"); + return split(/ /, $output[0]); + +} + +#-------------------------------------------------------- +# Fuction name: backup_env +# Description: +# Atrributes: +# Retrun code: +#-------------------------------------------------------- +sub backup_env { + my $rst = 0; + + foreach my $switch (keys %discovery_target_switch_info) { + my @cmds = ("rmdef $switch", +"mkdef -t node $pre_def_node_prefix$switch groups=switch mgt=switch nodetype=switch switch=$discovery_target_switch_info{$switch}{switch} switchport=$discovery_target_switch_info{$switch}{switchport}"); + foreach my $cmd (@cmds) { + print "To run <$cmd>..."; + my @output = runcmd("$cmd"); + if ($::RUNCMD_RC) { + print "failed\n"; + dump_info(\@output); + return 1; + } else { + print "ok\n"; + } + } + } + return 0; +} + +#-------------------------------------------------------- +# Fuction name: deletearray +# Description: +# Atrributes: +# Retrun code: +#-------------------------------------------------------- +sub deletearray { + my $org_arr_ref = shift; + my $del_arr_ref = shift; + my @left_arr = (); + + foreach my $i (@{$org_arr_ref}) { + push @left_arr, $i unless (grep(/$i/, @{$del_arr_ref})); + } + return @left_arr; +} From a28edb3e6f5a6333229bc94648a85e43434644d4 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 28 Sep 2017 09:56:32 -0400 Subject: [PATCH 247/251] modify community string --- .../lib/xcat/plugins/switchdiscover.pm | 49 ++++++++++++++----- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index f584f6385..40a9fd640 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -21,11 +21,12 @@ no strict; use Data::Dumper; use Socket; use Expect; +use SNMP; use xCAT::data::switchinfo; #global variables for this module my $device; -my $community="public"; +my $community; my %globalopt; my @filternodes; my @iprange; @@ -259,7 +260,6 @@ sub parse_args { $community=$opt{c}; } - ######################################################### # setup discover switch ######################################################### @@ -955,20 +955,47 @@ sub get_snmpvendorinfo { my $request = shift; my $ip = shift; my $snmpwalk_vendor; + my $result; + my $rc=1; + #checking snmp connection + #during discovery phase, xCAT will not know the community string for snmp + #so, will try community string from following way: + # 1) -c options from user input + # 2) snmpc attribute defined in the site table + # 3) default community string for the switches. - #Ubuntu only takes OID - #get sysDescr.0"; - my $ccmd = "snmpwalk -Os -v1 -c $community $ip 1.3.6.1.2.1.1.1"; - if (exists($globalopt{verbose})) { - send_msg($request, 0, "Process command: $ccmd\n"); + my @comm_list; + my $snmpver = '1'; + + my @snmpcs = xCAT::TableUtils->get_site_attribute("snmpc"); + my $snmp_site = $snmpcs[0]; + + if ($community) { + push @comm_list, $community; } + if ($snmp_site) { + push @comm_list, $snmp_site; + } + push @comm_list, 'public'; - my $result = xCAT::Utils->runcmd($ccmd, 0); - if ($::RUNCMD_RC != 0) - { + foreach $comms(@comm_list) { + #get sysDescr.0"; + my $ccmd = "snmpwalk -Os -v1 -c $comms $ip 1.3.6.1.2.1.1.1"; if (exists($globalopt{verbose})) { - send_msg($request, 1, "Could not process this command: $ccmd" ); + send_msg($request, 0, "Process command: $ccmd\n"); + } + $result = xCAT::Utils->runcmd($ccmd, 0); + if ($::RUNCMD_RC == 0) + { + $community = $comms; + $rc=0; + last; + } + } + if ($rc == 1) { + if (exists($globalopt{verbose})) { + send_msg($request, 1, "Could not process snmpwalk command to get sysDescr, please verify community string" ); } return $snmpwalk_vendor; } From 20e1e7213c5397165f9d92b2bf264bdc73275cda Mon Sep 17 00:00:00 2001 From: cxhong Date: Thu, 28 Sep 2017 23:07:55 -0400 Subject: [PATCH 248/251] Support config snmpv1/2 community string for Mellanox switches during discovery phase (#4030) * Support config snmpv1/2 community string for Mellanox switches during discovery phase * checking snmpversion defined in the switches table --- xCAT-server/share/xcat/scripts/configMellanox | 30 +++++++++++++------ xCAT/postscripts/enablesnmp | 2 +- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/xCAT-server/share/xcat/scripts/configMellanox b/xCAT-server/share/xcat/scripts/configMellanox index b92dd57d0..ecadfe257 100755 --- a/xCAT-server/share/xcat/scripts/configMellanox +++ b/xCAT-server/share/xcat/scripts/configMellanox @@ -269,21 +269,39 @@ sub config_snmp { my $snmp_user; my $snmp_passwd; my $snmp_auth; + my $snmp_version; + my $cmd; my $switchtab = xCAT::Table->new('switches'); - my $switchhash = $switchtab->getNodesAttribs(\@nodes,['sshusername','username','password','auth','privacy']); - foreach my $switch (@nodes) { + my $switchhash = $switchtab->getNodesAttribs(\@nodes,['snmpversion','sshusername','sshpassword','username','password','auth','privacy']); + foreach my $switch (@nodes) + { + #enable snmp function on the switch + $cmd=`rspconfig $switch snmpcfg=enable`; + my $user = $switchhash->{$switch}->[0]->{sshusername}; if (!$user) { print "switch ssh username is not defined, use default one\n"; $user="admin"; } + $snmp_version = $switchhash->{$switch}->[0]->{snmpversion}; + $snmp_passwd = $switchhash->{$switch}->[0]->{password}; + + #config snmpv1 with community string defined in the switches table + unless ($snmp_version =~ /3/) { + if ($snmp_passwd) { + $cmd=`rspconfig $switch community=$snmp_passwd`; + print "config snmp community string $snmp_passwd\n"; + next; + } + } + + #config snmpv3 defined in the switches table $snmp_user = $switchhash->{$switch}->[0]->{username}; if (!$snmp_user) { print "No snmp user defined for switch $switch. Will not configure snmpv3\n"; next; } - $snmp_passwd = $switchhash->{$switch}->[0]->{password}; $snmp_auth = $switchhash->{$switch}->[0]->{auth}; my $snmp_privacy = $switchhash->{$switch}->[0]->{privacy}; @@ -315,12 +333,6 @@ sub run_rspconfig { $master = `hostname -i`; foreach my $switch (@nodes) { my $user= $switchhash->{$switch}->[0]->{sshusername}; - # call rspconfig command to setup switch - # enable ssh - $cmd=`rspconfig $switch sshcfg=enable`; - - # enable snmp function on the switch - $cmd=`rspconfig $switch snmpcfg=enable`; # enable the snmp trap $cmd=`rspconfig $switch alert=enable`; diff --git a/xCAT/postscripts/enablesnmp b/xCAT/postscripts/enablesnmp index 5486c7c39..2d0010955 100755 --- a/xCAT/postscripts/enablesnmp +++ b/xCAT/postscripts/enablesnmp @@ -52,7 +52,7 @@ fi echo "# $xCATSettingsSTART" >> $snmp_conf echo "# $xCATSettingsInfo" >> $snmp_conf -if [ "$snmpversion" = "3" ]; then +if [[ "$snmpversion" =~ "3" ]]; then #set up snmp version 3 if [ -n "$snmpuser" ] && [ -n "$snmpauth" ] && [ -n "$snmppwd" ]; then len=${#snmppwd} From ad9179b18ff256b8a1a718959f7c1b57a2efccf1 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 29 Sep 2017 02:07:30 -0400 Subject: [PATCH 249/251] modify depending on comments --- .../switch_based_switch_discovery_key_process | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xCAT-test/autotest/testcase/switchdiscover/switch_based_switch_discovery_key_process b/xCAT-test/autotest/testcase/switchdiscover/switch_based_switch_discovery_key_process index 23d546746..8528a748d 100755 --- a/xCAT-test/autotest/testcase/switchdiscover/switch_based_switch_discovery_key_process +++ b/xCAT-test/autotest/testcase/switchdiscover/switch_based_switch_discovery_key_process @@ -33,10 +33,10 @@ my %discovery_target_switch_info; my @expected_attrs_for_switch_based_switch_discovery = ("ip", "mac", "switch", "switchport"); my $expected_attrs_for_switch_based_switch_discovery_str = join(",", @expected_attrs_for_switch_based_switch_discovery); -#$monitor_switch{}{workingip} -#$monitor_switch{}{workinghostname} -#$monitor_switch{}{mac} -#$monitor_switch{}{discover_status} +#$monitor_switch{}{workingip} +#$monitor_switch{}{workinghostname} +#$monitor_switch{}{mac} +#$monitor_switch{}{discover_status} my %monitor_switch; my %mac_nodename_map; @@ -44,7 +44,7 @@ my $pre_def_node_prefix = "xcattest_predef_"; #----------------------usage-------------------- $::USAGE = "Usage: - To test switch-based switch discovery key process: swtich discovery, predefined node match and predefined node definition update. + To test switch-based switch discovery key process: switch discovery, predefined node match and predefined node definition update. To get help: $program_name -h @@ -94,7 +94,7 @@ $SIG{TERM} = $SIG{INT} = sub { print "----------------Check the configuration of test case itself----------------\n"; $rst = check_test_case_self_conf(\@error); if ($failed_switch_num == $original_target_switch_num) { - print "All node in noderange $discovery_target_switch have error, there is not a valid swtich to do discovery\n"; + print "All node in noderange $discovery_target_switch have error, there is not a valid switch to do discovery\n"; foreach my $node (sort keys %node_error_info) { print "$node : $node_error_info{$node}\n"; } @@ -388,7 +388,7 @@ sub switch_discovery { my @values = split(" ", $line); if (grep(/$values[4]/, (keys %mac_nodename_map))) { if ($values[0] eq $monitor_switch{ $mac_nodename_map{ $values[4] } }{workingip}) { - $monitor_switch{ $mac_nodename_map{ $values[4] } }{discover_status} |= 0b01; + $monitor_switch{ $mac_nodename_map{ $values[4] } }{discover_status} |= 0b001; $monitor_switch{ $mac_nodename_map{ $values[4] } }{workinghostname} = $values[1]; } } @@ -398,7 +398,7 @@ sub switch_discovery { if ($opt_pre =~ /$pre_def_node_prefix(.+)/) { my $sname = $1; if ($monitor_switch{$sname}{workinghostname} eq $opt_sw) { - $monitor_switch{$sname}{discover_status} |= 0b10; + $monitor_switch{$sname}{discover_status} |= 0b010; } } } From bcee7b19e078abebfbc474ddf03e7eac1dec51dd Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 29 Sep 2017 02:09:09 -0400 Subject: [PATCH 250/251] modify depending on comments --- .../switchdiscover/switch_based_switch_discovery_key_process | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/switchdiscover/switch_based_switch_discovery_key_process b/xCAT-test/autotest/testcase/switchdiscover/switch_based_switch_discovery_key_process index 8528a748d..86ae22b4b 100755 --- a/xCAT-test/autotest/testcase/switchdiscover/switch_based_switch_discovery_key_process +++ b/xCAT-test/autotest/testcase/switchdiscover/switch_based_switch_discovery_key_process @@ -422,10 +422,10 @@ sub switch_discovery { foreach my $switch (keys %monitor_switch) { if ($monitor_switch{$switch}{discover_status} == 0b001) { - $node_error_info{$switch} = "be discvoered, but failed to match pre-defined node $pre_def_node_prefix$switch"; + $node_error_info{$switch} = "be discovered, but failed to match pre-defined node $pre_def_node_prefix$switch"; ++$failed_switch_num; } elsif ($monitor_switch{$switch}{discover_status} == 0b011) { - $node_error_info{$switch} = "be discvoered and matched, but failed to update pre-defined node info in DB"; + $node_error_info{$switch} = "be discovered and matched, but failed to update pre-defined node info in DB"; ++$failed_switch_num; } elsif ($monitor_switch{$switch}{discover_status} == 0b111) { push @success_be_discovered_switches, $switch; From c66f73ccd993df8f4c927fd576ca287097386404 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 29 Sep 2017 02:13:33 -0400 Subject: [PATCH 251/251] modify depending on comments --- .../switchdiscover/switch_based_switch_discovery_key_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/switchdiscover/switch_based_switch_discovery_key_process b/xCAT-test/autotest/testcase/switchdiscover/switch_based_switch_discovery_key_process index 86ae22b4b..5d252baef 100755 --- a/xCAT-test/autotest/testcase/switchdiscover/switch_based_switch_discovery_key_process +++ b/xCAT-test/autotest/testcase/switchdiscover/switch_based_switch_discovery_key_process @@ -240,7 +240,7 @@ sub check_test_case_self_conf { if (grep(/$arp_mc/, (keys %mac_nodename_map))) { $monitor_switch{ $mac_nodename_map{$arp_mc} }{workingip} = $ip; $monitor_switch{ $mac_nodename_map{$arp_mc} }{mac} = $arp_mc; - $monitor_switch{ $mac_nodename_map{$arp_mc} }{discover_status} = 0b00; + $monitor_switch{ $mac_nodename_map{$arp_mc} }{discover_status} = 0b000; --$without_working_ip; push @matchedip, $ip; }