diff --git a/docs/source/advanced/gpu/nvidia/osimage/rhels.rst b/docs/source/advanced/gpu/nvidia/osimage/rhels.rst index 77dee5f3f..a810fddee 100644 --- a/docs/source/advanced/gpu/nvidia/osimage/rhels.rst +++ b/docs/source/advanced/gpu/nvidia/osimage/rhels.rst @@ -189,24 +189,24 @@ xCAT includes a script, ``cuda_power9_setup`` as example, to help user handle th Diskful osimage ^^^^^^^^^^^^^^^ -For diskful deployment, there is no need to change the osimage definition. Instead, add this postscript to your compute node postbootscrtips list. +For diskful deployment, there is no need to change the osimage definition. Instead, add this postscript to your compute node postbootscrtips list. :: - chdef p9compute -p postbootscripts=cuda_power9_setup + chdef p9compute -p postscripts=cuda_power9_setup -Disless osimage -^^^^^^^^^^^^^^^ +Diskless osimage +^^^^^^^^^^^^^^^^ -For diskless deployment, the script need to add to the postinstall script of the osimage. And it should be run in the chroot environment. Please refer the following commands as an example. +For diskless deployment, the script need to add to the postinstall script of the osimage. And it should be run in the chroot environment. Please refer the following commands as an example. :: - mkdir -p /install/custom/netboot - cp /opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall /opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall + mkdir -p /install/custom/netboot/rh + cp /opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall /install/custom/netboot/rh/cudafull.rhels7.ppc64le.postinstall - cat >>/install/custom/netboot/rh/cudafull.rhels7.ppc64le.postinstall <-EOF + cat >>/install/custom/netboot/rh/cudafull.rhels7.ppc64le.postinstall <<-EOF - cp /install/postscripts/cuda_power9_setup /install/netboot/rhels7.5/ppc64le/compute/rootimg/tmp/cuda_power9_setup" - chroot /install/netboot/rhels7.5/ppc64le/compute/rootimg" /tmp/cuda_power9_setup + cp /install/postscripts/cuda_power9_setup \$installroot/tmp/cuda_power9_setup + chroot \$installroot /tmp/cuda_power9_setup - rm -f /install/netboot/rhels7.5/ppc64le/compute/rootimg/tmp/cuda_power9_setup + rm -f \$installroot/tmp/cuda_power9_setup EOF - chdef -t osimage rhels7.5-ppc64le-netboot-cudafull postinstall=/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall + chdef -t osimage rhels7.5-ppc64le-netboot-cudafull postinstall=/install/custom/netboot/rh/cudafull.rhels7.ppc64le.postinstall diff --git a/docs/source/advanced/restapi/restapi_resource/restapi_reference.rst b/docs/source/advanced/restapi/restapi_resource/restapi_reference.rst index d8b74d00d..b641252be 100644 --- a/docs/source/advanced/restapi/restapi_resource/restapi_reference.rst +++ b/docs/source/advanced/restapi/restapi_resource/restapi_reference.rst @@ -15,7 +15,7 @@ POST - Create a token. **Example:** -Aquire a token for user 'root'. :: +Acquire a token for user 'root'. :: curl -X POST -k 'https://127.0.0.1/xcatws/tokens?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"userName":"root","userPW":"cluster"}' diff --git a/docs/source/advanced/restapi/restapi_setup/restapi_setup.rst b/docs/source/advanced/restapi/restapi_setup/restapi_setup.rst index 84e15230f..b7e6454d7 100644 --- a/docs/source/advanced/restapi/restapi_setup/restapi_setup.rst +++ b/docs/source/advanced/restapi/restapi_setup/restapi_setup.rst @@ -154,3 +154,5 @@ You should see some output that includes your list of nodes. If errors returned, check `/var/log/httpd/ssl_error_log` on xCAT MN. +``Note:`` if passwords need to be changed in the future, make sure to update the xCAT passwd table. xCAT REST API uses passwords stored in that table to authenticate users. + diff --git a/docs/source/advanced/restapi/restapi_usage/restapi_usage.rst b/docs/source/advanced/restapi/restapi_usage/restapi_usage.rst index 301a0a770..09c65095c 100644 --- a/docs/source/advanced/restapi/restapi_usage/restapi_usage.rst +++ b/docs/source/advanced/restapi/restapi_usage/restapi_usage.rst @@ -37,14 +37,14 @@ where: Example: :: - curl -X GET --cacert /root/ca-cert.pem 'https:///xcatws/nodes?userName=root&userPW=cluster' + curl -X GET -k 'https:///xcatws/nodes?userName=root&userPW=cluster' Access Token ------------ xCAT also supports the use the Access Token to replace the using of username+password in every access. Before accessing any resource, you need get a token with your account (username+password) :: - # curl -X POST --cacert /root/ca-cert.pem \ + # curl -X POST -k \ 'https:///xcatws/tokens?pretty=1' -H Content-Type:application/json --data \ '{"userName":"root","userPW":"cluster"}' { @@ -56,7 +56,7 @@ xCAT also supports the use the Access Token to replace the using of username+pas Then in the subsequent REST API access, the token can be used to replace the user account (username+password) :: - curl -X GET --cacert /root/ca-cert.pem -H X-Auth-Token:5cabd675-bc2e-4318-b1d6-831fd1f32f97 'https:///xcatws/? + curl -X GET -k -H X-Auth-Token:5cabd675-bc2e-4318-b1d6-831fd1f32f97 'https:///xcatws/? The validity of token is 24 hours. If an old token has expired, you will get a 'Authentication failure' error. Then you need reacquire a token with your account. @@ -183,10 +183,17 @@ Testing the API Normally you will make REST API calls from your code. You can use any language that has REST API bindings (most modern languages do). +An Example of How to Use xCAT REST API from Python +-------------------------------------------------- + +Refer to the file `/opt/xcat/ws/xcatws-test.py `_: :: + + ./xcatws-test.py --user wsuser -password cluster_rest --xcatmn + An Example of How to Use xCAT REST API from PERL ------------------------------------------------ -Refer to the file /opt/xcat/ws/xcatws-test.pl: :: +Refer to the file `/opt/xcat/ws/xcatws-test.pl `_: :: ./xcatws-test.pl -m GET -u "https://127.0.0.1/xcatws/nodes?userName=root&userPW=cluster" @@ -202,9 +209,9 @@ It can be used as an example script to access and control xCAT resources. From t ./xcatws-test.sh -u root -p cluster -h -t ./xcatws-test.sh -u root -p cluster -h -c -t -But for exploration and experimentation, you can make API calls from your browser or using the **curl** command. +But for exploration and experimentation, you can make API calls from your browser or by using the **curl** command. -To make an API call from your browser, uses the desired URL from this document. To simplify the test step, all the examples for the resources uses 'curl -k' to use insecure http connection and use the 'username+password' to authenticate the user. :: +To make an API call from your browser, use the desired URL from this document. To simplify the test step, all the examples for the resources use 'curl -k' for unsecure http connection and use the 'username+password' to authenticate the user. :: curl -X GET -k 'https://myserver/xcatws/nodes?userName=xxx&userPW=xxx&pretty=1' diff --git a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_flash.py b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_flash.py index ffaa051a1..e24a70031 100644 --- a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_flash.py +++ b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_flash.py @@ -98,7 +98,7 @@ class OpenBMCFlashTask(ParallelNodesCommand): os.makedirs(XCAT_LOG_RFLASH_DIR) if activate_arg.endswith('.tar'): - version = self._get_firmware_version() + version = self._get_firmware_version(self.firmware_file) self.firmware.update(version) self.callback.info('Attempting to upload %s, please wait...' % self.firmware_file) else: diff --git a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_sensor.py b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_sensor.py index 7abd4c31d..12ccefaa7 100644 --- a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_sensor.py +++ b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_sensor.py @@ -34,27 +34,26 @@ class OpenBMCSensorTask(ParallelNodesCommand): def _get_beacon_info(self, beacon_dict, display_type='full'): + led_label = 'LEDs' info_list = [] # display_type == 'full' for detailed output for 'rvitals leds' command # display_type == 'compact' for compact output for 'rbeacon stat' command if display_type == 'compact': - info_list.append('Front:%s Rear:%s' % (beacon_dict.get('front_id'), beacon_dict.get('rear_id', 'N/A'))) + info_list.append('Front:%s Rear:%s' % (beacon_dict.get('front_id'), beacon_dict.get('rear_id', 'N/A'))) return info_list - info_list.append('Front . . . . . : Power:%s Fault:%s Identify:%s' % - (beacon_dict.get('front_power', 'N/A'), - beacon_dict.get('front_fault', 'N/A'), - beacon_dict.get('front_id', 'N/A'))) - if (beacon_dict.get('fan0', 'N/A') == 'Off' and beacon_dict.get('fan1', 'N/A') == 'Off' and - beacon_dict.get('fan2', 'N/A') == 'Off' and beacon_dict.get('fan3', 'N/A') == 'Off'): - info_list.append('Front Fans . . : No LEDs On') - else: - info_list.append('Front Fans . . : fan0:%s fan1:%s fan2:%s fan3:%s' % - (beacon_dict.get('fan0', 'N/A'), beacon_dict.get('fan1', 'N/A'), - beacon_dict.get('fan2', 'N/A'), beacon_dict.get('fan3', 'N/A'))) - info_list.append('Rear . . . . . : Power:%s Fault:%s Identify:%s' % - (beacon_dict.get('rear_power', 'N/A'), - beacon_dict.get('rear_fault', 'N/A'), - beacon_dict.get('rear_id', 'N/A'))) + + for i in range(4): + info_list.append('%s Fan%s: %s' % (led_label, i, beacon_dict.get('fan' + str(i), 'N/A'))) + + led_types = ('Fault', 'Identify', 'Power') + for i in ('Front', 'Rear'): + for led_type in led_types: + tmp_type = led_type.lower() + if led_type == 'Identify': + tmp_type = 'id' + key_type = i.lower() + '_' + tmp_type + info_list.append('%s %s %s: %s' % (led_label, i, led_type, beacon_dict.get(key_type, 'N/A'))) + return info_list diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index f576e20a5..5a1723ef7 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1863,6 +1863,10 @@ sub parse_command_status { $next_status{LOGIN_RESPONSE} = "RVITALS_REQUEST"; $next_status{RVITALS_REQUEST} = "RVITALS_RESPONSE"; $status_info{RVITALS_RESPONSE}{argv} = "$subcommand"; + if ($subcommand eq "all") { + $next_status{RVITALS_RESPONSE} = "RVITALS_LEDS_REQUEST"; + $next_status{RVITALS_LEDS_REQUEST} = "RVITALS_LEDS_RESPONSE"; + } } } @@ -4150,17 +4154,23 @@ sub rvitals_response { push (@sorted_output, $content_info); } else { # Full output for "rvitals leds" command - $content_info = "Front . . . . . : Power:$leds{front_power} Fault:$leds{front_fault} Identify:$leds{front_id}"; - push (@sorted_output, $content_info); - $content_info = "Rear . . . . . : Power:$leds{rear_power} Fault:$leds{rear_fault} Identify:$leds{rear_id}"; - push (@sorted_output, $content_info); - # Fans - if ($leds{fan0} =~ "Off" and $leds{fan1} =~ "Off" and $leds{fan2} eq "Off" and $leds{fan3} eq "Off") { - $content_info = "Front Fans . . : No LEDs On"; - } else { - $content_info = "Front Fans . . : fan0:$leds{fan0} fan1:$leds{fan1} fan2:$leds{fan2} fan3:$leds{fan3}"; - } - push (@sorted_output, $content_info); + my @front_rear = ("Front", "Rear"); + my @led_types = ("Power", "Fault", "Identify"); + foreach my $i (@front_rear) { + foreach my $led_type (@led_types) { + my $tmp_type = lc($led_type); + $tmp_type = "id" if ($led_type eq "Identify"); + my $key_type = lc($i) . "_" . $tmp_type; + $content_info = "LEDs $i $led_type: $leds{$key_type}"; + push (@sorted_output, $content_info); + } + } + # Fans + for (my $i = 0; $i < 4; $i++) { + my $tmp_key = "fan" . $i; + $content_info = "LEDs Fan$i: $leds{$tmp_key}"; + push (@sorted_output, $content_info); + } } } diff --git a/xCAT-server/xCAT-wsapi/xcatws-test.py b/xCAT-server/xCAT-wsapi/xcatws-test.py new file mode 100755 index 000000000..7fa06322a --- /dev/null +++ b/xCAT-server/xCAT-wsapi/xcatws-test.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python +"""Usage: + xcatws_test.py [--xcatmn=] [--user=] [--password=] +""" +import requests +import json +import sys + +XCATMN = "127.0.0.1" +username = "wsuser" +password = "cluster_rest" +# +# Gather user inputs if any, otherwise defaults above are used +# +try: + from docopt import docopt, DocoptExit + arguments = docopt(__doc__) + if arguments['--xcatmn']: + XCATMN = arguments['--xcatmn'] + if arguments['--user']: + username = arguments['--user'] + if arguments['--password']: + password = arguments['--password'] +except ImportError: + print "WARNING: docopt is not installed, will continue with hard coded defaults..." +except DocoptExit as e: + # Invalid arguments + print e + sys.exit(1) + +REST_ENDPOINT = "https://" + XCATMN + "/xcatws" +create_node = REST_ENDPOINT + "/nodes/" +get_all_nodes = REST_ENDPOINT + "/nodes/" +get_token = REST_ENDPOINT + "/tokens" + +# +# Create a test node object +# +testnode_name = "rest_api_node" +testnode_group = "all" +testnode_mgt = "ipmi" +testnode_data = {'groups': testnode_group,'mgt': testnode_mgt} +try: + new_node = requests.post(create_node + testnode_name + "?userName=" + username + "&userPW=" + password, verify=False, headers={'Content-Type': 'application/json'}, data=json.dumps(testnode_data)) + + if new_node.content: + # Display node creation error + print "Failed to create new node " + testnode_name + print new_node.content + sys.exit(1) + else: + print "New node definition created for " + testnode_name + ".\n" +except requests.exceptions.HTTPError as e: + print ("Http Error:",e) + sys.exit(1) +except requests.exceptions.ConnectionError as e: + print "Error connecting to xCAT management node " + XCATMN + print e + sys.exit(1) +except requests.exceptions.Timeout as e: + print "Timeout connecting to xCAT management node " + XCATMN + print e + sys.exit(1) +except requests.exceptions.RequestException as e: + print "Unexpected error connecting to xCAT management node " + XCATMN + print e + sys.exit(1) +except AttributeError as e: + print "AttributeError caught, you may need to update the Perl libraries." + print e + sys.exit(1) +except Exception as e: + print "Unexpected error." + print e + sys.exit(1) + +# +# Send a request to get all nodes, passing in user and password +# +all_nodes = requests.get(get_all_nodes + "?userName=" + username + "&userPW=" + password, verify=False) + +# Display returned data +print "List of all nodes extracted with userid and password:" +print all_nodes.content +# +# Send a request to get all nodes, passing in a token +# +user_data = {'userName': username,'userPW': password} +token = requests.post(get_token, verify=False, headers={'Content-Type': 'application/json'}, data=json.dumps(user_data)) +all_nodes = requests.get(get_all_nodes, verify=False, headers={'X-Auth-Token': token.json()['token']['id']}) + +# Display returned data +print "List of all nodes extracted with authentication token:" +print all_nodes.content + +sys.exit(0) diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index 099a905bd..84bd7c184 100755 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -1251,7 +1251,7 @@ my %URIdef = ( POST => { desc => "Create a token.", usage => "||An array of all the global configuration list.|", - example => "|Aquire a token for user \'root\'.|POST|/tokens {\"userName\":\"root\",\"userPW\":\"cluster\"}|{\n \"token\":{\n \"id\":\"a6e89b59-2b23-429a-b3fe-d16807dd19eb\",\n \"expire\":\"2014-3-8 14:55:0\"\n }\n}|", + example => "|Acquire a token for user \'root\'.|POST|/tokens {\"userName\":\"root\",\"userPW\":\"cluster\"}|{\n \"token\":{\n \"id\":\"a6e89b59-2b23-429a-b3fe-d16807dd19eb\",\n \"expire\":\"2014-3-8 14:55:0\"\n }\n}|", fhandler => \&nonobjhdl, outhdler => \&tokenout, }, diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat index f2019566a..6fde471d5 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -47,7 +47,7 @@ check:rc==0 check:output=~Provision node\(s\)\: $$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:sleep 900 +cmd:sleep 300 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done cmd:ping $$CN -c 3 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_postscripts_failed b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_postscripts_failed index 3a1d12b57..37f3d0d0f 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_postscripts_failed +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_postscripts_failed @@ -50,7 +50,7 @@ cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-ne check:rc==0 check:output=~Provision node\(s\)\: $$CN -cmd:sleep 900 +cmd:sleep 300 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep failed >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done cmd:ping $$CN -c 3 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy index 920c1d563..d846fca5a 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -53,7 +53,7 @@ check:rc==0 check:output=~Provision node\(s\)\: $$CN cmd:xdsh $$SN "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:sleep 900 +cmd:sleep 300 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done cmd:ping $$CN -c 3 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat index 7cc906537..de1331b54 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -59,7 +59,7 @@ check:rc==0 check:output=~Provision node\(s\)\: $$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:sleep 900 +cmd:sleep 300 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done cmd:ping $$CN -c 3 @@ -97,7 +97,7 @@ check:rc==0 check:output=~Provision node\(s\)\: $$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:sleep 900 +cmd:sleep 300 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done cmd:ping $$CN -c 3 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs index 65ac3cf86..802491f64 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs @@ -79,7 +79,7 @@ check:rc==0 check:output=~Provision node\(s\)\: $$CN cmd:xdsh $$SN "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:sleep 900 +cmd:sleep 300 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done cmd:ping $$CN -c 3 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk index fd7d84f4e..c61e15ac2 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk @@ -73,7 +73,7 @@ check:rc==0 check:output=~Provision node\(s\)\: $$CN cmd:xdsh $$SN "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:sleep 900 +cmd:sleep 300 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done cmd:ping $$CN -c 3 diff --git a/xCAT-test/autotest/testcase/kdump/linux_diskless_kdump b/xCAT-test/autotest/testcase/kdump/linux_diskless_kdump index 5437d5f32..100eb235d 100644 --- a/xCAT-test/autotest/testcase/kdump/linux_diskless_kdump +++ b/xCAT-test/autotest/testcase/kdump/linux_diskless_kdump @@ -35,7 +35,8 @@ check:rc==0 cmd:if [ ! -d /kdumpdir ]; then mkdir -p /kdumpdir && chmod 777 /kdumpdir; fi cmd:if [ ! -f /etc/exports ] ;then touch /etc/exports;else cp /etc/exports /etc/exports.bak;fi -cmd:echo -e "/kdumpdir *(rw,no_root_squash,sync,no_subtree_check)" >> /etc/exports && exportfs /etc/exports fi; +cmd:cat /etc/exports|grep kdumpdir; if [ "$?" -ne "0" ]; then echo "/kdumpdir *(rw,no_root_squash,sync,no_subtree_check)" >> /etc/exports; fi +cmd:cd /etc; export exports;cd -;service nfs restart cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute dump=nfs://$$MN/kdumpdir check:rc==0 @@ -55,7 +56,7 @@ cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-ne check:rc==0 check:output=~Provision node\(s\)\: $$CN -cmd:sleep 900 +cmd:sleep 300 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done cmd:ping $$CN -c 3 @@ -68,9 +69,8 @@ cmd:xdsh $$CN date check:rc==0 check:output=~\d\d:\d\d:\d\d -cmd:xdsh $$CN "echo 1 > /proc/sys/kernel/sysrq" -cmd:xdsh $$CN "echo c > /proc/sysrq-trigger" -cmd:sleep 600 +cmd:xdsh $$CN "setsid 'echo 1 > /proc/sys/kernel/sysrq; echo c > /proc/sysrq-trigger'" +cmd:sleep 300 cmd:vmcorefile=`find /kdumpdir/ -name vmcore`;if [[ -s $vmcorefile ]]; then echo "this file is not empty";else echo "this file is empty"; fi check:output=~not empty diff --git a/xCAT-test/autotest/testcase/rbeacon/cases0 b/xCAT-test/autotest/testcase/rbeacon/cases0 new file mode 100644 index 000000000..bf0343c72 --- /dev/null +++ b/xCAT-test/autotest/testcase/rbeacon/cases0 @@ -0,0 +1,55 @@ +start:rbeacon_null +description: this case is to test rbeacon usage +os:Linux +hcp:openbmc +cmd:rbeacon +check:rc==0 +check:output=~Usage +end + +start:rbeacon_stat +description: this case is to test rbeacon CN stat +os:Linux +hcp:openbmc +cmd:rbeacon $$CN stat +check:rc==0 +check:output=~$$CN\s*:\s*Front:Off Rear:Off|Front:On Rear:On|Front:Off Rear:On|Front:On Rear:Off +end + +start:rbeacon_help +description: this case is to test rbeacon -h and --help output +os:Linux +hcp:openbmc +cmd:rbeacon -h +check:rc==0 +check:output=~Usage +check:output =~OpenPOWER \(OpenBMC\) specific: +cmd:rbeacon --help +check:rc==0 +check:output=~Usage +check:output =~OpenPOWER \(OpenBMC\) specific: +end + +start:rbeacon_version +description: this case is to test rbeacon -v and --version output +os:Linux +hcp:openbmc +cmd:rbeacon -v +check:rc==0 +check:output=~Version +check:output =~git commit +cmd:rbeacon --version +check:rc==0 +check:output=~~Version +check:output =~git commit +end + +start:rbeacon_false +description: this case is to test rbeacon could process false input +os:Linux +hcp:openbmc +cmd:rbeacon $$CN abc +check:rc!=0 +check:output=~$$CN\s*:\s*Error:\s*Only \'on\', \'off\' or \'stat\' is supported +end + diff --git a/xCAT/postscripts/cuda_power9_setup b/xCAT/postscripts/cuda_power9_setup index d2120f465..caf0cddb5 100755 --- a/xCAT/postscripts/cuda_power9_setup +++ b/xCAT/postscripts/cuda_power9_setup @@ -40,3 +40,40 @@ chmod 0644 /usr/lib/systemd/system/nvidia-persistenced.service systemctl enable nvidia-persistenced rm -f /lib/udev/rules.d/40-redhat.rules + +# +# Extra steps for passing parameters to kernel module nvidia +# +mkdir -p /usr/lib/dracut/modules.d/95nvidia +cat >/usr/lib/dracut/modules.d/95nvidia/module-setup.sh <\$initdir/etc/modprobe.d/nvidia.conf +} +EOF + +chmod 0755 /usr/lib/dracut/modules.d/95nvidia/module-setup.sh +echo 'add_dracutmodules+=" nvidia "' >/etc/dracut.conf.d/nvidia_patch.conf + +# Patch for the diskfull environment, or in case kernel module nvidia need to be reloaded +echo 'options nvidia NVreg_RegistryDwords="RMNumaOnlining=0x1;RMNvLinkSpeedControl=0x9;PeerMappingOverride=1"' >/etc/modprobe.d/nvidia.conf + +# Redo the initrd image +kernel_version="$(for d in $(ls /lib/modules | sort -V) ; do : ; done && echo $d)" +mkinitrd -v -f "/boot/initramfs-${kernel_version}.img" "${kernel_version}"