傳統 IT 環境下,安裝一個系統是要麼從CD安裝,要麼用 Ghost 等克隆工具恢復。有以下幾個問題:數據庫
雲環境下須要更高效的解決方案,這就是Image。Image是一個模板,裏面包含了基本的操做系統和其餘的軟件。編程
Glance提供Image Service服務,功能是管理Image,讓用戶可以發現、獲取和保存Image。api
一、各組件的含義安全
A client:任何使用Glance服務器的應用程序。服務器
REST API:Glance提供REST訪問的API。架構
Database Abstraction Layer (DAL):統一Glance和數據庫之間的通訊的應用程序編程接口(API)。工具
Glance Domain Controller:域控制器,實現主要的中間件功能,如受權,通知,策略,數據庫鏈接。spa
Glance Store:用於組織Glance和各類數據存儲之間的交互。操作系統
Registry Layer:註冊表層,用於經過使用單獨的服務來組織域和DAL之間的安全通訊的可選層。命令行
Database:Image的metadata會保持到database中,默認是 MySQL。在控制節點上能夠查看glance的database信息。
Store backend:Glance本身並不存儲image。真正的image是存放在backend中的。
圖1 Glance的架構
圖2 Glance的架構
二、Glance支持多種backend;包括:
具體使用哪一種backend,是在 /etc/glance/glanceapi.conf中配置的:
[glance_store] filesystem_store_datadir =
三、鏡像磁盤格式
表1 鏡像磁盤格式表
類型 |
說明 |
raw |
This is an unstructured disk image format |
vhd |
This is the VHDdisk format, a common disk format used by virtual machine monitors from VMWare. |
vmdk |
Another common disk format supported by many common virtual machine monitors |
VDI |
A disk format supported by VirtualBox virtual machine monitor and the QEMU emulator |
ISO |
An archive format for the data contents of an optical disc(e.g. CDROM) |
qcow2 |
A disk format supported by the QEMU emulator that can expand dynamically and supports Copy on Write |
aki |
This indicates what is stored in Glance is an Amazon kernel image |
ari |
This indicates what is stored in Glance is an Amazon kernel image |
armi |
This indicates what is stored in Glance is an Amazon kernel image |
四、鏡像文件的訪問權限:
Public公共的:能夠被全部的Tenant使用。
Private私有的/項目的:只能被Image Owner所在的Tenant使用。
Shared共享的:一個非公共的Image能夠共享給指定的Tenant,經過member-*操做來實現。
Protected受保護的:Protected Image不能被刪除。
五、Image的狀態類型:
Queued:沒有上傳Image數據,只SQL Database中存有該鏡像的元數據(標識該鏡像的ID)。
Saving:標識鏡像正在上傳Image。
Active:正常狀態,標識鏡像在Glance中徹底可用。
Deleted/pending_delete:已刪除/等待刪除的Image。
Killed:標識鏡像上傳過程當中出錯,Image元數據不正確,鏡像徹底不可用,等待被刪除。
六、建立 Images
建立Image的兩種方法:Web UI(Horizon)和命令行CLI (推薦),API v1已經在Newton版本中被刪除了。
圖3 Image狀態類型