Skip to content

Commit

Permalink
BM refactorring: add node initialize and create feature before deploy.
Browse files Browse the repository at this point in the history
1. PXE Create SerialConsole when deploying to capture all logs, So it needs to create Featues before it's used.
2. node.initialize is the right way to "initialize" a node, make it functional.
  • Loading branch information
squirrelsc committed Dec 31, 2024
1 parent 7719280 commit ea33d44
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions lisa/sut_orchestrator/baremetal/platform_.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
from pathlib import Path
from typing import Any, List, Optional, Type

from lisa import RemoteNode, feature, schema
from lisa import feature, schema
from lisa.environment import Environment
from lisa.platform_ import Platform
from lisa.util.logger import Logger
from lisa.util.shell import try_connect
from lisa.util.subclasses import Factory

from .. import BAREMETAL
Expand Down Expand Up @@ -100,11 +99,8 @@ def _deploy_environment(self, environment: Environment, log: Logger) -> None:

node_context.client.connection.address = ip_getter.get_ip()

assert isinstance(node, RemoteNode), f"actual: {type(node)}"
node.name = f"node_{index}"
try_connect(
node_context.client.connection.get_connection_info(is_public=False)
)
node.initialize()

self._log.debug(f"deploy environment {environment.name} successfully")

Expand Down Expand Up @@ -174,13 +170,13 @@ def _predeploy_environment(self, environment: Environment, log: Logger) -> None:
key_file = key_loader.load_key(self.local_artifacts_path)

assert environment.runbook.nodes_requirement, "no node is specified"
for node_space in environment.runbook.nodes_requirement:
for index, node_space in enumerate(environment.runbook.nodes_requirement):
assert isinstance(
node_space, schema.NodeSpace
), f"actual: {type(node_space)}"
environment.create_node_from_requirement(node_space)
node = environment.create_node_from_requirement(node_space)

for index, node in enumerate(environment.nodes.list()):
node.features = feature.Features(node, self)
node_context = get_node_context(node)

if (
Expand Down

0 comments on commit ea33d44

Please sign in to comment.