Openstack Core Service -- Glance

Image service overview

The OpenStack Image service includes the following components:

glance-api

Accepts Image API calls for image discovery, retrieval, and storage.

glance-registry

Stores, processes, and retrieves metadata about images. Metadata includes items such as size and type.

Database

Stores image metadata and you can choose your database depending on your preference. Most deployments use MySQL or SQLite.

Storage repository for image files

Various repository types are supported including normal file systems (or any filesystem mounted on the glance-api controller node), Object Storage, RADOS block devices, VMware datastore, and HTTP. Note that some repositories will only support read-only usage.

Metadata definition service

A common API for vendors, admins, services, and users to meaningfully define their own custom metadata. This metadata can be used on different types of resources like images, artifacts, volumes, flavors, and aggregates. A definition includes the new property’s key, description, constraints, and the resource types which it can be associated with.

Glance 架构

 

 

  查看已存在的Image: glance image-list
  

 查看image保存目录
 

CLI创建Image

    1. 将 image 上传到控制节点的文件系统中,例如 /tmp/cirros-0.3.4-x86_64-disk2.img

    2. 设置环境变量

      Devstack 的安装目录下有个 openrc 文件。source 该文件就可以配置 CLI 的环境变量。这里我们传入了两个参数,第一个参数是 OpenStack 用户名 admin;第二个参数是 Project 名 admin

    3. 执行 image 创建命令
      glance image-create --name cirros --file /tmp/cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --progress
      如需查看详细image-create的详细选项:glance help image-create

    4. 由于刚才创建的image没有指定 --visibility选项,导致该image默认为private,现在我们需要修改 --visibility 为public
      glance image-update <image-id> --visibility public
    5. 在 /opt/stack/data/glance/images/ 下查看新的 Imag

CLI删除Image

    删除image比较简单: glance image-delete <image-id>

    

TroubleShooting

  OpenStack 排查问题的方法主要是通过日志,Service 都有自己单独的日志。

  Glance 主要有两个日志,glance_api.log 和 glance_registry.log,保存在 /opt/stack/logs/ 目录里。

  devstack 的 screen 窗口已经帮我们打开了这两个日志,可以直接查看

  

  g-api 窗口显示glance-api 日志,记录 REST API 调用情况

  g-reg 窗口显示glance-registry 日志,记录 Glance 服务处理请求的过程以及数据库操作

  在非 devstack 安装中,日志在 /var/log/glance/ 目录里。

posted @ 2017-02-09 11:21  Vincen_shen  阅读(210)  评论(0)    收藏  举报