aboutsummaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authorzhifeng.jiang <jiang.zhifeng@zte.com.cn>2016-06-17 22:49:48 +0800
committerzhifeng.jiang <jiang.zhifeng@zte.com.cn>2016-06-21 14:09:50 +0800
commit0537cab223ae76d501591e6a1e83aa3ea4fdec0e (patch)
tree27393543d0ee775a47b3421d5b80bf9c29fe170d /func
parentb53c80415ae8e471cf1a59be26dbe572733e8946 (diff)
Run the test only when ping ok and try ping 20 times.
JIRA: QTIP-92 Change-Id: I270deb3b1d930d6805524d10826f5711b3e4787e Signed-off-by: zhifeng.jiang <jiang.zhifeng@zte.com.cn>
Diffstat (limited to 'func')
-rw-r--r--func/cli.py20
-rw-r--r--func/env_setup.py14
2 files changed, 19 insertions, 15 deletions
diff --git a/func/cli.py b/func/cli.py
index 76e0e19a..129ab96c 100644
--- a/func/cli.py
+++ b/func/cli.py
@@ -93,16 +93,16 @@ class cli():
if len(vm_info) != 0:
vmObj =''
vmObj = SpawnVM(vm_info)
- obj.callpingtest()
- obj.callsshtest()
- obj.updateAnsible()
- dvr = Driver()
- dvr.drive_bench(benchmark,
- obj.roles_dict.items(),
- self._get_fname(benchmarks[items]),
- benchmark_details,
- obj.ip_pw_dict.items(),
- proxy_info)
+ if obj.callpingtest():
+ obj.callsshtest()
+ obj.updateAnsible()
+ dvr = Driver()
+ dvr.drive_bench(benchmark,
+ obj.roles_dict.items(),
+ self._get_fname(benchmarks[items]),
+ benchmark_details,
+ obj.ip_pw_dict.items(),
+ proxy_info)
else:
print (benchmarks[items], ' is not a Template in the Directory - \
Enter a Valid file name. or use qtip.py -h for list')
diff --git a/func/env_setup.py b/func/env_setup.py
index 487d7af3..c1e2a003 100644
--- a/func/env_setup.py
+++ b/func/env_setup.py
@@ -13,7 +13,6 @@ from collections import defaultdict
import yaml
import time
import paramiko
-
class Env_setup():
roles_ip_list = [] # ROLE and its corresponding IP address list
ip_pw_list = [] # IP and password, this will be used to ssh
@@ -90,18 +89,23 @@ class Env_setup():
print 'Retrying SSH'
def pingtest(self, lister):
-
pingFlag = 0
+ result = True
for k, v in lister.iteritems():
time.sleep(10)
for val in v:
ipvar = val
ping_cmd = 'ping -D -c1 {0}'.format(ipvar)
- while os.system(ping_cmd) != 0:
+ while (os.system(ping_cmd) != 0) &(pingFlag <=20):
print '\nWaiting for machine\n'
time.sleep(10)
- pingFlag = 0
- print ('\n\n %s is UP \n\n ' % ipvar)
+ pingFlag = pingFlag+1
+ if pingFlag <= 2:
+ print ('\n\n %s is UP \n\n ' % ipvar)
+ else:
+ result = False
+ return result
+
def GetHostMachineinfo(self, Hosttag):