Exemplo n.º 1
0
 def _new_connection(self, *args, **kwargs):
     """
     Can be used to establish a new connection for all clients
     """
     keystone = _connect_to_keystone(*args, **kwargs)
     nova = _connect_to_nova(*args, **kwargs)
     glance = _connect_to_glance(keystone, *args, **kwargs)
     return (keystone, nova, glance)
Exemplo n.º 2
0
 def new_connection(self, *args, **kwargs):
     keystone = _connect_to_keystone(*args, **kwargs)
     nova_args = kwargs.copy()
     #HACK - Nova is certified-broken-on-v3.
     nova_args['version'] = 'v2.0'
     nova_args['auth_url'] = nova_args['auth_url'].replace('v3', 'v2.0')
     nova = _connect_to_nova(*args, **nova_args)
     swift_args = self._get_swift_args(*args, **kwargs)
     swift = _connect_to_swift(*args, **swift_args)
     return keystone, nova, swift
Exemplo n.º 3
0
    def _new_connection(self, *args, **kwargs):
        """
        Can be used to establish a new connection for all clients
        """
        ks_kwargs = self._build_keystone_creds(kwargs)
        nova_kwargs = self._build_nova_creds(kwargs)

        keystone = _connect_to_keystone(*args, **ks_kwargs)
        nova = _connect_to_nova(*args, **nova_kwargs)
        glance = _connect_to_glance(keystone, *args, **kwargs)
        return (keystone, nova, glance)
Exemplo n.º 4
0
 def build_nova(self, username, password, project_name, *args, **kwargs):
     """
     Ocassionally you will need the 'user nova' instead of admin nova.
     This function will build a 'proper' nova given credentials.
     """
     converted_kwargs = {
         'username':username,
         'password':password,
         'tenant_name':project_name,
         'auth_url':self.nova.client.auth_url,
         'region_name':self.nova.client.region_name}
     #TODO: Update w/ kwargs..
     nova = _connect_to_nova(*args, **converted_kwargs)
     nova.client.region_name = self.nova.client.region_name
     return nova
Exemplo n.º 5
0
    def get_openstack_clients(self, username, password=None, tenant_name=None):

        user_creds = self._get_openstack_credentials(username,
                                                     password,
                                                     tenant_name)
        neutron = self.network_manager.new_connection(**user_creds)
        keystone = _connect_to_keystone(*args, **kwargs)
        nova = _connect_to_nova(*args, **kwargs)
        glance = _connect_to_glance(keystone, *args, **kwargs)
        return {
            'glance': glance,
            'keystone': keystone,
            'nova': nova,
            'neutron': neutron,
            'horizon': self._get_horizon_url(keystone.tenant_id)
        }
Exemplo n.º 6
0
 def build_nova(self, username, password, project_name, *args, **kwargs):
     """
     Ocassionally you will need the 'user nova' instead of admin nova.
     This function will build a 'proper' nova given credentials.
     """
     converted_kwargs = {
         'username': username,
         'password': password,
         'tenant_name': project_name,
         'auth_url': self.nova.client.auth_url,
         'region_name': self.nova.client.region_name
     }
     #TODO: Update w/ kwargs..
     nova = _connect_to_nova(*args, **converted_kwargs)
     nova.client.region_name = self.nova.client.region_name
     return nova
Exemplo n.º 7
0
 def new_connection(self, *args, **kwargs):
     if kwargs.get('version') == 'v3':
         (auth, session, token) = _connect_to_keystone_v3(**kwargs)
         keystone = _connect_to_keystone(version="v3",
                                         auth=auth,
                                         session=session)
         nova = _connect_to_nova_by_auth(auth=auth, session=session)
     else:
         #Legacy cloud method for connection (without keystoneauth1)
         keystone = _connect_to_keystone(*args, **kwargs)
         nova_args = kwargs.copy()
         nova_args['version'] = 'v2.0'
         nova_args['auth_url'] = nova_args['auth_url'].replace('v3', 'v2.0')
         nova = _connect_to_nova(*args, **nova_args)
     swift_args = self._get_swift_args(*args, **kwargs)
     swift = _connect_to_swift(*args, **swift_args)
     return keystone, nova, swift
 def new_connection(self, *args, **kwargs):
     if kwargs.get('version') == 'v3':
         if 'auth_token' in kwargs:
             (auth, session, token) = _connect_to_keystone_auth_v3(**kwargs)
         else:
             (auth, session, token) = _connect_to_keystone_v3(**kwargs)
         keystone = _connect_to_keystone(version="v3", auth=auth, session=session)
         glance = _connect_to_glance_by_auth(auth=auth, session=session)
         nova = _connect_to_nova_by_auth(auth=auth, session=session)
         swift = _connect_to_swift(session=session)
     else:
         #Legacy cloud method for connection (without keystoneauth1)
         keystone = _connect_to_keystone(*args, **kwargs)
         glance = _connect_to_glance(keystone, **kwargs)
         nova_args = kwargs.copy()
         nova_args['version'] = 'v2.0'
         nova_args['auth_url'] = nova_args['auth_url'].replace('v3','v2.0')
         nova = _connect_to_nova(*args, **nova_args)
         swift_args = self._get_swift_args(*args, **kwargs)
         swift = _connect_to_swift(*args, **swift_args)
     return keystone, nova, swift, glance
 def _new_connection(self, *args, **kwargs):
     """
     Can be used to establish a new connection for all clients
     """
     version = kwargs.get('version')
     if version == 'v3':
         (auth, sess, token) = _connect_to_keystone_v3(**kwargs)
         keystone = _connect_to_keystone(auth=auth, session=sess, version=version)
         nova = _connect_to_nova_by_auth(auth=auth, session=sess)
         glance = _connect_to_glance_by_auth(auth=auth, session=sess)
         glance_v1 = glance
     else:
         ks_kwargs = self._build_keystone_creds(kwargs)
         nova_kwargs = self._build_nova_creds(kwargs)
         keystone = _connect_to_keystone(*args, **ks_kwargs)
         nova = _connect_to_nova(*args, **nova_kwargs)
         glance = _connect_to_glance(keystone, *args, **kwargs)
         kwargs.pop('version', None)
         kwargs['version'] = 1
         glance_v1 = _connect_to_glance(keystone, *args, **kwargs)
     return (keystone, nova, glance, glance_v1)
Exemplo n.º 10
0
 def _new_connection(self, *args, **kwargs):
     """
     Can be used to establish a new connection for all clients
     """
     version = kwargs.get('version')
     if version == 'v3':
         (auth, sess, token) = _connect_to_keystone_v3(**kwargs)
         keystone = _connect_to_keystone(auth=auth,
                                         session=sess,
                                         version=version)
         nova = _connect_to_nova_by_auth(auth=auth, session=sess)
         glance = _connect_to_glance_by_auth(auth=auth, session=sess)
         glance_v1 = glance
     else:
         ks_kwargs = self._build_keystone_creds(kwargs)
         nova_kwargs = self._build_nova_creds(kwargs)
         keystone = _connect_to_keystone(*args, **ks_kwargs)
         nova = _connect_to_nova(*args, **nova_kwargs)
         glance = _connect_to_glance(keystone, *args, **kwargs)
         kwargs.pop('version', None)
         kwargs['version'] = 1
         glance_v1 = _connect_to_glance(keystone, *args, **kwargs)
     return (keystone, nova, glance, glance_v1)
 def build_nova(self, username, password, project_name, *args, **kwargs):
     """
     Ocassionally you will need the 'user nova' instead of admin nova.
     This function will build a 'proper' nova given credentials.
     """
     try:
         auth_url = self.nova.client.auth_url
     except AttributeError:
         auth_url = self.nova.client.session.auth.auth_url
     region_name = self.nova.client.region_name
     if not region_name:
         region_name = kwargs.get('region_name')
     converted_kwargs = {
         'username': username,
         'password': password,
         'tenant_name': project_name,
         'auth_url': auth_url,
         'region_name': region_name,
         'version': self.version,
     }
     #TODO: Update w/ kwargs..
     nova = _connect_to_nova(*args, **converted_kwargs)
     nova.client.region_name = self.nova.client.region_name
     return nova
Exemplo n.º 12
0
 def build_nova(self, username, password, project_name, *args, **kwargs):
     """
     Ocassionally you will need the 'user nova' instead of admin nova.
     This function will build a 'proper' nova given credentials.
     """
     try:
         auth_url = self.nova.client.auth_url
     except AttributeError:
         auth_url = self.nova.client.session.auth.auth_url
     region_name = self.nova.client.region_name
     if not region_name:
         region_name = kwargs.get('region_name')
     converted_kwargs = {
         'username': username,
         'password': password,
         'tenant_name': project_name,
         'auth_url': auth_url,
         'region_name': region_name,
         'version': self.version,
     }
     #TODO: Update w/ kwargs..
     nova = _connect_to_nova(*args, **converted_kwargs)
     nova.client.region_name = self.nova.client.region_name
     return nova
Exemplo n.º 13
0
 def new_connection(self, *args, **kwargs):
     keystone = _connect_to_keystone(*args, **kwargs)
     nova = _connect_to_nova(*args, **kwargs)
     swift_args = self._get_swift_args(*args, **kwargs)
     swift = _connect_to_swift(*args, **swift_args)
     return keystone, nova, swift
Exemplo n.º 14
0
 def new_connection(self, *args, **kwargs):
     keystone = _connect_to_keystone(*args, **kwargs)
     nova = _connect_to_nova(*args, **kwargs)
     swift_args = self._get_swift_args(*args, **kwargs)
     swift = _connect_to_swift(*args, **swift_args)
     return keystone, nova, swift