diff options
| author | Ankit Agrawal <ankit11.agrawal@nttdata.com> | 2015-12-13 23:48:33 -0800 |
|---|---|---|
| committer | Ankit Agrawal <ankit11.agrawal@nttdata.com> | 2016-02-16 00:34:58 -0800 |
| commit | c49fce3909a1705855ee2b91a82c39830fe17edd (patch) | |
| tree | 64a4f46e3b33639ab62f13a20d3603ed83a7a6cf /cinderclient/v2/volume_backups.py | |
| parent | b2fc77f731c9cdb02efaa942f140ee7fd134ffac (diff) | |
| download | python-cinderclient-c49fce3909a1705855ee2b91a82c39830fe17edd.tar.gz | |
Add request_ids attribute to resource objects
Added request_ids attribute to resource object for all the
volume_backups, volume_encryption_types and volume_transfers
APIs by updating following APIs:
volume_backups: reset_state, delete, export_record, import_record
volume_transfers: delete
volume_encryption_types: list
Returning list with request_ids as attribute in case of 'list' API
for volume_encryption_types.
These changes are required to return 'request_id' from client to log
request_id mappings of cross projects.
For more details on how request_id will be returned to the caller,
please refer to the approved blueprint [1] discussed with the
cross-project team.
[1] http://specs.openstack.org/openstack/openstack-specs/specs/return-request-id.html
DocImpact
'request-ids' will be returned as an attribute with response object.
User can access it using 'res.request_ids' where 'res' is a
response object.
Change-Id: I2197ca38f6c9a8b0ced5c82d29676b49c9700b09
Partial-Implements: blueprint return-request-id-to-caller
Diffstat (limited to 'cinderclient/v2/volume_backups.py')
| -rw-r--r-- | cinderclient/v2/volume_backups.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cinderclient/v2/volume_backups.py b/cinderclient/v2/volume_backups.py index fc653c8..784aad7 100644 --- a/cinderclient/v2/volume_backups.py +++ b/cinderclient/v2/volume_backups.py @@ -17,6 +17,7 @@ Volume Backups interface (1.1 extension). """ from cinderclient import base +from cinderclient.openstack.common.apiclient import base as common_base class VolumeBackup(base.Resource): @@ -30,7 +31,7 @@ class VolumeBackup(base.Resource): return self.manager.delete(self) def reset_state(self, state): - self.manager.reset_state(self, state) + return self.manager.reset_state(self, state) class VolumeBackupManager(base.ManagerWithFind): @@ -85,7 +86,7 @@ class VolumeBackupManager(base.ManagerWithFind): :param backup: The :class:`VolumeBackup` to delete. """ - self._delete("/backups/%s" % base.getid(backup)) + return self._delete("/backups/%s" % base.getid(backup)) def reset_state(self, backup, state): """Update the specified volume backup with the provided state.""" @@ -96,7 +97,8 @@ class VolumeBackupManager(base.ManagerWithFind): body = {action: info} self.run_hooks('modify_body_for_action', body, **kwargs) url = '/backups/%s/action' % base.getid(backup) - return self.api.client.post(url, body=body) + resp, body = self.api.client.post(url, body=body) + return common_base.TupleWithMeta((resp, body), resp) def export_record(self, backup_id): """Export volume backup metadata record. @@ -106,7 +108,7 @@ class VolumeBackupManager(base.ManagerWithFind): """ resp, body = \ self.api.client.get("/backups/%s/export_record" % backup_id) - return body['backup-record'] + return common_base.DictWithMeta(body['backup-record'], resp) def import_record(self, backup_service, backup_url): """Export volume backup metadata record. @@ -119,4 +121,4 @@ class VolumeBackupManager(base.ManagerWithFind): 'backup_url': backup_url}} self.run_hooks('modify_body_for_update', body, 'backup-record') resp, body = self.api.client.post("/backups/import_record", body=body) - return body['backup'] + return common_base.DictWithMeta(body['backup'], resp) |
