重新支持 S3 驱动作为 Glance 存储后端

https://blueprints.launchpad.net/glance/+spec/re-support-s3-driver

Glance 存储直到 Mitaka 版本都支持 S3 后端,但后来由于缺乏维护者而被移除(在 Newton 版本中 [1])。然而,似乎仍有相当数量的运维人员希望使用 S3 作为 Glance 后端,因为 S3 是一种主要的存储方案,并且有很多与 S3 兼容的存储。因此,我建议恢复 S3 驱动,并将其作为 Glance 存储驱动程序之一重新支持 [2]

问题描述

似乎仍有相当数量的运维人员希望使用 S3 或与 S3 兼容的存储作为 Glance 后端,但 Glance 已经不再支持 S3 存储,因此他们无法使用 S3 后端。

提议的变更

恢复直到 Mitaka 版本使用的 S3 存储驱动程序,并支持多存储配置 [3]

以下配置将被添加到 glance-api.conf 文件的 glance_store 部分:

* s3_store_host
  The host where the S3 server is listening.
  This item accepts a string value.
  (e.g. s3-region.amazonaws.com, http://s3-region.amazonaws.com, https://s3-region.amazonaws.com or
  my-object-storage.com, http://my-object-storage.com, https://my-object-storage.com)

* s3_store_access_key
  The S3 query token access key.
  This item accepts a string value.

* s3_store_secret_key
  The S3 query token secret key.
  This item accepts a string value.

* s3_store_bucket
  The S3 bucket to be used to store the Glance data.
  This item accepts a string value, and if s3_store_create_bucket_on_put is
  set to true, it will be created automatically even if the bucket does not
  exist.
  It is desirable to have a DNS-compliant naming convention.

* s3_store_create_bucket_on_put
  A boolean to determine if the S3 bucket should be created on upload if it
  does not exist or if an error should be returned to the user.
  This item accepts True or False.

* s3_store_bucket_url_format
  The S3 calling format used to determine the bucket. Either 'auto' or 'path'
  or 'virtual' can be used.
  In 'path'-style, the endpoint for the object looks like 'https://s3.amazonaws.com/bucket/example.img' or 'https://my-object-storage.com/bucket/example.img'.
  And in 'virtual'-style, the endpoint for the object looks like 'https://bucket.s3.amazonaws.com/example.img' or 'https://bucket.my-object-storage.com/example.img'.
  If you do not follow the DNS naming convention (e.g. that includes '.' in
  the bucket name), you can get objects in the path style, but not in the
  virtual style.

* s3_store_large_object_size
  What size, in MB, should S3 start chunking image files and do a multipart
  upload in S3.
  This item accepts a positive integer value.

* s3_store_large_object_chunk_size
  What multipart upload part size, in MB, should S3 use when uploading parts.
  The size must be greater than or equal to 5M.
  Note that the maximum possible number of image divisions is 10,000.

* s3_store_thread_pools
  The number of thread pools to perform a multipart upload in S3.
  This item accepts a positive integer value.

因此,运维人员可以配置多个存储,包括 S3,如下所示:

[DEFAULT]
# list of enabled stores identified by their property group name
enabled_backends = fast:s3, cheap:s3, reliable:file

# the default store, if not set glance-api service will not start
default_backend = fast

# conf props for file system store instance
[reliable]
filesystem_store_datadir = /var/lib/images/data/
description = Reliable filesystem store
# etc..

# conf props for s3 store instance
[fast]
s3_store_host = https://s3.amazonaws.com
s3_store_access_key = access-key-for-fast
s3_store_secret_key = secret-key-for-fast
s3_store_bucket = bucket-for-fast
# etc..

# conf props for s3 store instance
[cheap]
s3_store_host = https://my-object-storage.com
s3_store_access_key = access-key-for-cheap
s3_store_secret_key = secret-key-for-cheap
s3_store_bucket = bucket-for-cheap
# etc..

备选方案

数据模型影响

REST API 影响

安全影响

通知影响

其他最终用户影响

性能影响

其他部署者影响

此更改必须在存储选项中显式配置。

开发人员影响

实现

负责人

主要负责人

nao-shark

工作项

  • 在 glance-api.conf 中添加配置(s3_store_host, s3_store_access_key, s3_store_secret_key, s3_store_bucket 等)。

  • 恢复直到 Mitaka 版本使用的 S3 驱动程序和单元测试,并支持多存储配置。

  • 关于如何使用和配置 S3 后端的文档。

依赖项

测试

  • 测试将镜像上传到 S3 后端。

  • 然后测试再次下载该镜像。

  • 测试删除该镜像。

  • 测试配置多个 S3 驱动程序。

文档影响

文档应扩展,以描述如何启用和使用 S3 存储。

参考资料