next up previous contents
Next: 區塊儲存 Cinder Up: Image 服務 Glance Previous: Glance 安裝   Contents

新增作業系統 image 到 Glance

  1. 導入 admin 環境變數。
    [root@kvm4 ~]# source keystonerc_admin 
    [root@kvm4 ~(keystone_admin)]#
    
  2. 上傳作業系統 image,目前 glance 只接受 http,不支援 ftp。
    [root@kvm4 ~(keystone_admin)]# glance image-create \
    --name "minkvm" \
    --is-public True \
    --disk-format qcow2 \
    --container-format bare \
    --copy-from http://deyu.wang/minkvm.qcow2
    +------------------+--------------------------------------+
    | Property         | Value                                |
    +------------------+--------------------------------------+
    | checksum         | None                                 |
    | container_format | bare                                 |
    | created_at       | 2014-01-24T19:29:18                  |
    | deleted          | False                                |
    | deleted_at       | None                                 |
    | disk_format      | qcow2                                |
    | id               | 7d4b5a3d-2ce5-4d6d-b35d-c21675693a95 |
    | is_public        | True                                 |
    | min_disk         | 0                                    |
    | min_ram          | 0                                    |
    | name             | minkvm                               |
    | owner            | a57da7d8a5f944c9b6258d0d91b8dee2     |
    | protected        | False                                |
    | size             | 0                                    |
    | status           | queued                               |
    | updated_at       | 2014-01-24T19:29:18                  |
    +------------------+--------------------------------------+
    
  3. 列出可用的 image,其狀態為存檔中。
    [root@kvm4 ~(keystone_admin)]# glance image-list
    +--------------------------------------+--------+-------------+------------------+-----------+--------+
    | ID                                   | Name   | Disk Format | Container Format | Size      | Status |
    +--------------------------------------+--------+-------------+------------------+-----------+--------+
    | 79e088a9-0d8c-40fc-b5d5-13865cc891d2 | minkvm | qcow2       | bare             | 941756416 | saving |
    +--------------------------------------+--------+-------------+------------------+-----------+--------+
    
  4. 列出可用的 image minkvm 細部資訊。
    [root@kvm4 ~(keystone_admin)]# glance image-show minkvm
    +------------------+--------------------------------------+
    | Property         | Value                                |
    +------------------+--------------------------------------+
    | checksum         | b01710b20d305795d3a834cd3e01d62b     |
    | container_format | bare                                 |
    | created_at       | 2014-01-24T19:31:49                  |
    | deleted          | False                                |
    | disk_format      | qcow2                                |
    | id               | 79e088a9-0d8c-40fc-b5d5-13865cc891d2 |
    | is_public        | True                                 |
    | min_disk         | 0                                    |
    | min_ram          | 0                                    |
    | name             | minkvm                               |
    | owner            | a57da7d8a5f944c9b6258d0d91b8dee2     |
    | protected        | False                                |
    | size             | 941756416                            |
    | status           | active                               |
    | updated_at       | 2014-01-24T19:32:01                  |
    +------------------+--------------------------------------+
    
  5. 經過一段時間,再列出 image minkvm,狀態已變為 active。
    [root@kvm4 ~(keystone_admin)]# glance image-list
    +--------------------------------------+--------+-------------+------------------+-----------+--------+
    | ID                                   | Name   | Disk Format | Container Format | Size      | Status |
    +--------------------------------------+--------+-------------+------------------+-----------+--------+
    | 79e088a9-0d8c-40fc-b5d5-13865cc891d2 | minkvm | qcow2       | bare             | 941756416 | active |
    +--------------------------------------+--------+-------------+------------------+-----------+--------+
    



2015-12-29