Skip to content

Commit

Permalink
Removed redundant fde kernel installation code (#2950)
Browse files Browse the repository at this point in the history
Moving .efi files is no longer needed for CVM kernel upgrades.
  • Loading branch information
SRIKKANTH authored Sep 15, 2023
1 parent 7396cbd commit cca895b
Showing 1 changed file with 8 additions and 29 deletions.
37 changes: 8 additions & 29 deletions lisa/transformers/kernel_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Type, cast

from assertpy import assert_that
from dataclasses_json import dataclass_json

from lisa import schema
Expand Down Expand Up @@ -122,8 +123,9 @@ def _internal_run(self) -> Dict[str, Any]:
node = quick_connect(runbook.connection, "installer_node")

uname = node.tools[Uname]
kernel_version_before_install = uname.get_linux_information()
self._log.info(
f"kernel version before install: {uname.get_linux_information()}"
f"kernel version before install: {kernel_version_before_install}"
)
factory = subclasses.Factory[BaseInstaller](BaseInstaller)
installer = factory.create_by_runbook(
Expand All @@ -140,37 +142,14 @@ def _internal_run(self) -> Dict[str, Any]:
if installer.runbook.source != "linux-image-azure-fde":
posix = cast(Posix, node.os)
posix.replace_boot_kernel(installed_kernel_version)
else:
efi_files = node.execute(
"ls -t /usr/lib/linux/efi/kernel.efi-*-azure-cvm",
sudo=True,
shell=True,
expected_exit_code=0,
expected_exit_code_failure_message=(
"fail to find kernel.efi file for kernel type "
" linux-image-azure-fde"
),
)
efi_file = efi_files.stdout.splitlines()[0]
node.execute(
(
"cp /boot/efi/EFI/ubuntu/grubx64.efi "
"/boot/efi/EFI/ubuntu/grubx64.efi.bak"
),
sudo=True,
)
node.execute(
f"cp {efi_file} /boot/efi/EFI/ubuntu/grubx64.efi",
sudo=True,
shell=True,
)

self._log.info("rebooting")
node.reboot()
self._log.info(
f"kernel version after install: "
f"{uname.get_linux_information(force_run=True)}"
)
kernel_version_after_install = uname.get_linux_information(force_run=True)
self._log.info(f"kernel version after install: {kernel_version_after_install}")
assert_that(
kernel_version_after_install, "Kernel installation Failed"
).is_equal_to(kernel_version_before_install)
return {self._information_output_name: self._information}


Expand Down

0 comments on commit cca895b

Please sign in to comment.