def check_nova_service(token, tenant_id, username, password, hostname, keystone_port): print "ok" print token nova_service = [] status = {} compute_endpoint = get_endpoint('admin', 'nova', username, password, hostname, keystone_port) print compute_endpoint try: nova = nova_client('3', auth_token=token, bypass_url=compute_endpoint) services = nova.services.list() print services for service in services: status['type-name'] = service.binary status['status'] = service.status status['hostname'] = service.host status['state'] = service.state status['updated_at'] = service.updated_at status['zone'] = service.zone nova_service.append(status) status = {} print status return nova_service except Exception as e: error = str(e) print error return nova_service
def check_neutron_service(token, tenant_id, hostname, keystone_port, username, password): neutron_endpoint = get_endpoint('admin', 'neutron', username, password, hostname, keystone_port) try: neutron = neutron_client.Client('2.0', token=token, endpoint_url=neutron_endpoint) except neutron_exc.NeutronClientException as e: error = str(e) agents = neutron.list_agents() agents = agents['agents'] return agents