def _cache_ramdisk_kernel(ctx, node, pxe_info): """Fetch the necessary kernels and ramdisks for the instance.""" fileutils.ensure_tree( os.path.join(pxe_utils.get_root_dir(), node.uuid)) LOG.debug("Fetching kernel and ramdisk for node %s", node.uuid) deploy_utils.fetch_images(ctx, TFTPImageCache(), pxe_info.values())
def _cache_tftp_images(ctx, node, pxe_info): """Fetch the necessary kernels and ramdisks for the instance.""" fileutils.ensure_tree( os.path.join(CONF.pxe.tftp_root, node.uuid)) LOG.debug("Fetching kernel and ramdisk for node %s", node.uuid) deploy_utils.fetch_images(ctx, AgentTFTPImageCache(), pxe_info.values())
def test_fetch_images(self, mock_clean_up_caches): mock_cache = mock.MagicMock(master_dir='master_dir') utils.fetch_images(None, mock_cache, [('uuid', 'path')]) mock_clean_up_caches.assert_called_once_with(None, 'master_dir', [('uuid', 'path')]) mock_cache.fetch_image.assert_called_once_with('uuid', 'path', ctx=None)
def test_fetch_images(self, mock_clean_up_caches): mock_cache = mock.MagicMock(master_dir='master_dir') utils.fetch_images(None, mock_cache, [('uuid', 'path')]) mock_clean_up_caches.assert_called_once_with(None, 'master_dir', [('uuid', 'path')]) mock_cache.fetch_image.assert_called_once_with('uuid', 'path', ctx=None, force_raw=True)
def cache_ramdisk_kernel(task, pxe_info, ipxe_enabled=False): """Fetch the necessary kernels and ramdisks for the instance.""" ctx = task.context node = task.node if ipxe_enabled: path = os.path.join(get_ipxe_root_dir(), node.uuid) else: path = os.path.join(get_root_dir(), node.uuid) fileutils.ensure_tree(path) LOG.debug("Fetching necessary kernel and ramdisk for node %s", node.uuid) deploy_utils.fetch_images(ctx, TFTPImageCache(), list(pxe_info.values()), CONF.force_raw_images)
def cache_instance_image(ctx, node): """Fetch the instance's image from Glance This method pulls the AMI and writes them to the appropriate place on local disk. :param ctx: context :param node: an ironic node object :returns: a tuple containing the uuid of the image and the path in the filesystem where image is cached. """ i_info = parse_instance_info(node) fileutils.ensure_tree(_get_image_dir_path(node.uuid)) image_path = _get_image_file_path(node.uuid) uuid = i_info["image_source"] LOG.debug("Fetching image %(ami)s for node %(uuid)s", {"ami": uuid, "uuid": node.uuid}) deploy_utils.fetch_images(ctx, InstanceImageCache(), [(uuid, image_path)], CONF.force_raw_images) return (uuid, image_path)
def cache_instance_image(ctx, node): """Fetch the instance's image from Glance This method pulls the AMI and writes them to the appropriate place on local disk. :param ctx: context :param node: an ironic node object :returns: a tuple containing the uuid of the image and the path in the filesystem where image is cached. """ i_info = parse_instance_info(node) fileutils.ensure_tree(_get_image_dir_path(node.uuid)) image_path = _get_image_file_path(node.uuid) uuid = i_info['image_source'] LOG.debug("Fetching image %(ami)s for node %(uuid)s", {'ami': uuid, 'uuid': node.uuid}) deploy_utils.fetch_images(ctx, InstanceImageCache(), [(uuid, image_path)]) return (uuid, image_path)
def _cache_ramdisk_kernel(ctx, node, pxe_info): """Fetch the necessary kernels and ramdisks for the instance.""" fileutils.ensure_tree(os.path.join(pxe_utils.get_root_dir(), node.uuid)) LOG.debug("Fetching necessary kernel and ramdisk for node %s", node.uuid) deploy_utils.fetch_images(ctx, TFTPImageCache(), list(pxe_info.values()), CONF.force_raw_images)
def _cache_tftp_images(ctx, node, pxe_info): """Fetch the necessary kernels and ramdisks for the instance.""" fileutils.ensure_tree(os.path.join(CONF.pxe.tftp_root, node.uuid)) LOG.debug("Fetching kernel and ramdisk for node %s", node.uuid) deploy_utils.fetch_images(ctx, AgentTFTPImageCache(), pxe_info.values())