本文整理汇总了Python中cloudmesh_client.cloud.iaas.CloudProvider.CloudProvider.list_floating_ips方法的典型用法代码示例。如果您正苦于以下问题:Python CloudProvider.list_floating_ips方法的具体用法?Python CloudProvider.list_floating_ips怎么用?Python CloudProvider.list_floating_ips使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cloudmesh_client.cloud.iaas.CloudProvider.CloudProvider
的用法示例。
在下文中一共展示了CloudProvider.list_floating_ips方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_floating_ip_list
# 需要导入模块: from cloudmesh_client.cloud.iaas.CloudProvider import CloudProvider [as 别名]
# 或者: from cloudmesh_client.cloud.iaas.CloudProvider.CloudProvider import list_floating_ips [as 别名]
def get_floating_ip_list(cls, cloudname):
"""
Method to get the floating IP list
:param cloudname:
:return: floating_ips
"""
try:
cloud_provider = CloudProvider(cloudname).provider
floating_ips = cloud_provider.list_floating_ips()
return floating_ips
except Exception as ex:
Console.error(ex.message, ex)
示例2: get_unused_floating_ip_list
# 需要导入模块: from cloudmesh_client.cloud.iaas.CloudProvider import CloudProvider [as 别名]
# 或者: from cloudmesh_client.cloud.iaas.CloudProvider.CloudProvider import list_floating_ips [as 别名]
def get_unused_floating_ip_list(cls, cloudname):
"""
Method to get the unused floating IP list
:param cloudname:
:return: floating_ips
"""
try:
cloud_provider = CloudProvider(cloudname).provider
floating_ips = cloud_provider.list_floating_ips()
unused_floating_ips = list()
for floating_ip in list(floating_ips.values()):
if floating_ip["fixed_ip"] is None and \
floating_ip["instance_id"] is None:
# add to unused list
floating_ip["cloud"] = cloudname
unused_floating_ips.append(floating_ip)
return unused_floating_ips
except Exception as ex:
Console.error(ex.message)