Add os-extend_volume_completion volume action.
Change-Id: Ifdeab1a8cd634bbe63c25fae17448c0789b297c9
This commit is contained in:
parent
9f8a5c767e
commit
dd8ba12681
@ -26,7 +26,7 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
# key is unsupported version, value is appropriate supported alternative
|
# key is unsupported version, value is appropriate supported alternative
|
||||||
REPLACEMENT_VERSIONS = {"1": "3", "2": "3"}
|
REPLACEMENT_VERSIONS = {"1": "3", "2": "3"}
|
||||||
MAX_VERSION = "3.70"
|
MAX_VERSION = "3.71"
|
||||||
MIN_VERSION = "3.0"
|
MIN_VERSION = "3.0"
|
||||||
|
|
||||||
_SUBSTITUTIONS = {}
|
_SUBSTITUTIONS = {}
|
||||||
|
@ -455,6 +455,8 @@ class FakeHTTPClient(fakes_base.FakeHTTPClient):
|
|||||||
assert action in body
|
assert action in body
|
||||||
elif action == 'os-reimage':
|
elif action == 'os-reimage':
|
||||||
assert 'image_id' in body[action]
|
assert 'image_id' in body[action]
|
||||||
|
elif action == 'os-extend_volume_completion':
|
||||||
|
assert 'error' in body[action]
|
||||||
else:
|
else:
|
||||||
raise AssertionError("Unexpected action: %s" % action)
|
raise AssertionError("Unexpected action: %s" % action)
|
||||||
return (resp, {}, {})
|
return (resp, {}, {})
|
||||||
|
@ -552,6 +552,8 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||||||
assert 'snapshot_id' in body[action]
|
assert 'snapshot_id' in body[action]
|
||||||
elif action == 'os-reimage':
|
elif action == 'os-reimage':
|
||||||
assert 'image_id' in body[action]
|
assert 'image_id' in body[action]
|
||||||
|
elif action == 'os-extend_volume_completion':
|
||||||
|
assert 'error' in body[action]
|
||||||
else:
|
else:
|
||||||
raise AssertionError("Unexpected action: %s" % action)
|
raise AssertionError("Unexpected action: %s" % action)
|
||||||
return (resp, {}, _body)
|
return (resp, {}, _body)
|
||||||
|
@ -213,3 +213,13 @@ class VolumesTest(utils.TestCase):
|
|||||||
'reimage_reserved':
|
'reimage_reserved':
|
||||||
reimage_reserved}})
|
reimage_reserved}})
|
||||||
self._assert_request_id(vol)
|
self._assert_request_id(vol)
|
||||||
|
|
||||||
|
@ddt.data(False, True)
|
||||||
|
def test_complete_volume_extend(self, error):
|
||||||
|
cs = fakes.FakeClient(api_versions.APIVersion('3.71'))
|
||||||
|
v = cs.volumes.get('1234')
|
||||||
|
self._assert_request_id(v)
|
||||||
|
vol = cs.volumes.extend_volume_completion(v, error)
|
||||||
|
cs.assert_called('POST', '/volumes/1234/action',
|
||||||
|
{'os-extend_volume_completion': {'error': error}})
|
||||||
|
self._assert_request_id(vol)
|
||||||
|
@ -71,6 +71,10 @@ class Volume(volumes_base.Volume):
|
|||||||
"""Rebuilds the volume with the new specified image"""
|
"""Rebuilds the volume with the new specified image"""
|
||||||
self.manager.reimage(self, image_id, reimage_reserved)
|
self.manager.reimage(self, image_id, reimage_reserved)
|
||||||
|
|
||||||
|
def extend_volume_completion(self, volume, error=False):
|
||||||
|
"""Complete extending an attached volume"""
|
||||||
|
self.manager.extend_volume_completion(self, volume, error)
|
||||||
|
|
||||||
|
|
||||||
class VolumeManager(volumes_base.VolumeManager):
|
class VolumeManager(volumes_base.VolumeManager):
|
||||||
resource_class = Volume
|
resource_class = Volume
|
||||||
@ -304,3 +308,15 @@ class VolumeManager(volumes_base.VolumeManager):
|
|||||||
volume,
|
volume,
|
||||||
{'image_id': image_id,
|
{'image_id': image_id,
|
||||||
'reimage_reserved': reimage_reserved})
|
'reimage_reserved': reimage_reserved})
|
||||||
|
|
||||||
|
@api_versions.wraps('3.71')
|
||||||
|
def extend_volume_completion(self, volume, error=False):
|
||||||
|
"""Complete extending an attached volume.
|
||||||
|
|
||||||
|
:param volume: The UUID of the extended volume
|
||||||
|
:param error: Used to indicate if an error has occured that requires
|
||||||
|
Cinder to roll back the extend operation.
|
||||||
|
"""
|
||||||
|
return self._action('os-extend_volume_completion',
|
||||||
|
volume,
|
||||||
|
{'error': error})
|
||||||
|
Loading…
Reference in New Issue
Block a user