• [OpenStack] OpenStack Essex Glance api 的实验(curl)


    glance api 的实验(curl)

    参考文档:

    http://docs.openstack.org/api/openstack-image-service/1.0/content/requesting-detailed-metadata-on-public-vm-images.html

    http://glance.openstack.org/glanceapi.html

    http://glance.openstack.org/formats.html

    1、登录、获取 token

    curl -X POST -d ‘{“auth”: {“tenantName”: “admin”, “passwordCredentials”:{“username”: “admin”, “password”: “nova”}}}’ -H “Content-type: application/json” http://192.168.28.5:35357/v2.0/tokens | python -mjson.tool

    curl -X POST -d ‘{“auth”: {“tenantId”: “6a524dbe23dd4e4ab672cd163c85a27d”, “passwordCredentials”:{“username”: “admin”, “password”: “nova”}}}’ -H “Content-type: application/json” http://192.168.28.5:35357/v2.0/tokens | python -mjson.tool

    2、glance的api实验

    获取 images 列表
    curl -H “X-Auth-Token: 32efbc8c22af4ad6a8f03d051dc3413b” http://192.168.28.5:9292/v1/images |python -mjson.tool
    获取 images列表(详情)
    curl -H “X-Auth-Token: 32efbc8c22af4ad6a8f03d051dc3413b” http://192.168.28.5:9292/v1/images/detail |python -mjson.tool

    可以使用 name, container_format, disk_format, status, size_min, size_max进行帅选
    可以使用 sort_key 进行排序, sort_dir (asc, desc(缺省))决定正序、倒序

    获取某个image的详细Metadata:
    curl -I -X HEAD -H “X-Auth-Token: 32efbc8c22af4ad6a8f03d051dc3413b” http://192.168.28.5:9292/v1/images/32b518d8-2dcf-451a-9f8b-ccf5264e17f3
    下载某个image, 和上面的方法,相差就是 HEAD和 GET 的方法区别:
    curl -X GET -H “X-Auth-Token: 32efbc8c22af4ad6a8f03d051dc3413b” http://192.168.28.5:9292/v1/images/32b518d8-2dcf-451a-9f8b-ccf5264e17f3

    删除某个image:
    curl -X DELETE -H “X-Auth-Token: 32efbc8c22af4ad6a8f03d051dc3413b” http://192.168.28.5:9292/v1/images/258ad2d5-d48b-4f95-94f4-10e60ace6e67
    查看 image 的Memberships:
    curl -H “X-Auth-Token: 32efbc8c22af4ad6a8f03d051dc3413b” http://192.168.28.5:9292/v1/images/32b518d8-2dcf-451a-9f8b-ccf5264e17f3/members |python -mjson.tool

    查看某个 tenant 共享的image:
    curl -H “X-Auth-Token: 32efbc8c22af4ad6a8f03d051dc3413b” http://192.168.28.5:9292/v1/shared-images/admin |python -mjson.tool

    增加某个成员共享:
    curl -X PUT -H “X-Auth-Token: 32efbc8c22af4ad6a8f03d051dc3413b” http://192.168.28.5:9292/v1/images/32b518d8-2dcf-451a-9f8b-ccf5264e17f3/members/demo

    缺省,can_share 是false,可以加入body:
    {‘member’:
    {‘can_share’: true}
    }

    删除某个成员共享:
    curl -X DELETE -H “X-Auth-Token: 32efbc8c22af4ad6a8f03d051dc3413b” http://192.168.28.5:9292/v1/images/32b518d8-2dcf-451a-9f8b-ccf5264e17f3/members/demo

  • 相关阅读:
    实验10 使用PBR实现策略路由
    实验9 使用route-policy控制路由
    实验8 filter-policy过滤路由
    实验7 ISIS多区域配置
    实验6 IS-IS基本配置
    MySQL复制表
    mysql数据备份
    mysql 创建用户,授权
    数据库
    mysql 修改文件记录:
  • 原文地址:https://www.cnblogs.com/licheng/p/2534725.html
Copyright © 2020-2023  润新知