目錄
Image service overview
官檔:The Image service (glance) enables users to discover, register, and retrieve virtual machine images. It offers a REST API that enables you to query virtual machine image metadata and retrieve an actual image. You can store virtual machine images made available through the Image service in a variety of locations, from simple file systems to object-storage systems like OpenStack Object Storage.
粗譯:Image service (glance)使使用者能夠發現、注冊、檢索虛拟機鏡像。它提供了一個REST API讓你能夠查詢虛拟機鏡像的中繼資料和檢索一個實際的鏡像。無論是一個簡單的file systems還是一個OpenStack Object Storage,你都可以通過Image service在各種不同的位置上存儲一個虛拟機鏡像。
Important:
For simplicity, this guide describes configuring the Image service to use the file back end, which uploads and stores in a directory on the controller node hosting the Image service. By default, this directory is /var/lib/glance/images/.
Before you proceed, ensure that the controller node has at least several gigabytes of space available in this directory.
重要提示:為了簡單起見,該指南記錄了使用Controller Node中的目錄來上傳和存儲鏡像檔案。預設的,這個目錄是<code>/var/lib/glance/images/</code>。
在開始之前,确定Controller Node上的鏡像存儲目錄還有幾個G的空間。
官檔:The OpenStack Image service is central to Infrastructure-as-a-Service (IaaS) as shown in Conceptual architecture. It accepts API requests for disk or server images, and metadata definitions from end users or OpenStack Compute components. It also supports the storage of disk or server images on various repository types, including OpenStack Object Storage.
A number of periodic processes run on the OpenStack Image service to support caching. Replication services ensure consistency and availability through the cluster. Other periodic processes include auditors, updaters, and reapers.
粗譯:Openstack Image service是IaaS中非常重要的元件。它能夠為磁盤或者伺服器鏡像接受來自于User或者Openstack Compute service的API請求和中繼資料定義。它也支援磁盤存儲、伺服器鏡像、OpenStack Object Storage等何種存儲方式。OpenStack Image service還運作着一些周期性的程序來支援緩存。而且同步服務(Replication services)還能確定叢集中的鏡像的一緻性和可用性。其他的周期性程序還包括auditors, updaters, and reapers。
glance-api:提供了Image service的發現、檢索、存儲功能的API調用。
glance-registry:用于存儲、處理、檢索Image中繼資料。這些中繼資料包含了鏡像的size和type等資訊。需要注意的是,注冊(glance-registry)是OpenStack Image service私有的内部服務,這意味着不能向User公開該服務。
Database:用于存儲Image的中繼資料,支援大多數Database種類,常使用MySQL或SQLite來實作。
Storage repository for image files(鏡像檔案的存儲倉庫):支援多種存儲類型,包括file systems、Object Storage、RADOS block devices、HTTP、Amazon S3等類型。但有些存儲類型隻支援隻讀通路。
Metadata definition service(中繼資料定義服務):是一個統一的vendors API,管理者、服務、使用者可以定義他們所擁有的自定義中繼資料(custom metadata)。這個自定義的中繼資料可以使用不同的資源類型,如:images、artifacts、volumes、flavors、aggregates。定義包含了new property’s key、description、constraints和相關的資源類型。
Install and configure
在Controller Node上安裝并配置OpenStack Image service
Before you install and configure the Image service, you must create a database, service credentials, and API endpoints.
在安裝個配置Image service之前,你必須建立一個Database,service credentials,API endpoints。
Use the database access client to connect to the database server as the root
以資料庫管理者root的身份登入資料庫
Create the glance database
建立glance資料庫
Grant proper access to the glance database
建立資料庫使用者glance,并授予其對glance資料庫的管理權限
Exit the database access client.
建立服務憑證
Source the admin credentials to gain access to admin-only CLI commands
Create the glance user
建立glance使用者
Add the admin role to the glance user and service project
添加Project service和User glance到Role admin中
Create the glance service entity
建立glance服務實體,将Image service加入到服務目錄。
Create the Image service API endpoints
為OpenStack Image service建立認證服務端點
Install and configure components
In the [database] section, configure database access
配置Image service的資料庫連接配接
vim /etc/glance/glance-api.conf
配置詳細日志報告
In the [keystone_authtoken] and [paste_deploy] sections, configure Identity service access
配置Identity service通路
注意:在<code>[keystone_authtoken]</code> 節點中,注釋或删除其他别的選項。
In the [glance_store] section, configure the local file system store and location of image files
配置本地檔案系統存儲和鏡像檔案的存放路徑
總覽
vim /etc/glance/glance-registry.conf
Note:忽略所有的警告輸出資訊
檢視glance資料庫:
Finalize installation
Verify operation驗證操作
Verify operation of the Image service using CirrOS, a small Linux image that helps you test your OpenStack deployment.
使用<code>CirrOS</code>鏡像來進行Image service的測試操作,<code>CirrOS</code>是一個小型的Linux鏡像檔案。
Note:在Controller Node上執行下列操作
1.Source the admin credentials to gain access to admin-only CLI commands
2.Download the source image
3.Upload the image to the Image service using the QCOW2 disk format, bare container format, and public visibility so all projects can access it
以<code>QCOW2</code>的磁盤格式、<code>bare</code>容器格式、<code>public visibility</code>的方式将鏡像上傳到Image service,是以所有的使用者都能否通路這個鏡像。
Example:
檢視鏡像檔案存儲目錄:
ERROR1:500 Internal Server Error: The server has either erred or is incapable of performing the requested operation. (HTTP 500)
解決:<code>systemctl restart mariadb.service</code>
ERROR2:An unexpected error prevented the server from fulfilling your request.
Glance Log:
解決:重新開機Controller Node主機
4.Confirm upload of the image and validate attributes
至此Openstack Image service的安裝就完成