openstack team mailing list archive
-
openstack team
-
Mailing list archive
-
Message #15808
Re: Cannot associate/dissociate an floating IP to an instance from API
it is an action on a server so you want:
v2/{tenant_id}/servers/{server_id}/action
{
"addFloatingIp": {"address": "10.100.20.7"}
}
Python-novaclient is very helpfel for this kind of thing try nova --debug add-flaoting-ip <server> <address>:
…
REQ: curl -i http://192.168.27.100:8774/v2/cd1a46fd42ab43c9a8e9465e0df3807b/servers/02d5dcfd-e84e-4c74-9c09-5b0f52962a1c/action -X POST -H "X-Auth-Project-Id: demo" -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: 299d0eeca66e4576a5b53e0b06977360"
REQ BODY: {"addFloatingIp": {"address": "192.168.27.129"}}
RESP:{'date': 'Tue, 14 Aug 2012 07:07:09 GMT', 'status': '202', 'content-length': '0', 'content-type': 'text/html; charset=UTF-8'}
…
Vish
On Aug 13, 2012, at 8:35 PM, Sam Su <susltd.su@xxxxxxxxx> wrote:
> Hi,
>
> I am trying to associate an floating IP to an instance from API in my Essex environment, and get the error "404 Not Found". I found someone have filed an invalid bug (the link is https://bugs.launchpad.net/nova/+bug/917064), I followed the information and tried several request formats as below, but all are failed.
>
> 1. curl -k -D - -H "X-Auth-Token: 7f48c07af3b842d1b9c0f15a37ddd956" -X 'POST' -d @test.json -v http://localhost:8774/v1.1/53869b3cd0cc40a28a826422a37622da/os-floating-ips/1/associate -H 'Content-type: application/json'
>
> The file test.json:
> {
> "associate_address" : {
> "fixed_ip" : "192.168.20.3"
> }
> }
>
> 2. curl -k -D - -H "X-Auth-Token: 7f48c07af3b842d1b9c0f15a37ddd956" -X 'POST' -d @test.json -v http://localhost:8774/v1.1/53869b3cd0cc40a28a826422a37622da/os-floating-ips/1/action -H 'Content-type: application/json'
>
> The file test.json:
> {
> "addFloatingIp": {
> "address" : "10.100.20.17"
> },
> "associate_address" : {
> "fixed_ip" : "192.168.20.3"
> }
> }
>
> 3. curl -k -D - -H "X-Auth-Token: 7f48c07af3b842d1b9c0f15a37ddd956" -X 'POST' -d @test.json -v http:// localhost:8774/v1.1/53869b3cd0cc40a28a826422a37622da/os-floating-ips/1/addFloatingIp -H 'Content-type: application/json'
>
> The file test.json:
> {
> "associate_address" : {
> "fixed_ip" : "192.168.20.3"
> }
> }
>
> I am wondering what is the correct request format or just a bug? It will be much appreciated if someone can give me some hints.
>
> Thanks,
> Sam
>
>
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help : https://help.launchpad.net/ListHelp
References