def _do_update_firmware_sum(self, task, **kwargs): """Update the firmware using Smart Update Manager (SUM). :param task: a TaskManager object. :raises: NodeCleaningFailure or InstanceDeployFailure, on failure to execute of clean or deploy step respectively. :returns: states.CLEANWAIT or states.DEPLOYWAIT to signify the step will be completed async for clean or deploy step respectively. """ node = task.node if node.provision_state == states.DEPLOYING: step = node.deploy_step step_type = 'deploy' else: step = node.clean_step step_type = 'clean' # The arguments are validated and sent to the ProliantHardwareManager # to perform SUM based firmware update clean step. firmware_processor.get_and_validate_firmware_image_info(kwargs, 'sum') url = kwargs['url'] if urlparse.urlparse(url).scheme == 'swift': url = firmware_processor.get_swift_url(urlparse.urlparse(url)) step['args']['url'] = url # Insert SPP ISO into virtual media CDROM ilo_common.attach_vmedia(node, 'CDROM', url) return agent_base.execute_step(task, step, step_type)
def apply_configuration(self, task, raid_config, delete_existing=True): """Applies RAID configuration on the given node. :param task: A TaskManager instance. :param raid_config: The RAID configuration to apply. :param delete_existing: Setting this to True indicates to delete RAID configuration prior to creating the new configuration. :raises: InvalidParameterValue, if the RAID configuration is invalid. :returns: states.DEPLOYWAIT if RAID configuration is in progress asynchronously or None if it is complete. """ self.validate_raid_config(task, raid_config) step = task.node.deploy_step return agent_base.execute_step(task, step, 'deploy')
def write_image(self, task): if not task.driver.storage.should_write_image(task): return node = task.node image_source = node.instance_info.get('image_source') LOG.debug('Continuing deploy for node %(node)s with image %(img)s', { 'node': node.uuid, 'img': image_source }) image_info = { 'id': image_source.split('/')[-1], 'urls': [node.instance_info['image_url']], # NOTE(comstud): Older versions of ironic do not set # 'disk_format' nor 'container_format', so we use .get() # to maintain backwards compatibility in case code was # upgraded in the middle of a build request. 'disk_format': node.instance_info.get('image_disk_format'), 'container_format': node.instance_info.get('image_container_format'), 'stream_raw_images': CONF.agent.stream_raw_images, } if node.instance_info.get('image_checksum'): image_info['checksum'] = node.instance_info['image_checksum'] if (node.instance_info.get('image_os_hash_algo') and node.instance_info.get('image_os_hash_value')): image_info['os_hash_algo'] = node.instance_info[ 'image_os_hash_algo'] image_info['os_hash_value'] = node.instance_info[ 'image_os_hash_value'] proxies = {} for scheme in ('http', 'https'): proxy_param = 'image_%s_proxy' % scheme proxy = node.driver_info.get(proxy_param) if proxy: proxies[scheme] = proxy if proxies: image_info['proxies'] = proxies no_proxy = node.driver_info.get('image_no_proxy') if no_proxy is not None: image_info['no_proxy'] = no_proxy image_info['node_uuid'] = node.uuid iwdi = node.driver_internal_info.get('is_whole_disk_image') if not iwdi: for label in PARTITION_IMAGE_LABELS: image_info[label] = node.instance_info.get(label) boot_option = deploy_utils.get_boot_option(node) image_info['deploy_boot_mode'] = ( boot_mode_utils.get_boot_mode(node)) image_info['boot_option'] = boot_option disk_label = deploy_utils.get_disk_label(node) if disk_label is not None: image_info['disk_label'] = disk_label has_write_image = agent_base.find_step(task, 'deploy', 'deploy', 'write_image') is not None if not has_write_image: LOG.warning( 'The agent on node %s does not have the deploy ' 'step deploy.write_image, using the deprecated ' 'synchronous fall-back', task.node.uuid) if self.has_decomposed_deploy_steps and has_write_image: configdrive = node.instance_info.get('configdrive') # Now switch into the corresponding in-band deploy step and let the # result be polled normally. new_step = { 'interface': 'deploy', 'step': 'write_image', 'args': { 'image_info': image_info, 'configdrive': configdrive } } return agent_base.execute_step(task, new_step, 'deploy', client=self._client) else: # TODO(dtantsur): remove in W command = self._client.prepare_image(node, image_info, wait=True) if command['command_status'] == 'FAILED': # TODO(jimrollenhagen) power off if using neutron dhcp to # align with pxe driver? msg = (_('node %(node)s command status errored: %(error)s') % { 'node': node.uuid, 'error': command['command_error'] }) LOG.error(msg) deploy_utils.set_failed_state(task, msg)
def write_image(self, task): if not task.driver.storage.should_write_image(task): return node = task.node image_source = node.instance_info.get('image_source') LOG.debug('Continuing deploy for node %(node)s with image %(img)s', { 'node': node.uuid, 'img': image_source }) image_info = { 'id': image_source.split('/')[-1], 'urls': [node.instance_info['image_url']], # NOTE(comstud): Older versions of ironic do not set # 'disk_format' nor 'container_format', so we use .get() # to maintain backwards compatibility in case code was # upgraded in the middle of a build request. 'disk_format': node.instance_info.get('image_disk_format'), 'container_format': node.instance_info.get('image_container_format'), 'stream_raw_images': CONF.agent.stream_raw_images, } if node.instance_info.get('image_checksum'): image_info['checksum'] = node.instance_info['image_checksum'] if (node.instance_info.get('image_os_hash_algo') and node.instance_info.get('image_os_hash_value')): image_info['os_hash_algo'] = node.instance_info[ 'image_os_hash_algo'] image_info['os_hash_value'] = node.instance_info[ 'image_os_hash_value'] proxies = {} for scheme in ('http', 'https'): proxy_param = 'image_%s_proxy' % scheme proxy = node.driver_info.get(proxy_param) if proxy: proxies[scheme] = proxy if proxies: image_info['proxies'] = proxies no_proxy = node.driver_info.get('image_no_proxy') if no_proxy is not None: image_info['no_proxy'] = no_proxy image_info['node_uuid'] = node.uuid iwdi = node.driver_internal_info.get('is_whole_disk_image') if not iwdi: for label in PARTITION_IMAGE_LABELS: image_info[label] = node.instance_info.get(label) boot_option = deploy_utils.get_boot_option(node) image_info['deploy_boot_mode'] = ( boot_mode_utils.get_boot_mode(node)) image_info['boot_option'] = boot_option disk_label = deploy_utils.get_disk_label(node) if disk_label is not None: image_info['disk_label'] = disk_label configdrive = manager_utils.get_configdrive_image(node) if configdrive: # FIXME(dtantsur): remove this duplication once IPA is ready: # https://review.opendev.org/c/openstack/ironic-python-agent/+/790471 image_info['configdrive'] = configdrive # Now switch into the corresponding in-band deploy step and let the # result be polled normally. new_step = { 'interface': 'deploy', 'step': 'write_image', 'args': { 'image_info': image_info, 'configdrive': configdrive } } return agent_base.execute_step(task, new_step, 'deploy', client=self._client)