From 3c0ed0db349327df4f211bdb1e48566236bfd00b Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 29 Mar 2018 11:13:53 -0400 Subject: [PATCH 01/13] Updates to REST API documentation --- .../restapi/restapi_setup/restapi_setup.rst | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/source/advanced/restapi/restapi_setup/restapi_setup.rst b/docs/source/advanced/restapi/restapi_setup/restapi_setup.rst index 8f831211a..3208826bc 100644 --- a/docs/source/advanced/restapi/restapi_setup/restapi_setup.rst +++ b/docs/source/advanced/restapi/restapi_setup/restapi_setup.rst @@ -83,10 +83,10 @@ Extend the Timeout of Web Server Some operations like 'create osimage' (copycds) need a long time (longer than 3 minutes sometimes) to complete. It would fail with a ``timeout error`` (504 Gateway Time-out) if the timeout setting in the web server is not extended: :: For [RHEL] - sed -i 's/^Timeout.*/Timeout 600/' /etc/httpd/conf/httpd.conf + Edit /etc/httpd/conf/httpd.conf and change existing or add new entry: "Timeout 600" service htttd restart For [SLES] - echo "Timeout 600" >> /etc/apache2/httpd.conf + Edit /etc/apache2/httpd.conf and change existing or add new entry: "Timeout 600" service apache2 restart Set Up an Account for Web Service Access @@ -114,13 +114,18 @@ Use non-root Account Create new user and setup the password and policy rules. :: - useradd wsuser + useradd -u wsuser passwd wsuser # set the password - tabch key=xcat,username=wsuser passwd.password=cluster + tabch key=xcat,username=wsuser passwd.password= mkdef -t policy 6 name=wsuser rule=allow ``Note:`` in the tabch command above you can put the salted password (from /etc/shadow) in the xCAT passwd table instead of the clear text password, if you prefer. +Identical user with the same name and userid need to be created on each compute node. :: + + useradd -u wsuser + passwd wsuser # set the password + Create the SSL certificate under that user's home directory so that user can be authenticated to xCAT. This is done by running the following command on the Management node as root: :: /opt/xcat/share/xcat/scripts/setup-local-client.sh @@ -141,3 +146,5 @@ or if you did not set up the certificate: :: You should see some output that includes your list of nodes. +If errors returned, check `/var/log/httpd/ssl_error_log` on xCAT MN. + From cd07bf9d16efc77a6fcc4bf7bbd3dc4f302da66e Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 30 Mar 2018 11:19:16 -0400 Subject: [PATCH 02/13] Updated for review comments --- .../restapi/restapi_setup/restapi_setup.rst | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/docs/source/advanced/restapi/restapi_setup/restapi_setup.rst b/docs/source/advanced/restapi/restapi_setup/restapi_setup.rst index 3208826bc..84e15230f 100644 --- a/docs/source/advanced/restapi/restapi_setup/restapi_setup.rst +++ b/docs/source/advanced/restapi/restapi_setup/restapi_setup.rst @@ -75,7 +75,7 @@ The REST API client needs to download the xCAT certificate CA from the xCAT http When accessing the REST API, the certificate CA must be specified and the FQDN of the https server must be used. For example: :: - curl -X GET --cacert /root/ca-cert.pem 'https:///xcatws/nodes?userName=root& userPW=cluster' + curl -X GET --cacert /root/ca-cert.pem 'https:///xcatws/nodes?userName=root&userPW=' Extend the Timeout of Web Server ================================ @@ -83,10 +83,10 @@ Extend the Timeout of Web Server Some operations like 'create osimage' (copycds) need a long time (longer than 3 minutes sometimes) to complete. It would fail with a ``timeout error`` (504 Gateway Time-out) if the timeout setting in the web server is not extended: :: For [RHEL] - Edit /etc/httpd/conf/httpd.conf and change existing or add new entry: "Timeout 600" - service htttd restart + Edit "/etc/httpd/conf/httpd.conf" and change existing or add new entry: "Timeout 600" + service httpd restart For [SLES] - Edit /etc/apache2/httpd.conf and change existing or add new entry: "Timeout 600" + Edit "/etc/apache2/httpd.conf" and change existing or add new entry: "Timeout 600" service apache2 restart Set Up an Account for Web Service Access @@ -114,21 +114,27 @@ Use non-root Account Create new user and setup the password and policy rules. :: - useradd -u wsuser - passwd wsuser # set the password - tabch key=xcat,username=wsuser passwd.password= - mkdef -t policy 6 name=wsuser rule=allow + # create a user + useradd -u + # set the password + passwd + # add password to passwd table + tabch key=xcat,username= passwd.password= + # add user to policy table + mkdef -t policy 6 name= rule=allow ``Note:`` in the tabch command above you can put the salted password (from /etc/shadow) in the xCAT passwd table instead of the clear text password, if you prefer. -Identical user with the same name and userid need to be created on each compute node. :: +Identical user with the same name and uid need to be created on each compute node. :: - useradd -u wsuser - passwd wsuser # set the password + # create a user + useradd -u + # set the password + passwd Create the SSL certificate under that user's home directory so that user can be authenticated to xCAT. This is done by running the following command on the Management node as root: :: - /opt/xcat/share/xcat/scripts/setup-local-client.sh + /opt/xcat/share/xcat/scripts/setup-local-client.sh When running this command you'll see SSL certificates created. Enter "y" where prompted and take the defaults. @@ -138,11 +144,11 @@ To enable the POST method of resources like nodeshell, nodecopy, updating and fi Run a test request to see if everything is working: :: - curl -X GET --cacert /root/ca-cert.pem 'https:///xcatws/nodes?userName=&userPW=' + curl -X GET --cacert /root/ca-cert.pem 'https:///xcatws/nodes?userName=&userPW=' or if you did not set up the certificate: :: - curl -X GET -k 'https:///xcatws/nodes?userName=&userPW=' + curl -X GET -k 'https:///xcatws/nodes?userName=&userPW=' You should see some output that includes your list of nodes. From 6d5ca924f74d407517b6fb3063cf323199c4339c Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 4 Apr 2018 01:18:07 -0400 Subject: [PATCH 03/13] Refine test cases based on new output --- xCAT-test/autotest/testcase/reventlog/cases0 | 2 +- xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 | 9 +++------ xCAT-test/autotest/testcase/rspconfig/cases0 | 11 +++++------ 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/xCAT-test/autotest/testcase/reventlog/cases0 b/xCAT-test/autotest/testcase/reventlog/cases0 index 82fa7cc30..8ebfcdec6 100644 --- a/xCAT-test/autotest/testcase/reventlog/cases0 +++ b/xCAT-test/autotest/testcase/reventlog/cases0 @@ -33,7 +33,7 @@ cmd:reventlog $$CN 10 -s 1 check:output=~The -s option is not supported for OpenBMC check:rc!=0 cmd:reventlog $$CN -s all -check:output=~The -s option is not supported for OpenBMC +check:output=~The -s option is not supported for OpenBMC|Only one option is supported at the same time for reventlog check:rc!=0 cmd:reventlog $$CN -s check:output=~Error: Unsupported command diff --git a/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 b/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 index 4db2ba69b..a0f2d8fd0 100644 --- a/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 +++ b/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 @@ -448,22 +448,19 @@ check:rc != 0 cmd:mkdir -p /tmp/bogus123 check:rc == 0 cmd:rflash $$CN /tmp/bogus123 -d -check:output =~Error: No BMC tar file found -check:output =~Error: No Host tar file found +check:output =~Error: No BMC tar file found|Can't open directory check:output!~Attempting to check:rc != 0 cmd:touch /tmp/bogus123/obmc-phosphor-image-witherspoon.ubi.mtd.tar check:rc == 0 cmd:rflash $$CN -d /tmp/bogus123 -check:output =~Error: No BMC tar file found -check:output =~Error: No Host tar file found +check:output =~Error: No BMC tar file found|Can't open directory check:output!~Attempting to check:rc != 0 cmd:touch /tmp/bogus123/witherspoon.pnor.squashfs.tar check:rc == 0 cmd:rflash $$CN -d /tmp/bogus123 -check:output =~Error: No BMC tar file found -check:output =~Error: No Host tar file found +check:output =~Error: No BMC tar file found|Can't open directory check:output!~Attempting to check:rc != 0 cmd:rm -rf /tmp/bogus123 diff --git a/xCAT-test/autotest/testcase/rspconfig/cases0 b/xCAT-test/autotest/testcase/rspconfig/cases0 index 5dc0ee6a8..1054e48fa 100644 --- a/xCAT-test/autotest/testcase/rspconfig/cases0 +++ b/xCAT-test/autotest/testcase/rspconfig/cases0 @@ -127,7 +127,7 @@ start:rspconfig_set_vlan description:rspconfig change openbmc gateway Attribute: $$CN-The operation object of rspconfig command cmd:rspconfig $$CN vlan=0 -check:output=~Error: Invalid parameter for option vlan +check:output=~Error: Invalid parameter for option vlan|Error: VLAN must be configured with IP, netmask and gateway check:rc!=0 cmd:rspconfig $$CN vlan=111 check:output=~Error: VLAN must be configured with IP, netmask and gateway @@ -258,6 +258,7 @@ check:rc == 0 cmd:rspconfig $$CN hostname=* check:rc == 0 check:output =~ Invalid OpenBMC Hostname +cmd:ssh __GETNODEATTR(f6u03,bmc)__ "hostname" end @@ -342,17 +343,15 @@ cmd:rspconfig $$CN sshcfg check:rc == 0 cmd:ssh __GETNODEATTR($$CN,bmc)__ "hostname" | tee /tmp/rspconfig_set_hostname/working_hostname check:rc == 0 -cmd:cat /tmp/rspconfig_set_hostname/working_hostname -check:rc == 0 cmd:a=$(cat /tmp/rspconfig_set_hostname/working_hostname); rspconfig $$CN hostname=test_$a |tee /tmp/rspconfig_set_hostname/rspconfig_output check:rc == 0 -cmd:grep -i 'BMC hostname' /tmp/rspconfig_set_hostname/rspconfig_output|awk -F':' '{print $3}' |sed s/\\s//g > /tmp/rspconfig_set_hostname/rspconfig_get_hostname +cmd:grep -i '$$CN: BMC hostname:' /tmp/rspconfig_set_hostname/rspconfig_output|awk -F':' '{print $3}' |sed s/\\s//g |tee /tmp/rspconfig_set_hostname/rspconfig_get_hostname check:rc == 0 cmd:ssh __GETNODEATTR($$CN,bmc)__ "hostname" | tee /tmp/rspconfig_set_hostname/new_working_hostname check:rc == 0 -cmd:diff /tmp/rspconfig_set_hostname/rspconfig_get_hostname /tmp/rspconfig_set_hostname/new_working_hostname +cmd:diff -y /tmp/rspconfig_set_hostname/rspconfig_get_hostname /tmp/rspconfig_set_hostname/new_working_hostname check:rc == 0 -cmd:diff /tmp/rspconfig_set_hostname/new_working_hostname /tmp/rspconfig_set_hostname/working_hostname +cmd:diff -y /tmp/rspconfig_set_hostname/new_working_hostname /tmp/rspconfig_set_hostname/working_hostname check:rc != 0 cmd:a=test_$(cat /tmp/rspconfig_set_hostname/working_hostname);b=$(cat /tmp/rspconfig_set_hostname/new_working_hostname);echo "a=$a b=$b";if [ "$a" = "$b" ];then exit 0;else exit 1; fi check:rc == 0 From c9dc4439ecd94217f5dc2c17d4663b7bea67797b Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 5 Apr 2018 09:39:56 -0400 Subject: [PATCH 04/13] Add postscript to enable CAPI mode for mlnxofed --- xCAT/postscripts/enablecapi | 92 +++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 xCAT/postscripts/enablecapi diff --git a/xCAT/postscripts/enablecapi b/xCAT/postscripts/enablecapi new file mode 100644 index 000000000..e99e6fe6c --- /dev/null +++ b/xCAT/postscripts/enablecapi @@ -0,0 +1,92 @@ +#!/bin/bash + +if [ "$(uname -s|tr 'A-Z' 'a-z')" = "linux" ];then + str_dir_name=`dirname $0` + . $str_dir_name/xcatlib.sh +fi + +#--------------------------------------------------------------------------- +#=head1 enablecapi +#=head2 enable CAPI and tunnel Atomics for compute nodes +# at least MOFED 4.3.1 has to be installed and only support on ConnectX5 +# +# updatenode enablecapi +# +#--------------------------------------------------------------------------- + +#check if mlnx ofed installed +if [ ! -x /usr/bin/ofed_info ]; then + logger -t xcat -p local4.err "MOFED is not installed" + echo "MOFED is not installed on the system" + exit -1 +fi + +#mofed version at least 4.3-1 +version=`/usr/bin/ofed_info -n` +majorversion=`echo $version | cut -d- -f1` +minorversion=`echo $version | cut -d- -f2` +if (( $(echo "$majorversion < 4.3" |bc -l) )); then + logger -t xcat -p local4.err "Current MOFED version is $version and needs to be at least 4.3-1" + echo "Current MOFED version is $version and needs to be at least 4.3-1" + exit -1 +fi +if (( $(echo "$majorversion == 4.3" |bc -l) )); then + minor=`echo $minorversion | cut -d. -f1` + if (( $(echo "$minor < 1") )); then + logger -t xcat -p local4.err "MOFED version needs to be at least 4.3-1" + echo "Current MOFED version is $version and needs to be at least 4.3-1" + exit -1 + fi +fi + +#check if mst is existed +if [ ! -x /usr/bin/mst ]; then + logger -t xcat -p local4.err "mst command is not available" + echo "mst command is not available" + exit -1 +fi + +service mst restart >/dev/null 2>&1 +if [ "$?" != "0" ] ;then + logger -t xcat -p local4.err "[Error] failed to start mst." + echo "[Error] failed to start mst." + exit -1 +fi + + +#check if mlxconfig is existed +if [ ! -x /usr/bin/mlxconfig ]; then + logger -t xcat -p local4.err "mlxconfig command is not available" + echo "mlxconfig command is not available" + exit -1 +fi + +reboot_flag=0 + +for x in `ls /dev/mst/mt*` +do + mlxconfig -y -d $x q | grep 'ConnectX5' >/dev/null 2>&1 + if [ $? == 0 ]; then + mlxconfig -y -d $x set ADVANCED_PCI_SETTINGS=true >/dev/null 2>&1 + mlxconfig -y -d $x set IBM_CAPI_EN=true >/dev/null 2>&1 + mlxconfig -y -d $x set IBM_TUNNELED_ATOMIC_EN=true >/dev/null 2>&1 + mlxconfig -y -d $x set IBM_AS_NOTIFY_EN=true >/dev/null 2>&1 + echo "Apply new Configuration for $x:" + mlxconfig -y -d $x q | grep 'IBM' + reboot_flag=1 + fi +done + +if [[ $reboot_flag == 0 ]]; then + echo "Didn't find ConnectX5 Devices, will not apply the new configuration" +fi + +if [[ $reboot_flag == 1 ]]; then + echo "******************************************************" + echo " New configuration applied" + echo " Please reboot system to load new configurations" + echo "******************************************************" +fi + +exit 0 + From 4240fd54c96e8d3b2c3c8a5be9a45641e2705935 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 5 Apr 2018 10:42:51 -0400 Subject: [PATCH 05/13] modify from review --- xCAT/postscripts/enablecapi | 59 ++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 33 deletions(-) diff --git a/xCAT/postscripts/enablecapi b/xCAT/postscripts/enablecapi index e99e6fe6c..628e8f19a 100644 --- a/xCAT/postscripts/enablecapi +++ b/xCAT/postscripts/enablecapi @@ -14,51 +14,46 @@ fi # #--------------------------------------------------------------------------- -#check if mlnx ofed installed -if [ ! -x /usr/bin/ofed_info ]; then - logger -t xcat -p local4.err "MOFED is not installed" - echo "MOFED is not installed on the system" - exit -1 -fi +function logerr { + echo "$@" + logger -t xcat -p local4.err $@ +} + + +#check if mlnx ofed commands are installed +COMMANDS="ofed_info mst mlxconfig" +for CMD in ${COMMANDS}; do + RC=`command -v ${CMD} >> /dev/nul 2>&1; echo $?` + if [[ ${RC} != 0 ]]; then + ERRMSG="Command: ${CMD} is not found, unable to run the scripts" + logerr $ERRMSG + exit 1 + fi +done #mofed version at least 4.3-1 version=`/usr/bin/ofed_info -n` majorversion=`echo $version | cut -d- -f1` minorversion=`echo $version | cut -d- -f2` if (( $(echo "$majorversion < 4.3" |bc -l) )); then - logger -t xcat -p local4.err "Current MOFED version is $version and needs to be at least 4.3-1" - echo "Current MOFED version is $version and needs to be at least 4.3-1" - exit -1 + ERRMSG="Current MOFED version is $version and needs to be at least 4.3-1" + logerr $ERRMSG + exit 1 fi if (( $(echo "$majorversion == 4.3" |bc -l) )); then minor=`echo $minorversion | cut -d. -f1` if (( $(echo "$minor < 1") )); then - logger -t xcat -p local4.err "MOFED version needs to be at least 4.3-1" - echo "Current MOFED version is $version and needs to be at least 4.3-1" - exit -1 + ERRMSG="Current MOFED version is $version and needs to be at least 4.3-1" + logerr $ERRMSG + exit 1 fi fi -#check if mst is existed -if [ ! -x /usr/bin/mst ]; then - logger -t xcat -p local4.err "mst command is not available" - echo "mst command is not available" - exit -1 -fi - service mst restart >/dev/null 2>&1 if [ "$?" != "0" ] ;then - logger -t xcat -p local4.err "[Error] failed to start mst." - echo "[Error] failed to start mst." - exit -1 -fi - - -#check if mlxconfig is existed -if [ ! -x /usr/bin/mlxconfig ]; then - logger -t xcat -p local4.err "mlxconfig command is not available" - echo "mlxconfig command is not available" - exit -1 + ERRMSG "[Error] failed to start mst." + logerr $ERRMSG + exit 1 fi reboot_flag=0 @@ -79,9 +74,7 @@ done if [[ $reboot_flag == 0 ]]; then echo "Didn't find ConnectX5 Devices, will not apply the new configuration" -fi - -if [[ $reboot_flag == 1 ]]; then +else echo "******************************************************" echo " New configuration applied" echo " Please reboot system to load new configurations" From dc61ea57da18e41be0d51973e679dfe2ab454e49 Mon Sep 17 00:00:00 2001 From: XuWei Date: Sun, 8 Apr 2018 22:27:14 -0400 Subject: [PATCH 06/13] Show error msg when set hostname as IP address --- .../agent/hwctl/executor/openbmc_bmcconfig.py | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_bmcconfig.py b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_bmcconfig.py index 8890f5ce2..1da131af4 100644 --- a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_bmcconfig.py +++ b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_bmcconfig.py @@ -301,9 +301,10 @@ rmdir \"/tmp/$userid\" \n") def _set_hostname(self, hostname, **kw): node = kw['node'] if hostname == '*': - if kw['nodeinfo']['bmc'] == kw['nodeinfo']['bmcip']: - self.callback.info("%s: set BMC ip as BMC Hostname" % node) - hostname = kw['nodeinfo']['bmc'] + if kw['nodeinfo']['bmc'] != kw['nodeinfo']['bmcip']: + hostname = kw['nodeinfo']['bmc'] + else: + return self.callback.error("Invalid OpenBMC Hostname %s, can't set to OpenBMC" % kw['nodeinfo']['bmc'], node) self._set_apis_values("hostname", hostname, **kw) self._get_netinfo(hostname=True, ntpserver=False, **kw) return @@ -383,7 +384,15 @@ rmdir \"/tmp/$userid\" \n") try: obmc.login() obmc.set_apis_values(key, value) - except (SelfServerException, SelfClientException) as e: + except SelfServerException as e: + return self.callback.error(e.message, node) + except SelfClientException: + if e.code == 404: + return self.callback.error('404 Not Found - Requested endpoint does not exists and may \ + indicate function is not supported on this OpenBMC firmware.', node) + if e.code == 403: + return self.callback.error('403 Forbidden - Requested endpoint does not exists and may \ + indicate function is not yet supported by OpenBMC firmware.', node) return self.callback.error(e.message, node) self.callback.info("%s: BMC Setting %s..." % (node, openbmc.RSPCONFIG_APIS[key]['display_name'])) @@ -396,7 +405,15 @@ rmdir \"/tmp/$userid\" \n") obmc.login() value = obmc.get_apis_values(key) - except (SelfServerException, SelfClientException) as e: + except SelfServerException as e: + return self.callback.error(e.message, node) + except SelfClientException: + if e.code == 404: + return self.callback.error('404 Not Found - Requested endpoint does not exists and may \ + indicate function is not supported on this OpenBMC firmware.', node) + if e.code == 403: + return self.callback.error('403 Forbidden - Requested endpoint does not exists and may \ + indicate function is not yet supported by OpenBMC firmware.', node) return self.callback.error(e.message, node) if isinstance(value, dict): From 0560a81e41bf61fccfa3c89bd1730f0fee1800ac Mon Sep 17 00:00:00 2001 From: Matt Ezell Date: Mon, 9 Apr 2018 03:37:56 -0400 Subject: [PATCH 07/13] Remove deprecated SSH option KeyRegenerationInterval from remoteshell (#4599) --- xCAT/postscripts/remoteshell | 2 -- 1 file changed, 2 deletions(-) diff --git a/xCAT/postscripts/remoteshell b/xCAT/postscripts/remoteshell index 3832208c5..5d35add8e 100755 --- a/xCAT/postscripts/remoteshell +++ b/xCAT/postscripts/remoteshell @@ -56,8 +56,6 @@ then #delete all occurance of the attribute and then add xCAT settings sed -i '/X11Forwarding /'d /etc/ssh/sshd_config echo "X11Forwarding yes" >>/etc/ssh/sshd_config - sed -i '/KeyRegenerationInterval /'d /etc/ssh/sshd_config - echo "KeyRegenerationInterval 0" >>/etc/ssh/sshd_config sed -i '/MaxStartups /'d /etc/ssh/sshd_config echo "MaxStartups 1024" >>/etc/ssh/sshd_config From df93416a916eb92e8f51fc0921d3a8a015f2aeb9 Mon Sep 17 00:00:00 2001 From: Bin Xu Date: Mon, 9 Apr 2018 17:40:38 +0800 Subject: [PATCH 08/13] Avoiding error log for `installmonitor` requesting during provisioning (#5069) * (#5067) to avoid error log for `installmonitor` requesting during provisioning * add 2 sec timeout as others for unsupport requesting --- xCAT-server/sbin/xcatd | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 69bef0db1..6c717bebe 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -409,7 +409,7 @@ sub do_installm_service { } } $conn_peer_addr = $conn->peerhost(); - xCAT::MsgUtils->trace(0, "I", "xcatd: received a connection request from $conn_peer_addr"); + xCAT::MsgUtils->trace(0, "I", "xcatd: install monitor received a connection request from $conn_peer_addr"); my $client_name; my $client_aliases; @@ -590,11 +590,15 @@ sub do_installm_service { `/usr/bin/cat $myfile | /usr/bin/sed "/BASECUST_REMOVAL/d">/tmp/$text.nimtmp`; `/usr/bin/mv /tmp/$text.nimtmp $myfile`; close($conn); + } elsif ($text =~ /installmonitor/) { + xCAT::MsgUtils->trace(0, "I", "xcatd: handle installmonitor requesting from $text..."); + close($conn); } else { sleep 0.01; chomp $text; xCAT::MsgUtils->trace(0, "E", "xcatd: install monitor does not support \'$text\', the connection request from $conn_peer_addr will be ignored."); close($conn); #close it to avoid the DDOS attack + alarm(2); next; } xCAT::MsgUtils->trace(0, "I", "xcatd: finish a connection request for $node from $conn_peer_addr"); From aef3850b0e98b636541591096e83313387d2702b Mon Sep 17 00:00:00 2001 From: Weihua Hu Date: Tue, 10 Apr 2018 10:17:26 +0800 Subject: [PATCH 09/13] Add more log for SN setup test cases (#5070) --- xCAT-test/autotest/testcase/installation/SN_diskless_setup_case | 2 +- xCAT-test/autotest/testcase/installation/SN_setup_case | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/SN_diskless_setup_case b/xCAT-test/autotest/testcase/installation/SN_diskless_setup_case index 5b1fcafdb..4184572fc 100644 --- a/xCAT-test/autotest/testcase/installation/SN_diskless_setup_case +++ b/xCAT-test/autotest/testcase/installation/SN_diskless_setup_case @@ -116,7 +116,7 @@ cmd:xdsh $$SN "service httpd status" check:rc==0 cmd:xdsh $$SN "service systemd status" #check:rc==0 - +cmd:xdsh $$SN "cat /var/log/xcat/xcat.log" cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-netboot-service|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.org ]; then rm -rf $rootimgdir; mv $rootimgdir.org $rootimgdir; fi check:rc==0 cmd:xdsh $$SN "cat /var/log/xcat/xcat.log" diff --git a/xCAT-test/autotest/testcase/installation/SN_setup_case b/xCAT-test/autotest/testcase/installation/SN_setup_case index 4d0c6baa0..0853c7cd3 100644 --- a/xCAT-test/autotest/testcase/installation/SN_setup_case +++ b/xCAT-test/autotest/testcase/installation/SN_setup_case @@ -90,7 +90,7 @@ check:output=~/install on /install cmd:xdsh $$SN "mount" check:rc==0 check:output=~/tftpboot on /tftpboot - +cmd:xdsh $$SN "cat /var/log/xcat/xcat.log" cmd:if [[ "__GETNODEATTR($$SN,arch)__" =~ "x86_64" ]]; then if [[ "__GETNODEATTR($$SN,os)__" =~ "sles" ]];then xdsh $$SN "zypper -n install perl-Sys-Virt"; elif [[ "__GETNODEATTR($$SN,os)__" =~ "rh" ]];then xdsh $$SN "yum install -y perl-Sys-Virt";fi;fi check:rc==0 cmd:makentp -a From bc0b23fe9c75119229b2e721f427b7f87180f9e8 Mon Sep 17 00:00:00 2001 From: XuWei Date: Mon, 9 Apr 2018 03:30:51 -0400 Subject: [PATCH 10/13] modify rflash args for docopt parse --- xCAT-openbmc-py/lib/python/agent/common/task.py | 1 + .../lib/python/agent/common/utils.py | 2 +- .../agent/hwctl/executor/openbmc_inventory.py | 2 +- .../lib/python/agent/xcatagent/openbmc.py | 3 +++ xCAT-server/lib/xcat/plugins/openbmc2.pm | 17 +++++++++++++++++ 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/xCAT-openbmc-py/lib/python/agent/common/task.py b/xCAT-openbmc-py/lib/python/agent/common/task.py index 899d8fd8b..76f7fa04d 100644 --- a/xCAT-openbmc-py/lib/python/agent/common/task.py +++ b/xCAT-openbmc-py/lib/python/agent/common/task.py @@ -54,6 +54,7 @@ class ParallelNodesCommand(BaseCommand): """ self.inventory = inventory self.callback = callback + self.cwd = kwargs.get('cwd') self.debugmode = kwargs.get('debugmode') self.verbose = kwargs.get('verbose') diff --git a/xCAT-openbmc-py/lib/python/agent/common/utils.py b/xCAT-openbmc-py/lib/python/agent/common/utils.py index a2f2e00b0..84e925d9a 100644 --- a/xCAT-openbmc-py/lib/python/agent/common/utils.py +++ b/xCAT-openbmc-py/lib/python/agent/common/utils.py @@ -98,7 +98,7 @@ def mask_int2str(mask_int): def get_full_path(cwd, directory): if not os.path.isabs(directory): - directory = '%s/%s' % (cwd, directory) + directory = os.path.join(cwd, directory) return directory class Messager(object): diff --git a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_inventory.py b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_inventory.py index 8fdf93368..a59bd14a6 100644 --- a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_inventory.py +++ b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_inventory.py @@ -34,7 +34,7 @@ class OpenBMCInventoryTask(ParallelNodesCommand): if 'version=' in line: version = line.split('=')[-1].strip() if 'purpose=' in line: - purpose = line.split('=')[-1].strip().split('.')[-1] + purpose = line.split('=')[-1].strip() if version and purpose: break diff --git a/xCAT-openbmc-py/lib/python/agent/xcatagent/openbmc.py b/xCAT-openbmc-py/lib/python/agent/xcatagent/openbmc.py index c7cf2a85c..11f35da34 100644 --- a/xCAT-openbmc-py/lib/python/agent/xcatagent/openbmc.py +++ b/xCAT-openbmc-py/lib/python/agent/xcatagent/openbmc.py @@ -190,6 +190,9 @@ class OpenBMCManager(base.BaseManager): try: opts = docopt(rflash_usage, argv=args) self.verbose = opts.pop('--verbose') + except DocoptExit as e: + self.messager.error("Failed to parse args by docopt: %s" % e) + return except Exception as e: self.messager.error("Failed to parse arguments for rflash: %s" % args) return diff --git a/xCAT-server/lib/xcat/plugins/openbmc2.pm b/xCAT-server/lib/xcat/plugins/openbmc2.pm index ce5c73f93..84b952049 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc2.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc2.pm @@ -508,6 +508,23 @@ sub refactor_args { unshift @$extrargs, "list"; } } + if ($command eq "rflash") { + my @new_args = ('') x 4; + foreach my $tmp (@$extrargs) { + if ($tmp =~ /^-/) { + if ($tmp !~ /^-V$|^--verbose$/) { + $new_args[0] = $tmp; + } elsif ($tmp =~ /^--no-host-reboot$/) { + $new_args[2] = $tmp; + } else { + $new_args[3] = $tmp; + } + } else { + $new_args[1] = $tmp; + } + } + @$extrargs = grep(/.+/, @new_args); + } return 0; } From a1e2a1c10f53fcf1fe2d7d340fba2f49283ebd4e Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Mon, 9 Apr 2018 22:41:03 -0400 Subject: [PATCH 11/13] fix bug of test case go_xcat_with_x --- xCAT-test/autotest/testcase/go-xcat/case1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/go-xcat/case1 b/xCAT-test/autotest/testcase/go-xcat/case1 index c2eac9449..ee34b3ceb 100644 --- a/xCAT-test/autotest/testcase/go-xcat/case1 +++ b/xCAT-test/autotest/testcase/go-xcat/case1 @@ -53,10 +53,9 @@ cmd:xdsh $$CN "rm -rf /tmp/go-xcat.log" cmd:migration_version=`echo $$MIGRATION2_VERSION |cut -d "." -f -2`; xdsh $$CN "cd /; ./go-xcat -x $migration_version -y install" check:rc==0 cmd:xdsh $$CN "cat /tmp/go-xcat.log" -cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" |tee /tmp/version check:rc==0 cmd:migration_version=`echo $$MIGRATION2_VERSION |cut -d "." -f -2`;cd /;if grep Ubuntu /etc/*release;then cd / ; wget http://xcat.org/files/xcat/repos/apt/$migration_version/xcat-core/buildinfo;else cd / ; wget http://xcat.org/files/xcat/repos/yum/$migration_version/xcat-core/buildinfo; fi -cmd:xdsh $$CN "lsxcatd -v" |tee /tmp/version cmd:if [ -e /buildinfo ]; then xcatversion=`grep VERSION /buildinfo |awk -F'=' '{print $2}'`;grep $xcatversion /tmp/version; fi check:rc==0 cmd:migration_version=`echo $$MIGRATION2_VERSION |cut -d "." -f -2`;grep $migration_version /tmp/version From ba32210e9bac9a6e5681ba19b7933d7e587bfd95 Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 10 Apr 2018 02:54:48 -0400 Subject: [PATCH 12/13] modified depending on comments --- .../lib/python/agent/hwctl/executor/openbmc_bmcconfig.py | 8 ++++---- xCAT-server/lib/xcat/plugins/openbmc.pm | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_bmcconfig.py b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_bmcconfig.py index 1da131af4..4ae5f1eff 100644 --- a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_bmcconfig.py +++ b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_bmcconfig.py @@ -388,10 +388,10 @@ rmdir \"/tmp/$userid\" \n") return self.callback.error(e.message, node) except SelfClientException: if e.code == 404: - return self.callback.error('404 Not Found - Requested endpoint does not exists and may \ + return self.callback.error('404 Not Found - Requested endpoint does not exist or may \ indicate function is not supported on this OpenBMC firmware.', node) if e.code == 403: - return self.callback.error('403 Forbidden - Requested endpoint does not exists and may \ + return self.callback.error('403 Forbidden - Requested endpoint does not exist or may \ indicate function is not yet supported by OpenBMC firmware.', node) return self.callback.error(e.message, node) @@ -409,10 +409,10 @@ rmdir \"/tmp/$userid\" \n") return self.callback.error(e.message, node) except SelfClientException: if e.code == 404: - return self.callback.error('404 Not Found - Requested endpoint does not exists and may \ + return self.callback.error('404 Not Found - Requested endpoint does not exist or may \ indicate function is not supported on this OpenBMC firmware.', node) if e.code == 403: - return self.callback.error('403 Forbidden - Requested endpoint does not exists and may \ + return self.callback.error('403 Forbidden - Requested endpoint does not exist or may \ indicate function is not yet supported by OpenBMC firmware.', node) return self.callback.error(e.message, node) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index da29a7120..d5671b12b 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -2423,7 +2423,7 @@ sub deal_with_response { my $log_id = (split ('/', $cur_url))[5]; $error = "Invalid ID=$log_id provided to be resolved. [$::RESPONSE_FORBIDDEN]"; } else{ - $error = "$::RESPONSE_FORBIDDEN - Requested endpoint does not exists and may indicate function is not yet supported by OpenBMC firmware."; + $error = "$::RESPONSE_FORBIDDEN - Requested endpoint does not exist or may indicate function is not yet supported by OpenBMC firmware."; } # Handle 404 } elsif ($response->status_line eq $::RESPONSE_NOT_FOUND) { @@ -2434,7 +2434,7 @@ sub deal_with_response { $error = "Invalid ID provided to delete. Use the -l option to view valid firmware IDs."; } elsif (($node_info{$node}{cur_status} eq "RSPCONFIG_API_CONFIG_QUERY_RESPONSE") || ($node_info{$node}{cur_status} eq "RSPCONFIG_API_CONFIG_ATTR_RESPONSE")) { - $error = "$::RESPONSE_NOT_FOUND - Requested endpoint does not exists and may indicate function is not supported on this OpenBMC firmware."; + $error = "$::RESPONSE_NOT_FOUND - Requested endpoint does not exist or may indicate function is not supported on this OpenBMC firmware."; } else { $error = "[" . $response->code . "] " . $response_info->{'data'}->{'description'}; } From 17793bc3640ea635a4e66c0753824f6530aff5c1 Mon Sep 17 00:00:00 2001 From: Yuan Bai Date: Tue, 10 Apr 2018 16:36:00 +0800 Subject: [PATCH 13/13] delete password from log for runsqlcmd (#5075) --- xCAT-server/sbin/runsqlcmd | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-server/sbin/runsqlcmd b/xCAT-server/sbin/runsqlcmd index 4247a4e4d..7b9137f24 100755 --- a/xCAT-server/sbin/runsqlcmd +++ b/xCAT-server/sbin/runsqlcmd @@ -356,6 +356,7 @@ sub runpgsqlcmd if ($? > 0) # error { $rc = $? >> 8; + $cmd = "PGPASSWORD=xxxxxx $psql -d $dbname -h $hostname -U $admin -f $file "; xCAT::MsgUtils->message("SE", "The command $cmd had errors. Return=$rc"); }