diff --git a/cinder/tests/unit/test_volume.py b/cinder/tests/unit/test_volume.py index 1ceda520a97..218c515c3c6 100644 --- a/cinder/tests/unit/test_volume.py +++ b/cinder/tests/unit/test_volume.py @@ -6860,6 +6860,7 @@ class GenericVolumeDriverTestCase(DriverTestCase): def test__create_temp_volume_from_snapshot(self): volume_dict = {'id': fake.SNAPSHOT_ID, 'host': 'fakehost', + 'cluster_name': 'fakecluster', 'availability_zone': 'fakezone', 'size': 1} vol = fake_volume.fake_volume_obj(self.context, **volume_dict) @@ -6874,6 +6875,7 @@ class GenericVolumeDriverTestCase(DriverTestCase): self.assertEqual(fields.VolumeAttachStatus.DETACHED, temp_vol.attach_status) self.assertEqual('fakezone', temp_vol.availability_zone) + self.assertEqual('fakecluster', temp_vol.cluster_name) @mock.patch.object(utils, 'brick_get_connector_properties') @mock.patch.object(cinder.volume.manager.VolumeManager, '_attach_volume') diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index b429a50eb61..ba13a2f71a7 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -1424,9 +1424,10 @@ class BaseVD(object): def _create_temp_volume(self, context, volume): kwargs = { - 'size': volume['size'], - 'display_name': 'backup-vol-%s' % volume['id'], - 'host': volume['host'], + 'size': volume.size, + 'display_name': 'backup-vol-%s' % volume.id, + 'host': volume.host, + 'cluster_name': volume.cluster_name, 'user_id': context.user_id, 'project_id': context.project_id, 'status': 'creating',