Skip to content

Conversation

@manfrednde
Copy link

…et to dhcp

This code change is to solve the issue where the network interface is specified in the payload and it is set to dhcp. The payload may look like the following in this case:

{
"options": {
"defaults": {
"version": "6.0",
"repo": "http://172.31.128.1:9080/esxi/esxi6",
"networkDevices":[{"device": "vmnic2"}]
}
}
}
It looks like when the host try to download the call back script the link is not ready. So I included a retry option in the kickstart script.

@RackHD/corecommitters

@stuart-stanley

@derrickostertag

@johren

@manfrednde
Copy link
Author

@jimturnquist

#
# Try to download call back script 60 times 1 second
# sleep in between to allow link to be up after DHCP
for retry in $(awk 'BEGIN { for ( i=0; i<60; i++ ) { print i; } }');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This iteration technique seems overly complex. How about:

for retry in $(seq 1 60); do
...
...
done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the question is if busy box supports the above iteration pattern. I will check...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just ran under busy box and the iteration form above worked fine.

Copy link
Contributor

@jimturnquist jimturnquist Jan 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Busy box v1.21.1

If you want to test run your sample commands:

turnqj1@lab03:~$ busybox sh

BusyBox v1.21.1 (Ubuntu 1:1.21.0-1ubuntu1) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/emc/turnqj1 $

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I will try your suggestions

Copy link
Author

@manfrednde manfrednde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#
# Try to download call back script 60 times 1 second
# sleep in between to allow link to be up after DHCP
for retry in $(awk 'BEGIN { for ( i=0; i<60; i++ ) { print i; } }');
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I will try your suggestions

@yyscamper
Copy link
Contributor

@manfrednde change logger to echo is better for me as well. Do you have ever tried if on-syslog is down, whether the logger command will fail and continue to fail the whole installation?

Meanwhile, I'd suggest you use the -p to specify the logger level, so that user not feel it is a bug while seeing "Failed to download call back script after 1 attempt"

-p, --priority priority
              Enter the message into the log with the specified priority.  The priority may be specified numerically or as a facility.level pair.  For example, -p local3.info logs the message
              as informational in the local3 facility.  The default is user.notice.

@manfrednde
Copy link
Author

@yyscamper
@jimturnquist

Please review above change

@jimturnquist
Copy link
Contributor

Could we catch the case where the retries were exhausted and report via user.err? Something like:

if [ $retry -eq 60 ]; then
logger -p user.err "Failed to download RackHD's call back script, kickstart failed"
fi

@manfrednde
Copy link
Author

Thanks Jim I will add that case but executing the kickstart file will not fail

@manfrednde
Copy link
Author

@jimturnquist
@yyscamper
Please review new change

else
logger -p user.info "Failed to download RackHD's call back script after $retry attempt(s)."
sleep 1
if [ $retry -eq 60 ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to just check it once after the loop is finished instead of every iteration.

@manfrednde
Copy link
Author

@jimturnquist
@yyscamper

@JenkinsRHD
Copy link
Contributor

BUILD on-http #3009 : UNSTABLE

BUILD smoke-test #4067 Error Logs ▼Test Name: test_sel_overflow Error Details: 'SEL Record ID' -------------------- >> begin captured logging << -------------------- root: INFO: +186+186+186+186+186 root: INFO: -------STARTING TEST: proboscis.case.MethodTest (test_sel_overflow)-------- root: INFO: +186+186+186+186+186 --------------------- >> end captured logging << --------------------- Stack Trace: File "/usr/lib/python2.7/unittest/case.py", line 331, in run testMethod() File "/usr/lib/python2.7/unittest/case.py", line 1043, in runTest self._testFunc() File "/home/jenkins/workspace/on-http/RackHD/test/.venv/on-build-config/local/lib/python2.7/site-packages/proboscis/case.py", line 296, in testng_method_mistake_capture_func compatability.capture_type_error(s_func) File "/home/jenkins/workspace/on-http/RackHD/test/.venv/on-build-config/local/lib/python2.7/site-packages/proboscis/compatability/exceptions_2_6.py", line 27, in capture_type_error func() File "/home/jenkins/workspace/on-http/RackHD/test/.venv/on-build-config/local/lib/python2.7/site-packages/proboscis/case.py", line 350, in func func(test_case.state.get_state()) File "/home/jenkins/workspace/on-http/RackHD/test/tests/api/v2_0/sel_alert_poller_tests.py", line 162, in test_sel_overflow LOG.info(selInfoObj["SEL Record ID"][0]) "'SEL Record ID'\n-------------------- >> begin captured logging << --------------------\nroot: INFO: +186+186+186+186+186\nroot: INFO: -------STARTING TEST: proboscis.case.MethodTest (test_sel_overflow)--------\nroot: INFO: +186+186+186+186+186\n--------------------- >> end captured logging << ---------------------"

@PengTian0
Copy link
Contributor

test this please

@manfrednde
Copy link
Author

@johren

Can you please check the above changes and merge if all good ?

Thank you
Manfred

Copy link
Contributor

@brianparry brianparry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@brianparry brianparry merged commit ad03599 into RackHD:master Jan 10, 2017
@JenkinsRHD JenkinsRHD mentioned this pull request Sep 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants