配置安装p_w_picpath镜像服务

在controller节点

一、创建数据库

[root@controller ~]# mysql -u root -p
>>CREATE DATABASE glance;
>>GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'GLANCE_DBPASS';
>>GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%'  IDENTIFIED BY 'GLANCE_DBPASS';

GLANCE_DBPASS改成自己 的密码。


二、创建服务实体和api接口

[root@controller ~]# source /root/admin-openrc.sh
[root@controller ~]# openstack user create --domain default --password-prompt glance
[root@controller ~]# openstack role add --project service --user glance admin
[root@controller ~]# openstack service create --name glance   --description "OpenStack Image" p_w_picpath
[root@controller ~]#  openstack endpoint create --region RegionOne   p_w_picpath public http://controller:9292
[root@controller ~]#  openstack endpoint create --region RegionOne   p_w_picpath internal http://controller:9292 
[root@controller ~]#  openstack endpoint create --region RegionOne   p_w_picpath admin http://controller:9292

三、安装p_w_picpath镜像服务

[root@controller ~]# yum install openstack-glance

编辑镜像服务配置文件

[root@controller ~]# mv /etc/glance/glance-api.conf /etc/glance/glance-api.conf_bak 
[root@controller ~]# vim /etc/glance/glance-api.conf
[database]
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance  #改为自己的数据库密码
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = GLANCE_PASS  #改为自己的服务密码

[paste_deploy]
flavor = keystone
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/p_w_picpaths/


[root@controller ~]# /etc/glance/glance-registry.conf /etc/glance/glance-registry.conf_bak
[root@controller ~]# vim /etc/glance/glance-registry.conf
[database]
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance  #改为自己的数据库密码
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = GLANCE_PASS  #改为自己的服务密码

[paste_deploy]
flavor = keystone

同步数据库

[root@controller ~]# su -s /bin/sh -c "glance-manage db_sync" glance

启动p_w_picpath相关服务,并加入开机启动

[root@controller ~]# systemctl enable openstack-glance-api.service   openstack-glance-registry.service
[root@controller ~]# systemctl start openstack-glance-api.service   openstack-glance-registry.service


四、验证

[root@controller ~]# source /root/admin-openrc.sh
[root@controller ~]# wget 
[root@controller ~]# openstack p_w_picpath create "cirros-linux"   --file cirros-0.3.4-x86_64-disk.img   --disk-format qcow2 --container-format bare   --public
+------------------+------------------------------------------------------+
| Field            | Value                                                |
+------------------+------------------------------------------------------+
| checksum         | ee1eca47dc88f4879d8a229cc70a07c6                     |
| container_format | bare                                                 |
| created_at       | 2016-06-16T11:15:04Z                                 |
| disk_format      | qcow2                                                |
| file             | /v2/p_w_picpaths/75a82c7f-39cb-4eb4-ba72-5d92c3a52c02/file |
| id               | 75a82c7f-39cb-4eb4-ba72-5d92c3a52c02                 |
| min_disk         | 0                                                    |
| min_ram          | 0                                                    |
| name             | cirros-linux                                         |
| owner            | 00a82ac5055d4ddd934d14eaed7c76ac                     |
| protected        | False                                                |
| schema           | /v2/schemas/p_w_picpath                                    |
| size             | 13287936                                             |
| status           | active                                               |
| tags             |                                                      |
| updated_at       | 2016-06-16T11:15:06Z                                 |
| virtual_size     | None                                                 |
| visibility       | public                                               |
+------------------+------------------------------------------------------+

出现上面信息表示成功

[root@controller ~]# openstack p_w_picpath list
+--------------------------------------+--------------+--------+
| ID                                   | Name         | Status |
+--------------------------------------+--------------+--------+
| 75a82c7f-39cb-4eb4-ba72-5d92c3a52c02 | cirros-linux | active | #改成添加的镜像
| 81b71bcd-133a-48a4-868e-4d1970bee9f3 | test_for_1   | active |
| 8a3754a8-86c6-499a-b4f3-bc0f76ab2e8c | cirros       | active |
+--------------------------------------+--------------+--------+



compute(nova)服务请参考: