簡體   English   中英

圖像卷緩存不適用於 RAW 圖像

[英]Image Volume Cache not working for RAW images

圖像卷緩存僅適用於 QCOW2 圖像,不適用於 RAW 圖像。 Cinder 的這一功能有望顯着提高卷創建性能。 https://docs.openstack.org/cinder/latest/admin/blockstorage-image-volume-cache.html

從鏡像創建卷,首先嘗試調用clone_image接口,然后嘗試調用clone_image_volume接口,然后嘗試使用鏡像緩存。 如果所有其他方法都失敗,則返回到創建卷的默認行為下載圖像數據並將其復制到卷中。

如果卷后端是 ceph 和 ceph 中的 RAW 圖像,則從 RAW 圖像創建卷,將直接在 ceph 中克隆圖像,而不使用圖像緩存。

 @utils.retry(exception.SnapshotLimitReached, retries=1)
def _create_from_image(self, context, volume,
                       image_location, image_id, image_meta,
                       image_service, **kwargs):
    LOG.debug("Cloning %(volume_id)s from image %(image_id)s "
              " at location %(image_location)s.",
              {'volume_id': volume.id,
               'image_location': image_location, 'image_id': image_id})

    virtual_size = image_meta.get('virtual_size')
    if virtual_size:
        virtual_size = image_utils.check_virtual_size(virtual_size,
                                                      volume.size,
                                                      image_id)

    # Create the volume from an image.
    #
    # First see if the driver can clone the image directly.
    #
    # NOTE (singn): two params need to be returned
    # dict containing provider_location for cloned volume
    # and clone status.
    # NOTE (lixiaoy1): Currently all images are raw data, we can't
    # use clone_image to copy data if new volume is encrypted.
    volume_is_encrypted = volume.encryption_key_id is not None
    cloned = False
    model_update = None
    if not volume_is_encrypted:
        model_update, cloned = self.driver.clone_image(context,
                                                       volume,
                                                       image_location,
                                                       image_meta,
                                                       image_service)

    # Try and clone the image if we have it set as a glance location.
    if not cloned and 'cinder' in CONF.allowed_direct_url_schemes:
        model_update, cloned = self._clone_image_volume(context,
                                                        volume,
                                                        image_location,
                                                        image_meta)

    # If we're going to try using the image cache then prepare the cache
    # entry. Note: encrypted volume images are not cached.
    if not cloned and self.image_volume_cache and not volume_is_encrypted:
        # If _prepare_image_cache_entry() has to create the cache entry
        # then it will also create the volume. But if the volume image
        # is already in the cache then it returns (None, False), and
        # _create_from_image_cache_or_download() will use the cache.
        model_update, cloned = self._prepare_image_cache_entry(
            context,
            volume,
            image_location,
            image_id,
            image_meta,
            image_service)

    # Try and use the image cache, and download if not cached.
    if not cloned:
        model_update = self._create_from_image_cache_or_download(
            context,
            volume,
            image_location,
            image_id,
            image_meta,
            image_service)

    self._handle_bootable_volume_glance_meta(context, volume,
                                             image_id=image_id,
                                             image_meta=image_meta)
    return model_update

https://github.com/openstack/cinder/blob/master/cinder/volume/flows/manager/create_volume.py

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM