一 简单架构图示参考
二 部署glance
yum install memcached python-memcached
systemctl enable memcached.service
systemctl start memcached.service
step 1:glance关于数据库的操作
mysql -u root -p #登入数据库
CREATE DATABASE glance; #新建库keystone
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
IDENTIFIED BY '123'; #新建本地访问glance库的账号
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
IDENTIFIED BY '123'; #新建远程访问glance库的账号
step 2:glance关于keystone的操作
soure admin-openrc #执行管理员脚本
#为glance的使用者创建用户
openstack user create --domain default --password-prompt glance
#对glance-service添加role角色,提示:用户glance只有在一个确定的项目service内才有角色的概念,单独的用户或者单独的项目都是无法绑定角色的。
openstack role add --project service --user glance admin
#创建glance服务的catalog:service+endpoint
openstack service create --name glance \
--description "OpenStack Image" image
openstack endpoint create --region RegionOne \
image public http://192.168.31.57:9292
openstack endpoint create --region RegionOne \
image internal http://192.168.31.57:9292
openstack endpoint create --region RegionOne \
image admin http://192.168.31.57:9292
step 3:安装软件包
yum -y install openstack-glance
step 4:配置/etc/glance/glance.conf
大前提:每一条配置都应该新增到文件中,一定不要打开注释在原有的基础上修改。
创建本地存储:
1.一定要在opesntack-glance-api.service服务启动之前部署好存储设备,因为该服务在启动时会加载存储驱动检索存储设备,如果事先不存在,就意味着该服务没有识别到任何可用的存储设备,即便是后来你又新增了存储,仍然是无效的,最终导致你上传镜像失败;
2.一定要赋予opesntack-glance-api.service服务对存储设备的可写权限。
mkdir -p /var/lib/glance/images
chown -R glance.glance /var/lib/glance/images
配置/etc/glance/glance-api.conf
[database]
connection = mysql+pymysql://glance:123@192.168.31.57/glance
[keystone_authtoken]
auth_uri = http://192.168.31.57:5000
auth_url = http://192.168.31.57:35357
memcached_servers = 192.168.31.57:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = 123
[paste_deploy]
flavor = keystone
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
配置/etc/glance/glance-registry.conf
[database]
connection = mysql+pymysql://glance:123@192.168.31.57/glance
[keystone_authtoken]
auth_uri = http://192.168.31.57:5000
auth_url = http://192.168.31.57:35357
memcached_servers = 192.168.31.57:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = 123
[paste_deploy]
flavor = keystone
step 5: 初始化数据库glance
su -s /bin/sh -c "glance-manage db_sync" glance
'''
忽略以下打印,此乃正常性行为:
Option "verbose" from group "DEFAULT" is deprecated for removal. Its value may be silently ignored in the future.
/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:1171:...... oslo_db.sqlalchemy.enginefacade
...... a future release.")
result = self._query(query)
'''
step 6:启动glance且设置开机启动
systemctl enable openstack-glance-api.service \
openstack-glance-registry.service
systemctl start openstack-glance-api.service \
openstack-glance-registry.service
三 验证
source admin-openrc
#如果没有wget则必须yum -y install wget
wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
openstack image create "cirros" \
--file cirros-0.3.4-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
--public
openstack image list
For information about the openstack image create parameters, see Create or update an image (glance) in the OpenStack User Guide.
For information about disk and container formats for images, see Disk and container formats for images in the OpenStack Virtual Machine Image Guide.
以上就是openstack云计算之glance部署及操作步骤的详细内容,更多关于openstack云计算glance部署操作的资料请关注编程网其它相关文章!