如何从<bound method =“”server.diagnostics =“”of =“”<server:=“”ubuntu12_6 =“”>&gt;?</bound>中提取值

时间:2014-05-03 06:16:20

标签: python openstack-nova novaclient

我正在使用novaclient.v1_1来获取实例列表并尝试提取每个服务器实例的诊断信息。

我编写的代码

instances = nova.servers.list()
  for i in instances:
    val_list = i.diagnostics
    print val_list

所以这里我得到了像这样的输出

<bound method Server.diagnostics of <Server: ubuntu12_6>>
<bound method Server.diagnostics of <Server: ubuntu12_4>>
<bound method Server.diagnostics of <Server: ubuntu12_3>>
<bound method Server.diagnostics of <Server: ubuntu12_1>>

那么如何获得每个服务器实例的完整诊断信息?如何从这个对象中提取tap接口信息?

1 个答案:

答案 0 :(得分:1)

正如输出所示,diagnostics方法。这意味着你需要调用它!

instances = nova.servers.list()
  for i in instances:
    val_list = i.diagnostics()     # <---- Add parenthesis here
    print val_list