summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-10-02 18:04:43 +0000
committerGerrit Code Review <review@openstack.org>2018-10-02 18:04:43 +0000
commit66de9440d17f603d9bc017217d10c7a3a6683be7 (patch)
tree1072c0e1041286d2c5a13f6dafe004127f38dd64
parentd734925bb6d80bb0fd3970641d7be08a70f1a453 (diff)
parentd8570fe8ada6ad1d1192a5143239770f6ace0dec (diff)
Merge "Improve gate NIC HW compatibility/portability"
-rw-r--r--divingbell/templates/bin/_ethtool.sh.tpl2
-rwxr-xr-xtools/gate/scripts/020-test-divingbell.sh30
2 files changed, 25 insertions, 7 deletions
diff --git a/divingbell/templates/bin/_ethtool.sh.tpl b/divingbell/templates/bin/_ethtool.sh.tpl
index 0f2f497..66e1c86 100644
--- a/divingbell/templates/bin/_ethtool.sh.tpl
+++ b/divingbell/templates/bin/_ethtool.sh.tpl
@@ -76,7 +76,7 @@ add_ethtool_param(){
76 [ "$(echo "${current_val_raw}" | wc -l)" -le 1 ] || 76 [ "$(echo "${current_val_raw}" | wc -l)" -le 1 ] ||
77 die "More than one match for '${user_key}'" 77 die "More than one match for '${user_key}'"
78 [[ ! ${current_val_raw} = *fixed* ]] || 78 [[ ! ${current_val_raw} = *fixed* ]] ||
79 die "'${deivce}' does not permit changing the '${user_key}' setting" 79 die "'${device}' does not permit changing the '${user_key}' setting"
80 if [[ ${current_val_raw} = *off\ \[requested\ on\] ]]; then 80 if [[ ${current_val_raw} = *off\ \[requested\ on\] ]]; then
81 current_val_raw='off' 81 current_val_raw='off'
82 elif [[ ${current_val_raw} = *on\ \[requested\ off\] ]]; then 82 elif [[ ${current_val_raw} = *on\ \[requested\ off\] ]]; then
diff --git a/tools/gate/scripts/020-test-divingbell.sh b/tools/gate/scripts/020-test-divingbell.sh
index 22c3347..7039fda 100755
--- a/tools/gate/scripts/020-test-divingbell.sh
+++ b/tools/gate/scripts/020-test-divingbell.sh
@@ -26,10 +26,13 @@ MOUNTS_PATH3=${MOUNTS_SYSTEMD}3
26ETHTOOL_KEY2=tx-tcp-segmentation 26ETHTOOL_KEY2=tx-tcp-segmentation
27ETHTOOL_VAL2_DEFAULT=on 27ETHTOOL_VAL2_DEFAULT=on
28ETHTOOL_KEY3=tx-tcp6-segmentation 28ETHTOOL_KEY3=tx-tcp6-segmentation
29# Not all NIC hardware has enough ethtool tunables available
30ETHTOOL_KEY3_BACKUP=''
29ETHTOOL_VAL3_DEFAULT=on 31ETHTOOL_VAL3_DEFAULT=on
30ETHTOOL_KEY4=tx-nocache-copy 32ETHTOOL_KEY4=tx-nocache-copy
31ETHTOOL_VAL4_DEFAULT=off 33ETHTOOL_VAL4_DEFAULT=off
32ETHTOOL_KEY5=tx-checksum-ip-generic 34ETHTOOL_KEY5=tx-checksum-ip-generic
35ETHTOOL_KEY5_BACKUP=tx-scatter-gather
33ETHTOOL_VAL5_DEFAULT=on 36ETHTOOL_VAL5_DEFAULT=on
34USERNAME1=userone 37USERNAME1=userone
35USERNAME1_SUDO=true 38USERNAME1_SUDO=true
@@ -59,6 +62,13 @@ for line in ${nic_info}; do
59 fi 62 fi
60done 63done
61[ -n "${DEVICE}" ] || (echo Could not find physical NIC for tesing; exit 1) 64[ -n "${DEVICE}" ] || (echo Could not find physical NIC for tesing; exit 1)
65# Not all hardware has the same NIC tunables to use for testing
66if [[ $(/sbin/ethtool -k "${DEVICE}" | grep "${ETHTOOL_KEY3}:") =~ .*fixed.* ]]; then
67 ETHTOOL_KEY3="${ETHTOOL_KEY3_BACKUP}"
68fi
69if [[ $(/sbin/ethtool -k "${DEVICE}" | grep "${ETHTOOL_KEY5}:") =~ .*fixed.* ]]; then
70 ETHTOOL_KEY5="${ETHTOOL_KEY5_BACKUP}"
71fi
62 72
63exec >& >(while read line; do echo "${line}" | sudo tee -a ${LOG_NAME}; done) 73exec >& >(while read line; do echo "${line}" | sudo tee -a ${LOG_NAME}; done)
64 74
@@ -101,6 +111,9 @@ _write_sysctl(){
101 111
102_write_ethtool(){ 112_write_ethtool(){
103 local cur_val 113 local cur_val
114 if [ -z "${2}" ]; then
115 return
116 fi
104 cur_val="$(/sbin/ethtool -k ${1} | 117 cur_val="$(/sbin/ethtool -k ${1} |
105 grep "${2}:" | cut -d':' -f2 | cut -d' ' -f2)" 118 grep "${2}:" | cut -d':' -f2 | cut -d' ' -f2)"
106 if [ "${cur_val}" != "${3}" ]; then 119 if [ "${cur_val}" != "${3}" ]; then
@@ -126,7 +139,7 @@ init_default_state(){
126 _write_sysctl ${SYSCTL_KEY4} ${SYSCTL_VAL4_DEFAULT} 139 _write_sysctl ${SYSCTL_KEY4} ${SYSCTL_VAL4_DEFAULT}
127 # set ethtool original vals 140 # set ethtool original vals
128 _write_ethtool ${DEVICE} ${ETHTOOL_KEY2} ${ETHTOOL_VAL2_DEFAULT} 141 _write_ethtool ${DEVICE} ${ETHTOOL_KEY2} ${ETHTOOL_VAL2_DEFAULT}
129 _write_ethtool ${DEVICE} ${ETHTOOL_KEY3} ${ETHTOOL_VAL3_DEFAULT} 142 _write_ethtool ${DEVICE} "${ETHTOOL_KEY3}" ${ETHTOOL_VAL3_DEFAULT}
130 _write_ethtool ${DEVICE} ${ETHTOOL_KEY4} ${ETHTOOL_VAL4_DEFAULT} 143 _write_ethtool ${DEVICE} ${ETHTOOL_KEY4} ${ETHTOOL_VAL4_DEFAULT}
131 _write_ethtool ${DEVICE} ${ETHTOOL_KEY5} ${ETHTOOL_VAL5_DEFAULT} 144 _write_ethtool ${DEVICE} ${ETHTOOL_KEY5} ${ETHTOOL_VAL5_DEFAULT}
132 # Remove any created accounts, SSH keys 145 # Remove any created accounts, SSH keys
@@ -403,6 +416,9 @@ test_mounts(){
403} 416}
404 417
405_test_ethtool_value(){ 418_test_ethtool_value(){
419 if [ -z "${1}" ]; then
420 return
421 fi
406 test "$(/sbin/ethtool -k ${DEVICE} | 422 test "$(/sbin/ethtool -k ${DEVICE} |
407 grep "${1}:" | cut -d':' -f2 | tr -d '[:space:]')" = "${2}" 423 grep "${1}:" | cut -d':' -f2 | tr -d '[:space:]')" = "${2}"
408} 424}
@@ -412,17 +428,18 @@ test_ethtool(){
412 local overrides_yaml=${LOGS_SUBDIR}/${FUNCNAME}-set1.yaml 428 local overrides_yaml=${LOGS_SUBDIR}/${FUNCNAME}-set1.yaml
413 local val2=on 429 local val2=on
414 local val3=off 430 local val3=off
431 [ -n "${ETHTOOL_KEY3}" ] && local line2_1="${ETHTOOL_KEY3}: $val3"
415 local val4=off 432 local val4=off
416 echo "conf: 433 echo "conf:
417 ethtool: 434 ethtool:
418 ${DEVICE}: 435 ${DEVICE}:
419 $ETHTOOL_KEY2: $val2 436 $ETHTOOL_KEY2: $val2
420 $ETHTOOL_KEY3: $val3 437 $line2_1
421 $ETHTOOL_KEY4: $val4" > "${overrides_yaml}" 438 $ETHTOOL_KEY4: $val4" > "${overrides_yaml}"
422 install_base "--values=${overrides_yaml}" 439 install_base "--values=${overrides_yaml}"
423 get_container_status ethtool 440 get_container_status ethtool
424 _test_ethtool_value $ETHTOOL_KEY2 $val2 441 _test_ethtool_value $ETHTOOL_KEY2 $val2
425 _test_ethtool_value $ETHTOOL_KEY3 $val3 442 _test_ethtool_value "$ETHTOOL_KEY3" $val3
426 _test_ethtool_value $ETHTOOL_KEY4 $val4 443 _test_ethtool_value $ETHTOOL_KEY4 $val4
427 echo '[SUCCESS] ethtool test1 passed successfully' >> "${TEST_RESULTS}" 444 echo '[SUCCESS] ethtool test1 passed successfully' >> "${TEST_RESULTS}"
428 445
@@ -430,17 +447,18 @@ test_ethtool(){
430 overrides_yaml=${LOGS_SUBDIR}/${FUNCNAME}-set2.yaml 447 overrides_yaml=${LOGS_SUBDIR}/${FUNCNAME}-set2.yaml
431 val2=off 448 val2=off
432 val3=on 449 val3=on
450 [ -n "${ETHTOOL_KEY3}" ] && local line2_2="${ETHTOOL_KEY3}: $val3"
433 val4=on 451 val4=on
434 echo "conf: 452 echo "conf:
435 ethtool: 453 ethtool:
436 ${DEVICE}: 454 ${DEVICE}:
437 $ETHTOOL_KEY2: $val2 455 $ETHTOOL_KEY2: $val2
438 $ETHTOOL_KEY3: $val3 456 $line2_2
439 $ETHTOOL_KEY4: $val4" > "${overrides_yaml}" 457 $ETHTOOL_KEY4: $val4" > "${overrides_yaml}"
440 install_base "--values=${overrides_yaml}" 458 install_base "--values=${overrides_yaml}"
441 get_container_status ethtool 459 get_container_status ethtool
442 _test_ethtool_value $ETHTOOL_KEY2 $val2 460 _test_ethtool_value $ETHTOOL_KEY2 $val2
443 _test_ethtool_value $ETHTOOL_KEY3 $val3 461 _test_ethtool_value "$ETHTOOL_KEY3" $val3
444 _test_ethtool_value $ETHTOOL_KEY4 $val4 462 _test_ethtool_value $ETHTOOL_KEY4 $val4
445 echo '[SUCCESS] ethtool test2 passed successfully' >> "${TEST_RESULTS}" 463 echo '[SUCCESS] ethtool test2 passed successfully' >> "${TEST_RESULTS}"
446 464
@@ -448,7 +466,7 @@ test_ethtool(){
448 install_base 466 install_base
449 get_container_status ethtool 467 get_container_status ethtool
450 _test_ethtool_value $ETHTOOL_KEY2 $ETHTOOL_VAL2_DEFAULT 468 _test_ethtool_value $ETHTOOL_KEY2 $ETHTOOL_VAL2_DEFAULT
451 _test_ethtool_value $ETHTOOL_KEY3 $ETHTOOL_VAL3_DEFAULT 469 _test_ethtool_value "$ETHTOOL_KEY3" $ETHTOOL_VAL3_DEFAULT
452 _test_ethtool_value $ETHTOOL_KEY4 $ETHTOOL_VAL4_DEFAULT 470 _test_ethtool_value $ETHTOOL_KEY4 $ETHTOOL_VAL4_DEFAULT
453 echo '[SUCCESS] ethtool test3 passed successfully' >> "${TEST_RESULTS}" 471 echo '[SUCCESS] ethtool test3 passed successfully' >> "${TEST_RESULTS}"
454 472