Centos7 install Openstack - (第三节)添加镜像服务(Glance)

我的blog地址:http://www.cnblogs.com/caoguo

该文根据openstack官方文档配置

官方文档地址: http://docs.openstack.org/juno/install-guide/install/yum/content/#

0x01. 基本安装配置(控制节点)

一) To configure prerequisites 
1. To create the database, complete these steps:(在数据创建该服务需要使用的数据库帐户)

[root@controller ~]# mysql -uroot -p
MariaDB [(none)]> CREATE DATABASE glance;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
-> IDENTIFIED BY 'GLANCE_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
-> IDENTIFIED BY 'GLANCE_DBPASS';

2. 加载admin环境变量

[root@controller ~]# source admin-openrc.sh

3. To create the service credentials, complete these steps:

  a. Create the glance user:  #在认证服务中创建一个glance的帐户

[root@controller ~]# keystone user-create --name glance --pass GLANCE_PASS
+----------+----------------------------------+
| Property | Value |
+----------+----------------------------------+
| email | |
| enabled | True |
| id | b5eb644a0049459c9f1b1bb87eaa2f35 |
| name | glance |
| username | glance |
+----------+----------------------------------+

  

  

  b. Add the admin role to the glance user:   #将用户添加至admin用户组 service租户中

[root@controller ~]# keystone user-role-add --user glance --tenant service --role admin

  c. Create the glance service entiry:

[root@controller ~]# keystone service-create --name glance --type image \
--description "OpenStack Image Service"
+-------------+----------------------------------+
| Property | Value |
+-------------+----------------------------------+
| description | OpenStack Image Service |
| enabled | True |
| id | 95b4d1e8cee046ada8e131cdef6d01da |
| name | glance |
| type | image |
+-------------+----------------------------------+

4. Create the Image Service API endpoints:  #创建镜像服务api

[root@controller ~]# keystone endpoint-create \
--service-id $(keystone service-list | awk '/ image / {print $2}') \
--publicurl http://controller:9292 \
--internalurl http://controller:9292 \
--adminurl http://controller:9292 \
--region regionOne

  

二) To install and configure the Image Service components
1. Install the packages:  # 安装镜像服务软件包

[root@controller ~]# yum install -y openstack-glance python-glanceclient

2. Edit the /etc/glance/glance-api.conf file

[root@controller ~]# cp /etc/glance/glance-api.conf /etc/glance/glance-api.conf.old
[root@controller ~]# vi /etc/glance/glance-api.conf # 在配置文件节点下新增配置
[database]
connection = mysql://glance:GLANCE_DBPASS@controller/glance [keystone_authtoken]
auth_uri = http://controller:5000/v2.0
identity_uri = http://controller:35357
admin_tenant_name = service
admin_user = glance
admin_password = GLANCE_PASS [paste_deploy]
flavor = keystone [glance_store]
default_store = file
filesystem_store_datadir = /var/lib/glance/images/ [DEFAULT]
notification_driver = noop

3. Edit the /etc/glance/glance-registry.conf file

[root@controller ~]# cp /etc/glance/glance-registry.conf /etc/glance/glance-registry.conf.old
[root@controller ~]# vi /etc/glance/glance-registry.conf
[database]
connection = mysql://glance:GLANCE_DBPASS@controller/glance [keystone_authtoken]
auth_uri = http://controller:5000/v2.0
identity_uri = http://controller:35357
admin_tenant_name = service
admin_user = glance
admin_password = GLANCE_PASS [paste_deploy]
flavor = keystone [DEFAULT]
notification_driver = noop
verbose = True

4. Populate the Image Service database: # 镜像服务数据同步

[root@controller ~]# su -s /bin/sh -c "glance-manage db_sync" glance

三)To finalize installation(收尾工作)

[root@controller ~]# systemctl enable openstack-glance-api.service openstack-glance-registry.service
[root@controller ~]# systemctl start openstack-glance-api.service openstack-glance-registry.service

0x02. 确认以上操作
  1. Create and change into a temporary local directory: # 创建一个临时目录

[root@controller ~]# mkdir /tmp/images

  2. Download the image to the temporary local directory: # 下载一个测试镜像

[root@controller ~]# yum install -y wget
[root@controller ~]# wget -P /tmp/images http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img

  3. Source the admin credentials to gain access to admin-only CLI commands: # 导入admin环境变量

[root@controller ~]# source admin-openrc.sh

  4. Upload the image to the Image Service: # 上传镜像文件

[root@controller ~]# glance image-create --name "cirros-0.3.3-x86_64" --file /tmp/images/cirros-0.3.-x86_64-disk.img \
--disk-format qcow2 --container-format bare --is-public True --progress
[=============================>] %
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | 133eae9fb1c98f45894a4e60d8736619 |
| container_format | bare |
| created_at | --01T10:: |
| deleted | False |
| deleted_at | None |
| disk_format | qcow2 |
| id | 833b50a1-167e--8d8e-27799ad4c52a |
| is_public | True |
| min_disk | |
| min_ram | |
| name | cirros-0.3.-x86_64 |
| owner | f42937a2fd484d638ce58e67fef59b67 |
| protected | False |
| size | |
| status | active |
| updated_at | --01T10:: |
| virtual_size | None |
+------------------+--------------------------------------+

  5. Confirm upload for image and validate attributes: # 查看当前已经上传成功的镜像

[root@controller ~]# glance image-list
+--------------------------------------+---------------------+-------------+------------------+----------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+--------------------------------------+---------------------+-------------+------------------+----------+--------+
| 74da30a6-8e15-4b11-807c-2eba444e6a54 | cirros-0.3.-x86_64 | qcow2 | bare | | active |
+--------------------------------------+---------------------+-------------+------------------+----------+--------+

  6. Remove the temporary local directory:

[root@controller ~]# rm -r /tmp/images
rm: descend into directory ‘/tmp/images’? y
rm: remove regular file ‘/tmp/images/cirros-0.3.-x86_64-disk.img’? y
rm: remove directory ‘/tmp/images’? y

结束!!!

更多精彩请访问:http://www.cnblogs.com/caoguo

Centos7 install Openstack - (第三节)添加镜像服务(Glance)的更多相关文章

  1. 【openstack N版】——镜像服务glance

    一.openstack镜像服务glance 1.1 glance介绍 glance主要是由三部分组成 glance-api:接收云系统镜像的创建,删除,读取请求,类似nova-api,通过其他模块(g ...

  2. Openstack(八)部署镜像服务glance

    8.1glance镜像服务介绍 Glance是OpenStack镜像服务组件,glance服务默认监听在9292端口,其接收REST API请求,然后通过其他模块(glance-registry及im ...

  3. Centos7 install Openstack - (第四节)添加计算服务(Nova)

    Centos7 install Openstack - (第四节)添加计算服务(Nova) 我的blog地址:http://www.cnblogs.com/caoguo 该文根据openstack官方 ...

  4. 5.OpenStack添加镜像服务

    添加镜像服务 这里是安装在控制器上 创建数据库 mysql -uroot -ptoyo123 CREATE DATABASE glance; GRANT ALL PRIVILEGES ON glanc ...

  5. 云计算管理平台之OpenStack镜像服务glance

    一.glance简介 openstack中的glance服务是用来存储在openstack上启动虚拟机所需镜像:它主要用于发现.注册及检索虚拟机镜像:它通过提供RESTful风格的api对外提供服务: ...

  6. OpenStack 镜像服务 Glance部署(六)

    Glance介绍 创建虚拟机我们需要有glance的支持,因为glance是提供镜像的服务. Glance有两个比较重要的服务: Glance-api:接受云系统镜像的构建.删除.读取请求 Glanc ...

  7. [ Openstack ] OpenStack-Mitaka 高可用之 镜像服务(glance)

    目录 Openstack-Mitaka 高可用之 概述    Openstack-Mitaka 高可用之 环境初始化    Openstack-Mitaka 高可用之 Mariadb-Galera集群 ...

  8. 探索 OpenStack 之(10):深入镜像服务Glance

    本篇博文来探讨下镜像服务Glance. 0.  基本概念 0.1 基本功能 Glance提供REST API来支持以下镜像操作: 查询 注册 上传 获取 删除 访问权限管理 0.2 Glance RE ...

  9. OpenStack实践系列③镜像服务Glance

    OpenStack实践系列③镜像服务Glance 3.5 Glance部署 修改glance-api和glance-registry的配置文件,同步数据库 [root@node1 ~]# vim /e ...

随机推荐

  1. 关于今天mysql数据库的一系列问题

    首先,字符集的问题: mysql> show variables like 'character%';+--------------------------+------------------ ...

  2. WIN 8.1 x64 环境下 COM Surrogate 停止工作解决方案

    我的笔记本电脑是THINKPAD T420 4180AT8,NVIDIA NVS 4200M,Intel(R) HD Graphics 3000,WIN 8.1 x64操作系统.在安装完NVIDIA独 ...

  3. 【log】logback.xml

    <?xml version="1.0" encoding="UTF-8"?> <configuration> <!-- 控制台 - ...

  4. 请使用-Xlint:deprecation重新编译

    [已解决]Android Studio编译OsmAnd出现警告:GeoPointParserUtil.java使用或覆盖了已过时的 API.有关详细信息请使用-Xlint:deprecation重新编 ...

  5. 打开SDK Manager检查Android SDK下载和更新失败的解决方法

    [故障描述] 打开SDK Manager检查Android  SDK状况,出现以下情况: Failed to fetch URL https://dl-ssl.google.com/android/r ...

  6. 黄聪:WordPress根目录(Root)

    index.php:WordPress核心索引文件,即博客输出文件. license.txt:WordPress GPL许可证文件. my-hacks.php:定义了博客输出之前处理的追加程序.默认安 ...

  7. 正则表达式中的\b

    转自百度知道:https://zhidao.baidu.com/question/58688915.html\b表示的应该是ASCII码中的BS字符(退格字符),匹配字与字中间那个看不见的东西(即一个 ...

  8. poj 2104 K-th Number(主席树 视频)

    K-th Number 题意: 给你一些数,让你求一个区间内,第k大的数是多少. 题解: 主席树第一题,看的qsc视频写的,戳戳戳 学到了unique函数,他的作用是:把相邻的重复的放到后面,返回值是 ...

  9. CF534A Exam 构造

    An exam for n students will take place in a long and narrow room, so the students will sit in a line ...

  10. AD按键-矩阵按键:

    原理:利用数组分压+AD采集: 优点:一个IO口可以做成多个按键,节省IO口(矩阵键盘在>4时优点才能体现出来):可备用作为AD基准输入. 缺点:不能做成组合按键(或者电阻要精确选择):且离IO ...