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 :raises: IRMCOperationError if iRMC operation failed. """ if task.node.driver_internal_info.get('boot_from_volume'): self._cleanup_boot_from_volume(task) return # Disable secure boot, if enabled secure boot if deploy_utils.is_secure_boot_requested(task.node): irmc_common.set_secure_boot_mode(task.node, enable=False) _remove_share_file(_get_boot_iso_name(task.node)) driver_internal_info = task.node.driver_internal_info driver_internal_info.pop('irmc_boot_iso', None) driver_internal_info.pop('root_uuid_or_disk_id', None) task.node.driver_internal_info = driver_internal_info task.node.save() _cleanup_vmedia_boot(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 database. :param task: a task from TaskManager. :returns: None """ if task.node.driver_internal_info.get('boot_from_volume'): LOG.debug( 'Node %(node)s is configured for booting from a remote ' 'volume.', {'node': task.node.uuid}) self._configure_boot_from_volume(task) return _cleanup_vmedia_boot(task) node = task.node iwdi = node.driver_internal_info.get('is_whole_disk_image') if deploy_utils.get_boot_option(node) == "local" or iwdi: manager_utils.node_set_boot_device(task, boot_devices.DISK, persistent=True) else: driver_internal_info = node.driver_internal_info root_uuid_or_disk_id = driver_internal_info['root_uuid_or_disk_id'] self._configure_vmedia_boot(task, root_uuid_or_disk_id) # Enable secure boot, if being requested if deploy_utils.is_secure_boot_requested(node): irmc_common.set_secure_boot_mode(node, enable=True)
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 :raises: IRMCOperationError if iRMC operation failed. """ if task.node.driver_internal_info.get('boot_from_volume'): self._cleanup_boot_from_volume(task) return # Disable secure boot, if enabled secure boot if deploy_utils.is_secure_boot_requested(task.node): irmc_common.set_secure_boot_mode(task.node, enable=False) _remove_share_file(_get_iso_name(task.node, label='boot')) driver_internal_info = task.node.driver_internal_info driver_internal_info.pop('irmc_boot_iso', None) task.node.driver_internal_info = driver_internal_info task.node.save() _cleanup_vmedia_boot(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 database. :param task: a task from TaskManager. :returns: None """ if task.node.driver_internal_info.get('boot_from_volume'): LOG.debug('Node %(node)s is configured for booting from a remote ' 'volume.', {'node': task.node.uuid}) self._configure_boot_from_volume(task) return _cleanup_vmedia_boot(task) node = task.node iwdi = node.driver_internal_info.get('is_whole_disk_image') if deploy_utils.get_boot_option(node) == "local" or iwdi: manager_utils.node_set_boot_device(task, boot_devices.DISK, persistent=True) else: driver_internal_info = node.driver_internal_info root_uuid_or_disk_id = driver_internal_info['root_uuid_or_disk_id'] self._configure_vmedia_boot(task, root_uuid_or_disk_id) # Enable secure boot, if being requested if deploy_utils.is_secure_boot_requested(node): irmc_common.set_secure_boot_mode(node, enable=True)
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 :raises: IRMCOperationError if iRMC operation failed. """ if task.node.driver_internal_info.get('boot_from_volume'): self._cleanup_boot_from_volume(task) return # Disable secure boot, if enabled secure boot if deploy_utils.is_secure_boot_requested(task.node): irmc_common.set_secure_boot_mode(task.node, enable=False) _remove_share_file(_get_iso_name(task.node, label='boot')) driver_internal_info = task.node.driver_internal_info driver_internal_info.pop('irmc_boot_iso', None) # When rescue, this function is called. But we need to retain the # root_uuid_or_disk_id to use on unrescue (see prepare_instance). boot_local_or_iwdi = ( deploy_utils.get_boot_option(task.node) == "local" or driver_internal_info.get('is_whole_disk_image')) if task.node.provision_state != states.RESCUING or boot_local_or_iwdi: driver_internal_info.pop('root_uuid_or_disk_id', None) task.node.driver_internal_info = driver_internal_info task.node.save() _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. It unlinks the instance kernel/ramdisk in node's directory in tftproot and removes the PXE config. :param task: a task from TaskManager. :raises: IRMCOperationError, if some operation on iRMC failed. :returns: None """ node = task.node if deploy_utils.is_secure_boot_requested(node): irmc_common.set_secure_boot_mode(node, enable=False) super(IRMCPXEBoot, self).clean_up_instance(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. In case of netboot, it updates the dhcp entries and switches the PXE config. In case of localboot, it cleans up the PXE config. :param task: a task from TaskManager. :returns: None :raises: IRMCOperationError, if some operation on iRMC failed. """ super(IRMCPXEBoot, self).prepare_instance(task) node = task.node if deploy_utils.is_secure_boot_requested(node): irmc_common.set_secure_boot_mode(node, enable=True)
def _update_secure_boot_mode(task, mode): """Changes secure boot mode for next boot on the node. This method changes secure boot mode on the node for next boot. It changes the secure boot mode setting on node only if the deploy has requested for the secure boot. During deploy, this method is used to enable secure boot on the node by passing 'mode' as 'True'. During teardown, this method is used to disable secure boot on the node by passing 'mode' as 'False'. :param task: a TaskManager instance containing the node to act on. :param mode: Boolean value requesting the next state for secure boot :raises: IloOperationNotSupported, if operation is not supported on iLO :raises: IloOperationError, if some operation on iLO failed. """ if deploy_utils.is_secure_boot_requested(task.node): ilo_common.set_secure_boot_mode(task, mode) LOG.info(_LI("Changed secure boot to %(mode)s for node %(node)s"), {"mode": mode, "node": task.node.uuid})
def update_secure_boot_mode(task, mode): """Changes secure boot mode for next boot on the node. This method changes secure boot mode on the node for next boot. It changes the secure boot mode setting on node only if the deploy has requested for the secure boot. During deploy, this method is used to enable secure boot on the node by passing 'mode' as 'True'. During teardown, this method is used to disable secure boot on the node by passing 'mode' as 'False'. :param task: a TaskManager instance containing the node to act on. :param mode: Boolean value requesting the next state for secure boot :raises: IloOperationNotSupported, if operation is not supported on iLO :raises: IloOperationError, if some operation on iLO failed. """ if deploy_utils.is_secure_boot_requested(task.node): set_secure_boot_mode(task, mode) LOG.info(_LI('Changed secure boot to %(mode)s for node %(node)s'), { 'mode': mode, 'node': task.node.uuid })