"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cinder/tests/unit/volume/flows/test_create_volume_flow.py" between
cinder-15.0.1.tar.gz and cinder-15.1.0.tar.gz

About: OpenStack Cinder (Core Service: Block Storage) provides persistent block storage to running instances. Its pluggable driver architecture facilitates the creation and management of block storage devices.
The "Train" series (latest release).

test_create_volume_flow.py  (cinder-15.0.1):test_create_volume_flow.py  (cinder-15.1.0)
skipping to change at line 1558 skipping to change at line 1558
@mock.patch('cinder.image.image_utils.check_available_space') @mock.patch('cinder.image.image_utils.check_available_space')
@mock.patch('cinder.image.image_utils.qemu_img_info') @mock.patch('cinder.image.image_utils.qemu_img_info')
def test_create_from_image_clone_failure( def test_create_from_image_clone_failure(
self, cloning_supported, mock_qemu_info, mock_check_space, self, cloning_supported, mock_qemu_info, mock_check_space,
mock_get_internal_context, mock_get_internal_context,
mock_create_from_img_dl, mock_create_from_src, mock_create_from_img_dl, mock_create_from_src,
mock_handle_bootable, mock_fetch_img): mock_handle_bootable, mock_fetch_img):
image_location = 'someImageLocationStr' image_location = 'someImageLocationStr'
image_id = fakes.IMAGE_ID image_id = fakes.IMAGE_ID
image_meta = mock.MagicMock() image_meta = mock.MagicMock()
image_info = imageutils.QemuImgInfo()
image_info.virtual_size = '1073741824'
mock_qemu_info.return_value = image_info
volume = fake_volume.fake_volume_obj(self.ctxt, size=1, volume = fake_volume.fake_volume_obj(self.ctxt, size=1,
host='foo@bar#pool') host='foo@bar#pool')
image_volume = fake_volume.fake_db_volume(size=2) self.mock_driver.clone_image.return_value = (None, False)
self.mock_db.volume_create.return_value = image_volume
self.flags(verify_glance_signatures='disabled') self.flags(verify_glance_signatures='disabled')
if cloning_supported:
mock_create_from_src.side_effect = exception.CinderException(
'Error during cloning')
else:
mock_create_from_src.side_effect = NotImplementedError(
'Driver does not support clone')
manager = create_volume_manager.CreateVolumeFromSpecTask( manager = create_volume_manager.CreateVolumeFromSpecTask(
self.mock_volume_manager, self.mock_volume_manager,
self.mock_db, self.mock_db,
self.mock_driver, self.mock_driver,
image_volume_cache=self.mock_cache image_volume_cache=self.mock_cache
) )
if cloning_supported:
model_update = manager._create_from_image_cache_or_download( mock_create_from_src.side_effect = exception.SnapshotLimitReached(
self.ctxt, 'Error during cloning')
volume, self.assertRaises(
image_location, exception.SnapshotLimitReached,
image_id, manager._create_from_image,
image_meta, self.ctxt,
self.mock_image_service, volume,
update_cache=False) image_location,
image_id,
image_meta,
self.mock_image_service)
else:
mock_create_from_src.side_effect = NotImplementedError(
'Driver does not support clone')
model_update = manager._create_from_image(
self.ctxt,
volume,
image_location,
image_id,
image_meta,
self.mock_image_service)
mock_create_from_img_dl.assert_called_once()
self.assertEqual(mock_create_from_img_dl.return_value,
model_update)
# Ensure cloning was attempted and that it failed # Ensure cloning was attempted and that it failed
mock_create_from_src.assert_called_once() mock_create_from_src.assert_called_once()
mock_create_from_img_dl.assert_called_once() with mock.patch(
self.assertEqual(mock_create_from_img_dl.return_value, model_update) 'cinder.volume.flows.manager.create_volume.'
'CreateVolumeFromSpecTask') as volume_manager:
# Ensure a new cache entry is created when cloning fails, but (volume_manager.CreateVolumeFromSpecTask.
# only when the driver supports cloning. _create_from_image_cache_or_download.called_once())
if cloning_supported: (volume_manager.CreateVolumeFromSpecTask.
(self.mock_volume_manager. _create_from_image_cache.called_once())
_create_image_cache_volume_entry.assert_called_once())
else:
(self.mock_volume_manager.
_create_image_cache_volume_entry.assert_not_called())
@mock.patch('cinder.volume.flows.manager.create_volume.' @mock.patch('cinder.volume.flows.manager.create_volume.'
'CreateVolumeFromSpecTask.' 'CreateVolumeFromSpecTask.'
'_cleanup_cg_in_volume') '_cleanup_cg_in_volume')
@mock.patch('cinder.image.image_utils.check_available_space') @mock.patch('cinder.image.image_utils.check_available_space')
@mock.patch('cinder.image.image_utils.qemu_img_info') @mock.patch('cinder.image.image_utils.qemu_img_info')
@mock.patch('cinder.db.volume_update') @mock.patch('cinder.db.volume_update')
@mock.patch('cinder.image.image_utils.verify_glance_image_signature') @mock.patch('cinder.image.image_utils.verify_glance_image_signature')
def test_create_from_image_extend_failure( def test_create_from_image_extend_failure(
self, mock_verify, mock_volume_update, mock_qemu_info, self, mock_verify, mock_volume_update, mock_qemu_info,
 End of changes. 5 change blocks. 
34 lines changed or deleted 33 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)