使用 CirrOS 來驗(yàn)證映像服務(wù)的操作,這是一個(gè)小的 Linux 映像屑宠,可以幫助您測(cè)試 OpenStack 部署厢洞。
有關(guān)如何下載和構(gòu)建鏡像的更多信息,請(qǐng)參閱 OpenStack 虛擬機(jī)映像指南。有關(guān)如何管理鏡像的信息犀变,請(qǐng)參閱 OpenStack 最終用戶指南妹孙。
在控制節(jié)點(diǎn)上執(zhí)行這些命令。
1获枝、Source admin
憑證獲取對(duì) admin 專用 CLI 命令的訪問權(quán)限:
$ . admin-openrc
2蠢正、下載源鏡像:
$ wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
如果您的發(fā)行版沒有包含 wget,請(qǐng)安裝省店。
3嚣崭、使用 QCOW2 磁盤格式、裸容器格式和公共可見性上傳鏡像到鏡像服務(wù)懦傍,所有項(xiàng)目都可以訪問它:
$ openstack image create "cirros" \
--file cirros-0.3.5-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
--public
+------------------+------------------------------------------------------+
| Field | Value |
+------------------+------------------------------------------------------+
| checksum | 133eae9fb1c98f45894a4e60d8736619 |
| container_format | bare |
| created_at | 2015-03-26T16:52:10Z |
| disk_format | qcow2 |
| file | /v2/images/cc5c6982-4910-471e-b864-1098015901b5/file |
| id | cc5c6982-4910-471e-b864-1098015901b5 |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | ae7a98326b9c455588edd2656d723b9d |
| protected | False |
| schema | /v2/schemas/image |
| size | 13200896 |
| status | active |
| tags | |
| updated_at | 2015-03-26T16:52:10Z |
| virtual_size | None |
| visibility | public |
+------------------+------------------------------------------------------+
有關(guān) openstack image create 的參數(shù)雹舀,請(qǐng)參見 OpenStack 用戶指南中的 Create or update an image (glance)。
有關(guān)鏡像的磁盤和容器格式的信息粗俱,請(qǐng)參閱 OpenStack 虛擬機(jī)映像指南中的 Disk and container formats for images说榆。
OpenStack 動(dòng)態(tài)生成 IDs,因此您將在示例命令輸出中看到不同的值寸认。
4签财、確認(rèn)上傳鏡像和驗(yàn)證屬性:
$ openstack image list
+--------------------------------------+--------+--------+
| ID | Name | Status |
+--------------------------------------+--------+--------+
| 38047887-61a7-41ea-9b49-27987d5e8bb9 | cirros | active |
+--------------------------------------+--------+--------+