def ironic(self): try: endpoint = self.__make_endpoint( self._get_url_for_svc(service_type='baremetal')) return get_ironic_client('1', session=self.keystone_session, insecure=True, ironic_url=endpoint) except ClientException as e: logger.warning('Could not initialize ironic client {0}'.format(e)) raise
def __init__(self, os_conf): if not ironic_client_exists: logger.error("ironicclient module is not installed") raise ImportError("No module named ironicclient") self.ironic_client = get_ironic_client( api_version=os_conf.get('ironic-api-version', '1'), os_username=os_conf['username'], os_password=os_conf['password'], os_tenant_name=os_conf['tenant_name'], os_auth_url=os_conf['auth_url'] )
def ironic(self): try: endpoint = self.__make_endpoint( self._get_url_for_svc(service_type='baremetal')) return get_ironic_client('1', session=self.keystone_session, insecure=True, ironic_url=endpoint) except ClientException as e: logger.warning('Could not initialize ironic client {0}'.format(e)) raise
def _match_physical_and_cloud_hosts(self): """Connect CloudHosts and DC assets according to data from Ironic.""" for os_conf in settings.OPENSTACK_INSTANCES: if (os_conf.get('provider', DEFAULT_OPENSTACK_PROVIDER_NAME) != self.openstack_provider_name): continue ironic_client = get_ironic_client( api_version=os_conf.get('ironic-api-version', '1'), os_username=os_conf['username'], os_password=os_conf['password'], os_tenant_name=os_conf['tenant_name'], os_auth_url=os_conf['auth_url']) nodes = ironic_client.node.list(associated=True, fields=['extra', 'instance_uuid']) self._match_nodes_to_hosts(nodes)