xudonglee 最近的时间轴更新
xudonglee

xudonglee

V2EX 第 164427 号会员,加入于 2016-03-22 17:24:08 +08:00
xudonglee 最近回复了
2017-03-15 11:03:48 +08:00
回复了 whx20202 创建的主题 云计算 问个 openstack Python SDK 的问题,如何获得虚拟机的卷对象?
@whx20202 查询虚机详细信息会有 volume 的信息的。

REQ: curl -i 'http://vip:8774/v2/ef6ebc7aa16648c2a0efb98122628baf/servers/db3f4554-bec7-4886-8d4c-099636a17bc6' -X GET -H "Accept: application/json" -H "User-Agent: python-novaclient" -H "X-Auth-Project-Id: admin" -H "X-Auth-Token: {SHA1}2ca61ee792030b177cc471490971259b59cc37fd"

RESP: [200] {'date': 'Wed, 15 Mar 2017 02:59:49 GMT', 'connection': 'keep-alive', 'content-type': 'application/json', 'content-length': '1547', 'x-compute-request-id': 'req-fc7ac3d6-782d-4bd5-bc80-8ab0cd78e0fe'}

RESP BODY: {"server": {"OS-EXT-STS:task_state": null, "addresses": {"test": [{"OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:33:1d:30", "version": 4, "addr": "10.100.111.8", "OS-EXT-IPS:type": "fixed"}]}, "links": [{"href": "http://vip:8774/v2/ef6ebc7aa16648c2a0efb98122628baf/servers/db3f4554-bec7-4886-8d4c-099636a17bc6", "rel": "self"}, {"href": "http://vip:8774/ef6ebc7aa16648c2a0efb98122628baf/servers/db3f4554-bec7-4886-8d4c-099636a17bc6", "rel": "bookmark"}], "image": "", "OS-EXT-STS:vm_state": "active", "OS-EXT-SRV-ATTR:instance_name": "instance-0000004b", "OS-SRV-USG:launched_at": "2017-03-13T08:37:03.000000", "flavor": {"id": "4", "links": [{"href": "http://vip:8774/ef6ebc7aa16648c2a0efb98122628baf/flavors/4", "rel": "bookmark"}]}, "id": "db3f4554-bec7-4886-8d4c-099636a17bc6", "security_groups": [{"name": "default"}], "user_id": "806551f9bbe343b4b6d7b9f6c454da3e", "OS-DCF:diskConfig": "MANUAL", "accessIPv4": "", "accessIPv6": "", "progress": 0, "OS-EXT-STS:power_state": 1, "OS-EXT-AZ:availability_zone": "nova", "config_drive": "", "status": "ACTIVE", "updated": "2017-03-13T08:37:03Z", "hostId": "fd2df24c3dca92371434d552eca10587df73e21961df4b700dc827b9", "OS-EXT-SRV-ATTR:host": "node3", "OS-SRV-USG:terminated_at": null, "key_name": null, "OS-EXT-SRV-ATTR:hypervisor_hostname": "node3", "name": "base-vm", "created": "2017-03-13T08:36:55Z", "tenant_id": "ef6ebc7aa16648c2a0efb98122628baf",

"os-extended-volumes:volumes_attached": [{"id": "df5a5781-7a40-48e2-946b-03ae15bb2b35"}, {"id": "fbb65753-1fef-4908-985f-42f35d02ba2d"}],

"metadata": {}}}

其中,"os-extended-volumes:volumes_attached"对应的列表中的卷 id 就是你要的。
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5531 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms · UTC 07:07 · PVG 15:07 · LAX 23:07 · JFK 02:07
Developed with CodeLauncher
♥ Do have faith in what you're doing.