Reject volume extension of in-use volume regardless of multiattach
Cinder v3 API does not allow volumes in use to be extended. Drop the logic to allow this operation which was added for v2 api. Story: 2011229 Task: 51083 Change-Id: If2096e739cbb9de78c81840bfba5665893d791f1
This commit is contained in:
parent
ffa485a8e9
commit
0135d50659
@ -368,9 +368,7 @@ class CinderVolume(vb.BaseVolume, sh.SchedulerHintsMixin):
|
||||
|
||||
def _ready_to_extend_volume(self):
|
||||
vol = self.client().volumes.get(self.resource_id)
|
||||
expected_status = (
|
||||
'available', 'in-use') if vol.multiattach else ('available',)
|
||||
|
||||
expected_status = ('available',)
|
||||
if vol.status in expected_status:
|
||||
LOG.debug("Volume %s is ready to extend.", vol.id)
|
||||
return True
|
||||
@ -382,7 +380,8 @@ class CinderVolume(vb.BaseVolume, sh.SchedulerHintsMixin):
|
||||
LOG.debug("Volume %s is being extended", vol.id)
|
||||
return False
|
||||
|
||||
if vol.status != 'available':
|
||||
expected_status = ('available',)
|
||||
if vol.status not in expected_status:
|
||||
LOG.info("Resize failed: Volume %(vol)s "
|
||||
"is in %(status)s state.",
|
||||
{'vol': vol.id, 'status': vol.status})
|
||||
|
@ -1388,10 +1388,7 @@ class CinderVolumeTest(vt_base.VolumeTestCase):
|
||||
extra_get_mocks=[
|
||||
vt_base.FakeVolume('extending'),
|
||||
vt_base.FakeVolume('reserved'),
|
||||
vt_base.FakeVolume('in-use',
|
||||
multiattach=True),
|
||||
vt_base.FakeVolume('in-use',
|
||||
multiattach=False),
|
||||
vt_base.FakeVolume('in-use'),
|
||||
vt_base.FakeVolume('available')])
|
||||
|
||||
stack = utils.parse_stack(self.t, stack_name=self.stack_name)
|
||||
@ -1401,7 +1398,6 @@ class CinderVolumeTest(vt_base.VolumeTestCase):
|
||||
|
||||
self.assertEqual(False, rsrc._ready_to_extend_volume())
|
||||
self.assertEqual(False, rsrc._ready_to_extend_volume())
|
||||
self.assertEqual(True, rsrc._ready_to_extend_volume())
|
||||
self.assertEqual(False, rsrc._ready_to_extend_volume())
|
||||
self.assertEqual(True, rsrc._ready_to_extend_volume())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user