标签:files art tar com 配置文件 desc Opens 部署 信息
作用:主要用于帮助用户发现、注册及搜索VM实例映像文件(通过REST API的形式)
三大组件功能
磁盘映像文件的存储目录:/var/lib/glance/images
创建glance数据库
CREATE DATABASE glance;
数据库赋权
GRANT ALL PRIVILEGES ON glance.* TO ‘glance‘@‘localhost‘ IDENTIFIED BY ‘glance‘;
GRANT ALL PRIVILEGES ON glance.* TO ‘glance‘@‘%‘ IDENTIFIED BY ‘glance‘;
复制代码
yum install -y openstack-glance
备份两个配置文件/etc/glance/glance-api.conf和/etc/glance/glance-registry.conf
编辑glance-api配置文件
#vim /etc/glance/glance-api.conf
[database]
# ...
connection = mysql+pymysql://glance:glance@controller/glance
[keystone_authtoken]
# ...
auth_uri = http://controller:5000
auth_url = http://controller:5000
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/
复制代码
编辑glance-registry配置文件
# vim /etc/glance/glance-registry.conf
[database]
# ...
connection = mysql+pymysql://glance:glance@controller/glance
[keystone_authtoken]
# ...
auth_uri = http://controller:5000
auth_url = http://controller:5000
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数据库的配置信息
# su -s /bin/sh -c "glance-manage db_sync" glance
#加载admin的环境变量脚本文件
source admin-openstack.sh
#创建glance用户
openstack user create --domain default --password glance glance
#检查效果
oepnstack user list
#将glance用户添加到service项目的admin角色组
openstack role add --project service --user glance admin
#创建image的server
openstack service create --name glance --description "OpenStack Image" image
#检查效果
openstack service list
#初始化glance服务的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
#检查效果
openstack endpoint list
复制代码
重启glance相关服务,设置开机自启
# systemctl enable openstack-glance-api.service openstack-glance-registry.service
# systemctl start openstack-glance-api.service openstack-glance-registry.service
复制代码
glance-api端口是9292,glance-registry端口是9191
下载测试镜像文件
wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
这里上传时遇到问题,通过浏览日志文件发现是35357端口的问题,然而Queen版本的OpenStack中admin用户并未使用该端口,因此是KeyStone组件配置出错导致的问题。通过将endpoint中与KeyStone相关的服务删除后重新开启,解决了问题。
上传镜像文件到glance
openstack image create "cirros" --file cirros-0.3.5-x86_64-disk.img --disk-format qcow2 --container-format bare --public
安装qemu-kvm对镜像文件类型进行检查:qemu-img info cirros-0.3.5-x86_64-disk.img
检查效果
openstack image list
日志文件检查
cd /var/log/glance
grep ‘ERROR‘ api.log #关于用户操作的日志信息
grep ‘ERROR‘ registry.log #关于数据库操作的日志信息
标签:files art tar com 配置文件 desc Opens 部署 信息
原文地址:https://www.cnblogs.com/well-666/p/12151574.html