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. 使用 OWIN 作为 ASP.NET Web API 的宿主

    使用 OWIN 作为 ASP.NET Web API 的宿主 ASP.NET Web API 是一种框架,用于轻松构建可以访问多种客户端(包括浏览器和移动 设备)的 HTTP 服务. ASP.NET ...

  2. CentOS 7.0 安装中文输入法

    这是个蛋疼的问题 1.Applications -- System Tools -- Setting -- Regin & Language 2.input source -- + -- mo ...

  3. SQL语句技巧_索引的优化_慢查询日志开启_root密码的破解

    1.正则表达式的使用 regexp例:select name,email from t where email regexp '@163[.,]com$'使用like方式查询selct name,em ...

  4. 黄聪:如何删除wordpress登录之后wp_footer、wp_head自行加载的Open Sans字体、fonts.googleapis.com连接导致卡死的问题

    有时候在浏览自己的WordPress网站时,发现网页长时间无响应, 卡在正在连接到fonts.googleapis.com ,如下图所示: 查看网页源码时,发现Head里面有如下一段代码: <l ...

  5. mvc 控制器,视图,Razor 语法

    mvc 控制器controller:响应用户请求,并修改模型model;输入数据的处理,输出view数据的提供: url入控制器的方法有关联:MVC提供的是方法调用结果: mvc model:是对应用 ...

  6. ASP.NET MVC 基础(01)

    [ASP.NET MVC ]系列文章大致会包含这样一些内容: 1.ASP.NET MVC 的一些高级知识点: 2.ASP.NET MVC 的一些最新技术: 3.ASP.NET MVC 网站安全方面的知 ...

  7. Maven打包web工程成WAR

    其实不一定要通过Goals:package来打war包,直接run as maven bulid也行:

  8. 在x86转x64的开发过程会遇到各种意外的问题,比如MSScriptControl 在x64下

    遇到这种只能编译成x86的组件,那么就必须将 生成 目标平台 设置成  x86 参考文章: http://www.dotblogs.com.tw/stanley.hsu/archive/2010/04 ...

  9. Report_客制化Excel报表中的XLS标记(案例)

    2014-06-06 Created By BaoXinjian

  10. HDU 2717 Catch That Cow(BFS)

    Catch That Cow Farmer John has been informed of the location of a fugitive cow and wants to catch he ...