trunk: Start dhclient only if it's not running
There are distributions using daemons to monitor network interfaces,
like for example NetworkManager. Such daemons spawn dhclient by itself
which causes running double dhclients on guest VM. This patch
conditionally starts dhclient only if there is no other instance of it
running on the guest.
Change-Id: I9017aa6dad269c17cdf74c983910d4058bc8a95e
Closes-bug: #1770664
diff --git a/neutron_tempest_plugin/scenario/test_trunk.py b/neutron_tempest_plugin/scenario/test_trunk.py
index b5e8cda..2ff7e5d 100644
--- a/neutron_tempest_plugin/scenario/test_trunk.py
+++ b/neutron_tempest_plugin/scenario/test_trunk.py
@@ -34,7 +34,8 @@
'sudo su -c '
'"ip l a link $IFACE name $IFACE.%(tag)d type vlan id %(tag)d &&'
'ip l s up dev $IFACE.%(tag)d && '
- 'dhclient $IFACE.%(tag)d"')
+ '{ ps -ef | grep -q "dhclient .*$IFACE.%(tag)d" || '
+ 'dhclient $IFACE.%(tag)d"; }')
class TrunkTest(base.BaseTempestTestCase):