Raise renew_delay in TestNetworkBasicOps:test_subnet_details

Bug #1813198 can be reproduced both in cirros 0.3.5 and 0.4.0 by:

while true
do
    sudo /bin/kill -USR1 $( cat /var/run/udhcpc.$( ip -o addr | awk '/100.109.0.37/ {print $2}' ).pid )
    #sleep .1
done

Where 100.109.0.37 is the original IP of eth0 in cirros and the 'kill'
line basically reproduces how test_subnet_details() renews the dhcp
lease using busybox's udhcpc.

However if you uncomment the very short sleep in that loop, the error
is gone. It seems to me this because the following line in udhcpc:

https://git.busybox.net/busybox/tree/networking/udhcp/dhcpc.c?h=1_23_stable#n1093

Note: CirrOS 0.4.0 uses BusyBox v1.23.2.

That is SIGUSR1 triggers a renew request in udhcpc. Internally udhcpc
goes into RENEW_REQUESTED state. If it receives a 2nd SIGUSR1 signal
while still in that state then it deconfigures the interface briefly
before acquiring a new (many times still the same) address. For us it
means we should not retry renewing the lease too fast, because if we do
the address may get deconfigured leading to bug #1813198.

Note: the call of the deconfig script can be easily confirmed by
modifying it (for example to log something). In cirros it is located
under '/sbin/cirros-dhcpc'. Look for the case handling the 'deconfig'
parameter.

This patch increases the delay in retries.

Change-Id: I9b18ef2d835e02be30b7c557e5c10585722111a0
Closes-Bug: #1813198
This commit is contained in:
Bence Romsics 2019-01-28 14:18:00 +01:00 committed by Matt Riedemann
parent f853ef7a25
commit 199e022902
1 changed files with 10 additions and 4 deletions

View File

@ -544,7 +544,6 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
should_connect=True, msg="after updating "
"admin_state_up of router to True")
@decorators.skip_because(bug='1813198')
@decorators.idempotent_id('d8bb918e-e2df-48b2-97cd-b73c95450980')
@testtools.skipIf(CONF.network.shared_physical_network,
'network isolation not available')
@ -580,10 +579,17 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
initial_dns_server = '1.2.3.4'
alt_dns_server = '9.8.7.6'
# renewal should be immediate.
# Timeouts are suggested by salvatore-orlando in
# Original timeouts are suggested by salvatore-orlando in
# https://bugs.launchpad.net/neutron/+bug/1412325/comments/3
renew_delay = CONF.network.build_interval
#
# Compared to that renew_delay was increased, because
# busybox's udhcpc accepts SIGUSR1 as a renew request. Internally
# it goes into RENEW_REQUESTED state. If it receives a 2nd SIGUSR1
# signal while in that state then it calls the deconfig script
# ("/sbin/cirros-dhcpc deconfig" in sufficiently new cirros versions)
# which leads to the address being transiently deconfigured which
# for our case is unwanted.
renew_delay = 3 * CONF.network.build_interval
renew_timeout = CONF.network.build_timeout
self._setup_network_and_servers(dns_nameservers=[initial_dns_server])