Fix three resources not being deleted by using name

There are three resources: VolumeBackup, Snapshot, VolumeTransfer.
None of them can be deleted by using their names on V2.

For example, Snapshot client side filtering fails in the function
findall. The reason is that snapshot object
<class 'cinderclient.v2.volume_snapshots.Snapshot'> does not have
a attribute 'display_name'.

The response of /v2/{tenant_id}/backups/detail does not have
a parameter 'display_name', but have a parameter 'name'.
So class Snapshot does not need to define NAME_ATTR = 'display_name'.
The superclass of Snapshot 'Resource' has defined NAME_ATTR = 'name'.

Closes-Bug: #1497873
Closes-Bug: #1495428
Change-Id: I3c89fd9a82918e8a02385cfccb32dc9c3f4c4095
This commit is contained in:
chenying
2015-09-10 11:04:23 +08:00
parent 19ba5e8cf9
commit 62aa713a1b
3 changed files with 0 additions and 3 deletions

View File

@@ -22,7 +22,6 @@ from cinderclient import base
class VolumeBackup(base.Resource):
"""A volume backup is a block level backup of a volume."""
NAME_ATTR = "display_name"
def __repr__(self):
return "<VolumeBackup: %s>" % self.id

View File

@@ -26,7 +26,6 @@ from cinderclient import base
class Snapshot(base.Resource):
"""A Snapshot is a point-in-time snapshot of an openstack volume."""
NAME_ATTR = "display_name"
def __repr__(self):
return "<Snapshot: %s>" % self.id

View File

@@ -27,7 +27,6 @@ from cinderclient import base
class VolumeTransfer(base.Resource):
"""Transfer a volume from one tenant to another"""
NAME_ATTR = "display_name"
def __repr__(self):
return "<VolumeTransfer: %s>" % self.id