Esempio n. 1
0
 def __init__(self):
     if not importutils.try_import('ravello_sdk'):
         raise exception.DriverLoadError(
                 driver=self.__class__.__name__,
                 reason="Unable to import ravello_sdk library")
     self.power = ravello.RavelloPower()
     self.deploy = fake.FakeDeploy()
Esempio n. 2
0
File: pxe.py Progetto: n1zyy/ironic
 def __init__(self):
     if not importutils.try_import("pyghmi"):
         raise exception.DriverLoadError(driver=self.__class__.__name__, reason=_("Unable to import pyghmi library"))
     self.power = ipminative.NativeIPMIPower()
     self.deploy = pxe.PXEDeploy()
     self.management = ipminative.NativeIPMIManagement()
     self.vendor = pxe.VendorPassthru()
Esempio n. 3
0
 def __init__(self):
     if not importutils.try_import('seamicroclient'):
         raise exception.DriverLoadError(
                 driver=self.__class__.__name__,
                 reason="Unable to import seamicroclient library")
     self.power = seamicro.Power()
     self.deploy = fake.FakeDeploy()
     self.vendor = seamicro.VendorPassthru()
Esempio n. 4
0
 def __init__(self):
     if not importutils.try_import('seamicroclient'):
         raise exception.DriverLoadError(
             driver=self.__class__.__name__,
             reason="Unable to import seamicroclient library")
     self.power = seamicro.Power()
     self.deploy = fake.FakeDeploy()
     self.vendor = seamicro.VendorPassthru()
Esempio n. 5
0
 def __init__(self):
     if not importutils.try_import("pyghmi"):
         raise exception.DriverLoadError(driver=self.__class__.__name__, reason=_("Unable to import pyghmi library"))
     self.power = ipminative.NativeIPMIPower()
     self.deploy = pxe.PXEDeploy()
     self.pxe_vendor = pxe.VendorPassthru()
     self.ipmi_vendor = ipminative.VendorPassthru()
     self.mapping = {"pass_deploy_info": self.pxe_vendor, "set_boot_device": self.ipmi_vendor}
     self.vendor = utils.MixinVendorInterface(self.mapping)
Esempio n. 6
0
 def __init__(self):
     if not importutils.try_import('ravello_sdk'):
         raise exception.DriverLoadError(
                 driver=self.__class__.__name__,
                 reason="Unable to import ravello_sdk library")
     self.power = ravello.RavelloPower()
     self.console = ravello.RavelloConsole()
     self.deploy = pxe.PXEDeploy()
     self.vendor = pxe.VendorPassthru()
Esempio n. 7
0
    def __init__(self):
        if not importutils.try_import('pywsman'):
            raise exception.DriverLoadError(
                    driver=self.__class__.__name__,
                    reason=_('Unable to import pywsman library'))

        self.power = power.DracPower()
        self.deploy = pxe.PXEDeploy()
        self.management = management.DracManagement()
Esempio n. 8
0
 def __init__(self):
     if not importutils.try_import('seamicroclient'):
         raise exception.DriverNotFound('FakeSeaMicroDriver')
     self.power = seamicro.Power()
     self.deploy = fake.FakeDeploy()
     self.rescue = self.deploy
     self.seamicro_vendor = seamicro.VendorPassthru()
     self.pxe_vendor = pxe.VendorPassthru()
     self.vendor = seamicro.SeaMicroPXEMultipleVendorInterface(
         self.seamicro_vendor, self.pxe_vendor)
Esempio n. 9
0
    def __init__(self):
        if not importutils.try_import('pywsman'):
            raise exception.DriverLoadError(
                    driver=self.__class__.__name__,
                    reason=_('Unable to import pywsman library'))

        self.power = power.DracPower()
        self.deploy = pxe.PXEDeploy()
        # NOTE(ifarkas): using ipmitool is a temporary solution. It will be
        #                replaced by the DracManagement interface.
        self.management = ipmitool.IPMIManagement()
Esempio n. 10
0
    def __init__(self):

        if not importutils.try_import('proliantutils'):
            raise exception.DriverLoadError(
                driver=self.__class__.__name__,
                reason=_("Unable to import proliantutils library"))

        self.power = power.IloPower()
        self.deploy = None
        self.rescue = None
        self.console = None
        self.vendor = None
Esempio n. 11
0
 def __init__(self):
     if not importutils.try_import('seamicroclient'):
         raise exception.DriverNotFound('PXEAndSeaMicroDriver')
     self.power = seamicro.Power()
     self.deploy = pxe.PXEDeploy()
     self.seamicro_vendor = seamicro.VendorPassthru()
     self.pxe_vendor = pxe.VendorPassthru()
     self.mapping = {'pass_deploy_info': self.pxe_vendor,
                     'attach_volume': self.seamicro_vendor,
                     'set_boot_device': self.seamicro_vendor,
                     'set_node_vlan_id': self.seamicro_vendor}
     self.vendor = utils.MixinVendorInterface(self.mapping)
Esempio n. 12
0
 def __init__(self):
     if not importutils.try_import('pyghmi'):
         raise exception.DriverLoadError(
                 driver=self.__class__.__name__,
                 reason=_("Unable to import pyghmi library"))
     self.power = ipminative.NativeIPMIPower()
     self.deploy = pxe.PXEDeploy()
     self.pxe_vendor = pxe.VendorPassthru()
     self.ipmi_vendor = ipminative.VendorPassthru()
     self.mapping = {'pass_deploy_info': self.pxe_vendor,
                     'set_boot_device': self.ipmi_vendor}
     self.vendor = utils.MixinVendorInterface(self.mapping)
Esempio n. 13
0
    def __init__(self):

        if not importutils.try_import('proliantutils'):
            raise exception.DriverLoadError(
                    driver=self.__class__.__name__,
                    reason=_("Unable to import proliantutils library"))

        self.power = power.IloPower()
        self.deploy = None
        self.rescue = None
        self.console = None
        self.vendor = None
Esempio n. 14
0
 def __init__(self):
     if not importutils.try_import('seamicroclient'):
         raise exception.DriverLoadError(
                 driver=self.__class__.__name__,
                 reason="Unable to import seamicroclient library")
     self.power = seamicro.Power()
     self.deploy = pxe.PXEDeploy()
     self.management = seamicro.Management()
     self.seamicro_vendor = seamicro.VendorPassthru()
     self.pxe_vendor = pxe.VendorPassthru()
     self.mapping = {'pass_deploy_info': self.pxe_vendor,
                     'attach_volume': self.seamicro_vendor,
                     'set_node_vlan_id': self.seamicro_vendor}
     self.vendor = utils.MixinVendorInterface(self.mapping)
Esempio n. 15
0
 def __init__(self):
     if not importutils.try_import('seamicroclient'):
         raise exception.DriverLoadError(
                 driver=self.__class__.__name__,
                 reason="Unable to import seamicroclient library")
     self.power = seamicro.Power()
     self.deploy = pxe.PXEDeploy()
     self.seamicro_vendor = seamicro.VendorPassthru()
     self.pxe_vendor = pxe.VendorPassthru()
     self.mapping = {'pass_deploy_info': self.pxe_vendor,
                     'attach_volume': self.seamicro_vendor,
                     'set_boot_device': self.seamicro_vendor,
                     'set_node_vlan_id': self.seamicro_vendor}
     self.vendor = utils.MixinVendorInterface(self.mapping)
Esempio n. 16
0
 def __init__(self):
     if not importutils.try_import('seamicroclient'):
         raise exception.DriverNotFound('PXEAndSeaMicroDriver')
     self.power = seamicro.Power()
     self.deploy = pxe.PXEDeploy()
     self.seamicro_vendor = seamicro.VendorPassthru()
     self.pxe_vendor = pxe.VendorPassthru()
     self.mapping = {
         'pass_deploy_info': self.pxe_vendor,
         'attach_volume': self.seamicro_vendor,
         'set_boot_device': self.seamicro_vendor,
         'set_node_vlan_id': self.seamicro_vendor
     }
     self.vendor = utils.MixinVendorInterface(self.mapping)
Esempio n. 17
0
 def __init__(self):
     if not importutils.try_import("seamicroclient"):
         raise exception.DriverLoadError(
             driver=self.__class__.__name__, reason="Unable to import seamicroclient library"
         )
     self.power = seamicro.Power()
     self.deploy = pxe.PXEDeploy()
     self.management = seamicro.Management()
     self.seamicro_vendor = seamicro.VendorPassthru()
     self.pxe_vendor = pxe.VendorPassthru()
     self.mapping = {
         "pass_deploy_info": self.pxe_vendor,
         "attach_volume": self.seamicro_vendor,
         "set_node_vlan_id": self.seamicro_vendor,
     }
     self.vendor = utils.MixinVendorInterface(self.mapping)
Esempio n. 18
0
import signal
import sys
import time

import eventlet
from eventlet import event
from oslo.config import cfg

from ironic.openstack.common import eventlet_backdoor
from ironic.openstack.common.gettextutils import _  # noqa
from ironic.openstack.common import importutils
from ironic.openstack.common import log as logging
from ironic.openstack.common import threadgroup


rpc = importutils.try_import('ironic.openstack.common.rpc')
CONF = cfg.CONF
LOG = logging.getLogger(__name__)


def _sighup_supported():
    return hasattr(signal, 'SIGHUP')


def _is_sighup(signo):
    return _sighup_supported() and signo == signal.SIGHUP


def _signo_to_signame(signo):
    signals = {signal.SIGTERM: 'SIGTERM',
               signal.SIGINT: 'SIGINT'}
Esempio n. 19
0
    seamicroclient
    ipminative
    proliantutils
"""

import sys

import mock

from ironic.drivers.modules import ipmitool
from ironic.openstack.common import importutils


# attempt to load the external 'seamicroclient' library, which is
# required by the optional drivers.modules.seamicro module
seamicroclient = importutils.try_import("seamicroclient")
if not seamicroclient:
    smc = mock.Mock()
    smc.client = mock.Mock()
    smc.exceptions = mock.Mock()
    smc.exceptions.ClientException = Exception
    sys.modules['seamicroclient'] = smc
    sys.modules['seamicroclient.client'] = smc.client
    sys.modules['seamicroclient.exceptions'] = smc.exceptions

# if anything has loaded the seamicro driver yet, reload it now that
# the external library has been mocked
if 'ironic.drivers.modules.seamicro' in sys.modules:
    reload(sys.modules['ironic.drivers.modules.seamicro'])

# IPMITool driver checks the system for presense of 'ipmitool' binary during
Esempio n. 20
0
import itertools
import json

try:
    import xmlrpclib
except ImportError:
    # NOTE(jd): xmlrpclib is not shipped with Python 3
    xmlrpclib = None

import six

from ironic.openstack.common import gettextutils
from ironic.openstack.common import importutils
from ironic.openstack.common import timeutils

netaddr = importutils.try_import("netaddr")

_nasty_type_tests = [
    inspect.ismodule,
    inspect.isclass,
    inspect.ismethod,
    inspect.isfunction,
    inspect.isgeneratorfunction,
    inspect.isgenerator,
    inspect.istraceback,
    inspect.isframe,
    inspect.iscode,
    inspect.isbuiltin,
    inspect.isroutine,
    inspect.isabstract,
]
Esempio n. 21
0
except ImportError:
    # Python 2.6
    UnsupportedOperation = None

import eventlet
from eventlet import event
from oslo.config import cfg

from ironic.openstack.common import eventlet_backdoor
from ironic.openstack.common.gettextutils import _LE, _LI, _LW
from ironic.openstack.common import importutils
from ironic.openstack.common import log as logging
from ironic.openstack.common import systemd
from ironic.openstack.common import threadgroup

rpc = importutils.try_import('ironic.openstack.common.rpc')
CONF = cfg.CONF
LOG = logging.getLogger(__name__)


def _sighup_supported():
    return hasattr(signal, 'SIGHUP')


def _is_daemon():
    # The process group for a foreground process will match the
    # process group of the controlling terminal. If those values do
    # not match, or ioctl() fails on the stdout file handle, we assume
    # the process is running in the background as a daemon.
    # http://www.gnu.org/software/bash/manual/bashref.html#Job-Control-Basics
    try:
Esempio n. 22
0
#    under the License.

"""
Ironic Native IPMI power manager.
"""

from oslo.config import cfg

from ironic.common import exception
from ironic.common import states
from ironic.conductor import task_manager
from ironic.drivers import base
from ironic.openstack.common import importutils
from ironic.openstack.common import log as logging

pyghmi = importutils.try_import('pyghmi')
if pyghmi:
    from pyghmi import exceptions as pyghmi_exception
    from pyghmi.ipmi import command as ipmi_command

opts = [
    cfg.IntOpt('retry_timeout',
               default=60,
               help='Maximum time in seconds to retry IPMI operations.'),
    cfg.IntOpt('min_command_interval',
               default=5,
               help='Minimum time, in seconds, between IPMI operations '
                    'sent to a server. There is a risk with some hardware '
                    'that setting this too low may cause the BMC to crash. '
                    'Recommended setting is 5 seconds.'),
    ]
Esempio n. 23
0
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

"""
Ironic iBoot PDU power manager.
"""

from ironic.common import exception
from ironic.common import states
from ironic.conductor import task_manager
from ironic.drivers import base
from ironic.openstack.common import importutils
from ironic.openstack.common import log as logging

iboot = importutils.try_import('iboot')

LOG = logging.getLogger(__name__)

REQUIRED_PROPERTIES = {
    'iboot_address': _("IP address of the node. Required."),
    'iboot_username': _("username. Required."),
    'iboot_password': _("password. Required."),
}
OPTIONAL_PROPERTIES = {
    'iboot_relay_id': _("iBoot PDU relay id; default is 1. Optional."),
    'iboot_port': _("iBoot PDU port; default is 9100. Optional."),
}
COMMON_PROPERTIES = REQUIRED_PROPERTIES.copy()
COMMON_PROPERTIES.update(OPTIONAL_PROPERTIES)
Esempio n. 24
0
import itertools
import time
import uuid

import eventlet
import greenlet
from oslo.config import cfg

from ironic.openstack.common.gettextutils import _
from ironic.openstack.common import importutils
from ironic.openstack.common import jsonutils
from ironic.openstack.common import log as logging
from ironic.openstack.common.rpc import amqp as rpc_amqp
from ironic.openstack.common.rpc import common as rpc_common

qpid_messaging = importutils.try_import("qpid.messaging")
qpid_exceptions = importutils.try_import("qpid.messaging.exceptions")

LOG = logging.getLogger(__name__)

qpid_opts = [
    cfg.StrOpt('qpid_hostname',
               default='localhost',
               help='Qpid broker hostname'),
    cfg.IntOpt('qpid_port', default=5672, help='Qpid broker port'),
    cfg.ListOpt('qpid_hosts',
                default=['$qpid_hostname:$qpid_port'],
                help='Qpid HA cluster host:port pairs'),
    cfg.StrOpt('qpid_username',
               default='',
               help='Username for qpid connection'),
Esempio n. 25
0
#    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.
"""
The MatchMaker classes should accept a Topic or Fanout exchange key and
return keys for direct exchanges, per (approximate) AMQP parlance.
"""

from oslo.config import cfg

from ironic.openstack.common import importutils
from ironic.openstack.common import log as logging
from ironic.openstack.common.rpc import matchmaker as mm_common

redis = importutils.try_import('redis')

matchmaker_redis_opts = [
    cfg.StrOpt('host', default='127.0.0.1', help='Host to locate redis'),
    cfg.IntOpt('port',
               default=6379,
               help='Use this port to connect to redis host.'),
    cfg.StrOpt('password',
               default=None,
               help='Password for Redis server. (optional)'),
]

CONF = cfg.CONF
opt_group = cfg.OptGroup(name='matchmaker_redis',
                         title='Options for Redis-based MatchMaker')
CONF.register_group(opt_group)
Esempio n. 26
0
import inspect
import itertools
import json
try:
    import xmlrpclib
except ImportError:
    # NOTE(jd): xmlrpclib is not shipped with Python 3
    xmlrpclib = None

import six

from ironic.openstack.common import gettextutils
from ironic.openstack.common import importutils
from ironic.openstack.common import timeutils

netaddr = importutils.try_import("netaddr")

_nasty_type_tests = [
    inspect.ismodule, inspect.isclass, inspect.ismethod, inspect.isfunction,
    inspect.isgeneratorfunction, inspect.isgenerator, inspect.istraceback,
    inspect.isframe, inspect.iscode, inspect.isbuiltin, inspect.isroutine,
    inspect.isabstract
]

_simple_types = (six.string_types + six.integer_types +
                 (type(None), bool, float))


def to_primitive(value,
                 convert_instances=False,
                 convert_datetime=True,
Esempio n. 27
0
from ironic.conductor import task_manager
from ironic.conductor import utils as manager_utils
from ironic.drivers.modules import agent
from ironic.drivers.modules import deploy_utils
from ironic.drivers.modules.ilo import common as ilo_common
from ironic.drivers.modules.ilo import deploy as ilo_deploy
from ironic.drivers.modules import iscsi_deploy
from ironic.drivers.modules import pxe
from ironic.drivers import utils as driver_utils
from ironic.openstack.common import importutils
from ironic.tests.conductor import utils as mgr_utils
from ironic.tests.db import base as db_base
from ironic.tests.db import utils as db_utils
from ironic.tests.objects import utils as obj_utils

ilo_client = importutils.try_import('proliantutils.ilo.ribcl')

INFO_DICT = db_utils.get_test_ilo_info()
CONF = cfg.CONF


class IloDeployPrivateMethodsTestCase(db_base.DbTestCase):
    def setUp(self):
        super(IloDeployPrivateMethodsTestCase, self).setUp()
        mgr_utils.mock_the_extension_manager(driver="iscsi_ilo")
        self.node = obj_utils.create_test_node(self.context,
                                               driver='iscsi_ilo',
                                               driver_info=INFO_DICT)

    def test__get_boot_iso_object_name(self):
        boot_iso_actual = ilo_deploy._get_boot_iso_object_name(self.node)
Esempio n. 28
0
import types
import uuid

import eventlet
import greenlet
from oslo.config import cfg
import six
from six import moves

from ironic.openstack.common import excutils
from ironic.openstack.common.gettextutils import _
from ironic.openstack.common import importutils
from ironic.openstack.common import jsonutils
from ironic.openstack.common.rpc import common as rpc_common

zmq = importutils.try_import("eventlet.green.zmq")

# for convenience, are not modified.
pformat = pprint.pformat
Timeout = eventlet.timeout.Timeout
LOG = rpc_common.LOG
RemoteError = rpc_common.RemoteError
RPCException = rpc_common.RPCException

zmq_opts = [
    cfg.StrOpt(
        "rpc_zmq_bind_address",
        default="*",
        help="ZeroMQ bind address. Should be a wildcard (*), "
        "an ethernet interface, or IP. "
        'The "host" option should point or resolve to this '
Esempio n. 29
0
File: pxe.py Progetto: n1zyy/ironic
 def __init__(self):
     if not importutils.try_import("iboot"):
         raise exception.DriverLoadError(driver=self.__class__.__name__, reason="Unable to import iboot library")
     self.power = iboot.IBootPower()
     self.deploy = pxe.PXEDeploy()
     self.vendor = pxe.VendorPassthru()
Esempio n. 30
0
import time

import eventlet
import greenlet
from oslo.config import cfg
import six

from ironic.openstack.common import excutils
from ironic.openstack.common.gettextutils import _
from ironic.openstack.common import importutils
from ironic.openstack.common import jsonutils
from ironic.openstack.common import log as logging
from ironic.openstack.common.rpc import amqp as rpc_amqp
from ironic.openstack.common.rpc import common as rpc_common

qpid_codec = importutils.try_import("qpid.codec010")
qpid_messaging = importutils.try_import("qpid.messaging")
qpid_exceptions = importutils.try_import("qpid.messaging.exceptions")

LOG = logging.getLogger(__name__)

qpid_opts = [
    cfg.StrOpt('qpid_hostname',
               default='localhost',
               help='Qpid broker hostname'),
    cfg.IntOpt('qpid_port',
               default=5672,
               help='Qpid broker port'),
    cfg.ListOpt('qpid_hosts',
                default=['$qpid_hostname:$qpid_port'],
                help='Qpid HA cluster host:port pairs'),
Esempio n. 31
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.

"""
Wrapper for pywsman.Client
"""

from xml.etree import ElementTree

from ironic.common import exception
from ironic.openstack.common import importutils

pywsman = importutils.try_import('pywsman')

_SOAP_ENVELOPE_URI = 'http://www.w3.org/2003/05/soap-envelope'


class Client(object):

    def __init__(self, drac_host, drac_port, drac_path, drac_protocol,
                 drac_username, drac_password):
        pywsman_client = pywsman.Client(drac_host, drac_port, drac_path,
                                        drac_protocol, drac_username,
                                        drac_password)
        # TODO(ifarkas): Add support for CACerts
        pywsman.wsman_transport_set_verify_peer(pywsman_client, False)

        self.client = pywsman_client
Esempio n. 32
0
from ironic.common import driver_factory
from ironic.common import exception
from ironic.common import states
from ironic.conductor import task_manager
from ironic.db import api as dbapi
from ironic.drivers.modules import seamicro
from ironic.openstack.common import importutils
from ironic.tests import base
from ironic.tests.conductor import utils as mgr_utils
from ironic.tests.db import base as db_base
from ironic.tests.db import utils as db_utils

INFO_DICT = db_utils.get_test_seamicro_info()

seamicroclient = importutils.try_import("seamicroclient")
if seamicroclient:
    from seamicroclient import exceptions as seamicro_client_exception


class Fake_Server():
    def __init__(self, active=False, *args, **kwargs):
        self.active = active
        self.nic = {'0': {'untaggedVlan': ''}}

    def power_on(self):
        self.active = True

    def power_off(self, force=False):
        self.active = False
Esempio n. 33
0
python-seamicroclient.

Provides vendor passthru methods for SeaMicro specific functionality.
"""

from oslo.config import cfg

from ironic.common import exception
from ironic.common import states
from ironic.conductor import task_manager
from ironic.drivers import base
from ironic.openstack.common import importutils
from ironic.openstack.common import log as logging
from ironic.openstack.common import loopingcall

seamicroclient = importutils.try_import('seamicroclient')
if seamicroclient:
    from seamicroclient import client as seamicro_client
    from seamicroclient import exceptions as seamicro_client_exception

opts = [
    cfg.IntOpt('max_retry',
               default=3,
               help='Maximum retries for SeaMicro operations'),
    cfg.IntOpt('action_timeout',
               default=10,
               help='Seconds to wait for power action to be completed')
]

CONF = cfg.CONF
opt_group = cfg.OptGroup(name='seamicro',
Esempio n. 34
0
Ravello power and console drivers for Ironic.
"""

import socket
from contextlib import closing

from oslo.config import cfg

from ironic.common import exception
from ironic.common import states
from ironic.openstack.common import importutils
from ironic.conductor import task_manager
from ironic.drivers import base
from ironic.openstack.common import log as logging

ravello_sdk = importutils.try_import('ravello_sdk')
if ravello_sdk:
    from ravello_sdk import RavelloClient
    from ravello_sdk import RavelloError


ravello_opts = [
    cfg.StrOpt('username',
               help='Ravello API username.'),
    cfg.StrOpt('password',
               help='Ravello API password.'),
    cfg.StrOpt('endpoint',
               default='https://cloud.ravellosystems.com/api/v1',
               help='Ravello API endpoint.'),
]
Esempio n. 35
0
import types
import uuid

import eventlet
import greenlet
from oslo.config import cfg
import six
from six import moves

from ironic.openstack.common import excutils
from ironic.openstack.common.gettextutils import _
from ironic.openstack.common import importutils
from ironic.openstack.common import jsonutils
from ironic.openstack.common.rpc import common as rpc_common

zmq = importutils.try_import('eventlet.green.zmq')

# for convenience, are not modified.
pformat = pprint.pformat
Timeout = eventlet.timeout.Timeout
LOG = rpc_common.LOG
RemoteError = rpc_common.RemoteError
RPCException = rpc_common.RPCException

zmq_opts = [
    cfg.StrOpt('rpc_zmq_bind_address',
               default='*',
               help='ZeroMQ bind address. Should be a wildcard (*), '
               'an ethernet interface, or IP. '
               'The "host" option should point or resolve to this '
               'address.'),
Esempio n. 36
0
Current list of mocked libraries:
    seamicroclient
    ipminative
"""

import sys

import mock

from ironic.drivers.modules import ipmitool
from ironic.openstack.common import importutils


# attempt to load the external 'seamicroclient' library, which is
# required by the optional drivers.modules.seamicro module
seamicroclient = importutils.try_import("seamicroclient")
if not seamicroclient:
    smc = mock.Mock()
    smc.client = mock.Mock()
    smc.exceptions = mock.Mock()
    smc.exceptions.ClientException = Exception
    sys.modules['seamicroclient'] = smc
    sys.modules['seamicroclient.client'] = smc.client
    sys.modules['seamicroclient.exceptions'] = smc.exceptions

# if anything has loaded the seamicro driver yet, reload it now that
# the external library has been mocked
if 'ironic.drivers.modules.seamicro' in sys.modules:
    reload(sys.modules['ironic.drivers.modules.seamicro'])

# IPMITool driver checks the system for presense of 'ipmitool' binary during
Esempio n. 37
0
import sys
import types
import uuid

import eventlet
import greenlet
from oslo.config import cfg

from ironic.openstack.common import excutils
from ironic.openstack.common.gettextutils import _
from ironic.openstack.common import importutils
from ironic.openstack.common import jsonutils
from ironic.openstack.common import processutils as utils
from ironic.openstack.common.rpc import common as rpc_common

zmq = importutils.try_import('eventlet.green.zmq')

# for convenience, are not modified.
pformat = pprint.pformat
Timeout = eventlet.timeout.Timeout
LOG = rpc_common.LOG
RemoteError = rpc_common.RemoteError
RPCException = rpc_common.RPCException

zmq_opts = [
    cfg.StrOpt('rpc_zmq_bind_address', default='*',
               help='ZeroMQ bind address. Should be a wildcard (*), '
                    'an ethernet interface, or IP. '
                    'The "host" option should point or resolve to this '
                    'address.'),
Esempio n. 38
0
 def __init__(self):
     if not importutils.try_import('seamicroclient'):
         raise exception.DriverNotFound('FakeSeaMicroDriver')
     self.power = seamicro.Power()
     self.deploy = fake.FakeDeploy()
     self.vendor = seamicro.VendorPassthru()
Esempio n. 39
0
python-seamicroclient.

Provides vendor passthru methods for SeaMicro specific functionality.
"""

from oslo.config import cfg

from ironic.common import exception
from ironic.common import states
from ironic.conductor import task_manager
from ironic.drivers import base
from ironic.openstack.common import importutils
from ironic.openstack.common import log as logging
from ironic.openstack.common import loopingcall

seamicroclient = importutils.try_import('seamicroclient')
if seamicroclient:
    from seamicroclient import client as seamicro_client
    from seamicroclient import exceptions as seamicro_client_exception

opts = [
    cfg.IntOpt('max_retry',
               default=3,
               help='Maximum retries for SeaMicro operations'),
    cfg.IntOpt('action_timeout',
               default=10,
               help='Seconds to wait for power action to be completed')
]

CONF = cfg.CONF
opt_group = cfg.OptGroup(name='seamicro',
Esempio n. 40
0
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

"""
The MatchMaker classes should accept a Topic or Fanout exchange key and
return keys for direct exchanges, per (approximate) AMQP parlance.
"""

from oslo.config import cfg

from ironic.openstack.common import importutils
from ironic.openstack.common import log as logging
from ironic.openstack.common.rpc import matchmaker as mm_common

redis = importutils.try_import('redis')


matchmaker_redis_opts = [
    cfg.StrOpt('host',
               default='127.0.0.1',
               help='Host to locate redis'),
    cfg.IntOpt('port',
               default=6379,
               help='Use this port to connect to redis host.'),
    cfg.StrOpt('password',
               default=None,
               help='Password for Redis server. (optional)'),
]

CONF = cfg.CONF
Esempio n. 41
0
from ironic.conductor import task_manager
from ironic.conductor import utils as manager_utils
from ironic.drivers.modules import agent
from ironic.drivers.modules import deploy_utils
from ironic.drivers.modules.ilo import common as ilo_common
from ironic.drivers.modules.ilo import deploy as ilo_deploy
from ironic.drivers.modules import iscsi_deploy
from ironic.drivers.modules import pxe
from ironic.drivers import utils as driver_utils
from ironic.openstack.common import importutils
from ironic.tests.conductor import utils as mgr_utils
from ironic.tests.db import base as db_base
from ironic.tests.db import utils as db_utils
from ironic.tests.objects import utils as obj_utils

ilo_client = importutils.try_import('proliantutils.ilo.ribcl')


INFO_DICT = db_utils.get_test_ilo_info()
CONF = cfg.CONF


class IloDeployPrivateMethodsTestCase(db_base.DbTestCase):

    def setUp(self):
        super(IloDeployPrivateMethodsTestCase, self).setUp()
        mgr_utils.mock_the_extension_manager(driver="iscsi_ilo")
        self.node = obj_utils.create_test_node(self.context,
                driver='iscsi_ilo', driver_info=INFO_DICT)

    def test__get_boot_iso_object_name(self):
Esempio n. 42
0
#    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.
"""
The MatchMaker classes should accept a Topic or Fanout exchange key and
return keys for direct exchanges, per (approximate) AMQP parlance.
"""

from oslo.config import cfg

from ironic.openstack.common import importutils
from ironic.openstack.common import log as logging
from ironic.openstack.common.rpc import matchmaker as mm_common

redis = importutils.try_import("redis")


matchmaker_redis_opts = [
    cfg.StrOpt("host", default="127.0.0.1", help="Host to locate redis"),
    cfg.IntOpt("port", default=6379, help="Use this port to connect to redis host."),
    cfg.StrOpt("password", default=None, help="Password for Redis server. (optional)"),
]

CONF = cfg.CONF
opt_group = cfg.OptGroup(name="matchmaker_redis", title="Options for Redis-based MatchMaker")
CONF.register_group(opt_group)
CONF.register_opts(matchmaker_redis_opts, opt_group)
LOG = logging.getLogger(__name__)