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)
|
raise exception.ImageCreationFailed(image_type='iso', error=e)
|
||||||
|
|
||||||
|
|
||||||
def create_isolinux_image_for_uefi(output_file, kernel, ramdisk,
|
def create_esp_image_for_uefi(output_file, kernel, ramdisk,
|
||||||
deploy_iso=None, esp_image=None,
|
deploy_iso=None, esp_image=None,
|
||||||
kernel_params=None):
|
kernel_params=None):
|
||||||
"""Creates an isolinux image on the specified file.
|
"""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
|
a directory, generates the grub configuration file using kernel parameters
|
||||||
and then generates a bootable ISO image for UEFI.
|
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)
|
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):
|
def fetch(context, image_href, path, force_raw=False):
|
||||||
# TODO(vish): Improve context handling and add owner and auth data
|
# TODO(vish): Improve context handling and add owner and auth data
|
||||||
# when it is added to glance. Right now there is no
|
# when it is added to glance. Right now there is no
|
||||||
@ -489,7 +493,7 @@ def create_boot_iso(context, output_filename, kernel_href,
|
|||||||
elif CONF.esp_image:
|
elif CONF.esp_image:
|
||||||
esp_image_path = CONF.esp_image
|
esp_image_path = CONF.esp_image
|
||||||
|
|
||||||
create_isolinux_image_for_uefi(output_filename,
|
create_esp_image_for_uefi(output_filename,
|
||||||
kernel_path,
|
kernel_path,
|
||||||
ramdisk_path,
|
ramdisk_path,
|
||||||
deploy_iso=deploy_iso_path,
|
deploy_iso=deploy_iso_path,
|
||||||
|
@ -485,7 +485,7 @@ class FsImageTestCase(base.TestCase):
|
|||||||
@mock.patch.object(images, '_mount_deploy_iso', autospec=True)
|
@mock.patch.object(images, '_mount_deploy_iso', autospec=True)
|
||||||
@mock.patch.object(utils, 'tempdir', autospec=True)
|
@mock.patch.object(utils, 'tempdir', autospec=True)
|
||||||
@mock.patch.object(images, '_generate_cfg', 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,
|
self, gen_cfg_mock, tempdir_mock, mount_mock, execute_mock,
|
||||||
write_to_file_mock, create_root_fs_mock, umount_mock):
|
write_to_file_mock, create_root_fs_mock, umount_mock):
|
||||||
|
|
||||||
@ -517,7 +517,7 @@ class FsImageTestCase(base.TestCase):
|
|||||||
mount_mock.return_value = (uefi_path_info,
|
mount_mock.return_value = (uefi_path_info,
|
||||||
e_img_rel_path, grub_rel_path)
|
e_img_rel_path, grub_rel_path)
|
||||||
|
|
||||||
images.create_isolinux_image_for_uefi('tgt_file',
|
images.create_esp_image_for_uefi('tgt_file',
|
||||||
'path/to/kernel',
|
'path/to/kernel',
|
||||||
'path/to/ramdisk',
|
'path/to/ramdisk',
|
||||||
deploy_iso='path/to/deploy_iso',
|
deploy_iso='path/to/deploy_iso',
|
||||||
@ -537,7 +537,7 @@ class FsImageTestCase(base.TestCase):
|
|||||||
@mock.patch.object(utils, 'execute', autospec=True)
|
@mock.patch.object(utils, 'execute', autospec=True)
|
||||||
@mock.patch.object(utils, 'tempdir', autospec=True)
|
@mock.patch.object(utils, 'tempdir', autospec=True)
|
||||||
@mock.patch.object(images, '_generate_cfg', 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,
|
self, gen_cfg_mock, tempdir_mock, execute_mock,
|
||||||
create_root_fs_mock, write_to_file_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
|
tempdir_mock.side_effect = mock_file_handle, mock_file_handle1
|
||||||
mountdir_grub_cfg_path = 'tmpdir' + grub_cfg_file
|
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',
|
'tgt_file', 'path/to/kernel', 'path/to/ramdisk',
|
||||||
esp_image='sourceabspath/to/efiboot.img',
|
esp_image='sourceabspath/to/efiboot.img',
|
||||||
kernel_params=params)
|
kernel_params=params)
|
||||||
@ -643,11 +643,9 @@ class FsImageTestCase(base.TestCase):
|
|||||||
@mock.patch.object(utils, 'tempdir', autospec=True)
|
@mock.patch.object(utils, 'tempdir', autospec=True)
|
||||||
@mock.patch.object(utils, 'execute', autospec=True)
|
@mock.patch.object(utils, 'execute', autospec=True)
|
||||||
@mock.patch.object(os, 'walk', autospec=True)
|
@mock.patch.object(os, 'walk', autospec=True)
|
||||||
def test_create_isolinux_image_uefi_rootfs_fails(self, walk_mock,
|
def test_create_esp_image_uefi_rootfs_fails(
|
||||||
utils_mock,
|
self, walk_mock, utils_mock, tempdir_mock,
|
||||||
tempdir_mock,
|
create_root_fs_mock, umount_mock):
|
||||||
create_root_fs_mock,
|
|
||||||
umount_mock):
|
|
||||||
|
|
||||||
mock_file_handle = mock.MagicMock(spec=io.BytesIO)
|
mock_file_handle = mock.MagicMock(spec=io.BytesIO)
|
||||||
mock_file_handle.__enter__.return_value = 'tmpdir'
|
mock_file_handle.__enter__.return_value = 'tmpdir'
|
||||||
@ -657,7 +655,7 @@ class FsImageTestCase(base.TestCase):
|
|||||||
create_root_fs_mock.side_effect = IOError
|
create_root_fs_mock.side_effect = IOError
|
||||||
|
|
||||||
self.assertRaises(exception.ImageCreationFailed,
|
self.assertRaises(exception.ImageCreationFailed,
|
||||||
images.create_isolinux_image_for_uefi,
|
images.create_esp_image_for_uefi,
|
||||||
'tgt_file',
|
'tgt_file',
|
||||||
'path/to/kernel',
|
'path/to/kernel',
|
||||||
'path/to/ramdisk',
|
'path/to/ramdisk',
|
||||||
@ -686,14 +684,9 @@ class FsImageTestCase(base.TestCase):
|
|||||||
@mock.patch.object(utils, 'execute', autospec=True)
|
@mock.patch.object(utils, 'execute', autospec=True)
|
||||||
@mock.patch.object(images, '_mount_deploy_iso', autospec=True)
|
@mock.patch.object(images, '_mount_deploy_iso', autospec=True)
|
||||||
@mock.patch.object(images, '_generate_cfg', autospec=True)
|
@mock.patch.object(images, '_generate_cfg', autospec=True)
|
||||||
def test_create_isolinux_image_mkisofs_fails(self,
|
def test_create_esp_image_mkisofs_fails(
|
||||||
gen_cfg_mock,
|
self, gen_cfg_mock, mount_mock, utils_mock, tempdir_mock,
|
||||||
mount_mock,
|
write_to_file_mock, create_root_fs_mock, umount_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 = mock.MagicMock(spec=io.BytesIO)
|
||||||
mock_file_handle.__enter__.return_value = 'tmpdir'
|
mock_file_handle.__enter__.return_value = 'tmpdir'
|
||||||
mock_file_handle1 = mock.MagicMock(spec=io.BytesIO)
|
mock_file_handle1 = mock.MagicMock(spec=io.BytesIO)
|
||||||
@ -703,7 +696,7 @@ class FsImageTestCase(base.TestCase):
|
|||||||
utils_mock.side_effect = processutils.ProcessExecutionError
|
utils_mock.side_effect = processutils.ProcessExecutionError
|
||||||
|
|
||||||
self.assertRaises(exception.ImageCreationFailed,
|
self.assertRaises(exception.ImageCreationFailed,
|
||||||
images.create_isolinux_image_for_uefi,
|
images.create_esp_image_for_uefi,
|
||||||
'tgt_file',
|
'tgt_file',
|
||||||
'path/to/kernel',
|
'path/to/kernel',
|
||||||
'path/to/ramdisk',
|
'path/to/ramdisk',
|
||||||
@ -731,7 +724,7 @@ class FsImageTestCase(base.TestCase):
|
|||||||
'tgt_file', 'path/to/kernel',
|
'tgt_file', 'path/to/kernel',
|
||||||
'path/to/ramdisk')
|
'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(images, 'fetch', autospec=True)
|
||||||
@mock.patch.object(utils, 'tempdir', autospec=True)
|
@mock.patch.object(utils, 'tempdir', autospec=True)
|
||||||
def test_create_boot_iso_for_uefi_deploy_iso(
|
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,
|
deploy_iso='tmpdir/deploy_iso-uuid', esp_image=None,
|
||||||
kernel_params=params)
|
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(images, 'fetch', autospec=True)
|
||||||
@mock.patch.object(utils, 'tempdir', autospec=True)
|
@mock.patch.object(utils, 'tempdir', autospec=True)
|
||||||
def test_create_boot_iso_for_uefi_esp_image(
|
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',
|
deploy_iso=None, esp_image='tmpdir/efiboot-uuid',
|
||||||
kernel_params=params)
|
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(images, 'fetch', autospec=True)
|
||||||
@mock.patch.object(utils, 'tempdir', autospec=True)
|
@mock.patch.object(utils, 'tempdir', autospec=True)
|
||||||
def test_create_boot_iso_for_uefi_deploy_iso_for_hrefs(
|
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,
|
deploy_iso='tmpdir/deploy_iso-href', esp_image=None,
|
||||||
kernel_params=params)
|
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(images, 'fetch', autospec=True)
|
||||||
@mock.patch.object(utils, 'tempdir', autospec=True)
|
@mock.patch.object(utils, 'tempdir', autospec=True)
|
||||||
def test_create_boot_iso_for_uefi_esp_image_for_hrefs(
|
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…
x
Reference in New Issue
Block a user