Fixed access to instance_uuid in retype

We missed an access to volume['instance_uuid']
in the multiattach patch.   The instance_uuid and attached_host
were moved into the volume_attachment table.

This patch changes how we test to see if a volume is available
or not, but checking the new location.

Change-Id: I8844cd8c2947845f9efb11a2a1371efee2d28bbe
Closes-Bug: 1436604
This commit is contained in:
Walter A. Boring IV 2015-03-25 16:33:16 -07:00
parent 706878deaa
commit 8cd9e49a90
2 changed files with 5 additions and 3 deletions

View File

@ -196,8 +196,8 @@ class SchedulerManager(manager.Manager):
volume_ref, msg, reservations):
if reservations:
QUOTAS.rollback(context, reservations)
if (volume_ref['instance_uuid'] is None and
volume_ref['attached_host'] is None):
if (volume_ref['volume_attachment'] is None or
len(volume_ref['volume_attachment']) == 0):
orig_status = 'available'
else:
orig_status = 'in-use'

View File

@ -239,7 +239,9 @@ class SchedulerManagerTestCase(test.TestCase):
request_spec = {'volume_id': fake_volume_id, 'volume_type': {'id': 3},
'migration_policy': 'on-demand'}
vol_info = {'id': fake_volume_id, 'status': 'in-use',
'instance_uuid': 'foo', 'attached_host': None}
'volume_attachment': [{'id': 'fake_id',
'instance_uuid': 'foo',
'attached_host': None}]}
_mock_vol_get.return_value = vol_info
_mock_vol_update.return_value = {'status': 'in-use'}