summaryrefslogtreecommitdiffstats
path: root/doctor_tests/inspector
diff options
context:
space:
mode:
authordongwenjuan <dong.wenjuan@zte.com.cn>2018-03-20 15:13:14 +0800
committerdongwenjuan <dong.wenjuan@zte.com.cn>2018-03-20 16:27:19 +0800
commit631c3f99f0e499edd1adcbc7550dd3d0de393e31 (patch)
treeba85640e823956ea02c2ae045909e74b80c06ec1 /doctor_tests/inspector
parent5bbd044650de0ab4179101bb3156dd315be9391f (diff)
optimize the fault notification test
Change-Id: I47572b4515049c49f9aa04bf7984757779a605f3 Signed-off-by: dongwenjuan <dong.wenjuan@zte.com.cn>
Diffstat (limited to 'doctor_tests/inspector')
-rw-r--r--doctor_tests/inspector/base.py18
-rw-r--r--doctor_tests/inspector/sample.py9
2 files changed, 25 insertions, 2 deletions
diff --git a/doctor_tests/inspector/base.py b/doctor_tests/inspector/base.py
index a6eae451..967dc9ba 100644
--- a/doctor_tests/inspector/base.py
+++ b/doctor_tests/inspector/base.py
@@ -16,6 +16,24 @@ class BaseInspector(object):
def __init__(self, conf, log):
self.conf = conf
self.log = log
+ self._host_down_time = None
+ self._vm_down_time = None
+
+ @property
+ def host_down_time(self):
+ return self._host_down_time
+
+ @host_down_time.setter
+ def host_down_time(self, host_down_time):
+ self._host_down_time = host_down_time
+
+ @property
+ def vm_down_time(self):
+ return self._vm_down_time
+
+ @vm_down_time.setter
+ def vm_down_time(self, vm_down_time):
+ self._vm_down_time = vm_down_time
@abc.abstractmethod
def get_inspector_url(self):
diff --git a/doctor_tests/inspector/sample.py b/doctor_tests/inspector/sample.py
index abc4fc6d..7742373d 100644
--- a/doctor_tests/inspector/sample.py
+++ b/doctor_tests/inspector/sample.py
@@ -108,8 +108,11 @@ class SampleInspector(BaseInspector):
@utils.run_async
def _disable_compute_host(self, hostname):
self.nova.services.force_down(hostname, 'nova-compute', True)
+
+ hostdown_time = time.time()
+ self.host_down_time = hostdown_time
self.log.info('doctor mark host(%s) down at %s'
- % (hostname, time.time()))
+ % (hostname, hostdown_time))
@utils.run_async
def _vms_reset_state(self, state, hostname):
@@ -117,8 +120,10 @@ class SampleInspector(BaseInspector):
@utils.run_async
def _vm_reset_state(nova, server, state):
nova.servers.reset_state(server, state)
+ vmdown_time = time.time()
+ self.vm_down_time = vmdown_time
self.log.info('doctor mark vm(%s) error at %s'
- % (server, time.time()))
+ % (server, vmdown_time))
thrs = []
for nova, server in zip(self.novaclients, self.servers[hostname]):