【问题标题】:Using Softlayer Object Filters for activeTransaction为 activeTransaction 使用 Softlayer 对象过滤器
【发布时间】:2017-01-17 03:18:12
【问题描述】:

我正在尝试使用 Python SoftLayer API 返回一个虚拟服务器列表,这些虚拟服务器在“RECLAIM_WAIT”状态(这是您删除一个Softlayer 中的虚拟服务器)。我期望取回所有根本没有 activeTransaction 的虚拟服务器,以及那些有 activeTransaction 但处于“RECLAIM_WAIT”以外状态的虚拟服务器。

我用我认为应该可以工作的过滤器调用 vs 管理器:

f={'virtualGuests': {'activeTransaction': {'transactionStatus': {'name': {'operation': '!= RECLAIM_WAIT'}}}}}
instance = vs.list_instances(hostname="node5-0",filter=f)

但它只返回具有 activeTransaction 的实例(包括具有 RECLAIM_WAIT 状态的实例)。

这是该调用返回的实例的示例:

[{'status': {'keyName': 'DISCONNECTED', 'name': 'Disconnected'}, 'datacenter': {'statusId': 2, 'id': 265592, 'name': 'xxxx ', 'longName': 'xxx'}, 'domain': 'xxxx', 'powerState': {'keyName': 'HALTED', 'name': 'Halted'}, 'maxCpu': 2, 'maxMemory' :8192,'主机名':'node5-0','primaryIpAddress':'xxxx','activeTransaction':{'modifyDate':'2017-01-16T05:20:01-06:00','statusChangeDate': '2017-01-16T05:20:01-06:00', 'elapsedSeconds': 22261, 'createDate': '2017-01-16T05:19:05-06:00', 'hardwareId': '', ' guestId': 27490599, 'id': 46204349, 'transactionStatus': {'friendlyName': '这是客户可以取消服务器的缓冲时间', 'name': 'RECLAIM_WAIT'}}, 'globalIdentifier': 'xx', 'primaryBackendIpAddress': 'xxx', 'id': xxx, 'fullyQualifiedDomainName': 'xxx'}]

我的过滤器做错了什么?

【问题讨论】:

    标签: python ibm-cloud-infrastructure


    【解决方案1】:

    您的请求没有任何问题,很遗憾,无法过滤其transactionStatus的交易,因为交易无权访问“transactionStatusId”键 ,可以查看交易数据类型,本地属性中不存在“transactionStatusId”。

    因此,最好的方法是直接在您的代码中进行过滤。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-05
      • 2017-10-19
      相关资源
      最近更新 更多