Hi Udara,
In your code, you are using ip("192.168.16.66"). This seems to indicate that
you have this IP already created somehow. Not sure if it will work this way.
Try changing it to use pool(publicPoolName) and see if it works.
Regards,
Ambadas Ramanna Adam
From: Udara Liyanage [mailto:[email protected]]
Sent: Thursday, September 11, 2014 12:27 PM
To: [email protected]
Subject: Re: How to get reference to FloatingIpAPI in Neutron
Hi,
Thanks for the help.
In my Openstack setup there are two networks.
When creating the instance I specify both networks so instance get private ips
from both networks.
1. Set<String> novaNetworksSet = new LinkedHashSet<String>(2);
2.
3. novaNetworksSet.add("uuid_of_network1");
4. novaNetworksSet.add("uuid_of_network2");
5.
template.getOptions().as(NovaTemplateOptions.class).networks(novaNetworksSet);
Creating floating Ips.
privateIp1 and privateIp2 refers to the two private IPs allocated for the
instance
1. FloatingIP publicIP1 = FloatingIP.builder().instanceId(instanceId).
2. fixedIp(privateIp1).
3. id("927b976e-0666-4039-9c38-df5b8366cce4").
4. ip("192.168.16.66").
5. instanceId("231c1871-0b54-4af6-afe6-c868b44c2307").
6. build();
7.
8. FloatingIP publicIP2 = FloatingIP.builder().instanceId(instanceId).
9. fixedIp(privateIp2).
10.
id("2de964d3-1e6b-45fc-b870-55b82cc21ab1").ip("192.168.16.64").
11. instanceId("231c1871-0b54-4af6-afe6-c868b44c2307").
12. build();
The problem is both
floatingIpApi.addToServer(publicIP1.getIp(), node.getProviderId()) and
floatingIpApi.addToServer(publicIP2.getIp(), node.getProviderId())
associates the floating ip for the same interface.
Still I am unable to allocate the floatingIp to the specified network interface.
On Wed, Sep 10, 2014 at 1:07 PM, Ambadas Ramanna Adam
<[email protected]<mailto:[email protected]>> wrote:
Hi Udara,
As per [1], you were asking for REST APIs. If you want to use REST APIs, then
Dave’s answer seems correct, though haven’t used it.
If you are using JClouds API and want to associate a floating IP to a server
with multiple nics, then, you will have to use the fixed IP associated with
that nic.
Ex.
FloatingIP _publicIP =
FloatingIP.Builder().instanceId(_instanceID).fixedIp(_fixedPrivateIP).pool(_publicIPPoolName).build();
Regards,
Ambadas Ramanna Adam
From: Udara Liyanage
[mailto:[email protected]<mailto:[email protected]>]
Sent: Wednesday, September 10, 2014 12:39 PM
To: [email protected]<mailto:[email protected]>
Subject: Re: How to get reference to FloatingIpAPI in Neutron
Hi Ambadas,
I think I am bit confused here.
Please refer to my requirement on [1]. There I was suggested to use Openstack
Neutron API to associate floating IPs by specifying port information. Shouldn't
I use Jclouds Neutron in this case to create floating ip s.
[1]
http://stackoverflow.com/questions/25637605/openstack-neutron-specify-a-network-interface-when-associating-a-floating-ip
On Wed, Sep 10, 2014 at 12:21 PM, Ambadas Ramanna Adam
<[email protected]<mailto:[email protected]>> wrote:
Hi Udara,
JClouds has FloatingIPApi in package org.jclouds.openstack.nova.v2_0.extensions.
You can get hold of FloatingIPApi (not FloatingIpAPI, mind the p in IP!) like
below.
com.google.common.base.Optional<? extends FloatingIPApi>
NovaApi.getFloatingIPExtensionForZone(String zone)
Hope this helps.
regards,
Ambadas Ramanna Adam
From: Udara Liyanage
[mailto:[email protected]<mailto:[email protected]>]
Sent: Wednesday, September 10, 2014 12:07 PM
To: [email protected]<mailto:[email protected]>
Subject: How to get reference to FloatingIpAPI in Neutron
Hi,
I was able to get reference to PortAPI and NetworkAPi, but not to
FloatingIpAPI. Any help is appriciated.
neutronApi = ContextBuilder.newBuilder(provider)
.credentials(identity, password)
.endpoint(endpoint)
.modules(modules)
.buildApi(NeutronApi.class);
I am using Jclouds 1.8.0 version.
--
Udara S.S Liyanage.
Software Engineer at WSO2.
Commiter and PPMC Member of Apache Stratos.
Blog - http://udaraliyanage.wordpress.com<http://udaraliyanage.wordpress.com/>
phone: +94 71 443 6897<tel:%2B94%2071%20443%206897>
**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
for the use of the addressee(s). If you are not the intended recipient, please
notify the sender by e-mail and delete the original message. Further, you are
not
to copy, disclose, or distribute this e-mail or its contents to any other
person and
any such actions are unlawful. This e-mail may contain viruses. Infosys has
taken
every reasonable precaution to minimize this risk, but is not liable for any
damage
you may sustain as a result of any virus in this e-mail. You should carry out
your
own virus checks before opening the e-mail or attachment. Infosys reserves the
right to monitor and review the content of all messages sent to or from this
e-mail
address. Messages sent to or from this e-mail address may be stored on the
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***
--
Udara S.S Liyanage.
Software Engineer at WSO2.
Commiter and PPMC Member of Apache Stratos.
Blog - http://udaraliyanage.wordpress.com<http://udaraliyanage.wordpress.com/>
phone: +94 71 443 6897<tel:%2B94%2071%20443%206897>
--
Udara S.S Liyanage.
Software Engineer at WSO2.
Commiter and PPMC Member of Apache Stratos.
Blog - http://udaraliyanage.wordpress.com<http://udaraliyanage.wordpress.com/>
phone: +94 71 443 6897