设为首页 收藏本站
查看: 1136|回复: 0

[经验分享] OpenStack组件系列☞glance简介

[复制链接]

尚未签到

发表于 2017-6-26 22:53:52 | 显示全部楼层 |阅读模式
  Glance项目提供虚拟机镜像的发现,注册,取得服务。
  Glance提供restful API可以查询虚拟机镜像的metadata,并且可以获得镜像。
  通过Glance,虚拟机镜像可以被存储到多种存储上,比如简单的文件存储或者对象存储(比如OpenStack中swiftx项目)。
  Glance,像所有的OpenStack项目一样,遵循以下思想:
  1.基于组件的架构      便于快速增加新特性
  2.高可用性                  支持大负荷
  3.容错性                      独立的进程避免串行错误
  4.开放标准                  对社区驱动的API提供参考实现
  Glance的几个重要概念:
  1.Image identifiers                         Image使用URI作为唯一标识,URL符合以下格式:

<Glance Server Location>/images/<ID>
  Glance Server Location是镜像的所在位置, ID是镜像在Glance的唯一标识。
  2.Image Statuses                         共四种状态。
  queued                                标识该镜像ID已经被保留,但是镜像还未上传。
  saving                                  标识镜像正在被上传。
  active                                    标识镜像在Glance中完全可用。
  killed                                     标识镜像上传过程中出错,镜像完全不可用。
  3.Disk and Container format
  Disk  Format:raw vhd vmdk vdi iso qcow2 aki ari ami
  Container Format: ovf bare aki ari ami
  当disk format为aki ari ami时,disk format 和container format一致。
  4.Image Registries
  使用Glance,镜像metadata可以注册至image registries。
  只要为image metadata提供了rest like API,任何web程序可以作为image registries与Glance对接。
  当然,Glance也提供了参考实现。
  更多信息可以参考on
Controlling Servers,来自于Glance提供的Glance registry server。
  Glance提供了如下Rest-like API:

GET     /images         Return brief information about public images
GET     /images/detail  Return detailed information about public images
GET     /images/<ID>    Return metadata about an image in HTTP headers
POST    /images         Register metadata about a new image
PUT     /images/<ID>    Update metadata about an existing image
DELETE  /images/<ID>    Remove an image's metadata from the registry

通过 GET /images and GET /images/detail对镜像过滤查询




支持以下参数:






  • name=NAME
      Filters images having a name attribute
    matching NAME.


  • container_format=FORMAT
      Filters images having a container_format attribute
    matching FORMAT
      For more information, see About Disk and Container Formats


  • disk_format=FORMAT
      Filters images having a disk_format attribute
    matching FORMAT
      For more information, see About Disk and Container Formats


  • status=STATUS
      Filters images having a status attribute
    matching STATUS
      For more information, see About Image Statuses


  • size_min=BYTES
      Filters images having a size attribute
    greater than or equal to BYTES


  • size_max=BYTES
      Filters images having a size attribute
    less than or equal to BYTES
  These two resources also accept sort parameters:



  • sort_key=KEY
      Results will be ordered by the specified image attribute KEY.
    Accepted values include id, name, status, disk_format,container_format, size, created_at (default)
    and updated_at.


  • sort_dir=DIR
      Results will be sorted in the direction DIR.
    Accepted values are asc for
    ascending or desc (default)
    for descending.



POST /images


request的body部分使用json编码,比如以下格式:


{'image':
{'id': <ID>|None,
'name': <NAME>,
'status': <STATUS>,
'disk_format': <DISK_FORMAT>,
'container_format': <CONTAINER_FORMAT>,
'properties': [ ... ]
}
}
  如果输入不满足以下条件,将返回400错误:




  • status must
    be non-empty, and must be one of active, saving, queued, or killed
  • disk_format must
    be non-empty, and must be one of ari, aki, ami, raw, iso, vhd, vdi, qcow2, or vmdk
  • container_format must
    be non-empty, and must be on of ari, aki, ami, bare, or ovf
  • If disk_format or container_format is ari, aki, ami,
    then both disk_format and container_format must
    be the same.


  Glance的架构:
  Glance被设计为可以使用多种后端存储。
  前端通过API Server向多个Client提供服务。
DSC0000.gif

  Glance目前提供的参考实现中Registry Server仅是使用Sql数据库存储metadata
  Glance目前支持S3,Swift,简单的文件存储及只读的HTTPS存储。
  后续也可能支持其他后端,如分布式存储系统(SheepDog或Ceph)。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-388433-1-1.html 上篇帖子: OpenStack 镜像制作之cloud-init 下篇帖子: Openstack的vnc界面定制
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表