Merge "Use driver_internal_info methods for drac driver"
This commit is contained in:
commit
aed88ed93e
@ -128,13 +128,14 @@ class DracWSManBIOS(base.BIOSInterface):
|
|||||||
raise exception.DracOperationError(error=exc)
|
raise exception.DracOperationError(error=exc)
|
||||||
|
|
||||||
# Store JobID for the async job handler _check_node_bios_jobs
|
# Store JobID for the async job handler _check_node_bios_jobs
|
||||||
driver_internal_info = node.driver_internal_info
|
bios_config_job_ids = node.driver_internal_info.get(
|
||||||
driver_internal_info.setdefault(
|
'bios_config_job_ids', [])
|
||||||
'bios_config_job_ids', []).append(commit_result)
|
bios_config_job_ids.append(commit_result)
|
||||||
node.driver_internal_info = driver_internal_info
|
node.set_driver_internal_info('bios_config_job_ids',
|
||||||
|
bios_config_job_ids)
|
||||||
|
|
||||||
# This method calls node.save(), bios_config_job_ids will be saved
|
# This method calls node.save(), bios_config_job_ids will then be
|
||||||
# automatically
|
# saved.
|
||||||
# These flags are for the conductor to manage the asynchronous
|
# These flags are for the conductor to manage the asynchronous
|
||||||
# jobs that have been initiated by this method
|
# jobs that have been initiated by this method
|
||||||
deploy_utils.set_async_step_flags(
|
deploy_utils.set_async_step_flags(
|
||||||
@ -300,15 +301,15 @@ class DracWSManBIOS(base.BIOSInterface):
|
|||||||
"""
|
"""
|
||||||
if finished_job_ids is None:
|
if finished_job_ids is None:
|
||||||
finished_job_ids = []
|
finished_job_ids = []
|
||||||
driver_internal_info = node.driver_internal_info
|
|
||||||
# take out the unfinished job ids from all the jobs
|
# take out the unfinished job ids from all the jobs
|
||||||
unfinished_job_ids = [job_id for job_id
|
unfinished_job_ids = [
|
||||||
in driver_internal_info['bios_config_job_ids']
|
job_id for job_id
|
||||||
if job_id not in finished_job_ids]
|
in node.driver_internal_info['bios_config_job_ids']
|
||||||
|
if job_id not in finished_job_ids]
|
||||||
# assign the unfinished job ids back to the total list
|
# assign the unfinished job ids back to the total list
|
||||||
# this will clear the finished jobs from the list
|
# this will clear the finished jobs from the list
|
||||||
driver_internal_info['bios_config_job_ids'] = unfinished_job_ids
|
node.set_driver_internal_info('bios_config_job_ids',
|
||||||
node.driver_internal_info = driver_internal_info
|
unfinished_job_ids)
|
||||||
node.save()
|
node.save()
|
||||||
|
|
||||||
def _delete_cached_reboot_time(self, node):
|
def _delete_cached_reboot_time(self, node):
|
||||||
@ -316,12 +317,9 @@ class DracWSManBIOS(base.BIOSInterface):
|
|||||||
|
|
||||||
:param node: an ironic node object
|
:param node: an ironic node object
|
||||||
"""
|
"""
|
||||||
driver_internal_info = node.driver_internal_info
|
|
||||||
# Remove the last reboot time and factory reset time
|
# Remove the last reboot time and factory reset time
|
||||||
driver_internal_info.pop(
|
node.del_driver_internal_info('factory_reset_time_before_reboot')
|
||||||
'factory_reset_time_before_reboot')
|
node.del_driver_internal_info('factory_reset_time')
|
||||||
driver_internal_info.pop('factory_reset_time')
|
|
||||||
node.driver_internal_info = driver_internal_info
|
|
||||||
node.save()
|
node.save()
|
||||||
|
|
||||||
def _set_failed(self, task, error_message):
|
def _set_failed(self, task, error_message):
|
||||||
@ -414,14 +412,11 @@ class DracWSManBIOS(base.BIOSInterface):
|
|||||||
raise exception.DracOperationError(error=exc)
|
raise exception.DracOperationError(error=exc)
|
||||||
# Store the last inventory time on reboot for async job handler
|
# Store the last inventory time on reboot for async job handler
|
||||||
# _check_last_system_inventory_changed
|
# _check_last_system_inventory_changed
|
||||||
driver_internal_info = node.driver_internal_info
|
node.set_driver_internal_info('factory_reset_time_before_reboot',
|
||||||
driver_internal_info['factory_reset_time_before_reboot'] = \
|
factory_reset_time_before_reboot)
|
||||||
factory_reset_time_before_reboot
|
|
||||||
# Store the current time to later check if factory reset times out
|
# Store the current time to later check if factory reset times out
|
||||||
driver_internal_info['factory_reset_time'] = str(
|
node.timestamp_driver_internal_info('factory_reset_time')
|
||||||
timeutils.utcnow(with_timezone=True))
|
|
||||||
|
|
||||||
node.driver_internal_info = driver_internal_info
|
|
||||||
# rebooting the server to apply factory reset value
|
# rebooting the server to apply factory reset value
|
||||||
client.set_power_state('REBOOT')
|
client.set_power_state('REBOOT')
|
||||||
|
|
||||||
|
@ -445,9 +445,8 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
|
|||||||
lambda m: m.import_system_configuration(
|
lambda m: m.import_system_configuration(
|
||||||
json.dumps(configuration["oem"]["data"])),)
|
json.dumps(configuration["oem"]["data"])),)
|
||||||
|
|
||||||
info = task.node.driver_internal_info
|
task.node.set_driver_internal_info('import_task_monitor_url',
|
||||||
info['import_task_monitor_url'] = task_monitor.task_monitor_uri
|
task_monitor.task_monitor_uri)
|
||||||
task.node.driver_internal_info = info
|
|
||||||
|
|
||||||
deploy_utils.set_async_step_flags(
|
deploy_utils.set_async_step_flags(
|
||||||
task.node,
|
task.node,
|
||||||
@ -476,9 +475,8 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
|
|||||||
"""
|
"""
|
||||||
# Import is async operation, setting sub-step to store export config
|
# Import is async operation, setting sub-step to store export config
|
||||||
# and indicate that it's being executed as part of composite step
|
# and indicate that it's being executed as part of composite step
|
||||||
info = task.node.driver_internal_info
|
task.node.set_driver_internal_info('export_configuration_location',
|
||||||
info['export_configuration_location'] = export_configuration_location
|
export_configuration_location)
|
||||||
task.node.driver_internal_info = info
|
|
||||||
task.node.save()
|
task.node.save()
|
||||||
|
|
||||||
return self.import_configuration(task, import_configuration_location)
|
return self.import_configuration(task, import_configuration_location)
|
||||||
@ -521,9 +519,7 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
|
|||||||
log_msg = ("Import configuration task failed for node "
|
log_msg = ("Import configuration task failed for node "
|
||||||
"%(node)s. %(error)s" % {'node': task.node.uuid,
|
"%(node)s. %(error)s" % {'node': task.node.uuid,
|
||||||
'error': error_msg})
|
'error': error_msg})
|
||||||
info = node.driver_internal_info
|
node.del_driver_internal_info('import_task_monitor_url')
|
||||||
info.pop('import_task_monitor_url', None)
|
|
||||||
node.driver_internal_info = info
|
|
||||||
node.save()
|
node.save()
|
||||||
self._set_failed(task, log_msg, error_msg)
|
self._set_failed(task, log_msg, error_msg)
|
||||||
return
|
return
|
||||||
@ -532,9 +528,7 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
|
|||||||
import_task = task_monitor.get_task()
|
import_task = task_monitor.get_task()
|
||||||
|
|
||||||
task.upgrade_lock()
|
task.upgrade_lock()
|
||||||
info = node.driver_internal_info
|
node.del_driver_internal_info('import_task_monitor_url')
|
||||||
info.pop('import_task_monitor_url', None)
|
|
||||||
node.driver_internal_info = info
|
|
||||||
|
|
||||||
succeeded = False
|
succeeded = False
|
||||||
if (import_task.task_state == sushy.TASK_STATE_COMPLETED
|
if (import_task.task_state == sushy.TASK_STATE_COMPLETED
|
||||||
@ -557,8 +551,8 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
|
|||||||
'task_monitor_url': task_monitor_url})
|
'task_monitor_url': task_monitor_url})
|
||||||
|
|
||||||
# If import executed as part of import_export_configuration
|
# If import executed as part of import_export_configuration
|
||||||
export_configuration_location =\
|
export_configuration_location = node.driver_internal_info.get(
|
||||||
info.get('export_configuration_location')
|
'export_configuration_location')
|
||||||
if export_configuration_location:
|
if export_configuration_location:
|
||||||
# then do sync export configuration before finishing
|
# then do sync export configuration before finishing
|
||||||
self._cleanup_export_substep(node)
|
self._cleanup_export_substep(node)
|
||||||
@ -613,9 +607,7 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
|
|||||||
manager_utils.deploying_error_handler(task, log_msg, error_msg)
|
manager_utils.deploying_error_handler(task, log_msg, error_msg)
|
||||||
|
|
||||||
def _cleanup_export_substep(self, node):
|
def _cleanup_export_substep(self, node):
|
||||||
driver_internal_info = node.driver_internal_info
|
node.del_driver_internal_info('export_configuration_location')
|
||||||
driver_internal_info.pop('export_configuration_location', None)
|
|
||||||
node.driver_internal_info = driver_internal_info
|
|
||||||
|
|
||||||
@METRICS.timer('DracRedfishManagement.clear_job_queue')
|
@METRICS.timer('DracRedfishManagement.clear_job_queue')
|
||||||
@base.verify_step(priority=0)
|
@base.verify_step(priority=0)
|
||||||
@ -752,10 +744,9 @@ class DracWSManManagement(base.ManagementInterface):
|
|||||||
# at the next boot. As a workaround, saving it to
|
# at the next boot. As a workaround, saving it to
|
||||||
# driver_internal_info and committing the change during
|
# driver_internal_info and committing the change during
|
||||||
# power state change.
|
# power state change.
|
||||||
driver_internal_info = node.driver_internal_info
|
node.set_driver_internal_info('drac_boot_device',
|
||||||
driver_internal_info['drac_boot_device'] = {'boot_device': device,
|
{'boot_device': device,
|
||||||
'persistent': persistent}
|
'persistent': persistent})
|
||||||
node.driver_internal_info = driver_internal_info
|
|
||||||
node.save()
|
node.save()
|
||||||
|
|
||||||
@METRICS.timer('DracManagement.get_sensors_data')
|
@METRICS.timer('DracManagement.get_sensors_data')
|
||||||
|
@ -74,7 +74,6 @@ def _get_power_state(node):
|
|||||||
|
|
||||||
|
|
||||||
def _commit_boot_list_change(node):
|
def _commit_boot_list_change(node):
|
||||||
driver_internal_info = node.driver_internal_info
|
|
||||||
|
|
||||||
boot_device = node.driver_internal_info.get('drac_boot_device')
|
boot_device = node.driver_internal_info.get('drac_boot_device')
|
||||||
if boot_device is None:
|
if boot_device is None:
|
||||||
@ -83,8 +82,7 @@ def _commit_boot_list_change(node):
|
|||||||
drac_management.set_boot_device(node, boot_device['boot_device'],
|
drac_management.set_boot_device(node, boot_device['boot_device'],
|
||||||
boot_device['persistent'])
|
boot_device['persistent'])
|
||||||
|
|
||||||
driver_internal_info['drac_boot_device'] = None
|
node.set_driver_internal_info('drac_boot_device', None)
|
||||||
node.driver_internal_info = driver_internal_info
|
|
||||||
node.save()
|
node.save()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1007,19 +1007,14 @@ def _commit_to_controllers(node, controllers, substep="completed"):
|
|||||||
if not controllers:
|
if not controllers:
|
||||||
LOG.debug('No changes on any of the controllers on node %s',
|
LOG.debug('No changes on any of the controllers on node %s',
|
||||||
node.uuid)
|
node.uuid)
|
||||||
driver_internal_info = node.driver_internal_info
|
node.set_driver_internal_info('raid_config_substep', substep)
|
||||||
driver_internal_info['raid_config_substep'] = substep
|
node.set_driver_internal_info('raid_config_parameters', [])
|
||||||
driver_internal_info['raid_config_parameters'] = []
|
|
||||||
node.driver_internal_info = driver_internal_info
|
|
||||||
node.save()
|
node.save()
|
||||||
return
|
return
|
||||||
|
|
||||||
driver_internal_info = node.driver_internal_info
|
i_raid_config_parameters = []
|
||||||
driver_internal_info['raid_config_substep'] = substep
|
i_raid_config_job_ids = node.driver_internal_info.get(
|
||||||
driver_internal_info['raid_config_parameters'] = []
|
'raid_config_job_ids', [])
|
||||||
|
|
||||||
if 'raid_config_job_ids' not in driver_internal_info:
|
|
||||||
driver_internal_info['raid_config_job_ids'] = []
|
|
||||||
|
|
||||||
optional = drac_constants.RebootRequired.optional
|
optional = drac_constants.RebootRequired.optional
|
||||||
|
|
||||||
@ -1083,13 +1078,12 @@ def _commit_to_controllers(node, controllers, substep="completed"):
|
|||||||
raid_config_job_ids=raid_config_job_ids,
|
raid_config_job_ids=raid_config_job_ids,
|
||||||
raid_config_parameters=raid_config_parameters)
|
raid_config_parameters=raid_config_parameters)
|
||||||
|
|
||||||
driver_internal_info['raid_config_job_ids'].extend(job_details[
|
i_raid_config_job_ids.extend(job_details['raid_config_job_ids'])
|
||||||
'raid_config_job_ids'])
|
i_raid_config_parameters.extend(job_details['raid_config_parameters'])
|
||||||
|
node.set_driver_internal_info('raid_config_substep', substep)
|
||||||
driver_internal_info['raid_config_parameters'].extend(job_details[
|
node.set_driver_internal_info('raid_config_parameters',
|
||||||
'raid_config_parameters'])
|
i_raid_config_parameters)
|
||||||
|
node.set_driver_internal_info('raid_config_job_ids', i_raid_config_job_ids)
|
||||||
node.driver_internal_info = driver_internal_info
|
|
||||||
|
|
||||||
# Signal whether the node has been rebooted, that we do not need to execute
|
# Signal whether the node has been rebooted, that we do not need to execute
|
||||||
# the step again, and that this completion of this step is triggered
|
# the step again, and that this completion of this step is triggered
|
||||||
@ -1472,10 +1466,9 @@ class DracRedfishRAID(redfish_raid.RedfishRAID):
|
|||||||
deploy_utils.prepare_agent_boot(task)
|
deploy_utils.prepare_agent_boot(task)
|
||||||
# Reboot already done by non real time task
|
# Reboot already done by non real time task
|
||||||
task.upgrade_lock()
|
task.upgrade_lock()
|
||||||
info = task.node.driver_internal_info
|
task.node.set_driver_internal_info(
|
||||||
info['raid_task_monitor_uris'] = [
|
'raid_task_monitor_uris',
|
||||||
tm.task_monitor_uri for tm in task_mons]
|
[tm.task_monitor_uri for tm in task_mons])
|
||||||
task.node.driver_internal_info = info
|
|
||||||
task.node.save()
|
task.node.save()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -1526,27 +1519,25 @@ class DracRedfishRAID(redfish_raid.RedfishRAID):
|
|||||||
'message': ', '.join(messages)}))
|
'message': ', '.join(messages)}))
|
||||||
|
|
||||||
task.upgrade_lock()
|
task.upgrade_lock()
|
||||||
info = node.driver_internal_info
|
|
||||||
if failed_msgs:
|
if failed_msgs:
|
||||||
error_msg = (_("Failed RAID configuration tasks: %(messages)s")
|
error_msg = (_("Failed RAID configuration tasks: %(messages)s")
|
||||||
% {'messages': ', '.join(failed_msgs)})
|
% {'messages': ', '.join(failed_msgs)})
|
||||||
log_msg = ("RAID configuration task failed for node "
|
log_msg = ("RAID configuration task failed for node "
|
||||||
"%(node)s. %(error)s" % {'node': node.uuid,
|
"%(node)s. %(error)s" % {'node': node.uuid,
|
||||||
'error': error_msg})
|
'error': error_msg})
|
||||||
info.pop('raid_task_monitor_uris', None)
|
node.del_driver_internal_info('raid_task_monitor_uris')
|
||||||
self._set_failed(task, log_msg, error_msg)
|
self._set_failed(task, log_msg, error_msg)
|
||||||
else:
|
else:
|
||||||
running_task_mon_uris = [x for x in task_mon_uris
|
running_task_mon_uris = [x for x in task_mon_uris
|
||||||
if x not in completed_task_mon_uris]
|
if x not in completed_task_mon_uris]
|
||||||
if running_task_mon_uris:
|
if running_task_mon_uris:
|
||||||
info['raid_task_monitor_uris'] = running_task_mon_uris
|
node.set_driver_internal_info('raid_task_monitor_uris',
|
||||||
node.driver_internal_info = info
|
running_task_mon_uris)
|
||||||
# will check remaining jobs in the next period
|
# will check remaining jobs in the next period
|
||||||
else:
|
else:
|
||||||
# all tasks completed and none of them failed
|
# all tasks completed and none of them failed
|
||||||
info.pop('raid_task_monitor_uris', None)
|
node.del_driver_internal_info('raid_task_monitor_uris')
|
||||||
self._set_success(task)
|
self._set_success(task)
|
||||||
node.driver_internal_info = info
|
|
||||||
node.save()
|
node.save()
|
||||||
|
|
||||||
def _set_failed(self, task, log_msg, error_msg):
|
def _set_failed(self, task, log_msg, error_msg):
|
||||||
@ -1671,9 +1662,8 @@ class DracWSManRAID(base.RAIDInterface):
|
|||||||
physical_disk_name)
|
physical_disk_name)
|
||||||
|
|
||||||
# adding logical_disks to driver_internal_info to create virtual disks
|
# adding logical_disks to driver_internal_info to create virtual disks
|
||||||
driver_internal_info = node.driver_internal_info
|
node.set_driver_internal_info('logical_disks_to_create',
|
||||||
driver_internal_info[
|
logical_disks_to_create)
|
||||||
"logical_disks_to_create"] = logical_disks_to_create
|
|
||||||
|
|
||||||
commit_results = None
|
commit_results = None
|
||||||
if logical_disks_to_create:
|
if logical_disks_to_create:
|
||||||
@ -1688,8 +1678,8 @@ class DracWSManRAID(base.RAIDInterface):
|
|||||||
substep="create_virtual_disks")
|
substep="create_virtual_disks")
|
||||||
|
|
||||||
volume_validation = True if commit_results else False
|
volume_validation = True if commit_results else False
|
||||||
driver_internal_info['volume_validation'] = volume_validation
|
node.set_driver_internal_info('volume_validation',
|
||||||
node.driver_internal_info = driver_internal_info
|
volume_validation)
|
||||||
node.save()
|
node.save()
|
||||||
|
|
||||||
if commit_results:
|
if commit_results:
|
||||||
@ -1843,33 +1833,27 @@ class DracWSManRAID(base.RAIDInterface):
|
|||||||
self._complete_raid_substep(task, node)
|
self._complete_raid_substep(task, node)
|
||||||
|
|
||||||
def _clear_raid_substep(self, node):
|
def _clear_raid_substep(self, node):
|
||||||
driver_internal_info = node.driver_internal_info
|
node.del_driver_internal_info('raid_config_substep')
|
||||||
driver_internal_info.pop('raid_config_substep', None)
|
node.del_driver_internal_info('raid_config_parameters')
|
||||||
driver_internal_info.pop('raid_config_parameters', None)
|
|
||||||
node.driver_internal_info = driver_internal_info
|
|
||||||
node.save()
|
node.save()
|
||||||
|
|
||||||
def _set_raid_config_job_failure(self, node):
|
def _set_raid_config_job_failure(self, node):
|
||||||
driver_internal_info = node.driver_internal_info
|
node.set_driver_internal_info('raid_config_job_failure', True)
|
||||||
driver_internal_info['raid_config_job_failure'] = True
|
|
||||||
node.driver_internal_info = driver_internal_info
|
|
||||||
node.save()
|
node.save()
|
||||||
|
|
||||||
def _clear_raid_config_job_failure(self, node):
|
def _clear_raid_config_job_failure(self, node):
|
||||||
driver_internal_info = node.driver_internal_info
|
node.del_driver_internal_info('raid_config_job_failure')
|
||||||
del driver_internal_info['raid_config_job_failure']
|
|
||||||
node.driver_internal_info = driver_internal_info
|
|
||||||
node.save()
|
node.save()
|
||||||
|
|
||||||
def _delete_cached_config_job_id(self, node, finished_config_job_ids=None):
|
def _delete_cached_config_job_id(self, node, finished_config_job_ids=None):
|
||||||
if finished_config_job_ids is None:
|
if finished_config_job_ids is None:
|
||||||
finished_config_job_ids = []
|
finished_config_job_ids = []
|
||||||
driver_internal_info = node.driver_internal_info
|
unfinished_job_ids = [
|
||||||
unfinished_job_ids = [job_id for job_id
|
job_id for job_id
|
||||||
in driver_internal_info['raid_config_job_ids']
|
in node.driver_internal_info['raid_config_job_ids']
|
||||||
if job_id not in finished_config_job_ids]
|
if job_id not in finished_config_job_ids]
|
||||||
driver_internal_info['raid_config_job_ids'] = unfinished_job_ids
|
node.set_driver_internal_info('raid_config_job_ids',
|
||||||
node.driver_internal_info = driver_internal_info
|
unfinished_job_ids)
|
||||||
node.save()
|
node.save()
|
||||||
|
|
||||||
def _set_failed(self, task, config_job):
|
def _set_failed(self, task, config_job):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user