Switch to using cinderclient.
This is practically a transparent switch since it was copied out of novaclient and maintains API compatibility. NOTE: this will fail until python-cinderclient is published to PyPI properly. Implements blueprint switch-to-cinder-client Change-Id: Ic8cd6660735e172ff5d3402952265a15dc15f9e5
This commit is contained in:
parent
acb0516548
commit
0cd51d5c28
@ -27,6 +27,8 @@ import logging
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
|
from cinderclient.v1 import client as cinder_client
|
||||||
|
|
||||||
from novaclient.v1_1 import client as nova_client
|
from novaclient.v1_1 import client as nova_client
|
||||||
from novaclient.v1_1 import security_group_rules as nova_rules
|
from novaclient.v1_1 import security_group_rules as nova_rules
|
||||||
from novaclient.v1_1.security_groups import SecurityGroup as NovaSecurityGroup
|
from novaclient.v1_1.security_groups import SecurityGroup as NovaSecurityGroup
|
||||||
@ -210,11 +212,11 @@ def cinderclient(request):
|
|||||||
insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
|
insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
|
||||||
LOG.debug('cinderclient connection created using token "%s" and url "%s"' %
|
LOG.debug('cinderclient connection created using token "%s" and url "%s"' %
|
||||||
(request.user.token.id, url_for(request, 'volume')))
|
(request.user.token.id, url_for(request, 'volume')))
|
||||||
c = nova_client.Client(request.user.username,
|
c = cinder_client.Client(request.user.username,
|
||||||
request.user.token.id,
|
request.user.token.id,
|
||||||
project_id=request.user.tenant_id,
|
project_id=request.user.tenant_id,
|
||||||
auth_url=url_for(request, 'volume'),
|
auth_url=url_for(request, 'volume'),
|
||||||
insecure=insecure)
|
insecure=insecure)
|
||||||
c.client.auth_token = request.user.token.id
|
c.client.auth_token = request.user.token.id
|
||||||
c.client.management_url = url_for(request, 'volume')
|
c.client.management_url = url_for(request, 'volume')
|
||||||
return c
|
return c
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from cinderclient import exceptions as cinderclient
|
||||||
from glanceclient.common import exceptions as glanceclient
|
from glanceclient.common import exceptions as glanceclient
|
||||||
from keystoneclient import exceptions as keystoneclient
|
from keystoneclient import exceptions as keystoneclient
|
||||||
from novaclient import exceptions as novaclient
|
from novaclient import exceptions as novaclient
|
||||||
@ -27,6 +28,8 @@ from swiftclient import client as swiftclient
|
|||||||
|
|
||||||
UNAUTHORIZED = (keystoneclient.Unauthorized,
|
UNAUTHORIZED = (keystoneclient.Unauthorized,
|
||||||
keystoneclient.Forbidden,
|
keystoneclient.Forbidden,
|
||||||
|
cinderclient.Unauthorized,
|
||||||
|
cinderclient.Forbidden,
|
||||||
novaclient.Unauthorized,
|
novaclient.Unauthorized,
|
||||||
novaclient.Forbidden,
|
novaclient.Forbidden,
|
||||||
glanceclient.Unauthorized,
|
glanceclient.Unauthorized,
|
||||||
@ -34,6 +37,7 @@ UNAUTHORIZED = (keystoneclient.Unauthorized,
|
|||||||
quantumclient.Forbidden)
|
quantumclient.Forbidden)
|
||||||
|
|
||||||
NOT_FOUND = (keystoneclient.NotFound,
|
NOT_FOUND = (keystoneclient.NotFound,
|
||||||
|
cinderclient.NotFound,
|
||||||
novaclient.NotFound,
|
novaclient.NotFound,
|
||||||
glanceclient.NotFound,
|
glanceclient.NotFound,
|
||||||
quantumclient.NetworkNotFoundClient,
|
quantumclient.NetworkNotFoundClient,
|
||||||
@ -43,6 +47,7 @@ NOT_FOUND = (keystoneclient.NotFound,
|
|||||||
RECOVERABLE = (keystoneclient.ClientException,
|
RECOVERABLE = (keystoneclient.ClientException,
|
||||||
# AuthorizationFailure is raised when Keystone is "unavailable".
|
# AuthorizationFailure is raised when Keystone is "unavailable".
|
||||||
keystoneclient.AuthorizationFailure,
|
keystoneclient.AuthorizationFailure,
|
||||||
|
cinderclient.ClientException,
|
||||||
novaclient.ClientException,
|
novaclient.ClientException,
|
||||||
glanceclient.ClientException,
|
glanceclient.ClientException,
|
||||||
# NOTE(amotoki): Quantum exceptions other than the first one
|
# NOTE(amotoki): Quantum exceptions other than the first one
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
Django>=1.4
|
Django>=1.4
|
||||||
django_compressor
|
django_compressor
|
||||||
django_openstack_auth
|
django_openstack_auth
|
||||||
|
python-cinderclient
|
||||||
python-glanceclient<2
|
python-glanceclient<2
|
||||||
python-keystoneclient
|
python-keystoneclient
|
||||||
python-novaclient
|
python-novaclient
|
||||||
|
Loading…
Reference in New Issue
Block a user