繁体   English   中英

如何从中提取值 <bound method Server.diagnostics of <Server: ubuntu12_6> &gt;?

[英]how to extract values from <bound method Server.diagnostics of <Server: ubuntu12_6>>?

我正在使用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界面信息?

如输出所示, diagnostics是一种方法 这意味着您需要调用它!

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM