一、建立glance数据库并且给权限设置第三方登录

  mysql -uroot -p0330

  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';

二、部署glance 

  ①宣告环境变量

  source openrc或 . openrc

  ②创建glance用户

  openstack user create --domain default --password=glance glance

  ③将项目service中的用户glance设置为admin角色

  openstack role add --project service --user glance admin

  ④创建glance服务

  openstack service create --name glance \ --description "OpenStack Image" image

  ⑤创建服务端点(RegionOne是一个域)

  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镜像服务,并编辑配置文件

  ①安装

  yum install openstack-glance

  ②先复制在编辑配置文件

  cp /etc/glance/glance-api.conf /etc/glance/glance-api.conf.bak

  cp  /etc/glance/glance-registry.conf  /etc/glance/glance-registry.conf.bak

[DEFAULT]

[cors]
[cors.subdomain] [database] #数据库连接方式
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance [glance_store] #镜像存储位置
stores = file,http #保存方式:文件,http类型
default_store = file #默认以文件进行存储
filesystem_store_datadir = /var/lib/glance/images/ #文件系统目录 [image_format] [keystone_authtoken] #keystone验证方式
auth_uri = http://controller:5000 #私有服务端点
auth_url = http://controller:35357 #管理服务端点
memcached_servers = controller: #缓存镜像的方式memcache
auth_type = password #认证类型:密码
project_domain_name = default #项目处在default域中
user_domain_name = default #user处在default域中
project_name = service #项目名称
username = glance #用户名称
password = glance #密码 [matchmaker_redis] [oslo_concurrency] [oslo_messaging_amqp] [oslo_messaging_kafka] [oslo_messaging_notifications] [oslo_messaging_rabbit] [oslo_messaging_zmq] [oslo_middleware] [oslo_policy] [paste_deploy]
flavor = keystone #flavor认证的模板方式 [profiler] [store_type_location_strategy] [task] [taskflow_executor]

vim /etc/glance/glance-api.conf

[DEFAULT]

[database]
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance [keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance [matchmaker_redis] [oslo_messaging_amqp] [oslo_messaging_kafka] [oslo_messaging_notifications] [oslo_messaging_rabbit] [oslo_messaging_zmq] [oslo_policy] [paste_deploy]
flavor = keystone [profiler]

vim /etc/glance/glance-registry.conf

  ③同步数据库

  su -s /bin/sh -c "glance-manage db_sync" glance

  ④重启并设置开机自启

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

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

四、上传镜像

  ①上传镜像

  cirros-0.3.5-x86_64-disk.img

  source openrc

  openstack image create "cirros" --file cirros-0.3.5-x86_64-disk.img --disk-format qcow2 --container-format bare --public

  ②查看镜像列表(镜像保存在/var/lib/glance/images)

  opentack image list或glance image-list

【补充】

第三方进入数据库

1.必须安装mariadb客户端

2.登录的用户必须可以第三方登录

mysql -h ip -ukeystone -pkeystone

最新文章

  1. HTML5基础知识(3)--required属性
  2. Vector_h
  3. ArcGIS应用——四种计算图斑面积的方法
  4. shell命令getopts解析
  5. Windows Azure VM的两种shut down 方式
  6. C++:类的成员函数定义方式
  7. Learning Django Resources
  8. windows下Apache配置SSL安全连接
  9. Go语言实现-观察者模式
  10. c#基于这些,你已经看到了?(一)-----谁才刚刚开始学习使用
  11. UVA662- Fast Food
  12. Redis实战 - 4.Key
  13. Vue渲染列表,在更新data属性后,列表未更新问题
  14. shiro框架
  15. Poiji:基于列名绑定方式将Excel单元行转换为JavaBean的开源框架
  16. ionic创建项目失败
  17. tomcat源码阅读之集群
  18. Git工作流基础简介【与产品经理.jpg】
  19. learning docker steps(2) ----- docker contailner 初次体验
  20. Document对象中的一些重要的属性和方法(笔记)

热门文章

  1. 多线程模块的同步机制event对象
  2. rpm的specs学习
  3. Django form表单修改数据
  4. 牛客练习赛53 A 超越学姐爱字符串 (DP)
  5. 按照教程自动安装RFNoC时.在使用pip安装pybombs时出现报错,解决办法
  6. vue 自定义指令的魅力
  7. shell实现并发控制
  8. BZOJ 3489: A simple rmq problem (KD-tree做法)
  9. GNS3错误’Could not start Telnet console with command 'Solar-PuTTY.exe‘
  10. Mixed Content混合内容错误 Iframe Http页面无法访问