【问题标题】:how to extract values from <bound method Server.diagnostics of <Server: ubuntu12_6>>?如何从 <Server: ubuntu12_6>> 的 <bound method Server.diagnostics 中提取值?
【发布时间】:2014-05-03 06:16:20
【问题描述】:

我正在使用 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>>

那么我怎样才能获得每个服务器实例的完整诊断信息?如何从这个对象中提取点击界面信息?

【问题讨论】:

    标签: python openstack-nova novaclient


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2017-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-08
      • 2015-12-16
      • 2021-03-14
      • 2020-09-21
      相关资源
      最近更新 更多