def deploy(self, task): """Start deployment of the task's node. Fetches the instance image, prepares the options for the deployment ramdisk, sets the node to boot from virtual media cdrom, and reboots the given node. :param task: a TaskManager instance containing the node to act on. :returns: deploy state DEPLOYWAIT. :raises: InstanceDeployFailure, if image size if greater than root partition. :raises: ImageCreationFailed, if it failed while creating the floppy image. :raises: IloOperationError, if some operation on iLO fails. """ node = task.node manager_utils.node_power_action(task, states.POWER_OFF) iscsi_deploy.cache_instance_image(task.context, node) iscsi_deploy.check_image_size(task) deploy_ramdisk_opts = iscsi_deploy.build_deploy_ramdisk_options(node) deploy_nic_mac = deploy_utils.get_single_nic_with_vif_port_id(task) deploy_ramdisk_opts['BOOTIF'] = deploy_nic_mac deploy_iso_uuid = node.driver_info['ilo_deploy_iso'] deploy_iso = 'glance:' + deploy_iso_uuid _reboot_into(task, deploy_iso, deploy_ramdisk_opts) return states.DEPLOYWAIT
def deploy(self, task): """Start deployment of the task's node. Fetches the instance image, prepares the options for the deployment ramdisk, sets the node to boot from virtual media cdrom, and reboots the given node. :param task: a TaskManager instance containing the node to act on. :returns: deploy state DEPLOYWAIT. :raises: InstanceDeployFailure, if image size if greater than root partition. :raises: ImageCreationFailed, if it failed while creating the floppy image. :raises: IloOperationError, if some operation on iLO fails. """ node = task.node iscsi_deploy.cache_instance_image(task.context, node) iscsi_deploy.check_image_size(task) deploy_ramdisk_opts = iscsi_deploy.build_deploy_ramdisk_options(node) agent_opts = agent.build_agent_options(node) deploy_ramdisk_opts.update(agent_opts) deploy_nic_mac = deploy_utils.get_single_nic_with_vif_port_id(task) deploy_ramdisk_opts['BOOTIF'] = deploy_nic_mac deploy_iso = node.driver_info['ilo_deploy_iso'] _reboot_into(task, deploy_iso, deploy_ramdisk_opts) return states.DEPLOYWAIT
def deploy(self, task): """Start deployment of the task's node'. Fetches instance image, creates a temporary keystone token file, updates the DHCP port options for next boot, and issues a reboot request to the power driver. This causes the node to boot into the deployment ramdisk and triggers the next phase of PXE-based deployment via VendorPassthru._continue_deploy(). :param task: a TaskManager instance containing the node to act on. :returns: deploy state DEPLOYING. """ iscsi_deploy.cache_instance_image(task.context, task.node) iscsi_deploy.check_image_size(task) # TODO(yuriyz): more secure way needed for pass auth token # to deploy ramdisk _create_token_file(task) dhcp_opts = pxe_utils.dhcp_options_for_instance() provider = dhcp_factory.DHCPFactory(token=task.context.auth_token) provider.update_dhcp(task, dhcp_opts) manager_utils.node_set_boot_device(task, 'pxe', persistent=True) manager_utils.node_power_action(task, states.REBOOT) return states.DEPLOYWAIT
def deploy(self, task): """Start deployment of the task's node'. Fetches instance image, creates a temporary keystone token file, updates the DHCP port options for next boot, and issues a reboot request to the power driver. This causes the node to boot into the deployment ramdisk and triggers the next phase of PXE-based deployment via VendorPassthru.pass_deploy_info(). :param task: a TaskManager instance containing the node to act on. :returns: deploy state DEPLOYWAIT. """ iscsi_deploy.cache_instance_image(task.context, task.node) iscsi_deploy.check_image_size(task) # TODO(yuriyz): more secure way needed for pass auth token # to deploy ramdisk _create_token_file(task) dhcp_opts = pxe_utils.dhcp_options_for_instance(task) provider = dhcp_factory.DHCPFactory() provider.update_dhcp(task, dhcp_opts) deploy_utils.try_set_boot_device(task, boot_devices.PXE) manager_utils.node_power_action(task, states.REBOOT) return states.DEPLOYWAIT
def test_check_image_size(self, get_image_mb_mock): get_image_mb_mock.return_value = 1000 with task_manager.acquire(self.context, self.node.uuid, shared=False) as task: task.node.instance_info['root_gb'] = 1 iscsi_deploy.check_image_size(task) get_image_mb_mock.assert_called_once_with( iscsi_deploy._get_image_file_path(task.node.uuid))
def deploy(self, task): """Start deployment of the task's node. Fetches the instance image, prepares the options for the deployment ramdisk, sets the node to boot from virtual media cdrom, and reboots the given node. :param task: a TaskManager instance containing the node to act on. :returns: deploy state DEPLOYWAIT. :raises: InstanceDeployFailure, if image size if greater than root partition. :raises: ImageCreationFailed, if it failed while creating the floppy image. :raises: IloOperationError, if some operation on iLO fails. """ node = task.node # Clear ilo_boot_iso if it's a glance image to force recreate # another one again (or use existing one in glance). # This is mainly for rebuild scenario. if service_utils.is_glance_image( node.instance_info.get('image_source')): instance_info = node.instance_info instance_info.pop('ilo_boot_iso', None) node.instance_info = instance_info node.save() # Eject all virtual media devices, as we are going to use them # during deploy. ilo_common.eject_vmedia_devices(task) iscsi_deploy.cache_instance_image(task.context, node) iscsi_deploy.check_image_size(task) deploy_ramdisk_opts = iscsi_deploy.build_deploy_ramdisk_options(node) agent_opts = agent.build_agent_options(node) deploy_ramdisk_opts.update(agent_opts) deploy_nic_mac = deploy_utils.get_single_nic_with_vif_port_id(task) deploy_ramdisk_opts['BOOTIF'] = deploy_nic_mac deploy_iso = node.driver_info['ilo_deploy_iso'] _reboot_into(task, deploy_iso, deploy_ramdisk_opts) return states.DEPLOYWAIT
def deploy(self, task): """Start deployment of the task's node'. Fetches instance image, creates a temporary keystone token file, updates the DHCP port options for next boot, and issues a reboot request to the power driver. This causes the node to boot into the deployment ramdisk and triggers the next phase of PXE-based deployment via VendorPassthru._continue_deploy(). :param task: a TaskManager instance containing the node to act on. :returns: deploy state DEPLOYWAIT. """ iscsi_deploy.cache_instance_image(task.context, task.node) iscsi_deploy.check_image_size(task) # TODO(yuriyz): more secure way needed for pass auth token # to deploy ramdisk _create_token_file(task) dhcp_opts = pxe_utils.dhcp_options_for_instance(task) provider = dhcp_factory.DHCPFactory() provider.update_dhcp(task, dhcp_opts) # NOTE(faizan): Under UEFI boot mode, setting of boot device may differ # between different machines. IPMI does not work for setting boot # devices in UEFI mode for certain machines. # Expected IPMI failure for uefi boot mode. Logging a message to # set the boot device manually and continue with deploy. try: manager_utils.node_set_boot_device(task, 'pxe', persistent=True) except exception.IPMIFailure: if driver_utils.get_node_capability(task.node, 'boot_mode') == 'uefi': LOG.warning( _LW("ipmitool is unable to set boot device while " "the node is in UEFI boot mode." "Please set the boot device manually.")) else: raise manager_utils.node_power_action(task, states.REBOOT) return states.DEPLOYWAIT
def deploy(self, task): """Start deployment of the task's node'. Fetches instance image, creates a temporary keystone token file, updates the DHCP port options for next boot, and issues a reboot request to the power driver. This causes the node to boot into the deployment ramdisk and triggers the next phase of PXE-based deployment via VendorPassthru._continue_deploy(). :param task: a TaskManager instance containing the node to act on. :returns: deploy state DEPLOYING. """ iscsi_deploy.cache_instance_image(task.context, task.node) iscsi_deploy.check_image_size(task) # TODO(yuriyz): more secure way needed for pass auth token # to deploy ramdisk _create_token_file(task) dhcp_opts = pxe_utils.dhcp_options_for_instance(task) provider = dhcp_factory.DHCPFactory() provider.update_dhcp(task, dhcp_opts) # NOTE(faizan): Under UEFI boot mode, setting of boot device may differ # between different machines. IPMI does not work for setting boot # devices in UEFI mode for certain machines. # Expected IPMI failure for uefi boot mode. Logging a message to # set the boot device manually and continue with deploy. try: manager_utils.node_set_boot_device(task, 'pxe', persistent=True) except exception.IPMIFailure: if driver_utils.get_node_capability(task.node, 'boot_mode') == 'uefi': LOG.warning(_LW("ipmitool is unable to set boot device while " "the node is in UEFI boot mode." "Please set the boot device manually.")) else: raise manager_utils.node_power_action(task, states.REBOOT) return states.DEPLOYWAIT
def deploy(self, task): """Start deployment of the task's node'. Fetches instance image, updates the DHCP port options for next boot, and issues a reboot request to the power driver. This causes the node to boot into the deployment ramdisk and triggers the next phase of PXE-based deployment via VendorPassthru.pass_deploy_info(). :param task: a TaskManager instance containing the node to act on. :returns: deploy state DEPLOYWAIT. """ iscsi_deploy.cache_instance_image(task.context, task.node) iscsi_deploy.check_image_size(task) dhcp_opts = pxe_utils.dhcp_options_for_instance(task) provider = dhcp_factory.DHCPFactory() provider.update_dhcp(task, dhcp_opts) deploy_utils.try_set_boot_device(task, boot_devices.PXE) manager_utils.node_power_action(task, states.REBOOT) return states.DEPLOYWAIT