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. Android开发——通过扫描二维码,打开或者下载Android应用

    Android开发——通过扫描二维码,打开或者下载Android应用   在实现这个功能的时候,被不同的浏览器折磨的胃疼,最后实现了勉强能用,也查考了一下其他人的博客 android实现通过浏览器点击 ...

  2. mongodb基本语句使用

    mongodb学习:##mongodb基础##数据库常用命令##用户相关##修改.添加.删除集合数据##条件操作符##创建表 ------------------------------------- ...

  3. vmware 没挂载光盘解决方案

    一定要选中上方的'已连接'

  4. [tty与uart]1.Linux中tty框架与uart框架之间的调用关系剖析

    转自:http://developer.51cto.com/art/201209/357501_all.htm 目录 1.tty框架 2.uart框架 3.自底向上 4.自顶向下 5.关系图 在这期间 ...

  5. 黄聪:get_posts 函数 | wordpress

    get_posts 函数,简单的来讲是 get_post 的复数新形势,但因为是文章多篇提取,所以使用方法上却略有不同,支持众多参数选择需要提取的文章,在 CMS 主题中经常被用到,当然如果你对 Wo ...

  6. 黄聪:VS2010开发T4模版引擎之基础入门

    原文:http://www.cnblogs.com/lzrabbit/archive/2012/07/15/2591085.html 额,T4好陌生的名字,和NuGet一样很悲催,不为世人所熟知,却又 ...

  7. (C++) Interview in English. - Constructors/Destructors

    Constructors/Destructors. 我们都知道,在C++中建立一个类,这个类中肯定会包括构造函数.析构函数.复制构造函数和重载赋值操作:即使在你没有明确定义的情况下,编译器也会给你生成 ...

  8. java数组初始化的三种方式

      //第一种 int[] is= new int[3]; is[0]=1; is[1]=2; is[2]=3; //第二种 int[] is2= {1,2,3}; //第三种 int[] is3= ...

  9. Spark RDD简介与运行机制概述

    RDD工作原理: 主要分为三部分:创建RDD对象,DAG调度器创建执行计划,Task调度器分配任务并调度Worker开始运行. SparkContext(RDD相关操作)→通过(提交作业)→(遍历RD ...

  10. vim 学习日志(3):跳到行尾、行首、文件尾、文件首、加密

    vi操作: 1.跳到文本的最后一行:按“G”,即“shift+g” 2.跳到最后一行的最后一个字符 : 先重复1的操作即按“G”,之后按“$”键,即“shift+4”. 3.跳到第一行的第一个字符:先 ...