1.创建服务凭据
#先使用脚本登陆admin
[[email protected] ~]# . admin-openstack.sh
①创建glance user
openstack user create --domain default --password-prompt glance
②关联
openstack role add --project service --user glance admin
③创建glance service
openstack service create --name glance --description "OpenStack Image" image
④创建服务API
openstack endpoint create --region RegionOne image public http://controller:9292
openstack endpoint create --region RegionOne image internal http://controller:9292
openstack endpoint create --region RegionOne image admin http://controller:9292
2.在controller节点上安装glance
[[email protected] ~]# yum install openstack-glance -y
3.配置glance-api.conf
[[email protected] ~]# vim /etc/glance/glance-api.conf
[database]
connection = mysql+pymysql://glance:[email protected]/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
[paste_deploy]
flavor = keystone
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
4.配置glance-registry.conf
[[email protected] ~]# vim /etc/glance/glance-registry.conf
[database]
connection = mysql+pymysql://glance:[email protected]/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
[paste_deploy]
flavor = keystone
5.填充数据库
[[email protected] ~]# su -s /bin/sh -c "glance-manage db_sync" glance
[[email protected] ~]# mysql -h controller -uglance -pglance -e "use glance;show tables;"
6.启动服务
[[email protected] ~]# systemctl enable openstack-glance-api.service openstack-glance-registry.service
[[email protected] ~]# systemctl start openstack-glance-api.service openstack-glance-registry.service
7.上传镜像验证
①下载测试镜像
[[email protected] ~]# wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
②上传镜像到glance
openstack image create "cirros" --file cirros-0.3.5-x86_64-disk.img --disk-format qcow2 --container-format bare --public
③查看镜像列表
原文地址:http://blog.51cto.com/lullaby/2170256
时间: 2024-11-09 00:45:37