【发布时间】: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