-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- cvm_boot: use bootctl to locate root device Signed-off-by: Thien Trung Vuong <[email protected]>
- Loading branch information
Showing
3 changed files
with
56 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT license. | ||
|
||
from lisa.executable import Tool | ||
from lisa.operating_system import CBLMariner | ||
from lisa.util import LisaException | ||
|
||
|
||
class BootCtl(Tool): | ||
@property | ||
def command(self) -> str: | ||
return "bootctl" | ||
|
||
@property | ||
def can_install(self) -> bool: | ||
return True | ||
|
||
def _install(self) -> bool: | ||
if isinstance(self.node.os, CBLMariner): | ||
self.node.os.install_packages("systemd-udev") | ||
else: | ||
raise LisaException( | ||
f"tool {self.command} can't be installed in distro {self.node.os.name}" | ||
) | ||
return self._check_exists() | ||
|
||
def get_esp_path(self) -> str: | ||
return self._get_cmd_output("--print-esp-path") | ||
|
||
def get_boot_path(self) -> str: | ||
return self._get_cmd_output("--print-boot-path") | ||
|
||
def get_root_device(self) -> str: | ||
return self._get_cmd_output("--print-root-device") | ||
|
||
def _get_cmd_output(self, cmd: str) -> str: | ||
cmd_result = self.run( | ||
cmd, | ||
expected_exit_code=0, | ||
expected_exit_code_failure_message="failed to get ESP path", | ||
shell=True, | ||
sudo=True, | ||
force_run=True, | ||
) | ||
return cmd_result.stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters