Rename create_isolinux_image_for_uefi
function as misleading
The new name is `create_esp_image_for_uefi` which reflects what's actually going on under the hood. Change-Id: Ia9ac85fb2a450c9b5d009f10d82ab12c8ccd9a9d
This commit is contained in:
parent
c2ea6b8910
commit
9be7380e11
@ -222,12 +222,12 @@ def create_isolinux_image_for_bios(output_file, kernel, ramdisk,
|
||||
raise exception.ImageCreationFailed(image_type='iso', error=e)
|
||||
|
||||
|
||||
def create_isolinux_image_for_uefi(output_file, kernel, ramdisk,
|
||||
deploy_iso=None, esp_image=None,
|
||||
kernel_params=None):
|
||||
"""Creates an isolinux image on the specified file.
|
||||
def create_esp_image_for_uefi(output_file, kernel, ramdisk,
|
||||
deploy_iso=None, esp_image=None,
|
||||
kernel_params=None):
|
||||
"""Creates an ESP image on the specified file.
|
||||
|
||||
Copies the provided kernel, ramdisk and EFI system partition image to
|
||||
Copies the provided kernel, ramdisk and EFI system partition image (ESP) to
|
||||
a directory, generates the grub configuration file using kernel parameters
|
||||
and then generates a bootable ISO image for UEFI.
|
||||
|
||||
@ -317,6 +317,10 @@ def create_isolinux_image_for_uefi(output_file, kernel, ramdisk,
|
||||
raise exception.ImageCreationFailed(image_type='iso', error=e)
|
||||
|
||||
|
||||
# NOTE(etingof): backward compatibility
|
||||
create_isolinux_image_for_uefi = create_esp_image_for_uefi
|
||||
|
||||
|
||||
def fetch(context, image_href, path, force_raw=False):
|
||||
# TODO(vish): Improve context handling and add owner and auth data
|
||||
# when it is added to glance. Right now there is no
|
||||
@ -489,12 +493,12 @@ def create_boot_iso(context, output_filename, kernel_href,
|
||||
elif CONF.esp_image:
|
||||
esp_image_path = CONF.esp_image
|
||||
|
||||
create_isolinux_image_for_uefi(output_filename,
|
||||
kernel_path,
|
||||
ramdisk_path,
|
||||
deploy_iso=deploy_iso_path,
|
||||
esp_image=esp_image_path,
|
||||
kernel_params=params)
|
||||
create_esp_image_for_uefi(output_filename,
|
||||
kernel_path,
|
||||
ramdisk_path,
|
||||
deploy_iso=deploy_iso_path,
|
||||
esp_image=esp_image_path,
|
||||
kernel_params=params)
|
||||
else:
|
||||
create_isolinux_image_for_bios(output_filename,
|
||||
kernel_path,
|
||||
|
@ -485,7 +485,7 @@ class FsImageTestCase(base.TestCase):
|
||||
@mock.patch.object(images, '_mount_deploy_iso', autospec=True)
|
||||
@mock.patch.object(utils, 'tempdir', autospec=True)
|
||||
@mock.patch.object(images, '_generate_cfg', autospec=True)
|
||||
def test_create_isolinux_image_for_uefi_with_deploy_iso(
|
||||
def test_create_esp_image_for_uefi_with_deploy_iso(
|
||||
self, gen_cfg_mock, tempdir_mock, mount_mock, execute_mock,
|
||||
write_to_file_mock, create_root_fs_mock, umount_mock):
|
||||
|
||||
@ -517,11 +517,11 @@ class FsImageTestCase(base.TestCase):
|
||||
mount_mock.return_value = (uefi_path_info,
|
||||
e_img_rel_path, grub_rel_path)
|
||||
|
||||
images.create_isolinux_image_for_uefi('tgt_file',
|
||||
'path/to/kernel',
|
||||
'path/to/ramdisk',
|
||||
deploy_iso='path/to/deploy_iso',
|
||||
kernel_params=params)
|
||||
images.create_esp_image_for_uefi('tgt_file',
|
||||
'path/to/kernel',
|
||||
'path/to/ramdisk',
|
||||
deploy_iso='path/to/deploy_iso',
|
||||
kernel_params=params)
|
||||
mount_mock.assert_called_once_with('path/to/deploy_iso', 'mountdir')
|
||||
create_root_fs_mock.assert_called_once_with('tmpdir', files_info)
|
||||
gen_cfg_mock.assert_any_call(params, CONF.grub_config_template,
|
||||
@ -537,7 +537,7 @@ class FsImageTestCase(base.TestCase):
|
||||
@mock.patch.object(utils, 'execute', autospec=True)
|
||||
@mock.patch.object(utils, 'tempdir', autospec=True)
|
||||
@mock.patch.object(images, '_generate_cfg', autospec=True)
|
||||
def test_create_isolinux_image_for_uefi_with_esp_image(
|
||||
def test_create_esp_image_for_uefi_with_esp_image(
|
||||
self, gen_cfg_mock, tempdir_mock, execute_mock,
|
||||
create_root_fs_mock, write_to_file_mock):
|
||||
|
||||
@ -564,7 +564,7 @@ class FsImageTestCase(base.TestCase):
|
||||
tempdir_mock.side_effect = mock_file_handle, mock_file_handle1
|
||||
mountdir_grub_cfg_path = 'tmpdir' + grub_cfg_file
|
||||
|
||||
images.create_isolinux_image_for_uefi(
|
||||
images.create_esp_image_for_uefi(
|
||||
'tgt_file', 'path/to/kernel', 'path/to/ramdisk',
|
||||
esp_image='sourceabspath/to/efiboot.img',
|
||||
kernel_params=params)
|
||||
@ -643,11 +643,9 @@ class FsImageTestCase(base.TestCase):
|
||||
@mock.patch.object(utils, 'tempdir', autospec=True)
|
||||
@mock.patch.object(utils, 'execute', autospec=True)
|
||||
@mock.patch.object(os, 'walk', autospec=True)
|
||||
def test_create_isolinux_image_uefi_rootfs_fails(self, walk_mock,
|
||||
utils_mock,
|
||||
tempdir_mock,
|
||||
create_root_fs_mock,
|
||||
umount_mock):
|
||||
def test_create_esp_image_uefi_rootfs_fails(
|
||||
self, walk_mock, utils_mock, tempdir_mock,
|
||||
create_root_fs_mock, umount_mock):
|
||||
|
||||
mock_file_handle = mock.MagicMock(spec=io.BytesIO)
|
||||
mock_file_handle.__enter__.return_value = 'tmpdir'
|
||||
@ -657,7 +655,7 @@ class FsImageTestCase(base.TestCase):
|
||||
create_root_fs_mock.side_effect = IOError
|
||||
|
||||
self.assertRaises(exception.ImageCreationFailed,
|
||||
images.create_isolinux_image_for_uefi,
|
||||
images.create_esp_image_for_uefi,
|
||||
'tgt_file',
|
||||
'path/to/kernel',
|
||||
'path/to/ramdisk',
|
||||
@ -686,14 +684,9 @@ class FsImageTestCase(base.TestCase):
|
||||
@mock.patch.object(utils, 'execute', autospec=True)
|
||||
@mock.patch.object(images, '_mount_deploy_iso', autospec=True)
|
||||
@mock.patch.object(images, '_generate_cfg', autospec=True)
|
||||
def test_create_isolinux_image_mkisofs_fails(self,
|
||||
gen_cfg_mock,
|
||||
mount_mock,
|
||||
utils_mock,
|
||||
tempdir_mock,
|
||||
write_to_file_mock,
|
||||
create_root_fs_mock,
|
||||
umount_mock):
|
||||
def test_create_esp_image_mkisofs_fails(
|
||||
self, gen_cfg_mock, mount_mock, utils_mock, tempdir_mock,
|
||||
write_to_file_mock, create_root_fs_mock, umount_mock):
|
||||
mock_file_handle = mock.MagicMock(spec=io.BytesIO)
|
||||
mock_file_handle.__enter__.return_value = 'tmpdir'
|
||||
mock_file_handle1 = mock.MagicMock(spec=io.BytesIO)
|
||||
@ -703,7 +696,7 @@ class FsImageTestCase(base.TestCase):
|
||||
utils_mock.side_effect = processutils.ProcessExecutionError
|
||||
|
||||
self.assertRaises(exception.ImageCreationFailed,
|
||||
images.create_isolinux_image_for_uefi,
|
||||
images.create_esp_image_for_uefi,
|
||||
'tgt_file',
|
||||
'path/to/kernel',
|
||||
'path/to/ramdisk',
|
||||
@ -731,7 +724,7 @@ class FsImageTestCase(base.TestCase):
|
||||
'tgt_file', 'path/to/kernel',
|
||||
'path/to/ramdisk')
|
||||
|
||||
@mock.patch.object(images, 'create_isolinux_image_for_uefi', autospec=True)
|
||||
@mock.patch.object(images, 'create_esp_image_for_uefi', autospec=True)
|
||||
@mock.patch.object(images, 'fetch', autospec=True)
|
||||
@mock.patch.object(utils, 'tempdir', autospec=True)
|
||||
def test_create_boot_iso_for_uefi_deploy_iso(
|
||||
@ -759,7 +752,7 @@ class FsImageTestCase(base.TestCase):
|
||||
deploy_iso='tmpdir/deploy_iso-uuid', esp_image=None,
|
||||
kernel_params=params)
|
||||
|
||||
@mock.patch.object(images, 'create_isolinux_image_for_uefi', autospec=True)
|
||||
@mock.patch.object(images, 'create_esp_image_for_uefi', autospec=True)
|
||||
@mock.patch.object(images, 'fetch', autospec=True)
|
||||
@mock.patch.object(utils, 'tempdir', autospec=True)
|
||||
def test_create_boot_iso_for_uefi_esp_image(
|
||||
@ -787,7 +780,7 @@ class FsImageTestCase(base.TestCase):
|
||||
deploy_iso=None, esp_image='tmpdir/efiboot-uuid',
|
||||
kernel_params=params)
|
||||
|
||||
@mock.patch.object(images, 'create_isolinux_image_for_uefi', autospec=True)
|
||||
@mock.patch.object(images, 'create_esp_image_for_uefi', autospec=True)
|
||||
@mock.patch.object(images, 'fetch', autospec=True)
|
||||
@mock.patch.object(utils, 'tempdir', autospec=True)
|
||||
def test_create_boot_iso_for_uefi_deploy_iso_for_hrefs(
|
||||
@ -815,7 +808,7 @@ class FsImageTestCase(base.TestCase):
|
||||
deploy_iso='tmpdir/deploy_iso-href', esp_image=None,
|
||||
kernel_params=params)
|
||||
|
||||
@mock.patch.object(images, 'create_isolinux_image_for_uefi', autospec=True)
|
||||
@mock.patch.object(images, 'create_esp_image_for_uefi', autospec=True)
|
||||
@mock.patch.object(images, 'fetch', autospec=True)
|
||||
@mock.patch.object(utils, 'tempdir', autospec=True)
|
||||
def test_create_boot_iso_for_uefi_esp_image_for_hrefs(
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Renames misleadingly named `images.create_isolinux_image_for_uefi`
|
||||
function into `images.create_esp_image_for_uefi`. The new name
|
||||
reflects what's actually going on under the hood.
|
Loading…
Reference in New Issue
Block a user