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. Centos5.5下安装cacti

    系统环境OS:CentOSDataBase:MySQL5.0PHP Apachenet-snmp部署CentOS cacti配置需要的环境安装MySQLyum -y install mysqlyum ...

  2. PYTHON对文件及文件夹的一些操作

    python中对文件.文件夹的操作需要涉及到os模块和shutil模块. 创建文件:1) os.mknod("test.txt") 创建空文件2) open("test. ...

  3. 关于Linux中exec的一点心得

    最近在学习linux操作系统中的相关知识,在使用execlp系统调用时,发现了些有趣的东西. 首先,关于execlp函数的用法: int execlp(const char *file, const ...

  4. OAF_架构MVC系列3 - View的概述(概念)

    2014-06-18 Created By BaoXinjian

  5. DirFile

    using System; using System.Text; using System.IO; namespace MyListen { /// <summary> /// 文件操作夹 ...

  6. React Native 开发。

    1.react-native run-android 安装 2.react-native start  开启调试端口

  7. 转载__Android-屏幕适配需要注意的地方

    1.尽量使用线性布局(LinearLayout)和相对布局(RelativeLayout),不要使用绝对布局. 2.尽量使用dip和sp,不要使用px. 3.为不同的分辨率提供不同的布局文件和图片. ...

  8. docker一些命令

    1.创建image(先创建Dockerfile) docker build -t xxx/xxx . 2.删除image docker rmi xxxxx(image id) docker rmi r ...

  9. 第5章 Posix 消息队列

    5.1 概述 消息队列可以认为是一个链表.有写权限的线程可往消息队列中放置消息,有读权限的线程可以从消息队列中取走消息. 消息队列和管道/FIFO的区别: (1)消息队列往一个队列中写消息前,并不需要 ...

  10. java小程序 示例 菲薄垃圾数列

    package com.test; import java.util.Scanner; import org.junit.Test; import com.sun.xml.internal.ws.ap ...