[英]Nova Python Client - List available IP addresses
I have been using: 我一直在使用:
nova.floating_ips.list()
to retrieve all known floating IP addresses within my OpenStack deployment, is there a known way to retrieve only the available IP addresses? 要检索我的OpenStack部署中的所有已知浮动IP地址,是否有一种仅检索可用IP地址的已知方法? That is I don't want IP addresses that have already been assigned.
那就是我不要已经分配的IP地址。
The floating_ips.list()
method returns a list of floating ips, where each address has the following attributes: floating_ips.list()
方法返回一个浮动ip列表,其中每个地址都具有以下属性:
fixed_ip
id
instance_id
ip
pool
If you filter the list of address with instance_id is None
, you'll get a list of floating ips that are not currently in use: 如果您过滤
instance_id is None
的地址列表,则将获得当前未使用的浮动ip列表:
unused_ips = [addr for addr in nova.floating_ips.list() if addr.instance_id is None]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.