From 977d1f1f781fabee074af6854ee16424e2a4eb5f Mon Sep 17 00:00:00 2001 From: Yuriy Zveryanskyy Date: Fri, 30 Oct 2015 14:55:04 +0200 Subject: [PATCH] Add "agent_wol" (AgentAndWakeOnLanDriver) This patch adds new driver with WakeOnLanPower and AgentDeploy interfaces. Automatic deploy is possible because AgentDeploy does soft power off at the end of deploy cycle. Change-Id: I09dc41c1523fafc5155a02829f9528d65cf2f5b0 --- doc/source/drivers/wol.rst | 25 +++++++++++++++++++++++++ ironic/drivers/agent.py | 17 +++++++++++++++++ ironic/tests/unit/drivers/test_agent.py | 12 ++++++++++++ setup.cfg | 1 + 4 files changed, 55 insertions(+) diff --git a/doc/source/drivers/wol.rst b/doc/source/drivers/wol.rst index de4a2a395b..2ea9701d3a 100644 --- a/doc/source/drivers/wol.rst +++ b/doc/source/drivers/wol.rst @@ -97,6 +97,31 @@ which is the value of *$NODE* in the following command. ironic port-create -n $NODE -a +agent_wol +^^^^^^^^^ + +Overview +~~~~~~~~ + +The ``agent_wol`` driver uses the Wake-On-Lan technology to control the +power state, PXE/iPXE technology for booting and the Ironic Python Agent +for deploying the node. + +Additional requirements +~~~~~~~~~~~~~~~~~~~~~~~ + +* Boot device order should be set to "PXE, DISK" in the BIOS setup + +* BIOS must try next boot device if PXE boot failed + +* Cleaning should be disabled, see :ref:`cleaning` + +* Node should be powered off before start of deploy + +Configuration steps are the same as for ``pxe_wol`` driver, replace "pxe_wol" +with "agent_wol". + + References ========== .. [1] Wake-On-Lan - https://en.wikipedia.org/wiki/Wake-on-LAN diff --git a/ironic/drivers/agent.py b/ironic/drivers/agent.py index c4fac4fc6a..7891f593de 100644 --- a/ironic/drivers/agent.py +++ b/ironic/drivers/agent.py @@ -30,6 +30,7 @@ from ironic.drivers.modules import ssh from ironic.drivers.modules.ucs import management as ucs_mgmt from ironic.drivers.modules.ucs import power as ucs_power from ironic.drivers.modules import virtualbox +from ironic.drivers.modules import wol from ironic.drivers import utils @@ -212,3 +213,19 @@ class AgentAndCIMCDriver(base.BaseDriver): self.deploy = agent.AgentDeploy() self.management = cimc_mgmt.CIMCManagement() self.vendor = agent.AgentVendorInterface() + + +class AgentAndWakeOnLanDriver(base.BaseDriver): + """Agent + WakeOnLan driver. + + This driver implements the `core` functionality, combining + :class:`ironic.drivers.modules.wol.WakeOnLanPower` for power on with + :class:'ironic.driver.modules.agent.AgentDeploy' (for image deployment.) + Implementations are in those respective classes; + this class is merely the glue between them. + """ + def __init__(self): + self.power = wol.WakeOnLanPower() + self.boot = pxe.PXEBoot() + self.deploy = agent.AgentDeploy() + self.vendor = agent.AgentVendorInterface() diff --git a/ironic/tests/unit/drivers/test_agent.py b/ironic/tests/unit/drivers/test_agent.py index 021db2bc02..7a994718c1 100644 --- a/ironic/tests/unit/drivers/test_agent.py +++ b/ironic/tests/unit/drivers/test_agent.py @@ -25,6 +25,7 @@ from ironic.drivers.modules import agent as agent_module from ironic.drivers.modules.amt import management as amt_management from ironic.drivers.modules.amt import power as amt_power from ironic.drivers.modules import pxe +from ironic.drivers.modules import wol class AgentAndAMTDriverTestCase(testtools.TestCase): @@ -47,3 +48,14 @@ class AgentAndAMTDriverTestCase(testtools.TestCase): self.assertRaises(exception.DriverLoadError, agent.AgentAndAMTDriver) + + +class AgentAndWakeOnLanDriverTestCase(testtools.TestCase): + + def test___init__(self): + driver = agent.AgentAndWakeOnLanDriver() + + self.assertIsInstance(driver.power, wol.WakeOnLanPower) + self.assertIsInstance(driver.boot, pxe.PXEBoot) + self.assertIsInstance(driver.deploy, agent_module.AgentDeploy) + self.assertIsInstance(driver.vendor, agent_module.AgentVendorInterface) diff --git a/setup.cfg b/setup.cfg index 3f865f4c1d..93029fcc5f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,6 +41,7 @@ ironic.drivers = agent_ssh = ironic.drivers.agent:AgentAndSSHDriver agent_vbox = ironic.drivers.agent:AgentAndVirtualBoxDriver agent_ucs = ironic.drivers.agent:AgentAndUcsDriver + agent_wol = ironic.drivers.agent:AgentAndWakeOnLanDriver fake = ironic.drivers.fake:FakeDriver fake_agent = ironic.drivers.fake:FakeAgentDriver fake_inspector = ironic.drivers.fake:FakeIPMIToolInspectorDriver