Glance简介

  • Glance-api:接受云系统镜像的构建、删除、读取请求
  • Glance-Registry:云系统的镜像注册服务



部署在controller节点

配置数据库

MariaDB [(none)]> CREATE DATABASE glance;
Query OK, 1 row affected (0.01 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'glance';       
Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'glance';
Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> flush privileges ;
Query OK, 0 rows affected (0.00 sec)

配置Glance服务认证

创建glance用户:

root@controller:~# openstack user create --password-prompt glance
User Password:glance
Repeat User Password:glance
+----------+----------------------------------+
| Field    | Value                            |
+----------+----------------------------------+
| email    | None                             |
| enabled  | True                             |
| id       | ddcbca4dd1954923b6fd62f98110242b |
| name     | glance                           |
| username | glance                           |
+----------+----------------------------------+

将admin角色添加给glance用户和service项目:

root@controller:~# openstack role add --project service --user glance admin
+-------+----------------------------------+
| Field | Value                            |
+-------+----------------------------------+
| id    | 6d814860fbae4b9eb46c5e33835ba2a1 |
| name  | admin                            |
+-------+----------------------------------+

创建glance的服务实体:

root@controller:~# openstack service create --name glance  --description "OpenStack Image service" image
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Image service          |
| enabled     | True                             |
| id          | d5665f9b2f5645f6aaed5cbf74bad662 |
| name        | glance                           |
| type        | image                            |
+-------------+----------------------------------+

创建镜像服务的API endpoint:

root@controller:~# openstack endpoint create --publicurl http://controller:9292 --internalurl http://controller:9292 --adminurl http://controller:9292 --region RegionOne image
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| adminurl     | http://controller:9292           |
| id           | b0ab3b1386174c3da615baddeb590d27 |
| internalurl  | http://controller:9292           |
| publicurl    | http://controller:9292           |
| region       | RegionOne                        |
| service_id   | d5665f9b2f5645f6aaed5cbf74bad662 |
| service_name | glance                           |
| service_type | image                            |
+--------------+----------------------------------+

安装Glance

root@controller:~# apt-get install glance python-glanceclient

配置Glance

/etc/glance/glance-api.conf :

#[DEFAULT]部分,配置noop禁用通知驱动,因为这是为telemetry测量服务保留的
[DEFAULT]
notification_driver = noop # [database]部分,配置数据库的连接
[database]
connection = mysql://glance:glance@controller/glance #[keystone_authtoken]部分,配置身份认证服务访问
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = glance
password = glance
[paste_deploy]
flavor = keystone # [glance_store]部分,配置镜像存储采用文件的形式,并且指定存储的路径
[glance_store]
default_store = file
filesystem_store_datadir = /var/lib/glance/images/

/etc/glance/glance-registry.conf:

[DEFAULT]
notification_driver = noop [database]
connection = mysql://glance:glance@controller/glance [keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = glance
password = glance [paste_deploy]
flavor = keystone

初始化glance数据库:

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

重启Glance服务:

root@controller:~# service glance-registry restart
glance-registry stop/waiting
glance-registry start/running, process 28498 root@controller:~# service glance-api restart
glance-api stop/waiting
glance-api start/running, process 28526

删除ubuntu默认创建的SQLite数据库:

root@controller:~# rm -f /var/lib/glance/glance.sqlite

制作镜像

root@controller:~# echo "export OS_IMAGE_API_VERSION=2" | tee -a admin-openrc.sh 

root@controller:~# source admin-openrc.sh

root@controller:~# wget http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img 

使用QCOW2的磁盘格式和bare的容器格式将镜像上传到glance镜像服务中,并且设置为对所有的项目可见:

root@controller:~# glance image-create --name "cirros-0.3.3-x86_64" --file cirros-0.3.3-x86_64-disk.img --disk-format qcow2 --container-format bare --visibility public --progress

查看镜像

root@controller:~# glance image-list 
+--------------------------------------+---------------------+
| ID                                   | Name                |
+--------------------------------------+---------------------+
| 68657969-e3a0-4206-bbc8-cc15ee97daa5 | cirros-0.3.3-x86_64 |
+--------------------------------------+---------------------+ root@controller:~# glance image-show 68657969-e3a0-4206-bbc8-cc15ee97daa5
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 133eae9fb1c98f45894a4e60d8736619     |
| container_format | bare                                 |
| created_at       | 2019-08-16T09:03:58Z                 |
| disk_format      | qcow2                                |
| id               | 68657969-e3a0-4206-bbc8-cc15ee97daa5 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | cirros-0.3.3-x86_64                |
| owner            | c1d88707e8a04e889d151496421cfb92     |
| protected        | False                                |
| size             | 13200896                             |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2019-08-16T09:03:58Z                 |
| virtual_size     | None                                 |
| visibility       | public                               |
+------------------+--------------------------------------+

OpenStack kilo版(4) Glance部署的更多相关文章

  1. OpenStack Kilo版加CEPH部署手册

    OpenStack Kilo版加CEPH部署手册 作者: yz联系方式: QQ: 949587200日期: 2015-7-13版本: Kilo 转载地址: http://mp.weixin.qq.co ...

  2. OpenStack kilo版(3) Nova部署

    部署在controller和compute节点 配置数据库 MariaDB [(none)]> CREATE DATABASE nova;  Query OK, 1 row affected ( ...

  3. OpenStack kilo版(5) Neutron部署

    neutron简介: Neutron 通过 plugin 和 agent 提供的网络服务. plugin 位于 Neutron server,包括 core plugin 和 service plug ...

  4. OpenStack kilo版(2) keystone部署

    部署在controller节点 配置数据库 MariaDB [(none)]> CREATE DATABASE keystone; Query OK, 1 row affected (0.00 ...

  5. openstack安装newton版本Glance部署(二)

    一.部署Glance 1.Glance 安装 [root@linux-node1 ~]#yum install openstack-glance python-glance python-glance ...

  6. OpenStack kilo版(1) 部署环境

    硬件 VMware workstation虚拟机 Ubuntu14.04操作系统 虚拟机网络规划 管理网络: eth0, 桥接模式 10.0.0.0/24 外部网络: eth1, nat模式(需要关闭 ...

  7. OpenStack kilo版(8) 部署cinder

    直接将cinder服务和块设备都部署在controller节点上 在controller节点添加一块100G的块设备/dev/sdb 配置数据库 (root@localhost) [(none)]&g ...

  8. OpenStack kilo版(7) 部署dashboard

    安装dashboard  root@controller:~# apt-get install openstack-dashboard  配置 /etc/openstack-dashboard/loc ...

  9. OpenStack_I版 3.glance部署

    存储镜像path                 默认镜像不存储在本地,一般放在swift对象存储或Cinder块存储里   glance安装     拷贝配置文件到/ect下,并新建配置目录,日志目 ...

随机推荐

  1. PAT 甲级 1066 Root of AVL Tree (25 分)(快速掌握平衡二叉树的旋转,内含代码和注解)***

    1066 Root of AVL Tree (25 分)   An AVL tree is a self-balancing binary search tree. In an AVL tree, t ...

  2. Text Prompted Remote Speaker Authentication : Joint Speech and Speaker Recognition/Verification System :: Major Project ::: Introduction

    转载自:http://ganeshtiwaridotcomdotnp.blogspot.com/2010/12/text-prompted-remote-speaker.html Biometrics ...

  3. Java Sound : generate play sine wave - source code

    转载自:http://ganeshtiwaridotcomdotnp.blogspot.com/2011/12/java-sound-generate-play-sine-wave.html Work ...

  4. SQL Server判断对象是否存在

    1 判断数据库是否存在 if exists (select * from sys.databases where name = ’数据库名’) drop database [数据库名] if exis ...

  5. AI - AutoKeras - 简介

    前言 在数据集上训练神经网络时,主要有两个目标: 定义符合数据集特性的神经网络架构. 在许多试验中对一组超参数进行调优,从而使得模型具有较高的准确率并且能够泛化至训练集和测试集之外的数据. 针对不同的 ...

  6. 打印格式化printf

    #define _DEBUG_ #ifdef _DEBUG_#define  printm(fmt, ...) do { printf("%s line %d, "fmt, __f ...

  7. 微信小程序,内容组件中兼容的H5组件

    受信任的HTML节点及属性 全局支持class和style属性,不支持id属性. 节点 属性 a   abbr   address   article   aside   b   bdi   bdo ...

  8. Word 域代码使用方法

    插入域「Crtl+F9」 更新域「F9」 切换域代码「Alt+F9」 批量删除域 打开 Word 文档,全选,按下「Alt+F9」键,将 Word 中所有的域结果切换为域代码的形式. 调出" ...

  9. MATLAB 求一个点周围 voronoi 边的顶点的坐标

    本代码在[MATLAB 2015b] 下编写运行成功,不保证所有版本适用. x=[0 -.5 1 1 -1]; y=[0 -1 -.5 1 1]; voronoi(x,y);axis([-2 2 -2 ...

  10. PAT(B) 1028 人口普查(C)字符串

    题目链接:1028 人口普查 (20 point(s)) 题目描述 某城镇进行人口普查,得到了全体居民的生日.现请你写个程序,找出镇上最年长和最年轻的人. 这里确保每个输入的日期都是合法的,但不一定是 ...