def clean_up_instance(self, task): """Cleans up the boot of instance. This method cleans up the environment that was setup for booting the instance. It ejects virtual media. In case of UEFI iSCSI booting, it cleans up iSCSI target information from the node. :param task: a task from TaskManager. :returns: None :raises: IloOperationError, if some operation on iLO failed. """ LOG.debug("Cleaning up the instance.") manager_utils.node_power_action(task, states.POWER_OFF) disable_secure_boot_if_supported(task) if (deploy_utils.is_iscsi_boot(task) and task.node.driver_internal_info.get('ilo_uefi_iscsi_boot')): # It will clear iSCSI info from iLO task.driver.management.clear_iscsi_boot_target(task) driver_internal_info = task.node.driver_internal_info driver_internal_info.pop('ilo_uefi_iscsi_boot', None) task.node.driver_internal_info = driver_internal_info task.node.save() else: image_utils.cleanup_iso_image(task) ilo_common.cleanup_vmedia_boot(task)
def clean_up_instance(self, task): """Cleans up the boot of instance. This method cleans up the environment that was setup for booting the instance. :param task: A task from TaskManager. :returns: None """ LOG.debug("Cleaning up instance boot for " "%(node)s", {'node': task.node.uuid}) managers = redfish_utils.get_system(task.node).managers _eject_vmedia(task, managers, sushy.VIRTUAL_MEDIA_CD) d_info = task.node.driver_info config_via_floppy = d_info.get('config_via_floppy') if config_via_floppy: _eject_vmedia(task, managers, sushy.VIRTUAL_MEDIA_FLOPPY) boot_option = deploy_utils.get_boot_option(task.node) if (boot_option == 'ramdisk' and task.node.instance_info.get('configdrive')): _eject_vmedia(task, managers, sushy.VIRTUAL_MEDIA_USBSTICK) image_utils.cleanup_disk_image(task, prefix='configdrive') image_utils.cleanup_iso_image(task)
def clean_up_ramdisk(self, task): """Cleans up the boot of ironic ramdisk. This method cleans up the environment that was setup for booting the deploy ramdisk. :param task: A task from TaskManager. :returns: None """ d_info = _parse_driver_info(task.node) config_via_floppy = d_info.get('config_via_floppy') LOG.debug("Cleaning up deploy boot for " "%(node)s", {'node': task.node.uuid}) managers = redfish_utils.get_system(task.node).managers _eject_vmedia(task, managers, sushy.VIRTUAL_MEDIA_CD) image_utils.cleanup_iso_image(task) if (config_via_floppy and _has_vmedia_device(managers, sushy.VIRTUAL_MEDIA_FLOPPY)): _eject_vmedia(task, managers, sushy.VIRTUAL_MEDIA_FLOPPY) image_utils.cleanup_floppy_image(task)
def prepare_instance(self, task): """Prepares the boot of instance. This method prepares the boot of the instance after reading relevant information from the node's instance_info. It does the following depending on boot_option for deploy: - If the boot_option requested for this deploy is 'local' or image is a whole disk image, then it sets the node to boot from disk. - Otherwise it finds/creates the boot ISO, sets the node boot option to UEFIHTTP and sets the URL as the boot ISO to boot the instance image. :param task: a task from TaskManager. :returns: None :raises: IloOperationError, if some operation on iLO failed. :raises: InstanceDeployFailure, if its try to boot iSCSI volume in 'BIOS' boot mode. """ node = task.node image_utils.cleanup_iso_image(task) boot_option = deploy_utils.get_boot_option(task.node) iwdi = node.driver_internal_info.get('is_whole_disk_image') if boot_option == "local" or iwdi: manager_utils.node_set_boot_device(task, boot_devices.DISK, persistent=True) LOG.debug("Node %(node)s is set to permanently boot from local " "%(device)s", {'node': task.node.uuid, 'device': boot_devices.DISK}) return params = {} if boot_option != 'ramdisk': root_uuid = node.driver_internal_info.get('root_uuid_or_disk_id') if not root_uuid and task.driver.storage.should_write_image(task): LOG.warning( "The UUID of the root partition could not be found for " "node %s. Booting instance from disk anyway.", node.uuid) manager_utils.node_set_boot_device(task, boot_devices.DISK, persistent=True) return params.update(root_uuid=root_uuid) d_info = self._parse_deploy_info(node) iso_ref = image_utils.prepare_boot_iso(task, d_info, **params) if boot_option != 'ramdisk': i_info = node.instance_info i_info['ilo_boot_iso'] = iso_ref node.instance_info = i_info node.save() ilo_common.setup_uefi_https(task, iso_ref, persistent=True) LOG.debug("Node %(node)s is set to boot from UEFIHTTP " "boot option", {'node': task.node.uuid})
def test_cleanup_iso_image(self, mock_unpublish): with task_manager.acquire(self.context, self.node.uuid, shared=True) as task: image_utils.cleanup_iso_image(task) object_name = 'boot-%s.iso' % task.node.uuid mock_unpublish.assert_called_once_with(mock.ANY, object_name)
def clean_up_instance(self, task): """Cleans up the boot of instance. This method cleans up the environment that was setup for booting the instance. :param task: A task from TaskManager. :returns: None """ LOG.debug("Cleaning up instance boot for " "%(node)s", {'node': task.node.uuid}) image_utils.cleanup_iso_image(task)
def _eject_all(self, task): managers = redfish_utils.get_system(task.node).managers _eject_vmedia(task, managers, sushy.VIRTUAL_MEDIA_CD) d_info = task.node.driver_info config_via_floppy = d_info.get('config_via_floppy') if config_via_floppy: _eject_vmedia(task, managers, sushy.VIRTUAL_MEDIA_FLOPPY) boot_option = deploy_utils.get_boot_option(task.node) if (boot_option == 'ramdisk' and task.node.instance_info.get('configdrive')): _eject_vmedia(task, managers, sushy.VIRTUAL_MEDIA_USBSTICK) image_utils.cleanup_disk_image(task, prefix='configdrive') image_utils.cleanup_iso_image(task)
def clean_up_ramdisk(self, task): """Cleans up the boot of ironic ramdisk. This method cleans up virtual media devices setup for the deploy or rescue ramdisk. :param task: a task from TaskManager. :returns: None :raises: IloOperationError, if some operation on iLO failed. """ ilo_common.cleanup_vmedia_boot(task) info = task.node.driver_info mode = deploy_utils.rescue_or_deploy_mode(task.node) if ((mode == 'rescue' and not info.get('ilo_rescue_iso')) or (mode == 'deploy' and not info.get('ilo_deploy_iso'))): image_utils.cleanup_iso_image(task)
def clean_up_instance(self, task): """Cleans up the boot of instance. This method cleans up the environment that was setup for booting the instance. :param task: A task from TaskManager. :returns: None """ LOG.debug("Cleaning up instance boot for " "%(node)s", {'node': task.node.uuid}) _eject_vmedia(task, sushy.VIRTUAL_MEDIA_CD) d_info = task.node.driver_info config_via_floppy = d_info.get('config_via_floppy') if config_via_floppy: _eject_vmedia(task, sushy.VIRTUAL_MEDIA_FLOPPY) image_utils.cleanup_iso_image(task)