5.1 glance的部署
1
2
|
[root@linux-node1~]
# yum -y install openstack-glancepython-glance python-glanceclient
Glance一定会链接数据库,glance一定会链接keystone,存储配置,配置到哪个地方
|
5.2 glance-api的配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
[root@linux-node1~]
# grep '^[a-z]' /etc/glance/glance-api.conf
verbose =
true
#开启debug日志
connection =mysql:
//glance
:glance@192.168.56.11
/glance
#mysql数据库连接 #database模块
default_store =
file
#keystone_keystone_authtoken模块
filesystem_store_datadir=
/var/lib/glance/images
auth_uri = http:
//192
.168.56.11:5000
auth_url = http:
//192
.168.56.11:35357
memcached_servers= 192.168.56.11:11211
auth_type =password
project_domain_name= default
user_domain_name= default
project_name =service
username = glance
password = glance
driver = noop
#不适用消息队列
flavor = keystone
#paste_deploy模块
|
5.3 glance-registry配置
1
2
3
4
5
6
7
8
9
10
11
12
13
|
root@linux-node1~]
# grep '^[a-z]' /etc/glance/glance-registry.conf
connection =mysql:
//glance
:glance@192.168.56.11
/glance
auth_uri =http:
//192
.168.56.11:5000
auth_url =http:
//192
.168.56.11:35357
memcached_servers= 192.168.56.11:11211
auth_type = password
project_domain_name= default
user_domain_name= default
project_name =service
username = glance
password = glance
flavor = keystone
[root@linux-node1~]
#
|
5.4 同步glance数据库
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
su
-s
/bin/sh
-c
"glance-manage db_sync"
glance
检查数据库同步状况
[root@linux-node1~]
# mysql -h 192.168.56.11 -uglance-pglance -e "use glance;showtables;"
+----------------------------------+
|Tables_in_glance |
+----------------------------------+
|artifact_blob_locations |
|artifact_blobs |
|artifact_dependencies |
|artifact_properties |
|artifact_tags |
|artifacts |
|image_locations |
|image_members |
|image_properties |
|image_tags |
|images |
|metadef_namespace_resource_types |
|metadef_namespaces |
|metadef_objects |
|metadef_properties |
|metadef_resource_types |
|metadef_tags |
|migrate_version |
|task_info |
|tasks |
+----------------------------------+
[root@linux-node1~]
#
|
5.5 往keystone注册
5.5.1创建glance的域
1
2
3
4
5
6
7
8
9
10
11
|
[root@linux-node1~]
# openstack user create --domain default --password=glance glance
+---------------------+----------------------------------+
|Field | Value |
+---------------------+----------------------------------+
|domain_id |d1d9728ef1d64905b1ebf54982dc7991 |
|enabled | True |
|
id
|7a0adc3305d24ea4bc1d1a8abb51b410 |
|name | glance |
|password_expires_at | None |
+---------------------+----------------------------------+
[root@linux-node1~]
#
|
5.5.2 为glance添加角色
1
|
openstack role add --project service --userglance admin
|
5.6 启动glance-api 和glance-registry
1
2
3
4
5
6
7
8
9
|
[root@linux-node1~]
# systemctl enable openstack-glance-api
Created symlinkfrom
/etc/systemd/system/multi-user
.target.wants
/openstack-glance-api
.serviceto
/usr/lib/systemd/system/openstack-glance-api
.service.
[root@linux-node1~]
# systemctl enable openstack-glance-registry
Created symlinkfrom
/etc/systemd/system/multi-user
.target.wants
/openstack-glance-registry
.serviceto
/usr/lib/systemd/system/openstack-glance-registry
.service.
[root@linux-node1~]
#
[root@linux-node1~]
# systemctl start openstack-glance-api
[root@linux-node1~]
# systemctl start openstack-glance-registry
glance-registry9191端口
glance-api 9292端口
|
5.7创建对内,对外还有管理节点
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
[root@linux-node1~]
# openstack service create --name glance --description "OpenStack Imagesservice" image
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description |OpenStack Images service |
| enabled | True |
|
id
| 2c60396cbd3d4421ad9d298263e0e733 |
| name | glance |
|
type
| image |
+-------------+----------------------------------+
[root@linux-node1~]
#
[root@linux-node1~]
# openstack endpoint create --regionRegionOne image public http://192.168.56.11:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
|
id
| 710081d984f54eb78b9dfa704c8f104f |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 2c60396cbd3d4421ad9d298263e0e733 |
| service_name |glance |
| service_type |image |
| url | http:
//192
.168.56.11:9292 |
+--------------+----------------------------------+
[root@linux-node1~]
#
[root@linux-node1~]
# openstack endpoint create --regionRegionOne image internal http://192.168.56.11:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
|
id
| 9c6260f82e0b49a2a32969e7108f704b |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 2c60396cbd3d4421ad9d298263e0e733 |
| service_name |glance |
| service_type |image |
| url | http:
//192
.168.56.11:9292 |
+--------------+----------------------------------+
[root@linux-node1~]
# openstack endpoint create --regionRegionOne image admin http://192.168.56.11:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
|
id
| 470c6e79c23c4a0188ef3099b62030ab |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 2c60396cbd3d4421ad9d298263e0e733 |
| service_name |glance |
| service_type |image |
| url | http:
//192
.168.56.11:9292 |
+--------------+----------------------------------+
|
5.8 添加glance-api的调用版本号
1
2
|
在admin-openstack.shdemo-openstack.sh 里面要有
exportOS_IMAGE_API_VERSION=2
|
5.9 测试是否成功
1
2
3
4
5
6
|
[root@linux-node1~]
# glance image-list
+----+------+
| ID | Name |
+----+------+
+----+------+
[root@linux-node1~]
#
|
5.10 下载一个镜像测试
1
|
wgethttp:
//download
.cirros-cloud.net
/0
.3.4
/cirros-0
.3.4-x86_64-disk.img
|
5.11 上传镜像到glance
1
|
openstack image create
"cirros"
\ --
file
cirros-0.3.4-x86_64-disk.img \ --disk-
format
qcow2 --container-
format
bare \ --public
|
5.12 再次查看镜像
1
2
3
4
5
6
7
|
[root@linux-node1~]
# glance image-list
+--------------------------------------+--------+
| ID | Name |
+--------------------------------------+--------+
|2a71519f-59c6-4f11-994e-7d55c3e82110 | cirros |
+--------------------------------------+--------+
[root@linux-node1~]
#
|
5.13说明镜像存放的目录
1
2
3
4
5
|
[root@linux-node1images]
# pwd
/var/lib/glance/images
[root@linux-node1images]
# ls
2a71519f-59c6-4f11-994e-7d55c3e82110
#id一样的
[root@linux-node1images]
#
|
本文转自 小小三郎1 51CTO博客,原文链接:http://blog.51cto.com/wsxxsl/1883667,如需转载请自行联系原作者