Merge "Add hardware type for HPE OneView"
This commit is contained in:
commit
11112c8289
@ -21,6 +21,8 @@ from oslo_utils import importutils
|
|||||||
from ironic.common import exception
|
from ironic.common import exception
|
||||||
from ironic.common.i18n import _
|
from ironic.common.i18n import _
|
||||||
from ironic.drivers import base
|
from ironic.drivers import base
|
||||||
|
from ironic.drivers import generic
|
||||||
|
from ironic.drivers.modules import noop
|
||||||
from ironic.drivers.modules.oneview import common
|
from ironic.drivers.modules.oneview import common
|
||||||
from ironic.drivers.modules.oneview import deploy
|
from ironic.drivers.modules.oneview import deploy
|
||||||
from ironic.drivers.modules.oneview import inspect
|
from ironic.drivers.modules.oneview import inspect
|
||||||
@ -29,6 +31,33 @@ from ironic.drivers.modules.oneview import power
|
|||||||
from ironic.drivers.modules import pxe
|
from ironic.drivers.modules import pxe
|
||||||
|
|
||||||
|
|
||||||
|
class OneViewHardware(generic.GenericHardware):
|
||||||
|
"""OneView hardware type.
|
||||||
|
|
||||||
|
OneView hardware type is targeted for OneView
|
||||||
|
"""
|
||||||
|
|
||||||
|
@property
|
||||||
|
def supported_deploy_interfaces(self):
|
||||||
|
"""List of supported deploy interfaces."""
|
||||||
|
return [deploy.OneViewIscsiDeploy, deploy.OneViewAgentDeploy]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def supported_inspect_interfaces(self):
|
||||||
|
"""List of supported inspect interfaces."""
|
||||||
|
return [inspect.OneViewInspect, noop.NoInspect]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def supported_management_interfaces(self):
|
||||||
|
"""List of supported management interfaces."""
|
||||||
|
return [management.OneViewManagement]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def supported_power_interfaces(self):
|
||||||
|
"""List of supported power interfaces."""
|
||||||
|
return [power.OneViewPower]
|
||||||
|
|
||||||
|
|
||||||
class AgentPXEOneViewDriver(base.BaseDriver):
|
class AgentPXEOneViewDriver(base.BaseDriver):
|
||||||
"""OneViewDriver using OneViewClient interface.
|
"""OneViewDriver using OneViewClient interface.
|
||||||
|
|
||||||
|
171
ironic/tests/unit/drivers/test_oneview.py
Normal file
171
ironic/tests/unit/drivers/test_oneview.py
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
# Copyright 2017 Hewlett-Packard Enterprise Company, L.P.
|
||||||
|
#
|
||||||
|
# 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 HPE OneView Drivers."""
|
||||||
|
|
||||||
|
import mock
|
||||||
|
import testtools
|
||||||
|
|
||||||
|
from ironic.common import exception
|
||||||
|
from ironic.conductor import task_manager
|
||||||
|
from ironic.drivers.modules import agent
|
||||||
|
from ironic.drivers.modules import noop
|
||||||
|
from ironic.drivers.modules.oneview import deploy
|
||||||
|
from ironic.drivers.modules.oneview import management
|
||||||
|
from ironic.drivers.modules.oneview import power
|
||||||
|
from ironic.drivers.modules import pxe
|
||||||
|
from ironic.drivers.modules.storage import noop as noop_storage
|
||||||
|
from ironic.drivers import oneview
|
||||||
|
from ironic.tests.unit.db import base as db_base
|
||||||
|
from ironic.tests.unit.objects import utils as obj_utils
|
||||||
|
|
||||||
|
|
||||||
|
class OneViewHardwareTestCase(db_base.DbTestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(OneViewHardwareTestCase, self).setUp()
|
||||||
|
self.config(enabled_hardware_types=['oneview'],
|
||||||
|
enabled_deploy_interfaces=[
|
||||||
|
'oneview-direct', 'oneview-iscsi'],
|
||||||
|
enabled_inspect_interfaces=['oneview'],
|
||||||
|
enabled_management_interfaces=['oneview'],
|
||||||
|
enabled_power_interfaces=['oneview'],
|
||||||
|
enabled_raid_interfaces=['no-raid', 'agent'],
|
||||||
|
enabled_console_interfaces=['no-console'],
|
||||||
|
enabled_vendor_interfaces=['no-vendor'])
|
||||||
|
|
||||||
|
def test_default_interfaces(self):
|
||||||
|
node = obj_utils.create_test_node(self.context,
|
||||||
|
driver='oneview')
|
||||||
|
with task_manager.acquire(self.context, node.id) as task:
|
||||||
|
self.assertIsInstance(task.driver.boot,
|
||||||
|
pxe.PXEBoot)
|
||||||
|
self.assertIsInstance(task.driver.deploy,
|
||||||
|
oneview.deploy.OneViewIscsiDeploy)
|
||||||
|
self.assertIsInstance(task.driver.inspect,
|
||||||
|
oneview.inspect.OneViewInspect)
|
||||||
|
self.assertIsInstance(task.driver.management,
|
||||||
|
oneview.management.OneViewManagement)
|
||||||
|
self.assertIsInstance(task.driver.power,
|
||||||
|
oneview.power.OneViewPower),
|
||||||
|
self.assertIsInstance(task.driver.storage,
|
||||||
|
noop_storage.NoopStorage),
|
||||||
|
self.assertIsInstance(task.driver.console,
|
||||||
|
noop.NoConsole),
|
||||||
|
self.assertIsInstance(task.driver.raid,
|
||||||
|
noop.NoRAID)
|
||||||
|
self.assertIsInstance(task.driver.vendor,
|
||||||
|
noop.NoVendor)
|
||||||
|
|
||||||
|
def test_default_with_inspector_interface_enabled(self):
|
||||||
|
self.config(enabled_inspect_interfaces=['inspector', 'oneview'])
|
||||||
|
node = obj_utils.create_test_node(
|
||||||
|
self.context, driver='oneview',
|
||||||
|
deploy_interface='oneview-direct',
|
||||||
|
inspect_interface='oneview',
|
||||||
|
raid_interface='agent')
|
||||||
|
with task_manager.acquire(self.context, node.id) as task:
|
||||||
|
self.assertIsInstance(task.driver.boot,
|
||||||
|
pxe.PXEBoot)
|
||||||
|
self.assertIsInstance(task.driver.deploy,
|
||||||
|
oneview.deploy.OneViewAgentDeploy)
|
||||||
|
self.assertIsInstance(task.driver.inspect,
|
||||||
|
oneview.inspect.OneViewInspect)
|
||||||
|
self.assertIsInstance(task.driver.management,
|
||||||
|
oneview.management.OneViewManagement)
|
||||||
|
self.assertIsInstance(task.driver.power,
|
||||||
|
oneview.power.OneViewPower)
|
||||||
|
self.assertIsInstance(task.driver.raid,
|
||||||
|
agent.AgentRAID)
|
||||||
|
self.assertIsInstance(task.driver.vendor,
|
||||||
|
noop.NoVendor)
|
||||||
|
|
||||||
|
def test_override_with_direct(self):
|
||||||
|
node = obj_utils.create_test_node(
|
||||||
|
self.context, driver='oneview',
|
||||||
|
deploy_interface='oneview-direct',
|
||||||
|
boot_interface='pxe',
|
||||||
|
raid_interface='agent')
|
||||||
|
with task_manager.acquire(self.context, node.id) as task:
|
||||||
|
self.assertIsInstance(task.driver.boot,
|
||||||
|
pxe.PXEBoot)
|
||||||
|
self.assertIsInstance(task.driver.deploy,
|
||||||
|
oneview.deploy.OneViewAgentDeploy)
|
||||||
|
self.assertIsInstance(task.driver.inspect,
|
||||||
|
oneview.inspect.OneViewInspect)
|
||||||
|
self.assertIsInstance(task.driver.management,
|
||||||
|
oneview.management.OneViewManagement)
|
||||||
|
self.assertIsInstance(task.driver.power,
|
||||||
|
oneview.power.OneViewPower)
|
||||||
|
self.assertIsInstance(task.driver.raid,
|
||||||
|
agent.AgentRAID)
|
||||||
|
|
||||||
|
def test_override_with_iscsi(self):
|
||||||
|
node = obj_utils.create_test_node(
|
||||||
|
self.context, driver='oneview',
|
||||||
|
deploy_interface='oneview-iscsi',
|
||||||
|
boot_interface='pxe',
|
||||||
|
raid_interface='agent')
|
||||||
|
with task_manager.acquire(self.context, node.id) as task:
|
||||||
|
self.assertIsInstance(task.driver.boot,
|
||||||
|
pxe.PXEBoot)
|
||||||
|
self.assertIsInstance(task.driver.deploy,
|
||||||
|
oneview.deploy.OneViewIscsiDeploy)
|
||||||
|
self.assertIsInstance(task.driver.inspect,
|
||||||
|
oneview.inspect.OneViewInspect)
|
||||||
|
self.assertIsInstance(task.driver.management,
|
||||||
|
oneview.management.OneViewManagement)
|
||||||
|
self.assertIsInstance(task.driver.power,
|
||||||
|
oneview.power.OneViewPower)
|
||||||
|
self.assertIsInstance(task.driver.raid,
|
||||||
|
agent.AgentRAID)
|
||||||
|
|
||||||
|
|
||||||
|
@mock.patch.object(oneview.importutils, 'try_import', autospec=True)
|
||||||
|
class AgentPXEOneViewDriversTestCase(testtools.TestCase):
|
||||||
|
|
||||||
|
def test_oneview_agent_driver(self, mock_try_import):
|
||||||
|
mock_try_import.return_value = True
|
||||||
|
driver = oneview.AgentPXEOneViewDriver()
|
||||||
|
|
||||||
|
self.assertIsInstance(driver.boot, pxe.PXEBoot)
|
||||||
|
self.assertIsInstance(driver.power, power.OneViewPower)
|
||||||
|
self.assertIsInstance(driver.deploy, deploy.OneViewAgentDeploy)
|
||||||
|
self.assertIsInstance(driver.management, management.OneViewManagement)
|
||||||
|
|
||||||
|
def test_oneview_agent_driver_exc(self, mock_try_import):
|
||||||
|
mock_try_import.return_value = None
|
||||||
|
|
||||||
|
self.assertRaises(exception.DriverLoadError,
|
||||||
|
oneview.AgentPXEOneViewDriver)
|
||||||
|
|
||||||
|
|
||||||
|
@mock.patch.object(oneview.importutils, 'try_import', autospec=True)
|
||||||
|
class ISCSIPXEOneViewDriversTestCase(testtools.TestCase):
|
||||||
|
|
||||||
|
def test_oneview_iscsi_driver(self, mock_try_import):
|
||||||
|
mock_try_import.return_value = True
|
||||||
|
|
||||||
|
driver = oneview.ISCSIPXEOneViewDriver()
|
||||||
|
|
||||||
|
self.assertIsInstance(driver.boot, pxe.PXEBoot)
|
||||||
|
self.assertIsInstance(driver.power, power.OneViewPower)
|
||||||
|
self.assertIsInstance(driver.deploy, deploy.OneViewIscsiDeploy)
|
||||||
|
self.assertIsInstance(driver.management, management.OneViewManagement)
|
||||||
|
|
||||||
|
def test_oneview_iscsi_driver_exc(self, mock_try_import):
|
||||||
|
mock_try_import.return_value = None
|
||||||
|
|
||||||
|
self.assertRaises(exception.DriverLoadError,
|
||||||
|
oneview.ISCSIPXEOneViewDriver)
|
@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Add a new hardware type ``oneview`` for HPE OneView supported
|
||||||
|
servers. ``oneview`` hardware type supplies support following
|
||||||
|
driver interfaces:
|
||||||
|
|
||||||
|
* boot: ``pxe``
|
||||||
|
* console: ``no-console``
|
||||||
|
* deploy: ``oneview-direct`` and ``oneview-iscsi``
|
||||||
|
(Based on 'direct' and 'iscsi' respectively)
|
||||||
|
* inspect: ``oneview`` and ``no-inspect``
|
||||||
|
* management: ``oneview``
|
||||||
|
* network: ``flat``, ``neutron`` and ``no-op``
|
||||||
|
* power: ``oneview``
|
||||||
|
* raid: ``no-raid`` and ``agent``
|
@ -101,6 +101,8 @@ ironic.hardware.interfaces.deploy =
|
|||||||
direct = ironic.drivers.modules.agent:AgentDeploy
|
direct = ironic.drivers.modules.agent:AgentDeploy
|
||||||
fake = ironic.drivers.modules.fake:FakeDeploy
|
fake = ironic.drivers.modules.fake:FakeDeploy
|
||||||
iscsi = ironic.drivers.modules.iscsi_deploy:ISCSIDeploy
|
iscsi = ironic.drivers.modules.iscsi_deploy:ISCSIDeploy
|
||||||
|
oneview-direct = ironic.drivers.modules.oneview.deploy:OneViewAgentDeploy
|
||||||
|
oneview-iscsi = ironic.drivers.modules.oneview.deploy:OneViewIscsiDeploy
|
||||||
|
|
||||||
ironic.hardware.interfaces.inspect =
|
ironic.hardware.interfaces.inspect =
|
||||||
fake = ironic.drivers.modules.fake:FakeInspect
|
fake = ironic.drivers.modules.fake:FakeInspect
|
||||||
@ -108,12 +110,14 @@ ironic.hardware.interfaces.inspect =
|
|||||||
inspector = ironic.drivers.modules.inspector:Inspector
|
inspector = ironic.drivers.modules.inspector:Inspector
|
||||||
irmc = ironic.drivers.modules.irmc.inspect:IRMCInspect
|
irmc = ironic.drivers.modules.irmc.inspect:IRMCInspect
|
||||||
no-inspect = ironic.drivers.modules.noop:NoInspect
|
no-inspect = ironic.drivers.modules.noop:NoInspect
|
||||||
|
oneview = ironic.drivers.modules.oneview.inspect:OneViewInspect
|
||||||
|
|
||||||
ironic.hardware.interfaces.management =
|
ironic.hardware.interfaces.management =
|
||||||
fake = ironic.drivers.modules.fake:FakeManagement
|
fake = ironic.drivers.modules.fake:FakeManagement
|
||||||
ilo = ironic.drivers.modules.ilo.management:IloManagement
|
ilo = ironic.drivers.modules.ilo.management:IloManagement
|
||||||
ipmitool = ironic.drivers.modules.ipmitool:IPMIManagement
|
ipmitool = ironic.drivers.modules.ipmitool:IPMIManagement
|
||||||
irmc = ironic.drivers.modules.irmc.management:IRMCManagement
|
irmc = ironic.drivers.modules.irmc.management:IRMCManagement
|
||||||
|
oneview = ironic.drivers.modules.oneview.management:OneViewManagement
|
||||||
redfish = ironic.drivers.modules.redfish.management:RedfishManagement
|
redfish = ironic.drivers.modules.redfish.management:RedfishManagement
|
||||||
|
|
||||||
ironic.hardware.interfaces.network =
|
ironic.hardware.interfaces.network =
|
||||||
@ -126,6 +130,7 @@ ironic.hardware.interfaces.power =
|
|||||||
ilo = ironic.drivers.modules.ilo.power:IloPower
|
ilo = ironic.drivers.modules.ilo.power:IloPower
|
||||||
ipmitool = ironic.drivers.modules.ipmitool:IPMIPower
|
ipmitool = ironic.drivers.modules.ipmitool:IPMIPower
|
||||||
irmc = ironic.drivers.modules.irmc.power:IRMCPower
|
irmc = ironic.drivers.modules.irmc.power:IRMCPower
|
||||||
|
oneview = ironic.drivers.modules.oneview.power:OneViewPower
|
||||||
redfish = ironic.drivers.modules.redfish.power:RedfishPower
|
redfish = ironic.drivers.modules.redfish.power:RedfishPower
|
||||||
|
|
||||||
ironic.hardware.interfaces.raid =
|
ironic.hardware.interfaces.raid =
|
||||||
@ -152,6 +157,7 @@ ironic.hardware.types =
|
|||||||
ipmi = ironic.drivers.ipmi:IPMIHardware
|
ipmi = ironic.drivers.ipmi:IPMIHardware
|
||||||
irmc = ironic.drivers.irmc:IRMCHardware
|
irmc = ironic.drivers.irmc:IRMCHardware
|
||||||
manual-management = ironic.drivers.generic:ManualManagementHardware
|
manual-management = ironic.drivers.generic:ManualManagementHardware
|
||||||
|
oneview = ironic.drivers.oneview:OneViewHardware
|
||||||
redfish = ironic.drivers.redfish:RedfishHardware
|
redfish = ironic.drivers.redfish:RedfishHardware
|
||||||
|
|
||||||
ironic.database.migration_backend =
|
ironic.database.migration_backend =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user