Fix the gates about cinder

Cinder team has removed some unused paramters in cinder client,
we should update our cinder service module.

* https://review.openstack.org/#/c/573622/

Change-Id: I1e67113ee0e7b6778bcb3f861ec398dfb624dbd2
This commit is contained in:
chenhb 2018-07-31 15:27:05 +08:00
parent 2c5e12fdff
commit 67882d55ca
5 changed files with 19 additions and 30 deletions

View File

@ -13,10 +13,12 @@
# under the License.
from rally.common import cfg
from rally.common import logging
from rally.task import service
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
Volume = service.make_resource_cls(
@ -58,7 +60,7 @@ class BlockStorage(service.UnifiedService):
:param metadata: Optional metadata to set on volume creation
:param imageRef: reference to an image stored in glance
:param source_volid: ID of source volume to clone from
:param source_replica: ID of source volume to clone replica
:param source_replica: ID of source volume to clone replica(IGNORED)
:param scheduler_hints: (optional extension) arbitrary key-value pairs
specified by the client to help boot an instance
:param multiattach: Allow the volume to be attached to more than
@ -66,6 +68,9 @@ class BlockStorage(service.UnifiedService):
:returns: Return a new volume.
"""
if source_replica:
LOG.warning("The argument `source_replica` would be ignored"
" because it was removed from cinder api.")
return self._impl.create_volume(
size, consistencygroup_id=consistencygroup_id, group_id=group_id,
snapshot_id=snapshot_id, source_volid=source_volid,
@ -73,7 +78,7 @@ class BlockStorage(service.UnifiedService):
user_id=user_id, project_id=project_id,
availability_zone=availability_zone, metadata=metadata,
imageRef=imageRef, scheduler_hints=scheduler_hints,
source_replica=source_replica, multiattach=multiattach)
multiattach=multiattach)
@service.should_be_overridden
def list_volumes(self, detailed=True):

View File

@ -177,7 +177,7 @@ class UnifiedCinderV1Service(cinder_common.UnifiedCinderMixin,
volume_type=None, user_id=None,
project_id=None, availability_zone=None,
metadata=None, imageRef=None, scheduler_hints=None,
source_replica=None, multiattach=False):
multiattach=False):
"""Creates a volume.
:param size: Size of volume in GB
@ -193,7 +193,6 @@ class UnifiedCinderV1Service(cinder_common.UnifiedCinderMixin,
:param metadata: Optional metadata to set on volume creation
:param imageRef: reference to an image stored in glance
:param source_volid: ID of source volume to clone from
:param source_replica: ID of source volume to clone replica
:param scheduler_hints: (optional extension) arbitrary key-value pairs
specified by the client to help boot an instance
:param multiattach: Allow the volume to be attached to more than

View File

@ -31,10 +31,9 @@ class CinderV2Service(service.Service, cinder_common.CinderMixin):
@atomic.action_timer("cinder_v2.create_volume")
def create_volume(self, size, consistencygroup_id=None,
snapshot_id=None, source_volid=None, name=None,
description=None, volume_type=None, user_id=None,
project_id=None, availability_zone=None,
metadata=None, imageRef=None, scheduler_hints=None,
source_replica=None, multiattach=False):
description=None, volume_type=None,
availability_zone=None, metadata=None, imageRef=None,
scheduler_hints=None, multiattach=False):
"""Creates a volume.
:param size: Size of volume in GB
@ -43,13 +42,10 @@ class CinderV2Service(service.Service, cinder_common.CinderMixin):
:param name: Name of the volume
:param description: Description of the volume
:param volume_type: Type of volume
:param user_id: User id derived from context
:param project_id: Project id derived from context
:param availability_zone: Availability Zone to use
:param metadata: Optional metadata to set on volume creation
:param imageRef: reference to an image stored in glance
:param source_volid: ID of source volume to clone from
:param source_replica: ID of source volume to clone replica
:param scheduler_hints: (optional extension) arbitrary key-value pairs
specified by the client to help boot an instance
:param multiattach: Allow the volume to be attached to more than
@ -63,13 +59,10 @@ class CinderV2Service(service.Service, cinder_common.CinderMixin):
"snapshot_id": snapshot_id,
"source_volid": source_volid,
"volume_type": volume_type,
"user_id": user_id,
"project_id": project_id,
"availability_zone": availability_zone,
"metadata": metadata,
"imageRef": imageRef,
"scheduler_hints": scheduler_hints,
"source_replica": source_replica,
"multiattach": multiattach}
if isinstance(size, dict):
size = random.randint(size["min"], size["max"])
@ -241,7 +234,7 @@ class UnifiedCinderV2Service(cinder_common.UnifiedCinderMixin,
volume_type=None, user_id=None,
project_id=None, availability_zone=None,
metadata=None, imageRef=None, scheduler_hints=None,
source_replica=None, multiattach=False):
multiattach=False):
"""Creates a volume.
:param size: Size of volume in GB
@ -251,13 +244,12 @@ class UnifiedCinderV2Service(cinder_common.UnifiedCinderMixin,
:param name: Name of the volume
:param description: Description of the volume
:param volume_type: Type of volume
:param user_id: User id derived from context
:param project_id: Project id derived from context
:param user_id: User id derived from context(IGNORED)
:param project_id: Project id derived from context(IGNORED)
:param availability_zone: Availability Zone to use
:param metadata: Optional metadata to set on volume creation
:param imageRef: reference to an image stored in glance
:param source_volid: ID of source volume to clone from
:param source_replica: ID of source volume to clone replica
:param scheduler_hints: (optional extension) arbitrary key-value pairs
specified by the client to help boot an instance
:param multiattach: Allow the volume to be attached to more than
@ -270,10 +262,9 @@ class UnifiedCinderV2Service(cinder_common.UnifiedCinderMixin,
snapshot_id=snapshot_id,
source_volid=source_volid, name=name,
description=description, volume_type=volume_type,
user_id=user_id, project_id=project_id,
availability_zone=availability_zone, metadata=metadata,
imageRef=imageRef, scheduler_hints=scheduler_hints,
source_replica=source_replica, multiattach=multiattach))
multiattach=multiattach))
def list_volumes(self, detailed=True):
"""Lists all volumes.

View File

@ -39,7 +39,7 @@ class BlockTestCase(test.TestCase):
"fake_volume", availability_zone=None, consistencygroup_id=None,
description=None, group_id=None, imageRef=None, metadata=None,
multiattach=False, name=None, project_id=None,
scheduler_hints=None, snapshot_id=None, source_replica=None,
scheduler_hints=None, snapshot_id=None,
source_volid=None, user_id=None, volume_type=None)
def test_list_volumes(self):

View File

@ -49,13 +49,10 @@ class CinderV2ServiceTestCase(test.ScenarioTestCase):
"snapshot_id": None,
"source_volid": None,
"volume_type": None,
"user_id": None,
"project_id": None,
"availability_zone": None,
"metadata": None,
"imageRef": None,
"scheduler_hints": None,
"source_replica": None,
"multiattach": False}
self.cinder.volumes.create.assert_called_once_with(1, **kwargs)
self.service._wait_available_volume.assert_called_once_with(
@ -80,13 +77,10 @@ class CinderV2ServiceTestCase(test.ScenarioTestCase):
"snapshot_id": None,
"source_volid": None,
"volume_type": None,
"user_id": None,
"project_id": None,
"availability_zone": None,
"metadata": None,
"imageRef": None,
"scheduler_hints": None,
"source_replica": None,
"multiattach": False}
self.cinder.volumes.create.assert_called_once_with(
3, **kwargs)
@ -309,9 +303,9 @@ class UnifiedCinderV2ServiceTestCase(test.TestCase):
self.service._impl.create_volume.assert_called_once_with(
1, availability_zone=None, consistencygroup_id=None,
description=None, imageRef=None,
metadata=None, multiattach=False, name=None, project_id=None,
scheduler_hints=None, snapshot_id=None, source_replica=None,
source_volid=None, user_id=None, volume_type=None)
metadata=None, multiattach=False, name=None,
scheduler_hints=None, snapshot_id=None,
source_volid=None, volume_type=None)
self.service._unify_volume.assert_called_once_with(
self.service._impl.create_volume.return_value)