From 6855ab17a3d23810728828299b268a2d5fba057a Mon Sep 17 00:00:00 2001 From: Dao Cong Tien Date: Thu, 26 Jan 2017 17:02:40 +0700 Subject: [PATCH] Add hardware type 'irmc' for FUJITSU PRIMERGY servers Added IRMCHardware type for FUJITSU PRIMERGY servers which have iRMC S4 management system. Change-Id: I92c62a1680d4662dce5b1158b323192f35af7e9c Closes-Bug:#1659209 --- ironic/drivers/irmc.py | 39 ++++++++++++ ironic/tests/unit/drivers/test_irmc.py | 63 +++++++++++++++++++ .../irmc-hardware-type-2ab4e1906d01fe22.yaml | 3 + setup.cfg | 5 ++ 4 files changed, 110 insertions(+) create mode 100644 releasenotes/notes/irmc-hardware-type-2ab4e1906d01fe22.yaml diff --git a/ironic/drivers/irmc.py b/ironic/drivers/irmc.py index bde978a0da..f721c31098 100644 --- a/ironic/drivers/irmc.py +++ b/ironic/drivers/irmc.py @@ -21,13 +21,17 @@ from oslo_utils import importutils from ironic.common import exception from ironic.common.i18n import _ from ironic.drivers import base +from ironic.drivers import generic from ironic.drivers.modules import agent +from ironic.drivers.modules import inspector from ironic.drivers.modules import ipmitool from ironic.drivers.modules.irmc import boot from ironic.drivers.modules.irmc import inspect from ironic.drivers.modules.irmc import management from ironic.drivers.modules.irmc import power from ironic.drivers.modules import iscsi_deploy +from ironic.drivers.modules import noop +from ironic.drivers.modules import pxe class IRMCVirtualMediaIscsiDriver(base.BaseDriver): @@ -75,3 +79,38 @@ class IRMCVirtualMediaAgentDriver(base.BaseDriver): self.console = ipmitool.IPMIShellinaboxConsole() self.management = management.IRMCManagement() self.inspect = inspect.IRMCInspect() + + +class IRMCHardware(generic.GenericHardware): + """iRMC hardware type. + + iRMC hardware type is targeted for FUJITSU PRIMERGY servers which + have iRMC S4 management system. + """ + + @property + def supported_boot_interfaces(self): + """List of supported boot interfaces.""" + return [boot.IRMCVirtualMediaBoot, pxe.PXEBoot] + + @property + def supported_console_interfaces(self): + """List of supported console interfaces.""" + return [ipmitool.IPMISocatConsole, ipmitool.IPMIShellinaboxConsole, + noop.NoConsole] + + @property + def supported_inspect_interfaces(self): + """List of supported inspect interfaces.""" + return [inspect.IRMCInspect, inspector.Inspector, + noop.NoInspect] + + @property + def supported_management_interfaces(self): + """List of supported management interfaces.""" + return [management.IRMCManagement] + + @property + def supported_power_interfaces(self): + """List of supported power interfaces.""" + return [power.IRMCPower] diff --git a/ironic/tests/unit/drivers/test_irmc.py b/ironic/tests/unit/drivers/test_irmc.py index a07da81059..6970b9f2a5 100644 --- a/ironic/tests/unit/drivers/test_irmc.py +++ b/ironic/tests/unit/drivers/test_irmc.py @@ -20,9 +20,15 @@ import mock import testtools from ironic.common import exception +from ironic.conductor import task_manager from ironic.drivers import irmc from ironic.drivers.modules import agent +from ironic.drivers.modules import inspector +from ironic.drivers.modules import ipmitool from ironic.drivers.modules import iscsi_deploy +from ironic.drivers.modules import noop +from ironic.tests.unit.db import base as db_base +from ironic.tests.unit.objects import utils as obj_utils class IRMCVirtualMediaIscsiTestCase(testtools.TestCase): @@ -107,3 +113,60 @@ class IRMCVirtualMediaAgentTestCase(testtools.TestCase): self.assertRaises(exception.IRMCSharedFileSystemNotMounted, irmc.IRMCVirtualMediaAgentDriver) + + +class IRMCHardwareTestCase(db_base.DbTestCase): + + def setUp(self): + irmc.boot.check_share_fs_mounted_patcher.start() + self.addCleanup(irmc.boot.check_share_fs_mounted_patcher.stop) + super(IRMCHardwareTestCase, self).setUp() + self.config(enabled_hardware_types=['irmc'], + enabled_boot_interfaces=['irmc-virtual-media'], + enabled_console_interfaces=['ipmitool-socat'], + enabled_deploy_interfaces=['iscsi', 'direct'], + enabled_inspect_interfaces=['irmc'], + enabled_management_interfaces=['irmc'], + enabled_power_interfaces=['irmc'], + enabled_raid_interfaces=['no-raid', 'agent']) + + def test_default_interfaces(self): + node = obj_utils.create_test_node(self.context, driver='irmc') + with task_manager.acquire(self.context, node.id) as task: + self.assertIsInstance(task.driver.boot, + irmc.boot.IRMCVirtualMediaBoot) + self.assertIsInstance(task.driver.console, + ipmitool.IPMISocatConsole) + self.assertIsInstance(task.driver.deploy, + iscsi_deploy.ISCSIDeploy) + self.assertIsInstance(task.driver.inspect, + irmc.inspect.IRMCInspect) + self.assertIsInstance(task.driver.management, + irmc.management.IRMCManagement) + self.assertIsInstance(task.driver.power, + irmc.power.IRMCPower) + self.assertIsInstance(task.driver.raid, + noop.NoRAID) + + def test_override_with_inspector(self): + self.config(enabled_inspect_interfaces=['inspector', 'irmc']) + node = obj_utils.create_test_node( + self.context, driver='irmc', + deploy_interface='direct', + inspect_interface='inspector', + raid_interface='agent') + with task_manager.acquire(self.context, node.id) as task: + self.assertIsInstance(task.driver.boot, + irmc.boot.IRMCVirtualMediaBoot) + self.assertIsInstance(task.driver.console, + ipmitool.IPMISocatConsole) + self.assertIsInstance(task.driver.deploy, + agent.AgentDeploy) + self.assertIsInstance(task.driver.inspect, + inspector.Inspector) + self.assertIsInstance(task.driver.management, + irmc.management.IRMCManagement) + self.assertIsInstance(task.driver.power, + irmc.power.IRMCPower) + self.assertIsInstance(task.driver.raid, + agent.AgentRAID) diff --git a/releasenotes/notes/irmc-hardware-type-2ab4e1906d01fe22.yaml b/releasenotes/notes/irmc-hardware-type-2ab4e1906d01fe22.yaml new file mode 100644 index 0000000000..e825951ef6 --- /dev/null +++ b/releasenotes/notes/irmc-hardware-type-2ab4e1906d01fe22.yaml @@ -0,0 +1,3 @@ +--- +features: + - Adds new hardware type 'irmc' for FUJITSU PRIMERGY servers. \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 03b2802751..b872b2bf75 100644 --- a/setup.cfg +++ b/setup.cfg @@ -92,6 +92,7 @@ ironic.drivers = ironic.hardware.interfaces.boot = fake = ironic.drivers.modules.fake:FakeBoot pxe = ironic.drivers.modules.pxe:PXEBoot + irmc-virtual-media = ironic.drivers.modules.irmc.boot:IRMCVirtualMediaBoot ironic.hardware.interfaces.console = fake = ironic.drivers.modules.fake:FakeConsole @@ -108,10 +109,12 @@ ironic.hardware.interfaces.inspect = fake = ironic.drivers.modules.fake:FakeInspect inspector = ironic.drivers.modules.inspector:Inspector no-inspect = ironic.drivers.modules.noop:NoInspect + irmc = ironic.drivers.modules.irmc.inspect:IRMCInspect ironic.hardware.interfaces.management = fake = ironic.drivers.modules.fake:FakeManagement ipmitool = ironic.drivers.modules.ipmitool:IPMIManagement + irmc = ironic.drivers.modules.irmc.management:IRMCManagement ironic.hardware.interfaces.network = flat = ironic.drivers.modules.network.flat:FlatNetwork @@ -121,6 +124,7 @@ ironic.hardware.interfaces.network = ironic.hardware.interfaces.power = fake = ironic.drivers.modules.fake:FakePower ipmitool = ironic.drivers.modules.ipmitool:IPMIPower + irmc = ironic.drivers.modules.irmc.power:IRMCPower ironic.hardware.interfaces.raid = agent = ironic.drivers.modules.agent:AgentRAID @@ -142,6 +146,7 @@ ironic.hardware.types = fake-hardware = ironic.drivers.fake_hardware:FakeHardware manual-management = ironic.drivers.generic:ManualManagementHardware ipmi = ironic.drivers.ipmi:IPMIHardware + irmc = ironic.drivers.irmc:IRMCHardware ironic.database.migration_backend = sqlalchemy = ironic.db.sqlalchemy.migration