首页 > 代码库 > 《3》CentOS7.0+OpenStack+kvm云平台部署—配置Glance

《3》CentOS7.0+OpenStack+kvm云平台部署—配置Glance

感谢朋友支持本博客,欢迎共同探讨交流。因为能力和时间有限,错误之处在所难免,欢迎指正。
假设转载。请保留作者信息。


博客地址:http://blog.csdn.net/qq_21398167

原博文地址:http://blog.csdn.net/qq_21398167/article/details/46385621

初始化Glance

(1).安装Glance服务:

[root@openstack ~]# yum -y installopenstack-glance

 

(2).创建Glance数据库:

[root@openstack ~]# openstack-db--init --service glance

 

(3).改动配置文件里的数据库链接:

[root@openstack ~]# openstack-config--set /etc/glance/glance-api.conf DEFAULT sql_connectionmysql://glance:glance@localhost/glance

[root@openstack ~]# openstack-config--set /etc/glance/glance-registry.conf DEFAULT sql_connectionmysql://glance:glance@localhost/glance

 

创建User,定义Services API Endpoints

(1).Glance服务创建一个glance用户:

[root@openstack ~]# keystoneuser-create--name=glance --pass=service--email=glance@zcs.com

[root@openstack ~]# keystoneuser-role-add --user=glance --tenant=service --role=admin

(2).glance创建一个服务:

[root@openstack ~]# keystoneservice-create --name=glance --type=image --description="GlanceImageService"

(3).使用服务ID创建一个endpoint

[root@openstack ~]# vi/root/config/glance.sh

#!/bin/bash

my_ip=10.1.1.2

service=$(keystone service-list | awk‘/glance/ {print $2}‘)

keystone endpoint-create --service-id=$service--publicurl=http://$my_ip:9292 --internalurl=http://$my_ip:9292--adminurl=http://$my_ip:9292

 

[root@mg ~]# sh /root/config/glance.sh

WARNING: Bypassing authentication using atoken & endpoint (authentication credentials are being ignored).

+-------------+----------------------------------+

|  Property  |              Value               |

+-------------+----------------------------------+

|  adminurl  |     http://10.1.1.2:9292      |

|     id     |fe281515d406407bbcd4887cb5815de4 |

| internalurl |     http://10.1.1.2:9292      |

publicurl  |     http://10.1.1.2:9292      |

|   region   |            regionOne             |

service_id | 7c0102f0e715479e9292c0581d214de2 |

+-------------+----------------------------------+

配置Glance服务

 

(1).keystone认证信息加入到glance配置文件里:

[root@openstack ~]# openstack-config --set/etc/glance/glance-api.conf keystone_authtoken auth_host 127.0.0.1

[root@openstack ~]# openstack-config --set/etc/glance/glance-api.conf keystone_authtoken auth_port 35357

[root@openstack ~]# openstack-config --set/etc/glance/glance-api.conf keystone_authtoken auth_protocol http

[root@openstack ~]# openstack-config --set/etc/glance/glance-api.conf keystone_authtoken admin_tenant_name service

[root@openstack ~]# openstack-config --set/etc/glance/glance-api.conf keystone_authtoken admin_user glance

[root@openstack ~]# openstack-config --set/etc/glance/glance-api.conf keystone_authtoken admin_password service

 

[root@openstack ~]# openstack-config --set/etc/glance/glance-registry.conf keystone_authtoken auth_host 127.0.0.1

[root@openstack ~]# openstack-config --set/etc/glance/glance-registry.conf keystone_authtoken auth_port 35357

[root@openstack ~]# openstack-config --set/etc/glance/glance-registry.conf keystone_authtoken auth_protocol http

[root@openstack ~]# openstack-config --set/etc/glance/glance-registry.conf keystone_authtoken admin_tenant_name service

[root@openstack ~]# openstack-config --set/etc/glance/glance-registry.conf keystone_authtoken admin_user glance

[root@openstack ~]# openstack-config --set/etc/glance/glance-registry.conf keystone_authtoken admin_password service


(2).
改动ini文件路径。将keystone认证信息加入到ini文件里:

[root@openstack ~]# openstack-config --set/etc/glance/glance-api.conf paste_deploy config_file/etc/glance/glance-api-paste.ini

[root@openstack ~]# openstack-config --set/etc/glance/glance-api.conf paste_deploy flavor keystone

[root@openstack ~]# openstack-config --set/etc/glance/glance-registry.conf paste_deploy config_file /etc/glance/glance-registry-paste.ini

[root@openstack ~]# openstack-config --set/etc/glance/glance-registry.conf paste_deploy flavor keystone

 

[root@openstack ~]# cp/usr/share/glance/glance-api-dist-paste.ini /etc/glance/glance-api-paste.ini

[root@openstack ~]# cp/usr/share/glance/glance-registry-dist-paste.ini/etc/glance/glance-registry-paste.ini

[root@openstack ~]# chown -R root:glance/etc/glance/glance-api-paste.ini 

[root@openstack ~]# chown -R root:glance/etc/glance/glance-registry-paste.ini

 

[root@openstack ~]# openstack-config --set/etc/glance/glance-api-paste.ini filter:authtoken auth_host 127.0.0.1

[root@openstack ~]# openstack-config --set/etc/glance/glance-api-paste.ini filter:authtoken admin_tenant_name service

[root@openstack ~]# openstack-config --set/etc/glance/glance-api-paste.ini filter:authtoken admin_user glance

[root@openstack ~]# openstack-config --set/etc/glance/glance-api-paste.ini filter:authtoken admin_password service

[root@openstack ~]# openstack-config --set/etc/glance/glance-registry-paste.ini filter:authtoken auth_host 127.0.0.1

[root@openstack ~]# openstack-config --set/etc/glance/glance-registry-paste.ini filter:authtoken admin_tenant_nameservice

[root@openstack ~]# openstack-config --set/etc/glance/glance-registry-paste.ini filter:authtoken admin_user glance

[root@openstack ~]# openstack-config --set/etc/glance/glance-registry-paste.ini filter:authtoken admin_password service


《3》CentOS7.0+OpenStack+kvm云平台部署—配置Glance