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
================================================================================


查询某个镜像详细信息方法

glance image-show 0c47db9c-5f74-4544-8ada-0894c1d2c20c
+------------------------+--------------------------------------+
| Property               | Value                                |
+------------------------+--------------------------------------+
| Property 'description' | Windows7#_#                          |
| checksum               | eaa3a3a6dfe605f6292675018d41afdf     |
| container_format       | bare                                 |
| created_at             | 2014-09-25T08:33:46                  |
| deleted                | False                                |
| disk_format            | qcow2                                |
| id                     | 0c47db9c-5f74-4544-8ada-0894c1d2c20c |
| is_public              | True                                 |
| min_disk               | 0                                    |
| min_ram                | 0                                    |
| name                   | Win7                                 |
| owner                  | 3bf7f92c8b1449a8814b1cf15e1d1cda     |
| protected              | False                                |
| size                   | 3547856896                           |
| status                 | active                               |
| updated_at             | 2015-06-12T05:24:54                  |
+------------------------+--------------------------------------+



删除镜像

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


下载镜像

[root@station140~(keystone_admin)]# glance image-download--file /tmp/ centos5.8_x86_64.qcow2   2aad80bf-6fbb-4348-bb20-2c07dbf4f687




  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Terry_Tsang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值