Merge "Move FakeOneViewDriver to the fake.py module"

This commit is contained in:
Jenkins 2015-10-14 03:32:04 +00:00 committed by Gerrit Code Review
commit b80e59148c
3 changed files with 24 additions and 22 deletions

View File

@ -42,6 +42,9 @@ from ironic.drivers.modules.irmc import power as irmc_power
from ironic.drivers.modules import iscsi_deploy
from ironic.drivers.modules.msftocs import management as msftocs_management
from ironic.drivers.modules.msftocs import power as msftocs_power
from ironic.drivers.modules.oneview import common as oneview_common
from ironic.drivers.modules.oneview import management as oneview_management
from ironic.drivers.modules.oneview import power as oneview_power
from ironic.drivers.modules import pxe
from ironic.drivers.modules import seamicro
from ironic.drivers.modules import snmp
@ -291,3 +294,23 @@ class FakeWakeOnLanDriver(base.BaseDriver):
def __init__(self):
self.power = wol.WakeOnLanPower()
self.deploy = fake.FakeDeploy()
class FakeOneViewDriver(base.BaseDriver):
"""Fake OneView driver. For testing purposes. """
def __init__(self):
if not importutils.try_import('oneview_client.client'):
raise exception.DriverLoadError(
driver=self.__class__.__name__,
reason=_("Unable to import python-oneviewclient library"))
# Checks connectivity to OneView and version compatibility on driver
# initialization
oneview_client = oneview_common.get_oneview_client()
oneview_client.verify_oneview_version()
oneview_client.verify_credentials()
self.power = oneview_power.OneViewPower()
self.management = oneview_management.OneViewManagement()
self.boot = fake.FakeBoot()
self.deploy = fake.FakeDeploy()

View File

@ -23,7 +23,6 @@ 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 import fake
from ironic.drivers.modules import iscsi_deploy
from ironic.drivers.modules.oneview import common
from ironic.drivers.modules.oneview import management
@ -88,23 +87,3 @@ class ISCSIPXEOneViewDriver(base.BaseDriver):
self.boot = pxe.PXEBoot()
self.deploy = iscsi_deploy.ISCSIDeploy()
self.vendor = iscsi_deploy.VendorPassthru()
class FakeOneViewDriver(base.BaseDriver):
"""Fake OneView driver. For testing purposes. """
def __init__(self):
if not importutils.try_import('oneview_client.client'):
raise exception.DriverLoadError(
driver=self.__class__.__name__,
reason=_("Unable to import python-oneviewclient library"))
# Checks connectivity to OneView and version compatibility on driver
# initialization
oneview_client = common.get_oneview_client()
oneview_client.verify_oneview_version()
oneview_client.verify_credentials()
self.power = power.OneViewPower()
self.management = management.OneViewManagement()
self.boot = fake.FakeBoot()
self.deploy = fake.FakeDeploy()

View File

@ -60,7 +60,7 @@ ironic.drivers =
fake_ucs = ironic.drivers.fake:FakeUcsDriver
fake_cimc = ironic.drivers.fake:FakeCIMCDriver
fake_wol = ironic.drivers.fake:FakeWakeOnLanDriver
fake_oneview = ironic.drivers.oneview:FakeOneViewDriver
fake_oneview = ironic.drivers.fake:FakeOneViewDriver
iscsi_ilo = ironic.drivers.ilo:IloVirtualMediaIscsiDriver
iscsi_irmc = ironic.drivers.irmc:IRMCVirtualMediaIscsiDriver
iscsi_pxe_oneview = ironic.drivers.oneview:ISCSIPXEOneViewDriver