summaryrefslogtreecommitdiff
path: root/ironic/drivers/modules/agent.py
diff options
context:
space:
mode:
authorHamdy Khader <hamdyk@mellanox.com>2018-07-18 16:21:43 +0300
committerHamdy Khader <hamdyk@mellanox.com>2019-02-07 15:24:34 +0200
commita41c7a95920358af2fe23e4e102fc514a81d81c0 (patch)
treed5b62113cdef6f4359fa1453ede2cadac7b44895 /ironic/drivers/modules/agent.py
parent4404292276446b6e81590993db8ebd4f4c482f93 (diff)
downloadironic-a41c7a95920358af2fe23e4e102fc514a81d81c0.tar.gz
Add support for Smart NICs
Extend Ironic to enable use of Smart NICs to implement generic networking services for baremetal servers. Extending the ramdisk, direct, iscsi and ansible deployment Interfaces to support the Smart NIC use-cases. For Smart NIC use-case the baremetal node must be powered on and booted into bios then wait for agent that runs on the Smart NIC to be alive then do the network changes required. Task: #26932 Story: #2003346 Change-Id: I00d6f13dd991074e4f45ada4d7cf4ccc0edbc7e1
Diffstat (limited to 'ironic/drivers/modules/agent.py')
-rw-r--r--ironic/drivers/modules/agent.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/ironic/drivers/modules/agent.py b/ironic/drivers/modules/agent.py
index c9344ab15..851f6b652 100644
--- a/ironic/drivers/modules/agent.py
+++ b/ironic/drivers/modules/agent.py
@@ -464,8 +464,12 @@ class AgentDeploy(AgentDeployMixin, base.DeployInterface):
# This is not being done now as it is expected to be
# refactored in the near future.
manager_utils.node_power_action(task, states.POWER_OFF)
+ power_state_to_restore = (
+ manager_utils.power_on_node_if_needed(task))
task.driver.network.remove_provisioning_network(task)
task.driver.network.configure_tenant_networks(task)
+ manager_utils.restore_power_state_if_needed(
+ task, power_state_to_restore)
task.driver.boot.prepare_instance(task)
manager_utils.node_power_action(task, states.POWER_ON)
LOG.info('Deployment to node %s done', task.node.uuid)
@@ -489,11 +493,13 @@ class AgentDeploy(AgentDeployMixin, base.DeployInterface):
manager_utils.node_power_action(task, states.POWER_OFF)
task.driver.storage.detach_volumes(task)
deploy_utils.tear_down_storage_configuration(task)
+ power_state_to_restore = manager_utils.power_on_node_if_needed(task)
task.driver.network.unconfigure_tenant_networks(task)
# NOTE(mgoddard): If the deployment was unsuccessful the node may have
# ports on the provisioning network which were not deleted.
task.driver.network.remove_provisioning_network(task)
-
+ manager_utils.restore_power_state_if_needed(
+ task, power_state_to_restore)
return states.DELETED
@METRICS.timer('AgentDeploy.prepare')
@@ -548,8 +554,12 @@ class AgentDeploy(AgentDeployMixin, base.DeployInterface):
if task.driver.storage.should_write_image(task):
# NOTE(vdrok): in case of rebuild, we have tenant network
# already configured, unbind tenant ports if present
+ power_state_to_restore = (
+ manager_utils.power_on_node_if_needed(task))
task.driver.network.unconfigure_tenant_networks(task)
task.driver.network.add_provisioning_network(task)
+ manager_utils.restore_power_state_if_needed(
+ task, power_state_to_restore)
# Signal to storage driver to attach volumes
task.driver.storage.attach_volumes(task)
if not task.driver.storage.should_write_image(task):
@@ -806,8 +816,11 @@ class AgentRescue(base.RescueInterface):
task.node.save()
task.driver.boot.clean_up_instance(task)
+ power_state_to_restore = manager_utils.power_on_node_if_needed(task)
task.driver.network.unconfigure_tenant_networks(task)
task.driver.network.add_rescuing_network(task)
+ manager_utils.restore_power_state_if_needed(
+ task, power_state_to_restore)
if CONF.agent.manage_agent_boot:
ramdisk_opts = deploy_utils.build_agent_options(task.node)
# prepare_ramdisk will set the boot device
@@ -842,7 +855,10 @@ class AgentRescue(base.RescueInterface):
task.node.save()
self.clean_up(task)
+ power_state_to_restore = manager_utils.power_on_node_if_needed(task)
task.driver.network.configure_tenant_networks(task)
+ manager_utils.restore_power_state_if_needed(
+ task, power_state_to_restore)
task.driver.boot.prepare_instance(task)
manager_utils.node_power_action(task, states.POWER_ON)
@@ -894,4 +910,7 @@ class AgentRescue(base.RescueInterface):
manager_utils.remove_node_rescue_password(task.node, save=True)
if CONF.agent.manage_agent_boot:
task.driver.boot.clean_up_ramdisk(task)
+ power_state_to_restore = manager_utils.power_on_node_if_needed(task)
task.driver.network.remove_rescuing_network(task)
+ manager_utils.restore_power_state_if_needed(
+ task, power_state_to_restore)