]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fixed access to instance_uuid in retype
authorWalter A. Boring IV <walter.boring@hp.com>
Wed, 25 Mar 2015 23:33:16 +0000 (16:33 -0700)
committerWalter A. Boring IV <walter.boring@hp.com>
Wed, 25 Mar 2015 23:39:51 +0000 (16:39 -0700)
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

cinder/scheduler/manager.py
cinder/tests/scheduler/test_scheduler.py

index cc03b15ac8d3a651bec6273909aabc3a54a4b740..66acc4080e5a64f5e807e2767386b0641f7d6b2d 100644 (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'
index 623fc3219f64b8aecdc2e38982acae2daa97f4b1..1248b30a86c6ce352369703dd9b349db3831ad8d 100644 (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'}