зеркало из https://github.com/microsoft/lisa.git
Collect image, size, location and platform info when deploy failed. (#1090)
* Collect image, size, location and platform info when deploy failed. * Extend message length of inserted record.
This commit is contained in:
Родитель
968461fd83
Коммит
80aac06c24
|
@ -24,7 +24,7 @@ T = TypeVar("T")
|
|||
|
||||
|
||||
def _get_node_information(node: Node, information: Dict[str, str]) -> None:
|
||||
if node.is_linux:
|
||||
if node.is_connected and node.is_linux:
|
||||
uname = node.tools[Uname]
|
||||
linux_information = uname.get_linux_information()
|
||||
fields = ["hardware_platform", "kernel_version"]
|
||||
|
@ -47,6 +47,7 @@ class Node(ContextMixin, InitializableMixin):
|
|||
self.capability = capability
|
||||
self.name: str = ""
|
||||
self.index = index
|
||||
self.is_connected: bool = False
|
||||
|
||||
self.shell: Shell = LocalShell()
|
||||
|
||||
|
@ -153,6 +154,7 @@ class Node(ContextMixin, InitializableMixin):
|
|||
return self.os.is_linux
|
||||
|
||||
def close(self) -> None:
|
||||
self.is_connected = False
|
||||
self.shell.close()
|
||||
|
||||
def get_node_information(self) -> Dict[str, str]:
|
||||
|
@ -203,6 +205,7 @@ class Node(ContextMixin, InitializableMixin):
|
|||
self.working_path = constants.RUN_LOCAL_PATH
|
||||
self.shell.mkdir(self.working_path, parents=True, exist_ok=True)
|
||||
self.log.debug(f"working path is: '{self.working_path}'")
|
||||
self.is_connected = True
|
||||
|
||||
def _execute(
|
||||
self,
|
||||
|
|
|
@ -94,8 +94,8 @@ class Platform(subclasses.BaseClassWithRunbookMixin, InitializableMixin):
|
|||
log = get_logger(f"deploy[{environment.name}]", parent=self._log)
|
||||
log.info(f"deploying environment: {environment.name}")
|
||||
timer = create_timer()
|
||||
self._deploy_environment(environment, log)
|
||||
environment.platform = self
|
||||
self._deploy_environment(environment, log)
|
||||
log.debug(f"initializing environment: {environment.name}")
|
||||
environment.initialize()
|
||||
# initialize features
|
||||
|
|
|
@ -103,6 +103,7 @@ class Runner(Action):
|
|||
continue
|
||||
except Exception as identifier:
|
||||
# make first fit test case fail by deployment
|
||||
picked_result.environment = environment
|
||||
picked_result.set_status(
|
||||
TestStatus.FAILED, f"deployment: {str(identifier)}"
|
||||
)
|
||||
|
|
|
@ -283,7 +283,11 @@ HOST_VERSION_PATTERN = re.compile(r"Hyper-V Host Build:([^\n;]*)")
|
|||
|
||||
|
||||
def _get_node_information(node: Node, information: Dict[str, str]) -> None:
|
||||
if node.is_linux:
|
||||
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()
|
||||
if node.is_connected and node.is_linux:
|
||||
dmesg = node.tools[Dmesg]
|
||||
matched_host_version = find_patterns_in_lines(
|
||||
dmesg.get_output(), [HOST_VERSION_PATTERN]
|
||||
|
@ -298,11 +302,6 @@ def _get_node_information(node: Node, information: Dict[str, str]) -> None:
|
|||
waagent = node.tools[Waagent]
|
||||
information["wala_version"] = waagent.get_version()
|
||||
|
||||
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:
|
||||
|
@ -739,6 +738,7 @@ class AzurePlatform(Platform):
|
|||
|
||||
# init node
|
||||
node = environment.nodes.from_requirement(node_space)
|
||||
node.add_node_information_hook(_get_node_information)
|
||||
if not azure_node_runbook.name:
|
||||
azure_node_runbook.name = f"node-{len(nodes_parameters)}"
|
||||
if not azure_node_runbook.vm_size:
|
||||
|
|
|
@ -117,7 +117,7 @@ class TestResult:
|
|||
result_message.environment_information[
|
||||
"platform"
|
||||
] = self.environment.platform.type_name()
|
||||
result_message.message = self.message[0:200] if self.message else ""
|
||||
result_message.message = self.message[0:2048] if self.message else ""
|
||||
result_message.name = self.runtime_data.metadata.full_name
|
||||
notifier.notify(result_message)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче