From 6da6ace3840d56c7145ddf528bbdcbb813fc6ce2 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Fri, 6 May 2016 13:26:44 +0200 Subject: [inspection] wait for the PXE DHCP by default and remove the carrier check We hoped that checking /sys/class/net/XXX/carrier will allow us to not wait for interfaces that are not connected at all. In reality this field turned out to be unreliable. For example, it is also set to 0 when interface is down or is being configured. The bug https://bugzilla.redhat.com/show_bug.cgi?id=1327255 shows the case when carrier is 0 for all interfaces, including one that is used to post back data, which is obvious non-sense. This change removes check on carrier for the loop. To avoid 60 seconds wait for people with several NIC's, it's changed to only wait for the PXE booting NIC, which obviously must get an IP address. This makes IP addresses in the inspection data for other NIC's somewhat unreliable. A new option inspection_dhcp_all_interfaces is introduced to allow waiting for all NIC's to get IP addresses. This change should finally fix bug 1564954. Change-Id: I8b04bf726980fdcf6bd536c6bb28e30ac50658fb Related-Bug: #1564954 --- ironic_python_agent/cmd/agent.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'ironic_python_agent/cmd') diff --git a/ironic_python_agent/cmd/agent.py b/ironic_python_agent/cmd/agent.py index fc8b9267..8cec4999 100644 --- a/ironic_python_agent/cmd/agent.py +++ b/ironic_python_agent/cmd/agent.py @@ -118,9 +118,17 @@ cli_opts = [ cfg.IntOpt('inspection_dhcp_wait_timeout', default=APARAMS.get('ipa-inspection-dhcp-wait-timeout', inspector.DEFAULT_DHCP_WAIT_TIMEOUT), - help='Maximum time (in seconds) to wait for all NIC\'s ' - 'to get their IP addresses via DHCP before inspection. ' + help='Maximum time (in seconds) to wait for the PXE NIC ' + '(or all NICs if inspection_dhcp_all_interfaces is True) ' + 'to get its IP address via DHCP before inspection. ' 'Set to 0 to disable waiting completely.'), + + cfg.BoolOpt('inspection_dhcp_all_interfaces', + default=APARAMS.get('ipa-inspection-dhcp-all-interfaces', + False), + help='Whether to wait for all interfaces to get their IP ' + 'addresses before inspection. If set to false ' + '(the default), only waits for the PXE interface.'), ] CONF.register_cli_opts(cli_opts) -- cgit v1.2.1