- 載入管理者環境變變數。
[root@ip112 ~]# . admin.token
- 取得 VM image 檔,如果只是測試,可以下載 cirros image。
[root@ip112 ~]# wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
- 取得 crtusb.qcow2。
[root@ip112 ~]# scp 163.17.27.219:/var/lib/libvirt/images/crtusb.qcow2 .
root@163.17.27.219's password:
crtusb.qcow2 100% 3165MB 11.2MB/s 04:42
- 上傳 crtusb.qcow2 到 image 服務,disk 格式為 qcow2,container 格式為 bare,public 讓所有 project 可以存取。
[root@ip112 ~]# openstack image create "crtusb" --file crtusb.qcow2 \
--disk-format qcow2 --container-format bare --public
+------------------+------------------------------------------------------+
| Field | Value |
+------------------+------------------------------------------------------+
| checksum | 0c7385b6fabaf8b17cba5d0ede98abe2 |
| container_format | bare |
| created_at | 2018-05-24T13:55:20Z |
| disk_format | qcow2 |
| file | /v2/images/e4bea3db-581a-472d-a0dd-37b1e7055bbf/file |
| id | e4bea3db-581a-472d-a0dd-37b1e7055bbf |
| min_disk | 0 |
| min_ram | 0 |
| name | crtusb |
| owner | e28adc716118434c96b5833867faa08c |
| protected | False |
| schema | /v2/schemas/image |
| size | 3318743040 |
| status | active |
| tags | |
| updated_at | 2018-05-24T13:55:33Z |
| virtual_size | None |
| visibility | public |
+------------------+------------------------------------------------------+
- 列出 image,確認上傳的 crtusb 可用。
[root@ip112 ~]# openstack image list
+--------------------------------------+--------+--------+
| ID | Name | Status |
+--------------------------------------+--------+--------+
| e4bea3db-581a-472d-a0dd-37b1e7055bbf | crtusb | active |
+--------------------------------------+--------+--------+