Login
Log in using an SSO provider:
Fedora Account System
Red Hat Associate
Red Hat Customer
Login using a Red Hat Bugzilla account
Forgot Password
Create an Account
Red Hat Bugzilla – Attachment 1425440 Details for
Bug 1570429
Nova reports overcloud instance in error state after failed double compute failover instance-ha evacuation
Home
New
Search
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh90 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
[?]
This site requires JavaScript to be enabled to function correctly, please enable it.
Wait script
nova_wait.py (text/x-python), 5.60 KB, created by
Andrew Beekhof
on 2018-04-22 22:10:37 UTC
(
hide
)
Description:
Wait script
Filename:
MIME Type:
Creator:
Andrew Beekhof
Created:
2018-04-22 22:10:37 UTC
Size:
5.60 KB
patch
obsolete
>#!/bin/python -tt > > >import sys >import time >import inspect >import logging >import oslo_config.cfg >import requests.exceptions > >def is_forced_down(connection, hostname): > services = connection.services.list(host=hostname, binary="nova-compute") > for service in services: > if service.forced_down: > return True > return False > >def evacuations_done(connection, hostname): > > # Get a list of migrations. > # :param host: (optional) filter migrations by host name. > # :param status: (optional) filter migrations by status. > # :param cell_name: (optional) filter migrations for a cell. > # > migrations = connection.migrations.list(host=hostname) > > #servers = connection.servers.list(search_opts={'host': hostname, 'all_tenants': 1 }) > #for server in servers: > # migrations = connection.server_migrations.list(server.id) > > print("Checking %d migrations" % len(migrations)) > for migration in migrations: > # print migration.to_dict() > # > # { > # u'status': u'error', > # u'dest_host': None, > # u'new_instance_type_id': 2, > # u'old_instance_type_id': 2, > # u'updated_at': u'2018-04-22T20:55:29.000000', > # u'dest_compute': > # u'overcloud-novacompute-2.localdomain', > # u'migration_type': u'live-migration', > # u'source_node': > # u'overcloud-novacompute-0.localdomain', > # u'id': 8, > # u'created_at': u'2018-04-22T20:52:58.000000', > # u'instance_uuid': > # u'd1c82ce8-3dc5-48db-b59f-854b3b984ef1', > # u'dest_node': > # u'overcloud-novacompute-2.localdomain', > # u'source_compute': > # u'overcloud-novacompute-0.localdomain' > # } > if migration.status == "running": > return False > return True > >def safe_to_stop(connection, hostname): > if is_forced_down(connection, hostname): > print("Waiting for fence-down flag to be cleared") > return False > if not evacuations_done(connection, hostname): > print("Waiting for evacuations to complete or fail") > return False > return True > >def create_nova_connection(options): > nova = None > > try: > from novaclient import client > from novaclient.exceptions import NotAcceptable > except ImportError: > print("Nova not found or not accessible") > sys.exit(1) > > from keystoneauth1 import loading > from keystoneauth1 import session > from keystoneclient import discover > > # Prefer the oldest and strip the leading 'v' > keystone_versions = discover.available_versions(options["auth_url"][0]) > keystone_version = keystone_versions[0]['id'][1:] > kwargs = dict( > auth_url=options["auth_url"][0], > username=options["username"][0], > password=options["password"][0] > ) > > if discover.version_match("2", keystone_version): > kwargs["tenant_name"] = options["tenant_name"][0] > > elif discover.version_match("3", keystone_version): > kwargs["project_name"] = options["project_name"][0] > kwargs["user_domain_name"] = options["user_domain_name"][0] > kwargs["project_domain_name"] = options["project_domain_name"][0] > > loader = loading.get_plugin_loader('password') > keystone_auth = loader.load_from_options(**kwargs) > keystone_session = session.Session(auth=keystone_auth, verify=(not options["insecure"])) > > nova_versions = [ "2.23", "2" ] > for version in nova_versions: > clientargs = inspect.getargspec(client.Client).varargs > # Some versions of Openstack prior to Ocata only > # supported positional arguments for username, > # password, and tenant. > # > # Versions since Ocata only support named arguments. > # > # So we need to use introspection to figure out how to > # create a Nova client. > # > # Happy days > # > if clientargs: > # OSP < 11 > # ArgSpec(args=['version', 'username', 'password', 'project_id', 'auth_url'], > # varargs=None, > # keywords='kwargs', defaults=(None, None, None, None)) > nova = client.Client(version, > None, # User > None, # Password > None, # Tenant > None, # Auth URL > insecure=options["insecure"], > region_name=options["os_region_name"][0], > session=keystone_session, auth=keystone_auth, > http_log_debug=options.has_key("verbose")) > else: > # OSP >= 11 > # ArgSpec(args=['version'], varargs='args', keywords='kwargs', defaults=None) > nova = client.Client(version, > region_name=options["os_region_name"][0], > session=keystone_session, auth=keystone_auth, > http_log_debug=options.has_key("verbose")) > > try: > nova.hypervisors.list() > return nova > > except NotAcceptable as e: > logging.warning(e) > > except Exception as e: > logging.warning("Nova connection failed. %s: %s" % (e.__class__.__name__, e)) > > print("Couldn't obtain a supported connection to nova, tried: %s\n" % repr(nova_versions)) > return None > >sections = {} >config = oslo_config.cfg.ConfigParser("/etc/nova/nova.conf", sections) >config.parse() > >config.sections["placement"]["insecure"] = 0 >config.sections["placement"]["verbose"] = 1 > >connection = None >while not connection: > # Loop in case the control plane is recovering when we run > connection = create_nova_connection(config.sections["placement"]) > if not connection: > time.sleep(10) > >while not safe_to_stop(connection, config.sections["DEFAULT"]["host"][0]): > time.sleep(10) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1570429
: 1425440