openstack 管理二十九 - rpm 方式部署 openstack [glance]-阿里云开发者社区

开发者社区> 数据库> 正文

openstack 管理二十九 - rpm 方式部署 openstack [glance]

简介: 作用 1 glance 主要用于管理云主机镜像 2 glance 需要进行 keystone 验证 3 在第一次云主机创建时候, 把镜像从 glance server 传输至 compute 组件中 安装 yum install -y openstack-glance.noarch openstack-glance-doc.noarch python-glance

作用

1 glance 主要用于管理云主机镜像
2 glance 需要进行 keystone 验证
3 在第一次云主机创建时候, 把镜像从 glance server 传输至 compute 组件中

安装

yum install -y openstack-glance.noarch openstack-glance-doc.noarch python-glance.noarch python-glanceclient.noarch python-glanceclient-doc.noarch openstack-utils

glance 连接 db

数据库连接配置

# openstack-config --set /etc/glance/glance-api.conf DEFAULT sql_connection mysql://glance:glance@240.10.130.25/glance
# openstack-config --set /etc/glance/glance-api.conf DEFAULT sql_idle_timeout 3600
# openstack-config --set /etc/glance/glance-registry.conf DEFAULT sql_connection mysql://glance:glance@240.10.130.25/glance
# openstack-config --set /etc/glance/glance-registry.conf DEFAULT sql_idle_timeout 3600

glance 连接 keystone

配置 /etc/glance/glance-api.conf

# openstack-config --set /etc/glance/glance-api.conf paste_deploy flavor keystone
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_host 240.10.130.25
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_port 35357
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_protocol http
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_tenant_name services
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_user glance
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_password glance

配置 /etc/glance/glance-registry.conf

# openstack-config --set /etc/glance/glance-registry.conf paste_deploy flavor keystone
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_host 240.10.130.25
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_port 35357
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_protocol http
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_tenant_name services
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_user glance
# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_password glance
# openstack-config --set /etc/glance/glance-registry.conf paste_deploy config_file /etc/glance/glance-api-paste.ini
# openstack-config --set /etc/glance/glance-registry.conf paste_deploy flavor keystone

配置 /etc/glance/glance-api-paste.ini

# openstack-config --set /etc/glance/glance-api-paste.ini filter:authtoken paste.filter_factory  keystoneclient.middleware.auth_token:filter_factory
# openstack-config --set /etc/glance/glance-api-paste.ini filter:authtoken admin_tenant_name service
# openstack-config --set /etc/glance/glance-api-paste.ini filter:authtoken admin_user glance
# openstack-config --set /etc/glance/glance-api-paste.ini filter:authtoken admin_password glance

配置 /etc/glance/glance-registry-paste.ini

# openstack-config --set /etc/glance/glance-registry-paste.ini filter:authtoken paste.filter_factory  keystoneclient.middleware.auth_token:filter_factory
# openstack-config --set /etc/glance/glance-registry-paste.ini filter:authtoken admin_tenant_name service
# openstack-config --set /etc/glance/glance-registry-paste.ini filter:authtoken admin_user glance
# openstack-config --set /etc/glance/glance-registry-paste.ini filter:authtoken admin_password glance

启动 glance

# service openstack-glance-registry restart
# service openstack-glance-api restart

初始化 glance 数据

# glance-manage version_control 0
# glance-manage db_sync

成功后, 自动在 mysql 数据库下创建 glance.* 表

mysql> use glance;
Database changed

mysql> show tables;
+------------------+
| Tables_in_glance |
+------------------+
| image_locations  |
| image_members    |
| image_properties |
| image_tags       |
| images           |
| migrate_version  |
| task_info        |
| tasks            |
+------------------+
8 rows in set (0.00 sec)

glance 客户端安装

# yum install -y python-glanceclient.noarch python-glanceclient-doc.noarch

管理 glance

[root@hh-yun-compute-130025 ~(keystone_cookbook)]# cat keystonerc_cookbook

export OS_USERNAME=admin
export OS_TENANT_NAME=cookbook
export OS_PASSWORD=test123
export OS_NO_CACHE=1
export OS_AUTH_URL=http://240.10.130.25:35357/v2.0/
export PS1='[\u@\h \W(keystone_cookbook)]\$ '

镜像管理

获得 centos5.8_x86_64_2.9.4.qcow2, 并上传

[root@hh-yun-compute-130025 ~(keystone_cookbook)]# glance image-list
+----+------+-------------+------------------+------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+----+------+-------------+------------------+------+--------+
+----+------+-------------+------------------+------+--------+

# glance image-create --name='centos5.8' --disk-format=qcow2 --container-format=bare --is-public=True --file=./centos5.8_x86_64_2.9.4.qcow2

+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 1b957548077dc554915e82424d4c089a     |
| container_format | bare                                 |
| created_at       | 2014-10-01T10:00:17                  |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | qcow2                                |
| id               | 438d5c5a-f595-45e5-8236-801b9da8f9ab |
| is_public        | True                                 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | centos5.8                            |
| owner            | c74de0a2760343ac93f27095023be1cd     |
| protected        | False                                |
| size             | 460841984                            |
| status           | active                               |
| updated_at       | 2014-10-01T10:00:19                  |
| virtual_size     | None                                 |
+------------------+--------------------------------------+

[root@hh-yun-compute-130025 ~(keystone_cookbook)]# glance image-list
+--------------------------------------+-----------+-------------+------------------+-----------+--------+
| ID                                   | Name      | Disk Format | Container Format | Size      | Status |
+--------------------------------------+-----------+-------------+------------------+-----------+--------+
| 438d5c5a-f595-45e5-8236-801b9da8f9ab | centos5.8 | qcow2       | bare             | 460841984 | active |
+--------------------------------------+-----------+-------------+------------------+-----------+--------+

利用下面命令能够把某些不公开的镜像分享至指定的 tenant 中

# glance [--can-share] member-create image-id tenant-id

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
数据库
使用钉钉扫一扫加入圈子
+ 订阅

分享数据库前沿,解构实战干货,推动数据库技术变革

其他文章