标签:镜像 add 通过 var connect containe ros images style
glance 是 openstack镜像服务,负责虚拟机镜像的管理。
glance API
监听9292 ,接收REST API 请求(类似nova-api)然后通过registry 及image store来完成诸如镜像的查找、上传、删除、获取等更改
Registry
监听9191,用于与Mysql 数据库交互,用户存储与获取镜像的元数据;提供镜像元数据相关的接口,glance 数据库中有两张表,一张是image 表一张是image property,前 者用户保存镜像格式、大小等信息。后者保存各种定制化信息。
image store
是一个存储的接口层,通过这个接口glance 可以获取镜像,其支持的存储有Amazon的S3、openstack 本身的swift,还有诸如ceph、sheepdog、GlusterFS、等分布式存储,image store 是镜像的获取与存储的接口层,具体的存储还得依赖外部存储支持。
yum install openstack-glance -y
MariaDB [(none)]> create database glance;
MariaDB [(none)]> grant all on glance.* to ‘glance‘@‘localhost‘ identified by ‘glance‘;
MariaDB [(none)]> grant all on glance.* to ‘glance‘@‘%‘ identified by ‘glance‘;
source admin-openstack (admin-openstack 为声明变量的配置文件在keystone 服务按照配置时创建的)
openstack user create --domain default --password-prompt glance
openstack role add --project service --user glance admin
创建服务
openstack service create --name glance --description "OpenStack Image" image(类型)
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
vi /etc/glance/glance-api.conf
[database]
# ...
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
vi /etc/glance/glance-registry.conf
[database]
# ...
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
su -s /bin/sh -c "glance-manage db_sync" glance #有提示可以忽略
vi /etc/glance/glance-api.conf and /etc/glance/glance-registry.conf #两个配置文件添加相同的内容
[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 #取消注释即可
vi /etc/glance/glance-api.conf #打开一下注释即可
[glance_store]
# ...
stores = file,http
default_store = file #默认存储类型,可以有多种选择
filesystem_store_datadir = /var/lib/glance/images/ #文件存储类型的存储位置
# systemctl enable openstack-glance-api.service \
openstack-glance-registry.service
# systemctl start openstack-glance-api.service \
openstack-glance-registry.service
下载镜像 wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
创建镜像(以下操作虚拟机还未执行)
source admin-openstack
openstack image create "cirros" --file cirros-0.4.0-x86_64-disk.img --disk-format qcow2 --container-format bare --public
openstack image list 查看是否创建成功
标签:镜像 add 通过 var connect containe ros images style
原文地址:https://www.cnblogs.com/fanggege/p/10483934.html