Merge "Add agent_amt driver"
This commit is contained in:
commit
a64f423940
@ -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.
|
||||
|
||||
|
49
ironic/tests/unit/drivers/test_agent.py
Normal file
49
ironic/tests/unit/drivers/test_agent.py
Normal 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)
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user