Merge "Don't import sushy conditionally, it's a requirement"
This commit is contained in:
commit
43861609a8
@ -15,7 +15,7 @@
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log
|
||||
from oslo_utils import importutils
|
||||
import sushy
|
||||
|
||||
from ironic.common import boot_devices
|
||||
from ironic.drivers.modules.drac import utils as drac_utils
|
||||
@ -24,8 +24,6 @@ from ironic.drivers.modules.redfish import utils as redfish_utils
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
|
||||
class DracRedfishVirtualMediaBoot(redfish_boot.RedfishVirtualMediaBoot):
|
||||
"""iDRAC Redfish interface for virtual media boot-related actions.
|
||||
@ -63,11 +61,10 @@ class DracRedfishVirtualMediaBoot(redfish_boot.RedfishVirtualMediaBoot):
|
||||
via OEM action call implemented in Dell sushy OEM extension package.
|
||||
"""
|
||||
|
||||
if sushy:
|
||||
VIRTUAL_MEDIA_DEVICES = {
|
||||
boot_devices.FLOPPY: sushy.VIRTUAL_MEDIA_FLOPPY,
|
||||
boot_devices.CDROM: sushy.VIRTUAL_MEDIA_CD
|
||||
}
|
||||
VIRTUAL_MEDIA_DEVICES = {
|
||||
boot_devices.FLOPPY: sushy.VIRTUAL_MEDIA_FLOPPY,
|
||||
boot_devices.CDROM: sushy.VIRTUAL_MEDIA_CD
|
||||
}
|
||||
|
||||
def _validate_vendor(self, task, managers):
|
||||
pass # assume people are doing the right thing
|
||||
|
@ -34,7 +34,6 @@ from ironic.drivers.modules.redfish import utils as redfish_utils
|
||||
from ironic import objects
|
||||
|
||||
drac_exceptions = importutils.try_import('dracclient.exceptions')
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -28,6 +28,7 @@ import jsonschema
|
||||
from jsonschema import exceptions as json_schema_exc
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import importutils
|
||||
import sushy
|
||||
|
||||
from ironic.common import boot_devices
|
||||
from ironic.common import exception
|
||||
@ -48,7 +49,6 @@ from ironic.drivers.modules.redfish import utils as redfish_utils
|
||||
|
||||
|
||||
drac_exceptions = importutils.try_import('dracclient.exceptions')
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -22,6 +22,7 @@ from ironic_lib import metrics_utils
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import units
|
||||
import sushy
|
||||
import tenacity
|
||||
|
||||
from ironic.common import exception
|
||||
@ -41,7 +42,6 @@ from ironic.drivers.modules.redfish import utils as redfish_utils
|
||||
|
||||
drac_exceptions = importutils.try_import('dracclient.exceptions')
|
||||
drac_constants = importutils.try_import('dracclient.constants')
|
||||
sushy = importutils.try_import('sushy')
|
||||
sushy_oem_idrac = importutils.try_import('sushy_oem_idrac')
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -13,15 +13,13 @@
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log
|
||||
from oslo_utils import importutils
|
||||
import sushy
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.drivers.modules.redfish import utils as redfish_utils
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
|
||||
def execute_oem_manager_method(
|
||||
task, process_name, lambda_oem_func):
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
from ironic_lib import metrics_utils
|
||||
from oslo_log import log
|
||||
from oslo_utils import importutils
|
||||
import sushy
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common.i18n import _
|
||||
@ -29,8 +29,6 @@ LOG = log.getLogger(__name__)
|
||||
|
||||
METRICS = metrics_utils.get_metrics_logger(__name__)
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
registry_fields = ('attribute_type', 'allowable_values', 'lower_bound',
|
||||
'max_length', 'min_length', 'read_only',
|
||||
'reset_required', 'unique', 'upper_bound')
|
||||
@ -47,13 +45,6 @@ class RedfishBIOS(base.BIOSInterface):
|
||||
}
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
super(RedfishBIOS, self).__init__()
|
||||
if sushy is None:
|
||||
raise exception.DriverLoadError(
|
||||
driver='redfish',
|
||||
reason=_("Unable to import the sushy library"))
|
||||
|
||||
def _parse_allowable_values(self, node, allowable_values):
|
||||
"""Convert the BIOS registry allowable_value list to expected strings
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log
|
||||
from oslo_utils import importutils
|
||||
import sushy
|
||||
import tenacity
|
||||
|
||||
from ironic.common import boot_devices
|
||||
@ -79,8 +79,6 @@ COMMON_PROPERTIES.update(RESCUE_PROPERTIES)
|
||||
|
||||
IMAGE_SUBDIR = 'redfish'
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
|
||||
def _parse_driver_info(node):
|
||||
"""Gets the driver specific Node deployment info.
|
||||
@ -401,18 +399,6 @@ class RedfishVirtualMediaBoot(base.BootInterface):
|
||||
capabilities = ['iscsi_volume_boot', 'ramdisk_boot',
|
||||
'ramdisk_boot_configdrive']
|
||||
|
||||
def __init__(self):
|
||||
"""Initialize the Redfish virtual media boot interface.
|
||||
|
||||
:raises: DriverLoadError if the driver can't be loaded due to
|
||||
missing dependencies
|
||||
"""
|
||||
super(RedfishVirtualMediaBoot, self).__init__()
|
||||
if not sushy:
|
||||
raise exception.DriverLoadError(
|
||||
driver='redfish',
|
||||
reason=_('Unable to import the sushy library'))
|
||||
|
||||
def get_properties(self):
|
||||
"""Return the properties of the interface.
|
||||
|
||||
|
@ -15,8 +15,8 @@ from urllib.parse import urlparse
|
||||
|
||||
from ironic_lib import metrics_utils
|
||||
from oslo_log import log
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import timeutils
|
||||
import sushy
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common.i18n import _
|
||||
@ -34,8 +34,6 @@ LOG = log.getLogger(__name__)
|
||||
|
||||
METRICS = metrics_utils.get_metrics_logger(__name__)
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
|
||||
class RedfishFirmware(base.FirmwareInterface):
|
||||
|
||||
@ -48,13 +46,6 @@ class RedfishFirmware(base.FirmwareInterface):
|
||||
}
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
super(RedfishFirmware, self).__init__()
|
||||
if sushy is None:
|
||||
raise exception.DriverLoadError(
|
||||
driver='redfish',
|
||||
reason=_("Unable to import the sushy library"))
|
||||
|
||||
def get_properties(self):
|
||||
"""Return the properties of the interface.
|
||||
|
||||
|
@ -14,8 +14,8 @@ Redfish Inspect Interface
|
||||
"""
|
||||
|
||||
from oslo_log import log
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import units
|
||||
import sushy
|
||||
|
||||
from ironic.common import boot_modes
|
||||
from ironic.common import exception
|
||||
@ -30,48 +30,33 @@ from ironic import objects
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
CPU_ARCH_MAP = {
|
||||
sushy.PROCESSOR_ARCH_x86: 'x86_64',
|
||||
sushy.PROCESSOR_ARCH_IA_64: 'ia64',
|
||||
sushy.PROCESSOR_ARCH_ARM: 'arm',
|
||||
sushy.PROCESSOR_ARCH_MIPS: 'mips',
|
||||
sushy.PROCESSOR_ARCH_OEM: 'oem'
|
||||
}
|
||||
|
||||
if sushy:
|
||||
CPU_ARCH_MAP = {
|
||||
sushy.PROCESSOR_ARCH_x86: 'x86_64',
|
||||
sushy.PROCESSOR_ARCH_IA_64: 'ia64',
|
||||
sushy.PROCESSOR_ARCH_ARM: 'arm',
|
||||
sushy.PROCESSOR_ARCH_MIPS: 'mips',
|
||||
sushy.PROCESSOR_ARCH_OEM: 'oem'
|
||||
}
|
||||
PROCESSOR_INSTRUCTION_SET_MAP = {
|
||||
sushy.InstructionSet.ARM_A32: 'arm',
|
||||
sushy.InstructionSet.ARM_A64: 'aarch64',
|
||||
sushy.InstructionSet.IA_64: 'ia64',
|
||||
sushy.InstructionSet.MIPS32: 'mips',
|
||||
sushy.InstructionSet.MIPS64: 'mips64',
|
||||
sushy.InstructionSet.OEM: None,
|
||||
sushy.InstructionSet.X86: 'i686',
|
||||
sushy.InstructionSet.X86_64: 'x86_64'
|
||||
}
|
||||
|
||||
PROCESSOR_INSTRUCTION_SET_MAP = {
|
||||
sushy.InstructionSet.ARM_A32: 'arm',
|
||||
sushy.InstructionSet.ARM_A64: 'aarch64',
|
||||
sushy.InstructionSet.IA_64: 'ia64',
|
||||
sushy.InstructionSet.MIPS32: 'mips',
|
||||
sushy.InstructionSet.MIPS64: 'mips64',
|
||||
sushy.InstructionSet.OEM: None,
|
||||
sushy.InstructionSet.X86: 'i686',
|
||||
sushy.InstructionSet.X86_64: 'x86_64'
|
||||
}
|
||||
|
||||
BOOT_MODE_MAP = {
|
||||
sushy.BOOT_SOURCE_MODE_UEFI: boot_modes.UEFI,
|
||||
sushy.BOOT_SOURCE_MODE_BIOS: boot_modes.LEGACY_BIOS
|
||||
}
|
||||
BOOT_MODE_MAP = {
|
||||
sushy.BOOT_SOURCE_MODE_UEFI: boot_modes.UEFI,
|
||||
sushy.BOOT_SOURCE_MODE_BIOS: boot_modes.LEGACY_BIOS
|
||||
}
|
||||
|
||||
|
||||
class RedfishInspect(base.InspectInterface):
|
||||
|
||||
def __init__(self):
|
||||
"""Initialize the Redfish inspection interface.
|
||||
|
||||
:raises: DriverLoadError if the driver can't be loaded due to
|
||||
missing dependencies
|
||||
"""
|
||||
super(RedfishInspect, self).__init__()
|
||||
if not sushy:
|
||||
raise exception.DriverLoadError(
|
||||
driver='redfish',
|
||||
reason=_('Unable to import the sushy library'))
|
||||
|
||||
def get_properties(self):
|
||||
"""Return the properties of the interface.
|
||||
|
||||
|
@ -19,8 +19,8 @@ from urllib.parse import urlparse
|
||||
|
||||
from ironic_lib import metrics_utils
|
||||
from oslo_log import log
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import timeutils
|
||||
import sushy
|
||||
|
||||
from ironic.common import boot_devices
|
||||
from ironic.common import boot_modes
|
||||
@ -43,55 +43,52 @@ from ironic.drivers.modules.redfish import utils as redfish_utils
|
||||
LOG = log.getLogger(__name__)
|
||||
METRICS = metrics_utils.get_metrics_logger(__name__)
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
BOOT_MODE_CONFIG_INTERVAL = 15
|
||||
|
||||
if sushy:
|
||||
BOOT_DEVICE_MAP = {
|
||||
sushy.BOOT_SOURCE_TARGET_PXE: boot_devices.PXE,
|
||||
sushy.BOOT_SOURCE_TARGET_HDD: boot_devices.DISK,
|
||||
sushy.BOOT_SOURCE_TARGET_CD: boot_devices.CDROM,
|
||||
sushy.BOOT_SOURCE_TARGET_BIOS_SETUP: boot_devices.BIOS,
|
||||
sushy.BOOT_SOURCE_TARGET_UEFI_HTTP: boot_devices.UEFIHTTP
|
||||
}
|
||||
BOOT_DEVICE_MAP = {
|
||||
sushy.BOOT_SOURCE_TARGET_PXE: boot_devices.PXE,
|
||||
sushy.BOOT_SOURCE_TARGET_HDD: boot_devices.DISK,
|
||||
sushy.BOOT_SOURCE_TARGET_CD: boot_devices.CDROM,
|
||||
sushy.BOOT_SOURCE_TARGET_BIOS_SETUP: boot_devices.BIOS,
|
||||
sushy.BOOT_SOURCE_TARGET_UEFI_HTTP: boot_devices.UEFIHTTP
|
||||
}
|
||||
|
||||
BOOT_DEVICE_MAP_REV = {v: k for k, v in BOOT_DEVICE_MAP.items()}
|
||||
# Previously we used sushy constants in driver_internal_info. This mapping
|
||||
# is provided for backward compatibility, taking into account that sushy
|
||||
# constants will change from strings to enums.
|
||||
BOOT_DEVICE_MAP_REV_COMPAT = dict(
|
||||
BOOT_DEVICE_MAP_REV,
|
||||
pxe=sushy.BOOT_SOURCE_TARGET_PXE,
|
||||
hdd=sushy.BOOT_SOURCE_TARGET_HDD,
|
||||
cd=sushy.BOOT_SOURCE_TARGET_CD,
|
||||
**{'bios setup': sushy.BOOT_SOURCE_TARGET_BIOS_SETUP}
|
||||
)
|
||||
BOOT_DEVICE_MAP_REV = {v: k for k, v in BOOT_DEVICE_MAP.items()}
|
||||
# Previously we used sushy constants in driver_internal_info. This mapping
|
||||
# is provided for backward compatibility, taking into account that sushy
|
||||
# constants will change from strings to enums.
|
||||
BOOT_DEVICE_MAP_REV_COMPAT = dict(
|
||||
BOOT_DEVICE_MAP_REV,
|
||||
pxe=sushy.BOOT_SOURCE_TARGET_PXE,
|
||||
hdd=sushy.BOOT_SOURCE_TARGET_HDD,
|
||||
cd=sushy.BOOT_SOURCE_TARGET_CD,
|
||||
**{'bios setup': sushy.BOOT_SOURCE_TARGET_BIOS_SETUP}
|
||||
)
|
||||
|
||||
BOOT_MODE_MAP = {
|
||||
sushy.BOOT_SOURCE_MODE_UEFI: boot_modes.UEFI,
|
||||
sushy.BOOT_SOURCE_MODE_BIOS: boot_modes.LEGACY_BIOS
|
||||
}
|
||||
BOOT_MODE_MAP = {
|
||||
sushy.BOOT_SOURCE_MODE_UEFI: boot_modes.UEFI,
|
||||
sushy.BOOT_SOURCE_MODE_BIOS: boot_modes.LEGACY_BIOS
|
||||
}
|
||||
|
||||
BOOT_MODE_MAP_REV = {v: k for k, v in BOOT_MODE_MAP.items()}
|
||||
BOOT_MODE_MAP_REV = {v: k for k, v in BOOT_MODE_MAP.items()}
|
||||
|
||||
BOOT_DEVICE_PERSISTENT_MAP = {
|
||||
sushy.BOOT_SOURCE_ENABLED_CONTINUOUS: True,
|
||||
sushy.BOOT_SOURCE_ENABLED_ONCE: False
|
||||
}
|
||||
BOOT_DEVICE_PERSISTENT_MAP = {
|
||||
sushy.BOOT_SOURCE_ENABLED_CONTINUOUS: True,
|
||||
sushy.BOOT_SOURCE_ENABLED_ONCE: False
|
||||
}
|
||||
|
||||
BOOT_DEVICE_PERSISTENT_MAP_REV = {v: k for k, v in
|
||||
BOOT_DEVICE_PERSISTENT_MAP.items()}
|
||||
BOOT_DEVICE_PERSISTENT_MAP_REV = {v: k for k, v in
|
||||
BOOT_DEVICE_PERSISTENT_MAP.items()}
|
||||
|
||||
INDICATOR_MAP = {
|
||||
sushy.INDICATOR_LED_LIT: indicator_states.ON,
|
||||
sushy.INDICATOR_LED_OFF: indicator_states.OFF,
|
||||
sushy.INDICATOR_LED_BLINKING: indicator_states.BLINKING,
|
||||
sushy.INDICATOR_LED_UNKNOWN: indicator_states.UNKNOWN
|
||||
}
|
||||
INDICATOR_MAP = {
|
||||
sushy.INDICATOR_LED_LIT: indicator_states.ON,
|
||||
sushy.INDICATOR_LED_OFF: indicator_states.OFF,
|
||||
sushy.INDICATOR_LED_BLINKING: indicator_states.BLINKING,
|
||||
sushy.INDICATOR_LED_UNKNOWN: indicator_states.UNKNOWN
|
||||
}
|
||||
|
||||
INDICATOR_MAP_REV = {
|
||||
v: k for k, v in INDICATOR_MAP.items()}
|
||||
INDICATOR_MAP_REV = {
|
||||
v: k for k, v in INDICATOR_MAP.items()}
|
||||
|
||||
|
||||
_FIRMWARE_UPDATE_ARGS = {
|
||||
@ -169,18 +166,6 @@ def _set_boot_device(task, system, device, persistent=False,
|
||||
|
||||
class RedfishManagement(base.ManagementInterface):
|
||||
|
||||
def __init__(self):
|
||||
"""Initialize the Redfish management interface.
|
||||
|
||||
:raises: DriverLoadError if the driver can't be loaded due to
|
||||
missing dependencies
|
||||
"""
|
||||
super(RedfishManagement, self).__init__()
|
||||
if not sushy:
|
||||
raise exception.DriverLoadError(
|
||||
driver='redfish',
|
||||
reason=_('Unable to import the sushy library'))
|
||||
|
||||
def get_properties(self):
|
||||
"""Return the properties of the interface.
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log
|
||||
from oslo_utils import importutils
|
||||
import sushy
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common.i18n import _
|
||||
@ -27,23 +27,20 @@ from ironic.drivers.modules.redfish import utils as redfish_utils
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
GET_POWER_STATE_MAP = {
|
||||
sushy.SYSTEM_POWER_STATE_ON: states.POWER_ON,
|
||||
sushy.SYSTEM_POWER_STATE_POWERING_ON: states.POWER_ON,
|
||||
sushy.SYSTEM_POWER_STATE_OFF: states.POWER_OFF,
|
||||
sushy.SYSTEM_POWER_STATE_POWERING_OFF: states.POWER_OFF
|
||||
}
|
||||
|
||||
if sushy:
|
||||
GET_POWER_STATE_MAP = {
|
||||
sushy.SYSTEM_POWER_STATE_ON: states.POWER_ON,
|
||||
sushy.SYSTEM_POWER_STATE_POWERING_ON: states.POWER_ON,
|
||||
sushy.SYSTEM_POWER_STATE_OFF: states.POWER_OFF,
|
||||
sushy.SYSTEM_POWER_STATE_POWERING_OFF: states.POWER_OFF
|
||||
}
|
||||
|
||||
SET_POWER_STATE_MAP = {
|
||||
states.POWER_ON: sushy.RESET_ON,
|
||||
states.POWER_OFF: sushy.RESET_FORCE_OFF,
|
||||
states.REBOOT: sushy.RESET_FORCE_RESTART,
|
||||
states.SOFT_REBOOT: sushy.RESET_GRACEFUL_RESTART,
|
||||
states.SOFT_POWER_OFF: sushy.RESET_GRACEFUL_SHUTDOWN
|
||||
}
|
||||
SET_POWER_STATE_MAP = {
|
||||
states.POWER_ON: sushy.RESET_ON,
|
||||
states.POWER_OFF: sushy.RESET_FORCE_OFF,
|
||||
states.REBOOT: sushy.RESET_FORCE_RESTART,
|
||||
states.SOFT_REBOOT: sushy.RESET_GRACEFUL_RESTART,
|
||||
states.SOFT_POWER_OFF: sushy.RESET_GRACEFUL_SHUTDOWN
|
||||
}
|
||||
|
||||
TARGET_STATE_MAP = {
|
||||
states.REBOOT: states.POWER_ON,
|
||||
@ -71,18 +68,6 @@ def _set_power_state(task, system, power_state, timeout=None):
|
||||
|
||||
class RedfishPower(base.PowerInterface):
|
||||
|
||||
def __init__(self):
|
||||
"""Initialize the Redfish power interface.
|
||||
|
||||
:raises: DriverLoadError if the driver can't be loaded due to
|
||||
missing dependencies
|
||||
"""
|
||||
super(RedfishPower, self).__init__()
|
||||
if not sushy:
|
||||
raise exception.DriverLoadError(
|
||||
driver='redfish',
|
||||
reason=_('Unable to import the sushy library'))
|
||||
|
||||
def get_properties(self):
|
||||
"""Return the properties of the interface.
|
||||
|
||||
|
@ -18,8 +18,8 @@ import math
|
||||
|
||||
from ironic_lib import metrics_utils
|
||||
from oslo_log import log
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import units
|
||||
import sushy
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common.i18n import _
|
||||
@ -84,13 +84,10 @@ RAID_LEVELS = {
|
||||
}
|
||||
}
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
if sushy:
|
||||
PROTOCOL_MAP = {
|
||||
sushy.PROTOCOL_TYPE_SAS: raid.SAS,
|
||||
sushy.PROTOCOL_TYPE_SATA: raid.SATA
|
||||
}
|
||||
PROTOCOL_MAP = {
|
||||
sushy.PROTOCOL_TYPE_SAS: raid.SAS,
|
||||
sushy.PROTOCOL_TYPE_SATA: raid.SATA
|
||||
}
|
||||
|
||||
|
||||
def convert_drive_units(logical_disks, node):
|
||||
@ -715,13 +712,6 @@ def update_raid_config(node):
|
||||
|
||||
class RedfishRAID(base.RAIDInterface):
|
||||
|
||||
def __init__(self):
|
||||
super(RedfishRAID, self).__init__()
|
||||
if sushy is None:
|
||||
raise exception.DriverLoadError(
|
||||
driver='redfish',
|
||||
reason=_("Unable to import the sushy library"))
|
||||
|
||||
def get_properties(self):
|
||||
"""Return the properties of the interface.
|
||||
|
||||
|
@ -21,9 +21,9 @@ from urllib import parse as urlparse
|
||||
|
||||
from oslo_log import log
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import strutils
|
||||
import rfc3986
|
||||
import sushy
|
||||
import tenacity
|
||||
|
||||
from ironic.common import exception
|
||||
@ -31,8 +31,6 @@ from ironic.common.i18n import _
|
||||
from ironic.common import utils
|
||||
from ironic.conf import CONF
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
REQUIRED_PROPERTIES = {
|
||||
@ -200,13 +198,12 @@ def parse_driver_info(node):
|
||||
|
||||
class SessionCache(object):
|
||||
"""Cache of HTTP sessions credentials"""
|
||||
AUTH_CLASSES = {}
|
||||
if sushy:
|
||||
AUTH_CLASSES.update(
|
||||
basic=sushy.auth.BasicAuth,
|
||||
session=sushy.auth.SessionAuth,
|
||||
auto=sushy.auth.SessionOrBasicAuth
|
||||
)
|
||||
|
||||
AUTH_CLASSES = dict(
|
||||
basic=sushy.auth.BasicAuth,
|
||||
session=sushy.auth.SessionAuth,
|
||||
auto=sushy.auth.SessionOrBasicAuth
|
||||
)
|
||||
|
||||
_sessions = collections.OrderedDict()
|
||||
|
||||
|
@ -17,8 +17,8 @@ Vendor Interface for Redfish drivers and its supporting methods.
|
||||
|
||||
from ironic_lib import metrics_utils
|
||||
from oslo_log import log
|
||||
from oslo_utils import importutils
|
||||
import rfc3986
|
||||
import sushy
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common.i18n import _
|
||||
@ -26,8 +26,6 @@ from ironic.drivers import base
|
||||
from ironic.drivers.modules.redfish import boot as redfish_boot
|
||||
from ironic.drivers.modules.redfish import utils as redfish_utils
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
METRICS = metrics_utils.get_metrics_logger(__name__)
|
||||
SUBSCRIPTION_COMMON_FIELDS = {
|
||||
|
@ -20,7 +20,7 @@ Test class for DRAC boot interface
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import importutils
|
||||
import sushy
|
||||
|
||||
from ironic.common import boot_devices
|
||||
from ironic.conductor import task_manager
|
||||
@ -30,8 +30,6 @@ from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.drivers.modules.drac import utils as test_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
INFO_DICT = dict(db_utils.get_test_redfish_info(), **test_utils.INFO_DICT)
|
||||
|
||||
|
||||
|
@ -18,8 +18,8 @@ Test class for DRAC inspection interface
|
||||
from unittest import mock
|
||||
|
||||
from dracclient import exceptions as drac_exceptions
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import units
|
||||
import sushy
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common import states
|
||||
@ -33,8 +33,6 @@ from ironic import objects
|
||||
from ironic.tests.unit.drivers.modules.drac import utils as test_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
INFO_DICT = test_utils.INFO_DICT
|
||||
|
||||
|
||||
|
@ -24,6 +24,7 @@ import json
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import importutils
|
||||
import sushy
|
||||
|
||||
import ironic.common.boot_devices
|
||||
from ironic.common import exception
|
||||
@ -42,7 +43,6 @@ from ironic.tests.unit.drivers.modules.drac import utils as test_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
dracclient_exceptions = importutils.try_import('dracclient.exceptions')
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
INFO_DICT = test_utils.INFO_DICT
|
||||
|
||||
|
@ -21,6 +21,7 @@ from unittest import mock
|
||||
from dracclient import constants
|
||||
from dracclient import exceptions as drac_exceptions
|
||||
from oslo_utils import importutils
|
||||
import sushy
|
||||
import tenacity
|
||||
|
||||
from ironic.common import exception
|
||||
@ -39,7 +40,6 @@ from ironic.drivers.modules.redfish import utils as redfish_utils
|
||||
from ironic.tests.unit.drivers.modules.drac import utils as test_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
sushy_oem_idrac = importutils.try_import('sushy_oem_idrac')
|
||||
|
||||
INFO_DICT = test_utils.INFO_DICT
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import importutils
|
||||
import sushy
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.conductor import task_manager
|
||||
@ -23,8 +23,6 @@ from ironic.drivers.modules.redfish import utils as redfish_utils
|
||||
from ironic.tests.unit.drivers.modules.drac import utils as test_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
INFO_DICT = test_utils.INFO_DICT
|
||||
|
||||
|
||||
|
@ -14,14 +14,13 @@
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import importutils
|
||||
import sushy
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common import states
|
||||
from ironic.conductor import task_manager
|
||||
from ironic.conductor import utils as manager_utils
|
||||
from ironic.drivers.modules import deploy_utils
|
||||
from ironic.drivers.modules.redfish import bios as redfish_bios
|
||||
from ironic.drivers.modules.redfish import boot as redfish_boot
|
||||
from ironic.drivers.modules.redfish import utils as redfish_utils
|
||||
from ironic import objects
|
||||
@ -29,8 +28,6 @@ from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
INFO_DICT = db_utils.get_test_redfish_info()
|
||||
|
||||
|
||||
@ -57,13 +54,6 @@ class RedfishBiosTestCase(db_base.DbTestCase):
|
||||
self.node = obj_utils.create_test_node(
|
||||
self.context, driver='redfish', driver_info=INFO_DICT)
|
||||
|
||||
@mock.patch.object(redfish_bios, 'sushy', None)
|
||||
def test_loading_error(self):
|
||||
self.assertRaisesRegex(
|
||||
exception.DriverLoadError,
|
||||
'Unable to import the sushy library',
|
||||
redfish_bios.RedfishBIOS)
|
||||
|
||||
def test_get_properties(self):
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
shared=True) as task:
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import importutils
|
||||
import sushy
|
||||
|
||||
from ironic.common import boot_devices
|
||||
from ironic.common import exception
|
||||
@ -31,8 +31,6 @@ from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
INFO_DICT = db_utils.get_test_redfish_info()
|
||||
|
||||
|
||||
@ -51,13 +49,6 @@ class RedfishVirtualMediaBootTestCase(db_base.DbTestCase):
|
||||
self.node = obj_utils.create_test_node(
|
||||
self.context, driver='redfish', driver_info=INFO_DICT)
|
||||
|
||||
@mock.patch.object(redfish_boot, 'sushy', None)
|
||||
def test_loading_error(self):
|
||||
self.assertRaisesRegex(
|
||||
exception.DriverLoadError,
|
||||
'Unable to import the sushy library',
|
||||
redfish_boot.RedfishVirtualMediaBoot)
|
||||
|
||||
@mock.patch.object(deploy_utils, 'get_boot_option', lambda node: 'ramdisk')
|
||||
def test_parse_driver_info_ramdisk(self):
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
|
@ -14,7 +14,7 @@
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import importutils
|
||||
import sushy
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common import states
|
||||
@ -29,8 +29,6 @@ from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
INFO_DICT = db_utils.get_test_redfish_info()
|
||||
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import units
|
||||
import sushy
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common import states
|
||||
@ -29,8 +29,6 @@ from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
INFO_DICT = db_utils.get_test_redfish_info()
|
||||
|
||||
|
||||
|
@ -16,8 +16,8 @@
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import units
|
||||
import sushy
|
||||
|
||||
from ironic.common import boot_devices
|
||||
from ironic.common import boot_modes
|
||||
@ -39,8 +39,6 @@ from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
INFO_DICT = db_utils.get_test_redfish_info()
|
||||
|
||||
|
||||
@ -82,13 +80,6 @@ class RedfishManagementTestCase(db_base.DbTestCase):
|
||||
|
||||
return system_mock
|
||||
|
||||
@mock.patch.object(redfish_mgmt, 'sushy', None)
|
||||
def test_loading_error(self):
|
||||
self.assertRaisesRegex(
|
||||
exception.DriverLoadError,
|
||||
'Unable to import the sushy library',
|
||||
redfish_mgmt.RedfishManagement)
|
||||
|
||||
def test_get_properties(self):
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
shared=True) as task:
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import importutils
|
||||
import sushy
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common import states
|
||||
@ -27,8 +27,6 @@ from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
INFO_DICT = db_utils.get_test_redfish_info()
|
||||
|
||||
|
||||
@ -47,13 +45,6 @@ class RedfishPowerTestCase(db_base.DbTestCase):
|
||||
self.node = obj_utils.create_test_node(
|
||||
self.context, driver='redfish', driver_info=INFO_DICT)
|
||||
|
||||
@mock.patch.object(redfish_power, 'sushy', None)
|
||||
def test_loading_error(self):
|
||||
self.assertRaisesRegex(
|
||||
exception.DriverLoadError,
|
||||
'Unable to import the sushy library',
|
||||
redfish_power.RedfishPower)
|
||||
|
||||
def test_get_properties(self):
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
shared=True) as task:
|
||||
|
@ -14,8 +14,8 @@
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import units
|
||||
import sushy
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common import states
|
||||
@ -29,8 +29,6 @@ from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
INFO_DICT = db_utils.get_test_redfish_info()
|
||||
|
||||
|
||||
@ -111,13 +109,6 @@ class RedfishRAIDTestCase(db_base.DbTestCase):
|
||||
mock_drives}
|
||||
self.physical_disks = mock_drives
|
||||
|
||||
@mock.patch.object(redfish_raid, 'sushy', None)
|
||||
def test_loading_error(self, mock_get_system):
|
||||
self.assertRaisesRegex(
|
||||
exception.DriverLoadError,
|
||||
'Unable to import the sushy library',
|
||||
redfish_raid.RedfishRAID)
|
||||
|
||||
def test__max_volume_size_bytes_raid0(self, mock_get_system):
|
||||
spans = redfish_raid._calculate_spans('0', 3)
|
||||
max_size = redfish_raid._max_volume_size_bytes(
|
||||
|
@ -20,8 +20,8 @@ import time
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import importutils
|
||||
import requests
|
||||
import sushy
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.drivers.modules.redfish import utils as redfish_utils
|
||||
@ -29,8 +29,6 @@ from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
INFO_DICT = db_utils.get_test_redfish_info()
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import importutils
|
||||
import sushy
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.conductor import task_manager
|
||||
@ -26,8 +26,6 @@ from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
INFO_DICT = db_utils.get_test_redfish_info()
|
||||
|
||||
|
||||
|
@ -18,7 +18,6 @@ import os
|
||||
import tempfile
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from ironic.common import images
|
||||
@ -31,7 +30,6 @@ from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
INFO_DICT = db_utils.get_test_redfish_info()
|
||||
INFO_DICT_ILO = db_utils.get_test_ilo_info()
|
||||
|
@ -16,7 +16,6 @@
|
||||
import socket
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from ironic.common import context as ironic_context
|
||||
@ -30,8 +29,6 @@ from ironic import objects
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
sushy = importutils.try_import('sushy')
|
||||
|
||||
|
||||
@mock.patch('time.sleep', lambda sec: None)
|
||||
class InspectFunctionTestCase(db_base.DbTestCase):
|
||||
|
Loading…
x
Reference in New Issue
Block a user