验证glance服务

验证操作

本节我们使用一个叫CirOS的小镜像来验证glance是否安装成功

1、在每个客户端脚本中,配置镜像服务客户端使用2.0的API:

echo "export OS_IMAGE_API_VERSION=2" | tee -a admin-openrc.sh 

2、导入 admin 身份凭证以执行管理员用户专有的命令:

source admin-openrc.sh

3、创建一个临时本地目录:

mkdir /tmp/images

4、将源镜像下载到里面:

wget -P /tmp/images http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img

5、使用QCOW2磁盘格式,空白容器格式,和公开可见,上传镜像到镜像服务,以便所有的项目都能访问它:

glance image-create --name "cirros-0.3.4-x86_64" --file /tmp/images/cirros-0.3.4-x86_64-disk.img \
  --disk-format qcow2 --container-format bare --visibility public --progress
[=============================>] 100%
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 133eae9fb1c98f45894a4e60d8736619     |
| container_format | bare                                 |
| created_at       | 2015-03-26T16:52:10Z                 |
| disk_format      | qcow2                                |
| id               | 38047887-61a7-41ea-9b49-27987d5e8bb9 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | cirros-0.3.4-x86_64                  |
| owner            | ae7a98326b9c455588edd2656d723b9d     |
| protected        | False                                |
| size             | 13200896                             |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2015-03-26T16:52:10Z                 |
| virtual_size     | None                                 |
| visibility       | public                               |
+------------------+--------------------------------------+

6、确认镜像的上传并验证属性:

glance image-list
+--------------------------------------+---------------------+
| ID                                   | Name                |
+--------------------------------------+---------------------+
| 38047887-61a7-41ea-9b49-27987d5e8bb9 | cirros-0.3.4-x86_64 |
+--------------------------------------+---------------------+

7、移除临时本地目录和源镜像:

 rm -r /tmp/images

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
永久连接: http://www.nfvschool.cn/?p=220
标签:

发表评论