openstack安装--glance

创建glance数据库
mysql -u root -p
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'GLANCE_DBPASS';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'GLANCE_DBPASS';
flush privileges

创建glance用户
openstack user create --domain default --password-prompt glance


在service-project下为glance用户创建admin角色
openstack role add --project service --user glance admin


创建glance服务
openstack service create --name glance --description "OpenStack Image service" image


Create the Image service API endpoints:
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


安装glance相关的packages
yum install openstack-glance python-glance python-glanceclient



vim /etc/glance/glance-api.conf(已经存在的文件)
[database]
...
connection = mysql://glance:GLANCE_DBPASS@controller/glance
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = glance
password = GLANCE_PASS

[paste_deploy]
...
flavor = keystone

[glance_store]
...
default_store = file
filesystem_store_datadir = /var/lib/glance/images/

[DEFAULT]
...
notification_driver = noop
[DEFAULT]
...
verbose = True //可选配置,我没选



vim /etc/glance/glance-registry.conf
[database]
...
connection = mysql://glance:GLANCE_DBPASS@controller/glance
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = glance
password = GLANCE_PASS

[paste_deploy]
...
flavor = keystone

[DEFAULT]
...
notification_driver = noop
[DEFAULT]
...
verbose = True //可选



同步glance数据库,同步之前glance数据库里无任何内容,同步之后有n张表
su -s /bin/sh -c "glance-manage db_sync" glance //之前要手动建glance数据库


启动并设置glance服务开机启动

systemctl enable openstack-glance-api.service openstack-glance-registry.service
systemctl start openstack-glance-api.service openstack-glance-registry.service



增加环境变量
echo "export OS_IMAGE_API_VERSION=2" | tee -a admin-openrc.sh demo-openrc.sh


source admin-openrc.sh

验证glance服务是否安装成功
wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
glance image-create --name "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --visibility public --progress
glance image-list

glance命令
[code="java"]# glance help | grep image
[--os-image-url OS_IMAGE_URL] [-U OS_IMAGE_URL]
[--os-image-api-version OS_IMAGE_API_VERSION]
add DEPRECATED! Use image-create instead.
delete DEPRECATED! Use image-delete instead.
details DEPRECATED! Use image-list instead.
image-create Create a new image.
image-delete Delete specified image(s).
image-download Download a specific image.
image-list List images you can access.
image-members DEPRECATED! Use member-list instead.
image-show Describe a specific image.
image-update Update a specific image.
index DEPRECATED! Use image-list instead.
member-create Share a specific image with a tenant.
member-delete Remove a shared image from a tenant.
member-images DEPRECATED! Use member-list instead.
member-list Describe sharing permissions by image or tenant.
show DEPRECATED! Use image-show instead.
update DEPRECATED! Use image-update instead.[/code]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值