From: Lei Yang <yanglei.f...@gmail.com>

Before dhclient, we need to check if it has been running,and then kill it
Signed-off-by: Lei Yang <yanglei.f...@gmail.com>
---
 client/tests/kvm/tests/nic_bonding.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/tests/nic_bonding.py 
b/client/tests/kvm/tests/nic_bonding.py
index 6266058..c976466 100644
--- a/client/tests/kvm/tests/nic_bonding.py
+++ b/client/tests/kvm/tests/nic_bonding.py
@@ -36,6 +36,14 @@ def run_nic_bonding(test, params, env):
                for vlan, nic in enumerate(params.get("nics").split())]
     setup_cmd = "ifenslave bond0 " + " ".join(ifnames)
     session_serial.cmd(setup_cmd)
+    #do a pgrep to check if dhclient has already been running
+    pgrep_cmd = "pgrep dhclient"
+    cmd_output = session_serial.cmd(pgrep_cmd)
+    #if dhclient is there, killl it
+    if cmd_output != '':
+            logging.info("dhclient already is running,kill it")
+            session_serial.cmd("killall -9 dhclient")
+            time.sleep(1)
     session_serial.cmd("dhclient bond0")
 
     try:
-- 
1.7.5.4

_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to