赞
踩
14、安装镜像(Glance)服务:
镜像服务(Glance)使用户能够发现、登记,并检索虚拟机映像。它提供了 REST API,使您可以查询虚拟机映像元数据和检索一个实际的形象。你可以存储虚拟机映像通过图像服务在不同的位置,从简单的 对象存储系统,如OpenStack对象存储文件系统。
创建该服务的数据库和数据库管理账户
controller#mysql-u root -p123
CREATEDATABASE glance;
GRANTALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
IDENTIFIEDBY 'glance';
GRANTALL PRIVILEGES ON glance.* TO 'glance'@'%' \
IDENTIFIEDBY 'glance';
exit
创建用户、服务、API
controller#
openstack user create --domain default--password-prompt glance
需要输入密码:
openstack role add --project service --userglance admin
openstack service create --name glance \
--description "OpenStack Image"image
openstack endpoint create --regionRegionOne \
image public http://controller:9292
openstack endpoint create --regionRegionOne \
image internal http://controller:9292
openstack endpoint create --regionRegionOne \
image admin http://controller:9292
编辑配置文件(备份配置文件,删除配置文件里的所有数据,使用提供的配置):
controller#
cp /etc/glance/glance-api.conf/etc/glance/glance-api.conf.bak
vi /etc/glance/glance-api.conf
[database]
connection =mysql+pymysql://glance:glance@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
[paste_deploy]
flavor = keystone
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
cp /etc/glance/glance-registry.conf /etc/glance/glance-registry.conf.bak
vi /etc/glance/glance-registry.conf
[database]
connection =mysql+pymysql://glance:glance@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
[paste_deploy]
flavor = keystone
同步数据库:
controller#
su -s /bin/sh -c "glance-managedb_sync" glance
开机自启动和启动服务
controller#
systemctl enableopenstack-glance-api.service \
openstack-glance-registry.service
systemctl restartopenstack-glance-api.service \
openstack-glance-registry.service
下载镜像(没有wget命令则yum安装):
wgethttp://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
准备镜像且上传:
controller#
mv cirros-0.3.5-x86_64-disk.img/var/lib/glance/images/
cd /var/lib/glance/images/
openstack image create "cirros" \
--file cirros-0.3.5-x86_64-disk.img \
--disk-format qcow2 --container-format bare\
--public
查看已上传的镜像:
controller#
openstack image list
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。