Call server volume detach only once
Changes:
- Removed duplicate delete calls to prevent race condition.
- Removed duplicate mocked calls from unit-test.
Closes-Bug: #1311533
Closes-Bug: #1298350
Conflicts:
heat/engine/resources/volume.py
heat/tests/test_volume.py
Change-Id: I5f16c528652f12440160f03b92f41b76d1c9100c
(cherry picked from commit d1ffbd4bfd
)
This commit is contained in:
parent
931de32f21
commit
0b984b8c13
|
@ -280,17 +280,10 @@ class VolumeDetachTask(object):
|
|||
yield
|
||||
|
||||
try:
|
||||
vol.get()
|
||||
while vol.status in ('in-use', 'detaching'):
|
||||
logger.debug(_('%s - volume still in use') % str(self))
|
||||
yield
|
||||
|
||||
try:
|
||||
server_api.delete_server_volume(self.server_id,
|
||||
self.attachment_id)
|
||||
except (clients.novaclient.exceptions.BadRequest,
|
||||
clients.novaclient.exceptions.NotFound):
|
||||
pass
|
||||
vol.get()
|
||||
|
||||
logger.info(_('%(name)s - status: %(status)s') % {
|
||||
|
|
|
@ -332,10 +332,7 @@ class VolumeTest(HeatTestCase):
|
|||
self._mock_create_server_volume_script(fva)
|
||||
|
||||
# delete script
|
||||
fva = FakeVolume('i-use', 'available')
|
||||
self.m.StubOutWithMock(fva, 'get')
|
||||
fva.get().MultipleTimes()
|
||||
fva.status = "in-use"
|
||||
fva = FakeVolume('in-use', 'available')
|
||||
|
||||
self.fc.volumes.get_server_volume(u'WikiDatabase',
|
||||
'vol-123').AndReturn(fva)
|
||||
|
@ -345,18 +342,6 @@ class VolumeTest(HeatTestCase):
|
|||
'WikiDatabase', 'vol-123').AndRaise(
|
||||
clients.novaclient.exceptions.BadRequest('Already detached'))
|
||||
|
||||
self.fc.volumes.delete_server_volume(
|
||||
'WikiDatabase', 'vol-123').AndRaise(
|
||||
clients.novaclient.exceptions.NotFound('Not found'))
|
||||
|
||||
self.fc.volumes.delete_server_volume(
|
||||
'WikiDatabase', 'vol-123').AndRaise(
|
||||
clients.novaclient.exceptions.NotFound('Not found'))
|
||||
|
||||
self.fc.volumes.delete_server_volume(
|
||||
'WikiDatabase', 'vol-123').AndRaise(
|
||||
clients.cinderclient.exceptions.NotFound('Not found'))
|
||||
|
||||
self.fc.volumes.get_server_volume(u'WikiDatabase',
|
||||
'vol-123').AndReturn(fva)
|
||||
self.fc.volumes.get_server_volume(
|
||||
|
|
Loading…
Reference in New Issue