Add agent_amt driver

This combines the AgentDeploy deploy driver with the AMT power and
management drivers, to allow the agent-based deploy mechanism on AMT
hardware.

Co-Authored-By: Devananda van der Veen <devananda.vdv@gmail.com>
Closes-Bug: #1499489
Implements: blueprint agent-amt-driver
Change-Id: Ideaa68d97477a9a924c33e76b4da3aa8fb02f503
This commit is contained in:
Jim Rollenhagen 2015-10-06 12:15:23 -07:00 committed by Ramakrishnan G
parent edda2f2624
commit 42d203a9a5
3 changed files with 73 additions and 0 deletions

View File

@ -18,6 +18,8 @@ from ironic.common import exception
from ironic.common.i18n import _
from ironic.drivers import base
from ironic.drivers.modules import agent
from ironic.drivers.modules.amt import management as amt_management
from ironic.drivers.modules.amt import power as amt_power
from ironic.drivers.modules.cimc import management as cimc_mgmt
from ironic.drivers.modules.cimc import power as cimc_power
from ironic.drivers.modules import inspector
@ -145,6 +147,27 @@ class AgentAndVirtualBoxDriver(base.BaseDriver):
self.raid = agent.AgentRAID()
class AgentAndAMTDriver(base.BaseDriver):
"""Agent + AMT driver.
This driver implements the `core` functionality, combining
:class:`ironic.drivers.amt.AMTPower` for power on/off and reboot with
:class:`ironic.drivers.modules.agent_deploy.AgentDeploy` for image
deployment. Implementations are in those respective classes; this
class is merely the glue between them.
"""
def __init__(self):
if not importutils.try_import('pywsman'):
raise exception.DriverLoadError(
driver=self.__class__.__name__,
reason=_("Unable to import pywsman library"))
self.power = amt_power.AMTPower()
self.boot = pxe.PXEBoot()
self.deploy = agent.AgentDeploy()
self.management = amt_management.AMTManagement()
self.vendor = agent.AgentVendorInterface()
class AgentAndUcsDriver(base.BaseDriver):
"""Agent + Cisco UCSM driver.

View File

@ -0,0 +1,49 @@
# Copyright 2015 Rackspace, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Test class for Agent Deploy Driver
"""
import mock
import testtools
from ironic.common import exception
from ironic.drivers import agent
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
class AgentAndAMTDriverTestCase(testtools.TestCase):
@mock.patch.object(agent.importutils, 'try_import', spec_set=True,
autospec=True)
def test___init__(self, mock_try_import):
mock_try_import.return_value = True
driver = agent.AgentAndAMTDriver()
self.assertIsInstance(driver.power, amt_power.AMTPower)
self.assertIsInstance(driver.boot, pxe.PXEBoot)
self.assertIsInstance(driver.deploy, agent_module.AgentDeploy)
self.assertIsInstance(driver.management, amt_management.AMTManagement)
self.assertIsInstance(driver.vendor, agent_module.AgentVendorInterface)
@mock.patch.object(agent.importutils, 'try_import')
def test___init___try_import_exception(self, mock_try_import):
mock_try_import.return_value = False
self.assertRaises(exception.DriverLoadError,
agent.AgentAndAMTDriver)

View File

@ -32,6 +32,7 @@ ironic.dhcp =
none = ironic.dhcp.none:NoneDHCPApi
ironic.drivers =
agent_amt = ironic.drivers.agent:AgentAndAMTDriver
agent_ilo = ironic.drivers.ilo:IloVirtualMediaAgentDriver
agent_ipmitool = ironic.drivers.agent:AgentAndIPMIToolDriver
agent_irmc = ironic.drivers.irmc:IRMCVirtualMediaAgentDriver