use hostname without domain name & fix the `find` command in tox 51/68551/3
authordongwenjuan <dong.wenjuan@zte.com.cn>
Sun, 29 Sep 2019 06:07:20 +0000 (14:07 +0800)
committerdongwenjuan <dong.wenjuan@zte.com.cn>
Sun, 29 Sep 2019 06:44:01 +0000 (14:44 +0800)
Change-Id: I719c46a8b5407b565cf0b6df4cd9b4c95a6a8ce5
Signed-off-by: dongwenjuan <dong.wenjuan@zte.com.cn>
doctor_tests/scenario/fault_management.py
tox.ini

index 5216aa8..0271dff 100644 (file)
@@ -111,7 +111,10 @@ class FaultManagement(object):
         server = servers.get(vm_name)
         if not server:
             raise Exception('Can not find instance: vm_name(%s)' % vm_name)
-        host_name = server.__dict__.get('OS-EXT-SRV-ATTR:hypervisor_hostname')
+        # use hostname without domain name which is mapped to the cell
+        hostname = \
+            server.__dict__.get('OS-EXT-SRV-ATTR:hypervisor_hostname')
+        host_name = hostname.split('.')[0]
         host_ip = self.installer.get_host_ip_from_hostname(host_name)
 
         self.log.info('Get host info(name:%s, ip:%s) which vm(%s) launched at'
diff --git a/tox.ini b/tox.ini
index 8f734fc..c6c185e 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -34,7 +34,7 @@ passenv =
     SSH_KEY
 changedir = {toxinidir}/doctor_tests
 commands = doctor-test
-           /bin/find {toxinidir} -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
+           /usr/bin/find {toxinidir} -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
 
 [testenv:pep8]
 changedir = {toxinidir}