Looks like no, there is no such method. I'm not sure why reassigning is allowed, seems wrong to me.

Also I see you're using nova floating ip API. If you have neutron enabled in your environment you should avoid using nova network-related methods. There is an equivalent neutron call for this:
neutron floatingip-associate
but it has the same behavior.

13.10.2016 1:16, Derek Wood пишет:
Hi,

I have a question regarding using the compute "action" API to assign a
floating IP to a server
(http://developer.openstack.org/api-ref-compute-v2.1.html#addFloatingIp).
Using the API call below [1],  I am able to successfully assign a
floating IP to a server, even if the floating IP is already assigned
to another server.  My question is, is there a way or an equivalent
API that will fail if the floating IP is already assigned to another
node?

My use-case is that I have a couple processes running in parallel,
each provisioning instances with floating ips.  They often end up
querying for the list of available floating ips around the same time,
and request the same floating ip to be assigned to different
servers... both succeed, and last one "wins".  I'd like to find an API
call that will fail instead of reassign, so I can avoid implementing
some sort of inter-process synchronization on the client side.  Any
pointers appreciated.

Thanks,
-Derek

[1] $ curl -s -v -X POST -d @addfloatingip.json -H "Content-type:
application/json" -H "X-Auth-Token: $OS_TOKEN"
https://[hostname]:8774/v2/$OS_TENANT_NAME/servers/[uuid]/action

where addfloatingip.json:
{
     "addFloatingIp": {
         "address": "[ip-address]"
     }
}

where "ip-address" is a floating ip already assigned to another instance.

_______________________________________________
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to     : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


_______________________________________________
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to     : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack

Reply via email to