From bfed689614946a10e8ad0839cb2839e0d15dc561 Mon Sep 17 00:00:00 2001 From: Valeriy Ponomaryov Date: Mon, 5 Jan 2015 18:14:22 +0200 Subject: [PATCH] Use Cinder v2 API within Generic driver Manila uses v1 Cinder API for it's Generic driver. Cinder v1 API is deprecated and is going to be removed, see: https://blueprints.launchpad.net/cinder/+spec/deprecate-v1-api So, update our Generic driver to use v2 Cinder API. Implements blueprint v2-cinder-api-for-generic-driver Change-Id: I3cbd713a9a4c6eccee50ba4af4bdf2794db021d7 --- manila/compute/nova.py | 2 +- manila/tests/compute/test_nova.py | 2 +- manila/tests/fake_volume.py | 2 -- manila/volume/cinder.py | 14 +++++++------- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/manila/compute/nova.py b/manila/compute/nova.py index 98628b6845..199f54444c 100644 --- a/manila/compute/nova.py +++ b/manila/compute/nova.py @@ -246,7 +246,7 @@ class API(base.Base): for volume in volumes: volume_data = cinder.cinderclient(context).volumes.get(volume.id) - volume.name = volume_data.display_name + volume.name = volume_data.name return volumes diff --git a/manila/tests/compute/test_nova.py b/manila/tests/compute/test_nova.py index f19b8ecaf8..2fe030ad1f 100644 --- a/manila/tests/compute/test_nova.py +++ b/manila/tests/compute/test_nova.py @@ -26,7 +26,7 @@ from manila.volume import cinder class Volume(object): def __init__(self, volume_id): self.id = volume_id - self.display_name = volume_id + self.name = volume_id class FakeNovaClient(object): diff --git a/manila/tests/fake_volume.py b/manila/tests/fake_volume.py index 332a7be9e7..31df6c31fd 100644 --- a/manila/tests/fake_volume.py +++ b/manila/tests/fake_volume.py @@ -28,7 +28,6 @@ class FakeVolume(object): self.id = kwargs.pop('id', 'fake_vol_id') self.status = kwargs.pop('status', 'available') self.device = kwargs.pop('device', '') - self.display_name = kwargs.pop('display_name', 'fake_vol_name') for key, value in kwargs.items(): setattr(self, key, value) @@ -40,7 +39,6 @@ class FakeVolumeSnapshot(object): def __init__(self, **kwargs): self.id = kwargs.pop('id', 'fake_volsnap_id') self.status = kwargs.pop('status', 'available') - self.display_name = kwargs.pop('display_name', 'fake_volsnap_name') for key, value in kwargs.items(): setattr(self, key, value) diff --git a/manila/volume/cinder.py b/manila/volume/cinder.py index d7c2c2bcb8..07e02b45fd 100644 --- a/manila/volume/cinder.py +++ b/manila/volume/cinder.py @@ -22,7 +22,7 @@ import sys from cinderclient import exceptions as cinder_exception from cinderclient import service_catalog -from cinderclient.v1 import client as cinder_client +from cinderclient.v2 import client as cinder_client from oslo.config import cfg from manila.db import base @@ -136,8 +136,8 @@ def _untranslate_volume_summary_view(context, vol): else: d['attach_status'] = 'detached' - d['display_name'] = vol.display_name - d['display_description'] = vol.display_description + d['name'] = vol.name + d['description'] = vol.description d['volume_type_id'] = vol.volume_type d['snapshot_id'] = vol.snapshot_id @@ -161,8 +161,8 @@ def _untranslate_snapshot_summary_view(context, snapshot): d['progress'] = snapshot.progress d['size'] = snapshot.size d['created_at'] = snapshot.created_at - d['display_name'] = snapshot.display_name - d['display_description'] = snapshot.display_description + d['name'] = snapshot.name + d['description'] = snapshot.description d['volume_id'] = snapshot.volume_id d['project_id'] = snapshot.project_id d['volume_size'] = snapshot.size @@ -289,8 +289,8 @@ class API(base.Base): snapshot_id = None kwargs = dict(snapshot_id=snapshot_id, - display_name=name, - display_description=description, + name=name, + description=description, volume_type=volume_type, user_id=context.user_id, project_id=context.project_id,