Merge "volume: Allow passing a volume type object to retype_volume"

This commit is contained in:
Zuul 2024-04-17 10:37:13 +00:00 committed by Gerrit Code Review
commit cf5f4ce437
2 changed files with 10 additions and 4 deletions

View File

@ -361,7 +361,9 @@ class Proxy(_base_proxy.BaseBlockStorageProxy):
:param volume: The value can be either the ID of a volume or a
:class:`~openstack.block_storage.v2.volume.Volume` instance.
:param str new_type: The new volume type that volume is changed with.
:param new_type: The new volume type that volume is changed with.
The value can be either the ID of the volume type or a
:class:`~openstack.block_storage.v2.type.Type` instance.
:param str migration_policy: Specify if the volume should be migrated
when it is re-typed. Possible values are on-demand or never.
Default: never.
@ -369,7 +371,8 @@ class Proxy(_base_proxy.BaseBlockStorageProxy):
:returns: None
"""
volume = self._get_resource(_volume.Volume, volume)
volume.retype(self, new_type, migration_policy)
type_id = resource.Resource._get_id(new_type)
volume.retype(self, type_id, migration_policy)
def set_volume_bootable_status(self, volume, bootable):
"""Set bootable status of the volume.

View File

@ -747,7 +747,9 @@ class Proxy(_base_proxy.BaseBlockStorageProxy):
:param volume: The value can be either the ID of a volume or a
:class:`~openstack.block_storage.v3.volume.Volume` instance.
:param str new_type: The new volume type that volume is changed with.
:param new_type: The new volume type that volume is changed with.
The value can be either the ID of the volume type or a
:class:`~openstack.block_storage.v3.type.Type` instance.
:param str migration_policy: Specify if the volume should be migrated
when it is re-typed. Possible values are on-demand or never.
Default: never.
@ -755,7 +757,8 @@ class Proxy(_base_proxy.BaseBlockStorageProxy):
:returns: None
"""
volume = self._get_resource(_volume.Volume, volume)
volume.retype(self, new_type, migration_policy)
type_id = resource.Resource._get_id(new_type)
volume.retype(self, type_id, migration_policy)
def set_volume_bootable_status(self, volume, bootable):
"""Set bootable status of the volume.