Merge "Proxy is_volume through DriverBlockDevice"

This commit is contained in:
Zuul 2018-05-08 01:27:19 +00:00 committed by Gerrit Code Review
commit de7386822c
3 changed files with 11 additions and 11 deletions

View File

@ -1239,11 +1239,15 @@ class TestDriverBlockDevice(test.NoDBTestCase):
_proxy_as_attr_inherited = set('E')
bdm = objects.BlockDeviceMapping(self.context, no_device=False)
self.assertEqual(set(['uuid']), A(bdm)._proxy_as_attr)
self.assertEqual(set(['uuid', 'B']), B(bdm)._proxy_as_attr)
self.assertEqual(set(['uuid', 'C']), C(bdm)._proxy_as_attr)
self.assertEqual(set(['uuid', 'B', 'D']), D(bdm)._proxy_as_attr)
self.assertEqual(set(['uuid', 'B', 'C', 'E']), E(bdm)._proxy_as_attr)
self.assertEqual(set(['uuid', 'is_volume']), A(bdm)._proxy_as_attr)
self.assertEqual(set(['uuid', 'is_volume', 'B']),
B(bdm)._proxy_as_attr)
self.assertEqual(set(['uuid', 'is_volume', 'C']),
C(bdm)._proxy_as_attr)
self.assertEqual(set(['uuid', 'is_volume', 'B', 'D']),
D(bdm)._proxy_as_attr)
self.assertEqual(set(['uuid', 'is_volume', 'B', 'C', 'E']),
E(bdm)._proxy_as_attr)
class TestDriverBlockDeviceNewFlow(TestDriverBlockDevice):

View File

@ -105,7 +105,7 @@ class DriverBlockDevice(dict):
_fields = set()
_legacy_fields = set()
_proxy_as_attr_inherited = set(['uuid'])
_proxy_as_attr_inherited = set(['uuid', 'is_volume'])
_update_on_save = {'disk_bus': None,
'device_name': None,
'device_type': None}

View File

@ -389,11 +389,7 @@ class IronicDriver(virt_driver.ComputeDriver):
bdms = virt_driver.block_device_info_get_mapping(block_device_info)
for bdm in bdms:
# TODO(TheJulia): In Queens, we should refactor the check below
# to something more elegent, as is_volume is not proxied through
# to the DriverVolumeBlockDevice object. Until then, we are
# checking the underlying object's status.
if not bdm._bdm_obj.is_volume:
if not bdm.is_volume:
continue
connection_info = jsonutils.loads(bdm._bdm_obj.connection_info)