CirrOS を使用して、Image service の動作を検証します。 Cirros は、OpenStack 環境のテストに役立つ軽量な Linux イメージです。
For more information about how to download and build images, see OpenStack Virtual Machine Image Guide. For information about how to manage images, see the OpenStack User Guide.
注釈
これらのコマンドをコントローラーノードで実行します。
各クライアント環境スクリプトにおいて、API version 2.0 を使用するよう Image service クライアントを設定します。
$ echo "export OS_IMAGE_API_VERSION=2" \
| tee -a admin-openrc.sh demo-openrc.sh
admin クレデンシャルを読み込み、管理者専用 CLI コマンドへのアクセス権を取得します。
$ source admin-openrc.sh
ソースイメージをダウンロードします。
$ wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
注釈
wget がお使いのディストリビューションでインストールされていない場合はインストールしてください。
ダウンロードしたイメージを、 QCOW2 ディスク形式、bare コンテナー形式、パブリック公開で Image service にアップロードします。パブリック公開を指定すると、すべてのプロジェクトがこのイメージにアクセスできます。
$ glance image-create --name "cirros" \
--file cirros-0.3.4-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
--visibility public --progress
[=============================>] 100%
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | 133eae9fb1c98f45894a4e60d8736619 |
| container_format | bare |
| created_at | 2015-03-26T16:52:10Z |
| disk_format | qcow2 |
| id | 38047887-61a7-41ea-9b49-27987d5e8bb9 |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | ae7a98326b9c455588edd2656d723b9d |
| protected | False |
| size | 13200896 |
| status | active |
| tags | [] |
| updated_at | 2015-03-26T16:52:10Z |
| virtual_size | None |
| visibility | public |
+------------------+--------------------------------------+
glance image-create のパラメーターの詳細は OpenStack Command-Line Interface Reference の Image service command-line client を参照してください。
イメージのディスクとコンテナー形式に関する詳細は、OpenStack 仮想マシンイメージガイド の イメージのディスク形式とコンテナー形式 を参照してください。
注釈
OpenStack は ID を動的に生成します。そのため、このコマンド実行結果例と別の値になるでしょう。
イメージがアップロードされたことを確認し、属性を検証します。
$ glance image-list
+--------------------------------------+--------+
| ID | Name |
+--------------------------------------+--------+
| 38047887-61a7-41ea-9b49-27987d5e8bb9 | cirros |
+--------------------------------------+--------+
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.