Handling DHCP timeouts in script
|
2012-11-06, 06:16
Post: #1
|
|||
|
|||
Handling DHCP timeouts in script
I've got an iPXE setup that is scripted to boot off an iSCSI target. I followed the examples for handling dhcp timeouts/errors, but I'm still getting random machines that timeout on the dhcp request and exit the script. The booting system displays "Connection timed out" and "No more network devices" errors and then exits back to the BIOS. I can't for the life of me figure out why. Can someone point out my error in the following script:
#!ipxe :retry_dhcp dhcp && isset ${filename} || goto retry_dhcp set initiator-iqn iqn.2010-04.org.ipxe:${mac:hexhyp} :iscsiboot sanboot iscsi:10.0.0.1:::0:iqn.2008-08.com.target:prod-disk1 || sleep 3 goto iscsiboot |
|||
2012-11-06, 09:03
Post: #2
|
|||
|
|||
RE: Handling DHCP timeouts in script
Your script is almost good. I believe the isset in the dhcp line starts a new conditional, so if dhcp fails, it will indeed exit.
I would do something like this instead: Code: :retry_dhcp Then again, I don't understand why you check if the ${filename} variable is set, when you don't use it later. I would just skip that line, as it doesn't really make any difference in your script. After all, if the dhcp fails to retrieve an IP it will fail and go back to retry_dhcp. You might want to consider jumping back to :retry_dhcp instead of :iscsiboot if the sanboot fails, as it will just be standing there looping on trying to connect to the same target if it isn't able to connect. Depending on your setup, that might be exactly what you want, but redoing the dhcp and trying to connect again seems like a more robust setup. |
|||
2012-11-06, 17:06
Post: #3
|
|||
|
|||
RE: Handling DHCP timeouts in script
I was using that method since it was a copy and paste straight off the ipxe.org website as how to deal with retrying DHCP requests if they fail. So the site is wrong? I realize there's the extra check for the boot filename, but I tried your approach earlier and it didn't seem to work. I'll give it a go again. Good point on looping back to dhcp if sanboot fails. Thanks!
|
|||
2012-11-08, 17:45
Post: #4
|
|||
|
|||
RE: Handling DHCP timeouts in script
Indeed the example at http://ipxe.org/cmd/dhcp is similar to your script. To be absolutely certain I think you should ask the developer mailing list for the exact behavior of the branching logic.
|
|||
2012-11-08, 21:50
Post: #5
|
|||
|
|||
RE: Handling DHCP timeouts in script
(2012-11-06 17:06)digitalis99 Wrote: I was using that method since it was a copy and paste straight off the ipxe.org website as how to deal with retrying DHCP requests if they fail. So the site is wrong? I realize there's the extra check for the boot filename, but I tried your approach earlier and it didn't seem to work. I'll give it a go again. Good point on looping back to dhcp if sanboot fails. Thanks! Did you see the "Retry DHCP indefinitely until it succeeds" on that page? It seems you were looking at the "Notes" section, instead, which deals with a particular scenario that doesn't seem relevant to your original post. |
|||
2012-11-09, 09:36
Post: #6
|
|||
|
|||
RE: Handling DHCP timeouts in script
@Sha0: Yes, we were indeed looking at the "Notes" section. In particular, I was wondering what the behavior is when you have nested conditionals like this. Would the goto at the end of the line be based on the return code from dhcp or isset? I'm assuming isset. And in that particular case, if dhcp fails, it will indeed throw an exception and abort the script (which I seem to recall was his original problem).
|
|||
2012-11-13, 04:39
Post: #7
|
|||
|
|||
RE: Handling DHCP timeouts in script
I can't get a retry in either error phase of my script, the DHCP request or the sanboot. Any error in either one generates the "No more network devices" prompt, at which point I'm dumped back to the BIOS. There doesn't appear to be any error handling at all. My current script is quite simple. I can't see why neither goto is working...
#!ipxe :retry_dhcp dhcp || goto retry_dhcp set initiator-iqn iqn.2010-04.org.ipxe:${mac:hexhyp} sanboot iscsi:10.0.0.1:::0:iqn.2008-08.com.target:prod-disk1 || sleep 1 goto retry_dhcp |
|||
2012-11-13, 23:42
Post: #8
|
|||
|
|||
RE: Handling DHCP timeouts in script
Are you sure your device is actually supported? If you're using undionly.kpxe and chainloading things should just work, but if you're using ipxe.usb/iso/pxe you might have an unsupported network card. Have you verified that your card is in the list generated by the script below?
Code: src/util/niclist.pl --format csv Run it from the ipxe git checkout folder. |
|||
2012-11-13, 23:50
Post: #9
|
|||
|
|||
RE: Handling DHCP timeouts in script
I'm chainloading undionly.kpxe. Most of the boot attempts work, but when they don't, neither of the retry actions appear to retry. They exit instead.
|
|||
2012-11-14, 10:02
Post: #10
|
|||
|
|||
RE: Handling DHCP timeouts in script
I'm stumped. I suggest you try to email the mailing-list. Hopefully someone can shine some light on things there.
|
|||
2012-11-15, 01:40
Post: #11
|
|||
|
|||
RE: Handling DHCP timeouts in script
Done, hopefully I can get some answers.
|
|||
2012-11-24, 20:32
Post: #12
|
|||
|
|||
RE: Handling DHCP timeouts in script
It works for me... I do something a little less "aggressive" in my undionly script... I have to slow things down a bit to avoid possible issues with ports getting shutdown for too many broadcasts on an interface (an issue with highly subscribed virtualization farms).
Code: #!ipxe "Thus far, you have been adrift within the sheltered harbor of my patience..." |
|||
2012-11-25, 00:57
Post: #13
|
|||
|
|||
RE: Handling DHCP timeouts in script
If whitespace were an issue, then I'd think the entire script wouldn't work. It works fine as long as none of the steps error out.
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)