def test__get_deploy_image_info(self): expected_info = { 'deploy_ramdisk': (DRV_INFO_DICT['deploy_ramdisk'], os.path.join(CONF.pxe.tftp_root, self.node.uuid, 'deploy_ramdisk')), 'deploy_kernel': (DRV_INFO_DICT['deploy_kernel'], os.path.join(CONF.pxe.tftp_root, self.node.uuid, 'deploy_kernel')) } image_info = pxe._get_deploy_image_info(self.node) self.assertEqual(expected_info, image_info)
def test__get_deploy_image_info(self): expected_info = { "deploy_ramdisk": ( DRV_INFO_DICT["deploy_ramdisk"], os.path.join(CONF.pxe.tftp_root, self.node.uuid, "deploy_ramdisk"), ), "deploy_kernel": ( DRV_INFO_DICT["deploy_kernel"], os.path.join(CONF.pxe.tftp_root, self.node.uuid, "deploy_kernel"), ), } image_info = pxe._get_deploy_image_info(self.node) self.assertEqual(expected_info, image_info)
def test__get_deploy_image_info(self): expected_info = {'deploy_ramdisk': (DRV_INFO_DICT['deploy_ramdisk'], os.path.join(CONF.pxe.tftp_root, self.node.uuid, 'deploy_ramdisk')), 'deploy_kernel': (DRV_INFO_DICT['deploy_kernel'], os.path.join(CONF.pxe.tftp_root, self.node.uuid, 'deploy_kernel'))} image_info = pxe._get_deploy_image_info(self.node) self.assertEqual(expected_info, image_info)
def prepare_ramdisk(self, task, ramdisk_params): node = task.node # TODO(deva): optimize this if rerun on existing files if CONF.pxe.ipxe_enabled: # Copy the iPXE boot script to HTTP root directory bootfile_path = os.path.join( CONF.deploy.http_root, os.path.basename(CONF.pxe.ipxe_boot_script)) shutil.copyfile(CONF.pxe.ipxe_boot_script, bootfile_path) prov_ip = self._plug_provisioning(task) task.ports = objects.Port.list_by_node_id(task.context, node.id) pxe_info = pxe._get_deploy_image_info(node) # NODE: Try to validate and fetch instance images only # if we are in DEPLOYING state. if node.provision_state == states.DEPLOYING: pxe_info.update(pxe._get_instance_image_info(node, task.context)) pxe_options = pxe._build_pxe_config_options(task, pxe_info) pxe_options.update(ramdisk_params) pxe_options['advertise_host'] = prov_ip if deploy_utils.get_boot_mode_for_deploy(node) == 'uefi': pxe_config_template = CONF.pxe.uefi_pxe_config_template else: pxe_config_template = CONF.pxe.pxe_config_template pxe_utils.create_pxe_config(task, pxe_options, pxe_config_template) deploy_utils.try_set_boot_device(task, boot_devices.PXE) # FIXME(lucasagomes): If it's local boot we should not cache # the image kernel and ramdisk (Or even require it). pxe._cache_ramdisk_kernel(task.context, node, pxe_info)