"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ironic/drivers/modules/drac/management.py" between
ironic-17.0.2.tar.gz and ironic-17.0.3.tar.gz

About: OpenStack Ironic (Optional Service: Bare-Metal Provisioning) aims to provision bare metal machines instead of virtual machines, forked from the Nova baremetal driver.
The "Wallaby" series (latest release).

management.py  (ironic-17.0.2):management.py  (ironic-17.0.3)
skipping to change at line 43 skipping to change at line 43
from ironic.common.i18n import _ from ironic.common.i18n import _
from ironic.common import molds from ironic.common import molds
from ironic.common import states from ironic.common import states
from ironic.conductor import task_manager from ironic.conductor import task_manager
from ironic.conductor import utils as manager_utils from ironic.conductor import utils as manager_utils
from ironic.conf import CONF from ironic.conf import CONF
from ironic.drivers import base from ironic.drivers import base
from ironic.drivers.modules import deploy_utils from ironic.drivers.modules import deploy_utils
from ironic.drivers.modules.drac import common as drac_common from ironic.drivers.modules.drac import common as drac_common
from ironic.drivers.modules.drac import job as drac_job from ironic.drivers.modules.drac import job as drac_job
from ironic.drivers.modules.drac import utils as drac_utils
from ironic.drivers.modules.redfish import management as redfish_management from ironic.drivers.modules.redfish import management as redfish_management
from ironic.drivers.modules.redfish import utils as redfish_utils from ironic.drivers.modules.redfish import utils as redfish_utils
drac_exceptions = importutils.try_import('dracclient.exceptions') drac_exceptions = importutils.try_import('dracclient.exceptions')
sushy = importutils.try_import('sushy') sushy = importutils.try_import('sushy')
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
METRICS = metrics_utils.get_metrics_logger(__name__) METRICS = metrics_utils.get_metrics_logger(__name__)
skipping to change at line 358 skipping to change at line 359
_('export_configuration_location missing')) _('export_configuration_location missing'))
system = redfish_utils.get_system(task.node) system = redfish_utils.get_system(task.node)
configuration = None configuration = None
if not system.managers: if not system.managers:
raise exception.DracOperationError( raise exception.DracOperationError(
error=(_("No managers found for %(node)s") % error=(_("No managers found for %(node)s") %
{'node': task.node.uuid})) {'node': task.node.uuid}))
for manager in system.managers: configuration = drac_utils.execute_oem_manager_method(
task, 'export system configuration',
try: lambda m: m.export_system_configuration())
manager_oem = manager.get_oem_extension('Dell')
except sushy.exceptions.OEMExtensionNotFoundError as e:
error_msg = (_("Search for Sushy OEM extension Python package "
"'sushy-oem-idrac' failed for node %(node)s. "
"Ensure it is installed. Error: %(error)s") %
{'node': task.node.uuid, 'error': e})
LOG.error(error_msg)
raise exception.RedfishError(error=error_msg)
try:
configuration = manager_oem.export_system_configuration()
LOG.info("Exported %(node)s configuration via OEM",
{'node': task.node.uuid})
except sushy.exceptions.SushyError as e:
LOG.debug("Sushy OEM extension Python package "
"'sushy-oem-idrac' failed to export system "
" configuration for node %(node)s. Will try next "
"manager, if available. Error: %(error)s",
{'system': system.uuid if system.uuid else
system.identity,
'manager': manager.uuid if manager.uuid else
manager.identity,
'node': task.node.uuid,
'error': e})
continue
break
if configuration and configuration.status_code == 200: if configuration and configuration.status_code == 200:
configuration = {"oem": {"interface": "idrac-redfish", configuration = {"oem": {"interface": "idrac-redfish",
"data": configuration.json()}} "data": configuration.json()}}
molds.save_configuration(task, molds.save_configuration(task,
export_configuration_location, export_configuration_location,
configuration) configuration)
else: else:
raise exception.DracOperationError( raise exception.DracOperationError(
error=(_("No configuration exported for node %(node)s") % error=(_("No configuration exported for node %(node)s") %
skipping to change at line 438 skipping to change at line 413
interface = configuration["oem"]["interface"] interface = configuration["oem"]["interface"]
if interface != "idrac-redfish": if interface != "idrac-redfish":
raise exception.DracOperationError( raise exception.DracOperationError(
error=(_("Invalid configuration for node %(node)s " error=(_("Invalid configuration for node %(node)s "
"in %(configuration_name)s. Supports only " "in %(configuration_name)s. Supports only "
"idrac-redfish, but found %(interface)s") % "idrac-redfish, but found %(interface)s") %
{'node': task.node.uuid, {'node': task.node.uuid,
'configuration_name': import_configuration_location, 'configuration_name': import_configuration_location,
'interface': interface})) 'interface': interface}))
system = redfish_utils.get_system(task.node) task_monitor = drac_utils.execute_oem_manager_method(
task, 'import system configuration',
lambda m: m.import_system_configuration(
json.dumps(configuration["oem"]["data"])),)
if not system.managers: info = task.node.driver_internal_info
raise exception.DracOperationError( info['import_task_monitor_url'] = task_monitor.task_monitor_uri
error=(_("No managers found for %(node)s") % task.node.driver_internal_info = info
{'node': task.node.uuid}))
for manager in system.managers:
try:
manager_oem = manager.get_oem_extension('Dell')
except sushy.exceptions.OEMExtensionNotFoundError as e:
error_msg = (_("Search for Sushy OEM extension Python package "
"'sushy-oem-idrac' failed for node %(node)s. "
"Ensure it is installed. Error: %(error)s") %
{'node': task.node.uuid, 'error': e})
LOG.error(error_msg)
raise exception.RedfishError(error=error_msg)
try: deploy_utils.set_async_step_flags(
task_monitor = manager_oem.import_system_configuration( task.node,
json.dumps(configuration["oem"]["data"])) reboot=True,
skip_current_step=True,
polling=True)
deploy_opts = deploy_utils.build_agent_options(task.node)
task.driver.boot.prepare_ramdisk(task, deploy_opts)
manager_utils.node_power_action(task, states.REBOOT)
info = task.node.driver_internal_info return deploy_utils.get_async_step_return_state(task.node)
info['import_task_monitor_url'] = task_monitor.task_monitor_uri
task.node.driver_internal_info = info
deploy_utils.set_async_step_flags(
task.node,
reboot=True,
skip_current_step=True,
polling=True)
deploy_opts = deploy_utils.build_agent_options(task.node)
task.driver.boot.prepare_ramdisk(task, deploy_opts)
manager_utils.node_power_action(task, states.REBOOT)
return deploy_utils.get_async_step_return_state(task.node)
except sushy.exceptions.SushyError as e:
LOG.debug("Sushy OEM extension Python package "
"'sushy-oem-idrac' failed to import system "
" configuration for node %(node)s. Will try next "
"manager, if available. Error: %(error)s",
{'system': system.uuid if system.uuid else
system.identity,
'manager': manager.uuid if manager.uuid else
manager.identity,
'node': task.node.uuid,
'error': e})
continue
raise exception.DracOperationError(
error=(_("Failed to import configuration for node %(node)s") %
{'node': task.node.uuid}))
@base.clean_step(priority=0, @base.clean_step(priority=0,
argsinfo=IMPORT_EXPORT_CONFIGURATION_ARGSINFO) argsinfo=IMPORT_EXPORT_CONFIGURATION_ARGSINFO)
@base.deploy_step(priority=0, @base.deploy_step(priority=0,
argsinfo=IMPORT_EXPORT_CONFIGURATION_ARGSINFO) argsinfo=IMPORT_EXPORT_CONFIGURATION_ARGSINFO)
def import_export_configuration(self, task, import_configuration_location, def import_export_configuration(self, task, import_configuration_location,
export_configuration_location): export_configuration_location):
"""Import and export configuration in one go. """Import and export configuration in one go.
Gets pre-created configuration from storage by given name and Gets pre-created configuration from storage by given name and
skipping to change at line 642 skipping to change at line 584
@METRICS.timer('DracRedfishManagement.clear_job_queue') @METRICS.timer('DracRedfishManagement.clear_job_queue')
@base.clean_step(priority=0) @base.clean_step(priority=0)
def clear_job_queue(self, task): def clear_job_queue(self, task):
"""Clear iDRAC job queue. """Clear iDRAC job queue.
:param task: a TaskManager instance containing the node to act :param task: a TaskManager instance containing the node to act
on. on.
:raises: RedfishError on an error. :raises: RedfishError on an error.
""" """
system = redfish_utils.get_system(task.node) drac_utils.execute_oem_manager_method(
for manager in system.managers: task, 'clear job queue',
try: lambda m: m.job_service.delete_jobs(job_ids=['JID_CLEARALL']))
oem_manager = manager.get_oem_extension('Dell')
except sushy.exceptions.OEMExtensionNotFoundError as e:
error_msg = (_("Search for Sushy OEM extension Python package "
"'sushy-oem-idrac' failed for node %(node)s. "
"Ensure it is installed. Error: %(error)s") %
{'node': task.node.uuid, 'error': e})
LOG.error(error_msg)
raise exception.RedfishError(error=error_msg)
try:
oem_manager.job_service.delete_jobs(job_ids=['JID_CLEARALL'])
except sushy.exceptions.SushyError as e:
error_msg = ('Failed to clear iDRAC job queue with system '
'%(system)s manager %(manager)s for node '
'%(node)s. Will try next manager, if available. '
'Error: %(error)s' %
{'system': system.uuid if system.uuid else
system.identity,
'manager': manager.uuid if manager.uuid else
manager.identity,
'node': task.node.uuid,
'error': e})
LOG.debug(error_msg)
continue
LOG.info('Cleared iDRAC job queue for node %(node)s',
{'node': task.node.uuid})
break
else:
error_msg = (_('iDRAC Redfish clear job queue failed for node '
'%(node)s, because system %(system)s has no '
'manager%(no_manager)s.') %
{'node': task.node.uuid,
'system': system.uuid if system.uuid else
system.identity,
'no_manager': '' if not system.managers else
' which could'})
LOG.error(error_msg)
raise exception.RedfishError(error=error_msg)
@METRICS.timer('DracRedfishManagement.reset_idrac') @METRICS.timer('DracRedfishManagement.reset_idrac')
@base.clean_step(priority=0) @base.clean_step(priority=0)
def reset_idrac(self, task): def reset_idrac(self, task):
"""Reset the iDRAC. """Reset the iDRAC.
:param task: a TaskManager instance containing the node to act :param task: a TaskManager instance containing the node to act
on. on.
:raises: RedfishError on an error. :raises: RedfishError on an error.
""" """
system = redfish_utils.get_system(task.node) drac_utils.execute_oem_manager_method(
for manager in system.managers: task, 'reset iDRAC', lambda m: m.reset_idrac())
try: redfish_utils.wait_until_get_system_ready(task.node)
oem_manager = manager.get_oem_extension('Dell') LOG.info('Reset iDRAC for node %(node)s done',
except sushy.exceptions.OEMExtensionNotFoundError as e: {'node': task.node.uuid})
error_msg = (_("Search for Sushy OEM extension Python package "
"'sushy-oem-idrac' failed for node %(node)s. "
"Ensure it is installed. Error: %(error)s") %
{'node': task.node.uuid, 'error': e})
LOG.error(error_msg)
raise exception.RedfishError(error=error_msg)
try:
oem_manager.reset_idrac()
except sushy.exceptions.SushyError as e:
error_msg = ('Failed to reset iDRAC with system %(system)s '
'manager %(manager)s for node %(node)s. Will try '
'next manager, if available. Error: %(error)s' %
{'system': system.uuid if system.uuid else
system.identity,
'manager': manager.uuid if manager.uuid else
manager.identity,
'node': task.node.uuid,
'error': e})
LOG.debug(error_msg)
continue
redfish_utils.wait_until_get_system_ready(task.node)
LOG.info('Reset iDRAC for node %(node)s', {'node': task.node.uuid})
break
else:
error_msg = (_('iDRAC Redfish reset iDRAC failed for node '
'%(node)s, because system %(system)s has no '
'manager%(no_manager)s.') %
{'node': task.node.uuid,
'system': system.uuid if system.uuid else
system.identity,
'no_manager': '' if not system.managers else
' which could'})
LOG.error(error_msg)
raise exception.RedfishError(error=error_msg)
@METRICS.timer('DracRedfishManagement.known_good_state') @METRICS.timer('DracRedfishManagement.known_good_state')
@base.clean_step(priority=0) @base.clean_step(priority=0)
def known_good_state(self, task): def known_good_state(self, task):
"""Reset iDRAC to known good state. """Reset iDRAC to known good state.
An iDRAC is reset to a known good state by resetting it and An iDRAC is reset to a known good state by resetting it and
clearing its job queue. clearing its job queue.
:param task: a TaskManager instance containing the node to act :param task: a TaskManager instance containing the node to act
 End of changes. 8 change blocks. 
157 lines changed or deleted 28 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)