зеркало из https://github.com/microsoft/lisa.git
Update kernel version, insert image, platform, vmsize info into testresultmessage. (#1080)
This commit is contained in:
Родитель
1492be6ff1
Коммит
6dd4d1a246
|
@ -31,7 +31,7 @@ class HelloWorld(TestSuite):
|
|||
assert isinstance(node.os, Linux)
|
||||
info = node.tools[Uname].get_linux_information()
|
||||
self.log.info(
|
||||
f"release: '{info.kernel_release}', version: '{info.kernel_version}', "
|
||||
f"release: '{info.uname_version}', version: '{info.kernel_version}', "
|
||||
f"hardware: '{info.hardware_platform}', os: '{info.operating_system}'"
|
||||
)
|
||||
else:
|
||||
|
|
|
@ -95,6 +95,7 @@ class Platform(subclasses.BaseClassWithRunbookMixin, InitializableMixin):
|
|||
log.info(f"deploying environment: {environment.name}")
|
||||
timer = create_timer()
|
||||
self._deploy_environment(environment, log)
|
||||
environment.platform = self
|
||||
log.debug(f"initializing environment: {environment.name}")
|
||||
environment.initialize()
|
||||
# initialize features
|
||||
|
|
|
@ -160,6 +160,17 @@ class AzureNodeSchema:
|
|||
f"or '<Publisher>:<Offer>:<Sku>:<Version>'"
|
||||
)
|
||||
|
||||
def get_image_name(self) -> str:
|
||||
result = ""
|
||||
if self.vhd:
|
||||
result = self.vhd
|
||||
elif self.gallery_raw:
|
||||
assert isinstance(
|
||||
self.gallery_raw, dict
|
||||
), f"actual type: {type(self.gallery_raw)}"
|
||||
result = " ".join([x for x in self.gallery_raw.values()])
|
||||
return result
|
||||
|
||||
|
||||
@dataclass_json(letter_case=LetterCase.CAMEL)
|
||||
@dataclass
|
||||
|
@ -263,6 +274,11 @@ def _get_node_information(node: Node, information: Dict[str, str]) -> None:
|
|||
modinfo = node.tools[Modinfo]
|
||||
information["lis_version"] = modinfo.get_version("hv_vmbus")
|
||||
|
||||
node_runbook = node.capability.get_extended_runbook(AzureNodeSchema, AZURE)
|
||||
information["location"] = node_runbook.location
|
||||
information["vmsize"] = node_runbook.vm_size
|
||||
information["image"] = node_runbook.get_image_name()
|
||||
|
||||
|
||||
class AzurePlatform(Platform):
|
||||
def __init__(self, runbook: schema.Platform) -> None:
|
||||
|
|
|
@ -107,6 +107,10 @@ class TestResult:
|
|||
)
|
||||
result_message.environment_information.update(environment_information)
|
||||
result_message.environment_information["name"] = self.environment.name
|
||||
assert self.environment.platform
|
||||
result_message.environment_information[
|
||||
"platform"
|
||||
] = self.environment.platform.type_name()
|
||||
result_message.message = self.message[0:200] if self.message else ""
|
||||
result_message.name = self.runtime_data.metadata.full_name
|
||||
notifier.notify(result_message)
|
||||
|
|
|
@ -9,7 +9,7 @@ from lisa.util import LisaException
|
|||
@dataclass
|
||||
class UnameResult:
|
||||
has_result: bool
|
||||
kernel_release: str = ""
|
||||
uname_version: str = ""
|
||||
kernel_version: str = ""
|
||||
hardware_platform: str = ""
|
||||
operating_system: str = ""
|
||||
|
@ -17,7 +17,7 @@ class UnameResult:
|
|||
|
||||
class Uname(Tool):
|
||||
_key_info_pattern = re.compile(
|
||||
r"(?P<release>[^ ]*?) (?P<version>[\w\W]*) (?P<platform>[\w\W]+?) "
|
||||
r"(?P<kernel_version>[^ ]*?) (?P<uname_version>[\w\W]*) (?P<platform>[\w\W]+?) "
|
||||
r"(?P<os>[\w\W]+?)$"
|
||||
)
|
||||
|
||||
|
@ -50,8 +50,8 @@ class Uname(Tool):
|
|||
)
|
||||
self.result = UnameResult(
|
||||
has_result=True,
|
||||
kernel_release=match_result.group("release"),
|
||||
kernel_version=match_result.group("version"),
|
||||
kernel_version=match_result.group("kernel_version"),
|
||||
uname_version=match_result.group("uname_version"),
|
||||
hardware_platform=match_result.group("platform"),
|
||||
operating_system=match_result.group("os"),
|
||||
)
|
||||
|
|
Загрузка…
Ссылка в новой задаче