From 8f72e695538c2281f923bdbf7a6d7b1d1763c70c Mon Sep 17 00:00:00 2001 From: Ryota MIBU Date: Fri, 3 Mar 2017 06:58:42 +0000 Subject: urgent bug fixes for danube (1) - create "doctor_net" and use it in VM creation in order to avoid virtual network issues - make sample inspector use keystone v3 - use "openstack compute service set" for unset force_down - drop nova_force_down.py as keystone returns nova v2.1 - use '--os-project-name' except for ceilometer cli - avoid ping check (wait_ping) with empty "COMPUTE_IP" - add missing '$' in quota update args - move ping check (wait_ping) into unset_forced_down_hosts() and perform ping check only to downed compute hosts - use wait_until() instead of wait_ping() - put out unset_forced_down_hosts from collect_logs() JIRA: DOCTOR-95 Co-Authored-By: Carlos Goncalves Change-Id: I3275ff5dd993b82029dac6a58087096baa251022 Signed-off-by: Ryota MIBU --- tests/inspector.py | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'tests/inspector.py') diff --git a/tests/inspector.py b/tests/inspector.py index 7195969a..27c969e5 100644 --- a/tests/inspector.py +++ b/tests/inspector.py @@ -17,10 +17,10 @@ import os import threading import time +from keystoneauth1.identity import v3 +from keystoneauth1 import session import novaclient.client as novaclient -import nova_force_down - LOG = doctor_log.Logger('doctor_inspector').getLogger() @@ -39,7 +39,7 @@ class ThreadedResetState(threading.Thread): class DoctorInspectorSample(object): - NOVA_API_VERSION = '2.11' + NOVA_API_VERSION = '2.34' NUMBER_OF_CLIENTS = 50 # TODO(tojuvone): This could be enhanced in future with dynamic # reuse of self.novaclients when all threads in use and @@ -49,14 +49,18 @@ class DoctorInspectorSample(object): def __init__(self): self.servers = collections.defaultdict(list) self.novaclients = list() + auth = v3.Password(auth_url=os.environ['OS_AUTH_URL'], + username=os.environ['OS_USERNAME'], + password=os.environ['OS_PASSWORD'], + user_domain_name=os.environ['OS_USER_DOMAIN_NAME'], + project_name=os.environ['OS_PROJECT_NAME'], + project_domain_name=os.environ['OS_PROJECT_DOMAIN_NAME']) + sess=session.Session(auth=auth) # Pool of novaclients for redundant usage for i in range(self.NUMBER_OF_CLIENTS): - self.novaclients.append(novaclient.Client(self.NOVA_API_VERSION, - os.environ['OS_USERNAME'], - os.environ['OS_PASSWORD'], - os.environ['OS_TENANT_NAME'], - os.environ['OS_AUTH_URL'], - connection_pool=True)) + self.novaclients.append( + novaclient.Client(self.NOVA_API_VERSION, session=sess, + connection_pool=True)) # Normally we use this client for non redundant API calls self.nova=self.novaclients[0] self.nova.servers.list(detailed=False) @@ -87,14 +91,7 @@ class DoctorInspectorSample(object): threads.append(t) for t in threads: t.join() - # NOTE: We use our own client here instead of this novaclient for a - # workaround. Once keystone provides v2.1 nova api endpoint - # in the service catalog which is configured by OpenStack - # installer, we can use this: - # - # self.nova.services.force_down(hostname, 'nova-compute', True) - # - nova_force_down.force_down(hostname) + self.nova.services.force_down(hostname, 'nova-compute', True) LOG.info('doctor mark host(%s) down at %s' % (hostname, time.time())) -- cgit 1.2.3-korg