"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cinder/tests/unit/test_image_utils.py" between
cinder-15.5.0.tar.gz and cinder-15.6.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 (maintained release).

test_image_utils.py  (cinder-15.5.0):test_image_utils.py  (cinder-15.6.0)
skipping to change at line 1100 skipping to change at line 1100
data.file_format = volume_format data.file_format = volume_format
data.backing_file = None data.backing_file = None
data.virtual_size = 1234 data.virtual_size = 1234
tmp = mock_temp.return_value.__enter__.return_value tmp = mock_temp.return_value.__enter__.return_value
output = image_utils.fetch_to_volume_format(ctxt, image_service, output = image_utils.fetch_to_volume_format(ctxt, image_service,
image_id, dest, image_id, dest,
volume_format, blocksize) volume_format, blocksize)
self.assertIsNone(output) self.assertIsNone(output)
mock_temp.assert_called_once_with() mock_temp.assert_called_once_with(prefix='image_download_%s_' %
image_id)
mock_info.assert_has_calls([ mock_info.assert_has_calls([
mock.call(tmp, force_share=False, run_as_root=True), mock.call(tmp, force_share=False, run_as_root=True),
mock.call(tmp, run_as_root=True)]) mock.call(tmp, run_as_root=True)])
mock_fetch.assert_called_once_with(ctxt, image_service, image_id, mock_fetch.assert_called_once_with(ctxt, image_service, image_id,
tmp, None, None) tmp, None, None)
self.assertFalse(mock_repl_xen.called) self.assertFalse(mock_repl_xen.called)
self.assertFalse(mock_copy.called) self.assertFalse(mock_copy.called)
mock_convert.assert_called_once_with(tmp, dest, volume_format, mock_convert.assert_called_once_with(tmp, dest, volume_format,
out_subformat=out_subformat, out_subformat=out_subformat,
run_as_root=True, run_as_root=True,
skipping to change at line 1152 skipping to change at line 1153
data.backing_file = None data.backing_file = None
data.virtual_size = 1234 data.virtual_size = 1234
tmp = mock_temp.return_value.__enter__.return_value tmp = mock_temp.return_value.__enter__.return_value
output = image_utils.fetch_to_volume_format( output = image_utils.fetch_to_volume_format(
ctxt, image_service, image_id, dest, volume_format, blocksize, ctxt, image_service, image_id, dest, volume_format, blocksize,
user_id=user_id, project_id=project_id, size=size, user_id=user_id, project_id=project_id, size=size,
run_as_root=run_as_root) run_as_root=run_as_root)
self.assertIsNone(output) self.assertIsNone(output)
mock_temp.assert_called_once_with() mock_temp.assert_called_once_with(prefix='image_download_%s_' %
image_id)
mock_info.assert_has_calls([ mock_info.assert_has_calls([
mock.call(tmp, force_share=False, run_as_root=run_as_root), mock.call(tmp, force_share=False, run_as_root=run_as_root),
mock.call(tmp, run_as_root=run_as_root)]) mock.call(tmp, run_as_root=run_as_root)])
mock_fetch.assert_called_once_with(ctxt, image_service, image_id, mock_fetch.assert_called_once_with(ctxt, image_service, image_id,
tmp, user_id, project_id) tmp, user_id, project_id)
self.assertFalse(mock_repl_xen.called) self.assertFalse(mock_repl_xen.called)
self.assertFalse(mock_copy.called) self.assertFalse(mock_copy.called)
mock_convert.assert_called_once_with(tmp, dest, volume_format, mock_convert.assert_called_once_with(tmp, dest, volume_format,
out_subformat=out_subformat, out_subformat=out_subformat,
run_as_root=run_as_root, run_as_root=run_as_root,
skipping to change at line 1208 skipping to change at line 1210
tmp = mock_temp.return_value.__enter__.return_value tmp = mock_temp.return_value.__enter__.return_value
image_service = FakeImageService(disk_format='vhd') image_service = FakeImageService(disk_format='vhd')
expect_format = 'vpc' expect_format = 'vpc'
output = image_utils.fetch_to_volume_format( output = image_utils.fetch_to_volume_format(
ctxt, image_service, image_id, dest, volume_format, blocksize, ctxt, image_service, image_id, dest, volume_format, blocksize,
user_id=user_id, project_id=project_id, size=size, user_id=user_id, project_id=project_id, size=size,
run_as_root=run_as_root) run_as_root=run_as_root)
self.assertIsNone(output) self.assertIsNone(output)
mock_temp.assert_called_once_with() mock_temp.assert_called_once_with(prefix='image_download_%s_' %
image_id)
mock_info.assert_has_calls([ mock_info.assert_has_calls([
mock.call(tmp, force_share=False, run_as_root=run_as_root), mock.call(tmp, force_share=False, run_as_root=run_as_root),
mock.call(tmp, run_as_root=run_as_root)]) mock.call(tmp, run_as_root=run_as_root)])
mock_fetch.assert_called_once_with(ctxt, image_service, image_id, mock_fetch.assert_called_once_with(ctxt, image_service, image_id,
tmp, user_id, project_id) tmp, user_id, project_id)
mock_repl_xen.assert_called_once_with(tmp) mock_repl_xen.assert_called_once_with(tmp)
self.assertFalse(mock_copy.called) self.assertFalse(mock_copy.called)
mock_convert.assert_called_once_with(tmp, dest, volume_format, mock_convert.assert_called_once_with(tmp, dest, volume_format,
out_subformat=out_subformat, out_subformat=out_subformat,
run_as_root=run_as_root, run_as_root=run_as_root,
skipping to change at line 1260 skipping to change at line 1263
tmp = mock_temp.return_value.__enter__.return_value tmp = mock_temp.return_value.__enter__.return_value
image_service = FakeImageService(disk_format='iso') image_service = FakeImageService(disk_format='iso')
expect_format = 'raw' expect_format = 'raw'
output = image_utils.fetch_to_volume_format( output = image_utils.fetch_to_volume_format(
ctxt, image_service, image_id, dest, volume_format, blocksize, ctxt, image_service, image_id, dest, volume_format, blocksize,
user_id=user_id, project_id=project_id, size=size, user_id=user_id, project_id=project_id, size=size,
run_as_root=run_as_root) run_as_root=run_as_root)
self.assertIsNone(output) self.assertIsNone(output)
mock_temp.assert_called_once_with() mock_temp.assert_called_once_with(prefix='image_download_%s_' %
image_id)
mock_info.assert_has_calls([ mock_info.assert_has_calls([
mock.call(tmp, force_share=False, run_as_root=run_as_root), mock.call(tmp, force_share=False, run_as_root=run_as_root),
mock.call(tmp, run_as_root=run_as_root)]) mock.call(tmp, run_as_root=run_as_root)])
mock_fetch.assert_called_once_with(ctxt, image_service, image_id, mock_fetch.assert_called_once_with(ctxt, image_service, image_id,
tmp, user_id, project_id) tmp, user_id, project_id)
self.assertFalse(mock_copy.called) self.assertFalse(mock_copy.called)
mock_convert.assert_called_once_with(tmp, dest, volume_format, mock_convert.assert_called_once_with(tmp, dest, volume_format,
out_subformat=out_subformat, out_subformat=out_subformat,
run_as_root=run_as_root, run_as_root=run_as_root,
src_format=expect_format) src_format=expect_format)
skipping to change at line 1364 skipping to change at line 1368
'size': 41126400} 'size': 41126400}
image_size_m = math.ceil(float(41126400) / units.Mi) image_size_m = math.ceil(float(41126400) / units.Mi)
output = image_utils.fetch_to_volume_format( output = image_utils.fetch_to_volume_format(
ctxt, image_service, image_id, dest, volume_format, blocksize, ctxt, image_service, image_id, dest, volume_format, blocksize,
user_id=user_id, project_id=project_id, size=size, user_id=user_id, project_id=project_id, size=size,
run_as_root=run_as_root) run_as_root=run_as_root)
self.assertIsNone(output) self.assertIsNone(output)
image_service.show.assert_called_once_with(ctxt, image_id) image_service.show.assert_called_once_with(ctxt, image_id)
mock_temp.assert_called_once_with() mock_temp.assert_called_once_with(prefix='image_download_%s_' %
image_id)
mock_info.assert_called_once_with(tmp, mock_info.assert_called_once_with(tmp,
force_share=False, force_share=False,
run_as_root=run_as_root) run_as_root=run_as_root)
mock_fetch.assert_called_once_with(ctxt, image_service, image_id, mock_fetch.assert_called_once_with(ctxt, image_service, image_id,
tmp, user_id, project_id) tmp, user_id, project_id)
self.assertFalse(mock_repl_xen.called) self.assertFalse(mock_repl_xen.called)
mock_copy.assert_called_once_with(tmp, dest, image_size_m, mock_copy.assert_called_once_with(tmp, dest, image_size_m,
blocksize) blocksize)
self.assertFalse(mock_convert.called) self.assertFalse(mock_convert.called)
skipping to change at line 1411 skipping to change at line 1416
image_service.show.return_value = {'disk_format': 'not_raw'} image_service.show.return_value = {'disk_format': 'not_raw'}
self.assertRaises( self.assertRaises(
exception.ImageUnacceptable, exception.ImageUnacceptable,
image_utils.fetch_to_volume_format, image_utils.fetch_to_volume_format,
ctxt, image_service, image_id, dest, volume_format, blocksize, ctxt, image_service, image_id, dest, volume_format, blocksize,
user_id=user_id, project_id=project_id, size=size, user_id=user_id, project_id=project_id, size=size,
run_as_root=run_as_root) run_as_root=run_as_root)
image_service.show.assert_called_once_with(ctxt, image_id) image_service.show.assert_called_once_with(ctxt, image_id)
mock_temp.assert_called_once_with() mock_temp.assert_called_once_with(prefix='image_download_%s_' %
image_id)
mock_info.assert_called_once_with(tmp, mock_info.assert_called_once_with(tmp,
force_share=False, force_share=False,
run_as_root=run_as_root) run_as_root=run_as_root)
self.assertFalse(mock_fetch.called) self.assertFalse(mock_fetch.called)
self.assertFalse(mock_repl_xen.called) self.assertFalse(mock_repl_xen.called)
self.assertFalse(mock_copy.called) self.assertFalse(mock_copy.called)
self.assertFalse(mock_convert.called) self.assertFalse(mock_convert.called)
@mock.patch('cinder.image.image_utils.convert_image') @mock.patch('cinder.image.image_utils.convert_image')
@mock.patch('cinder.image.image_utils.volume_utils.copy_volume') @mock.patch('cinder.image.image_utils.volume_utils.copy_volume')
skipping to change at line 1456 skipping to change at line 1462
image_service.show.return_value = None image_service.show.return_value = None
self.assertRaises( self.assertRaises(
exception.ImageUnacceptable, exception.ImageUnacceptable,
image_utils.fetch_to_volume_format, image_utils.fetch_to_volume_format,
ctxt, image_service, image_id, dest, volume_format, blocksize, ctxt, image_service, image_id, dest, volume_format, blocksize,
user_id=user_id, project_id=project_id, size=size, user_id=user_id, project_id=project_id, size=size,
run_as_root=run_as_root) run_as_root=run_as_root)
image_service.show.assert_called_once_with(ctxt, image_id) image_service.show.assert_called_once_with(ctxt, image_id)
mock_temp.assert_called_once_with() mock_temp.assert_called_once_with(prefix='image_download_%s_' %
image_id)
mock_info.assert_called_once_with(tmp, mock_info.assert_called_once_with(tmp,
force_share=False, force_share=False,
run_as_root=run_as_root) run_as_root=run_as_root)
self.assertFalse(mock_fetch.called) self.assertFalse(mock_fetch.called)
self.assertFalse(mock_repl_xen.called) self.assertFalse(mock_repl_xen.called)
self.assertFalse(mock_copy.called) self.assertFalse(mock_copy.called)
self.assertFalse(mock_convert.called) self.assertFalse(mock_convert.called)
@mock.patch('cinder.image.image_utils.check_virtual_size') @mock.patch('cinder.image.image_utils.check_virtual_size')
@mock.patch('cinder.image.image_utils.convert_image') @mock.patch('cinder.image.image_utils.convert_image')
skipping to change at line 1507 skipping to change at line 1514
image_id='fake_image_id', reason='test') image_id='fake_image_id', reason='test')
self.assertRaises( self.assertRaises(
exception.ImageUnacceptable, exception.ImageUnacceptable,
image_utils.fetch_to_volume_format, image_utils.fetch_to_volume_format,
ctxt, image_service, image_id, dest, volume_format, blocksize, ctxt, image_service, image_id, dest, volume_format, blocksize,
user_id=user_id, project_id=project_id, size=size, user_id=user_id, project_id=project_id, size=size,
run_as_root=run_as_root) run_as_root=run_as_root)
image_service.show.assert_called_once_with(ctxt, image_id) image_service.show.assert_called_once_with(ctxt, image_id)
mock_temp.assert_called_once_with() mock_temp.assert_called_once_with(prefix='image_download_%s_' %
image_id)
mock_info.assert_has_calls([ mock_info.assert_has_calls([
mock.call(tmp, force_share=False, run_as_root=run_as_root), mock.call(tmp, force_share=False, run_as_root=run_as_root),
mock.call(tmp, run_as_root=run_as_root)]) mock.call(tmp, run_as_root=run_as_root)])
mock_fetch.assert_called_once_with(ctxt, image_service, image_id, mock_fetch.assert_called_once_with(ctxt, image_service, image_id,
tmp, user_id, project_id) tmp, user_id, project_id)
self.assertFalse(mock_repl_xen.called) self.assertFalse(mock_repl_xen.called)
self.assertFalse(mock_copy.called) self.assertFalse(mock_copy.called)
self.assertFalse(mock_convert.called) self.assertFalse(mock_convert.called)
@mock.patch('cinder.image.image_utils.convert_image') @mock.patch('cinder.image.image_utils.convert_image')
skipping to change at line 1555 skipping to change at line 1563
tmp = mock_temp.return_value.__enter__.return_value tmp = mock_temp.return_value.__enter__.return_value
self.assertRaises( self.assertRaises(
exception.ImageUnacceptable, exception.ImageUnacceptable,
image_utils.fetch_to_volume_format, image_utils.fetch_to_volume_format,
ctxt, image_service, image_id, dest, volume_format, blocksize, ctxt, image_service, image_id, dest, volume_format, blocksize,
user_id=user_id, project_id=project_id, size=size, user_id=user_id, project_id=project_id, size=size,
run_as_root=run_as_root) run_as_root=run_as_root)
image_service.show.assert_called_once_with(ctxt, image_id) image_service.show.assert_called_once_with(ctxt, image_id)
mock_temp.assert_called_once_with() mock_temp.assert_called_once_with(prefix='image_download_%s_' %
image_id)
mock_info.assert_has_calls([ mock_info.assert_has_calls([
mock.call(tmp, force_share=False, run_as_root=run_as_root), mock.call(tmp, force_share=False, run_as_root=run_as_root),
mock.call(tmp, run_as_root=run_as_root)]) mock.call(tmp, run_as_root=run_as_root)])
mock_fetch.assert_called_once_with(ctxt, image_service, image_id, mock_fetch.assert_called_once_with(ctxt, image_service, image_id,
tmp, user_id, project_id) tmp, user_id, project_id)
self.assertFalse(mock_repl_xen.called) self.assertFalse(mock_repl_xen.called)
self.assertFalse(mock_copy.called) self.assertFalse(mock_copy.called)
self.assertFalse(mock_convert.called) self.assertFalse(mock_convert.called)
@mock.patch('cinder.image.image_utils.convert_image') @mock.patch('cinder.image.image_utils.convert_image')
skipping to change at line 1603 skipping to change at line 1612
tmp = mock_temp.return_value.__enter__.return_value tmp = mock_temp.return_value.__enter__.return_value
self.assertRaises( self.assertRaises(
exception.ImageUnacceptable, exception.ImageUnacceptable,
image_utils.fetch_to_volume_format, image_utils.fetch_to_volume_format,
ctxt, image_service, image_id, dest, volume_format, blocksize, ctxt, image_service, image_id, dest, volume_format, blocksize,
user_id=user_id, project_id=project_id, size=size, user_id=user_id, project_id=project_id, size=size,
run_as_root=run_as_root) run_as_root=run_as_root)
image_service.show.assert_called_once_with(ctxt, image_id) image_service.show.assert_called_once_with(ctxt, image_id)
mock_temp.assert_called_once_with() mock_temp.assert_called_once_with(prefix='image_download_%s_' %
image_id)
mock_info.assert_has_calls([ mock_info.assert_has_calls([
mock.call(tmp, force_share=False, run_as_root=run_as_root), mock.call(tmp, force_share=False, run_as_root=run_as_root),
mock.call(tmp, run_as_root=run_as_root)]) mock.call(tmp, run_as_root=run_as_root)])
mock_fetch.assert_called_once_with(ctxt, image_service, image_id, mock_fetch.assert_called_once_with(ctxt, image_service, image_id,
tmp, user_id, project_id) tmp, user_id, project_id)
self.assertFalse(mock_repl_xen.called) self.assertFalse(mock_repl_xen.called)
self.assertFalse(mock_copy.called) self.assertFalse(mock_copy.called)
self.assertFalse(mock_convert.called) self.assertFalse(mock_convert.called)
@mock.patch('cinder.image.image_utils.check_virtual_size') @mock.patch('cinder.image.image_utils.check_virtual_size')
skipping to change at line 1652 skipping to change at line 1662
data.backing_file = None data.backing_file = None
data.virtual_size = 1234 data.virtual_size = 1234
tmp = mock_temp.return_value.__enter__.return_value tmp = mock_temp.return_value.__enter__.return_value
output = image_utils.fetch_to_volume_format( output = image_utils.fetch_to_volume_format(
ctxt, image_service, image_id, dest, volume_format, blocksize, ctxt, image_service, image_id, dest, volume_format, blocksize,
user_id=user_id, project_id=project_id, size=size, user_id=user_id, project_id=project_id, size=size,
run_as_root=run_as_root) run_as_root=run_as_root)
self.assertIsNone(output) self.assertIsNone(output)
mock_temp.assert_called_once_with() mock_temp.assert_called_once_with(prefix='image_download_%s_' %
image_id)
mock_info.assert_has_calls([ mock_info.assert_has_calls([
mock.call(tmp, force_share=False, run_as_root=run_as_root), mock.call(tmp, force_share=False, run_as_root=run_as_root),
mock.call(tmp, run_as_root=run_as_root)]) mock.call(tmp, run_as_root=run_as_root)])
mock_fetch.assert_called_once_with(ctxt, image_service, image_id, mock_fetch.assert_called_once_with(ctxt, image_service, image_id,
tmp, user_id, project_id) tmp, user_id, project_id)
mock_repl_xen.assert_called_once_with(tmp) mock_repl_xen.assert_called_once_with(tmp)
self.assertFalse(mock_copy.called) self.assertFalse(mock_copy.called)
mock_convert.assert_called_once_with(tmp, dest, volume_format, mock_convert.assert_called_once_with(tmp, dest, volume_format,
out_subformat=None, out_subformat=None,
run_as_root=run_as_root, run_as_root=run_as_root,
skipping to change at line 1810 skipping to change at line 1821
tmp = mock_temp.return_value.__enter__.return_value tmp = mock_temp.return_value.__enter__.return_value
mock_engine = mock.Mock(spec=fakeEngine) mock_engine = mock.Mock(spec=fakeEngine)
mock_get_engine.return_value = mock_engine mock_get_engine.return_value = mock_engine
output = image_utils.fetch_to_volume_format(ctxt, image_service, output = image_utils.fetch_to_volume_format(ctxt, image_service,
image_id, dest, image_id, dest,
volume_format, blocksize) volume_format, blocksize)
self.assertIsNone(output) self.assertIsNone(output)
mock_temp.assert_called_once_with() mock_temp.assert_called_once_with(prefix='image_download_%s_' %
image_id)
mock_info.assert_has_calls([ mock_info.assert_has_calls([
mock.call(tmp, force_share=False, run_as_root=True), mock.call(tmp, force_share=False, run_as_root=True),
mock.call(tmp, run_as_root=True)]) mock.call(tmp, run_as_root=True)])
mock_fetch.assert_called_once_with(ctxt, image_service, image_id, mock_fetch.assert_called_once_with(ctxt, image_service, image_id,
tmp, None, None) tmp, None, None)
self.assertFalse(mock_repl_xen.called) self.assertFalse(mock_repl_xen.called)
self.assertFalse(mock_copy.called) self.assertFalse(mock_copy.called)
mock_convert.assert_called_once_with(tmp, dest, volume_format, mock_convert.assert_called_once_with(tmp, dest, volume_format,
out_subformat=out_subformat, out_subformat=out_subformat,
run_as_root=True, run_as_root=True,
 End of changes. 12 change blocks. 
12 lines changed or deleted 24 lines changed or added

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