openstack 命令行管理二 - 镜像管理 (备忘)

帮助
[root@station140 ~(keystone_admin)]# glance help  | grep image
              [--os-image-url OS_IMAGE_URL] [-U OS_IMAGE_URL]
              [--os-image-api-version OS_IMAGE_API_VERSION]
    add                 DEPRECATED! Use image-create instead.
    delete              DEPRECATED! Use image-delete instead.
    details             DEPRECATED! Use image-list instead.
    image-create        Create a new image.
    image-delete        Delete specified image(s).
    image-download      Download a specific image.
    image-list          List images you can access.
    image-members       DEPRECATED! Use member-list instead.
    image-show          Describe a specific image.
    image-update        Update a specific image.
    index               DEPRECATED! Use image-list instead.
    member-create       Share a specific image with a tenant.
    member-delete       Remove a shared image from a tenant.
    member-images       DEPRECATED! Use member-list instead.
    member-list         Describe sharing permissions by image or tenant.
    show                DEPRECATED! Use image-show instead.
    update              DEPRECATED! Use image-update instead.


下载镜像或者自行创建 [ 略 ]

导入镜像方法

[root@localhost tmp]# source /root/keystonerc_admin

[root@localhost tmp(keystone_admin)]# glance image-create --name centos5.8_x86_64 --disk-format=qcow2 --container-format=bare --is-public=True --file=/tmp/centos5.8_x86_64_growroot_1.2_20131231.qcow2

+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 06de52dfbc2f582115b0c1981c2e3568     | 当前文件 md5 checksum 码
| container_format | bare                                 |
| created_at       | 2014-02-14T03:33:01                  | 导入时间
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | qcow2                                | 磁盘格式
| id               | 2aad80bf-6fbb-4348-bb20-2c07dbf4f687 | 当前磁盘唯一 ID 值
| is_public        | True                                 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | centos5.8_x86_64                     |
| owner            | e3a71a59840c4e88b8740b789c3afb9c     | 当前 openstack owner
| protected        | False                                |
| size             | 1151598592                           |
| status           | active                               |
| updated_at       | 2014-02-14T03:33:11                  |
+------------------+--------------------------------------+


列出当前可用镜像

[root@station140 ~(keystone_admin)]# glance image-list
+--------------------------------------+------------------+-------------+------------------+------------+--------+
| ID                                   | Name             | Disk Format | Container Format | Size       | Status |
+--------------------------------------+------------------+-------------+------------------+------------+--------+
| 2aad80bf-6fbb-4348-bb20-2c07dbf4f687 | centos5.8_x86_64 | qcow2       | bare             | 1151598592 | active |
| 2d6bb00d-002f-4675-ba84-73d90fdc1020 | cirros           | qcow2       | bare             | 13147648   | active |
+--------------------------------------+------------------+-------------+------------------+------------+--------+


[root@station140 ~(keystone_admin)]# glance details
================================================================================
URI: http://192.168.48.140:9292/v1/images/2aad80bf-6fbb-4348-bb20-2c07dbf4f687
Id: 2aad80bf-6fbb-4348-bb20-2c07dbf4f687
Public: Yes
Protected: No
Name: centos5.8_x86_64
Status: active
Size: 1151598592
Disk format: qcow2
Container format: bare
Minimum Ram Required (MB): 0
Minimum Disk Required (GB): 0
Owner: e3a71a59840c4e88b8740b789c3afb9c
Created at: 2014-02-14T03:33:01
Deleted at: None
Updated at: 2014-02-14T03:33:11
================================================================================


删除镜像

[root@station140 ~(keystone_admin)]# nova image-delete cirros





你可能感兴趣的:(openstack)