Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Associating a public IP for an Openstack-nova instance
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post will appear after it is approved by moderators
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nirmal Fernando  
View profile  
 More options Nov 8 2012, 11:36 pm
From: Nirmal Fernando <nir...@wso2.com>
Date: Fri, 9 Nov 2012 10:06:06 +0530
Local: Thurs, Nov 8 2012 11:36 pm
Subject: Associating a public IP for an Openstack-nova instance

Hi,

I want to do $subject.

I found following code does floating IP allocation.

novaClient.getFloatingIPExtensionForZone(region).get().allocate()

But does this means that this IP associated to the particular node that is
just started? It seems not. In that case, how can I associate the IP?

--

Thanks & regards,
Nirmal

Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: +94715779733
Blog: http://nirmalfdo.blogspot.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adrian Cole  
View profile  
 More options Nov 9 2012, 1:30 am
From: Adrian Cole <adrian.f.c...@gmail.com>
Date: Fri, 9 Nov 2012 03:30:54 -0300
Local: Fri, Nov 9 2012 1:30 am
Subject: Re: Associating a public IP for an Openstack-nova instance

You can set a property to enable auto up allocation.  Check out below:

https://github.com/jclouds/jclouds/blob/master/providers/hpcloud-comp...
On Nov 9, 2012 1:36 AM, "Nirmal Fernando" <nir...@wso2.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nirmal Fernando  
View profile  
 More options Nov 9 2012, 1:57 am
From: Nirmal Fernando <nir...@wso2.com>
Date: Fri, 9 Nov 2012 12:27:21 +0530
Local: Fri, Nov 9 2012 1:57 am
Subject: Re: Associating a public IP for an Openstack-nova instance

Hi Adrian,

On Fri, Nov 9, 2012 at 12:00 PM, Adrian Cole <adrian.f.c...@gmail.com>wrote:

> You can set a property to enable auto up allocation.  Check out below:

I want to get rid of auto allocation of IPs.

> https://github.com/jclouds/jclouds/blob/master/providers/hpcloud-comp...
> On Nov 9, 2012 1:36 AM, "Nirmal Fernando" <nir...@wso2.com> wrote:

>>  Hi,

>> I want to do $subject.

>> I found following code does floating IP allocation.

>> novaClient.getFloatingIPExtensionForZone(region).get().allocate()

Is only this what I needed to do? or is there another API call to make this
IP associated with the node?

--

Thanks & regards,
Nirmal

Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: +94715779733
Blog: http://nirmalfdo.blogspot.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Everett Toews  
View profile  
 More options Nov 9 2012, 9:19 am
From: Everett Toews <everett.to...@RACKSPACE.COM>
Date: Fri, 9 Nov 2012 14:19:20 +0000
Local: Fri, Nov 9 2012 9:19 am
Subject: Re: Associating a public IP for an Openstack-nova instance

To disable auto allocation of IPs you need to override the property.

Properties overrides = new Properties();
overrides.setProperty(NovaProperties.AUTO_ALLOCATE_FLOATING_IPS, "false");

ComputeServiceContext context = ContextBuilder.newBuilder(provider)
  .credentials(identity, key)
  .overrides(overrides)
  .modules(modules)
  .buildView(ComputeServiceContext.class);
compute = context.getComputeService();
nova = context.unwrap();

To learn how to use the FloatingIPApi first have a look at the Javadoc [1] to see what you can do with the API.

Regards,
Everett

[1] http://demobox.github.com/jclouds-maven-site-1.5.2/1.5.2/jclouds-mult...

From: Nirmal Fernando <nir...@wso2.com<mailto:nir...@wso2.com>>
Reply-To: "jclouds@googlegroups.com<mailto:jclouds@googlegroups.com>" <jclouds@googlegroups.com<mailto:jclouds@googlegroups.com>>
Date: Friday, November 9, 2012 12:57 AM
To: "jclouds@googlegroups.com<mailto:jclouds@googlegroups.com>" <jclouds@googlegroups.com<mailto:jclouds@googlegroups.com>>
Subject: Re: Associating a public IP for an Openstack-nova instance

Hi Adrian,

On Fri, Nov 9, 2012 at 12:00 PM, Adrian Cole <adrian.f.c...@gmail.com<mailto:adrian.f.c...@gmail.com>> wrote:

You can set a property to enable auto up allocation.  Check out below:

I want to get rid of auto allocation of IPs.

https://github.com/jclouds/jclouds/blob/master/providers/hpcloud-comp...

On Nov 9, 2012 1:36 AM, "Nirmal Fernando" <nir...@wso2.com<mailto:nir...@wso2.com>> wrote:
Hi,

I want to do $subject.

I found following code does floating IP allocation.

novaClient.getFloatingIPExtensionForZone(region).get().allocate()

Is only this what I needed to do? or is there another API call to make this IP associated with the node?

But does this means that this IP associated to the particular node that is just started? It seems not. In that case, how can I associate the IP?

--

Thanks & regards,
Nirmal

Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: +94715779733<tel:%2B94715779733>
Blog: http://nirmalfdo.blogspot.com/

--
You received this message because you are subscribed to the Google Groups "jclouds" group.
To post to this group, send email to jclouds@googlegroups.com<mailto:jclouds@googlegroups.com>.
To unsubscribe from this group, send email to jclouds+unsubscribe@googlegroups.com<mailto:jclouds%2Bunsubscribe@googlegro ups.com>.
For more options, visit this group at http://groups.google.com/group/jclouds?hl=en.

--
You received this message because you are subscribed to the Google Groups "jclouds" group.
To post to this group, send email to jclouds@googlegroups.com<mailto:jclouds@googlegroups.com>.
To unsubscribe from this group, send email to jclouds+unsubscribe@googlegroups.com<mailto:jclouds%2Bunsubscribe@googlegro ups.com>.
For more options, visit this group at http://groups.google.com/group/jclouds?hl=en.

--

Thanks & regards,
Nirmal

Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: +94715779733
Blog: http://nirmalfdo.blogspot.com/

--
You received this message because you are subscribed to the Google Groups "jclouds" group.
To post to this group, send email to jclouds@googlegroups.com<mailto:jclouds@googlegroups.com>.
To unsubscribe from this group, send email to jclouds+unsubscribe@googlegroups.com<mailto:jclouds+unsubscribe@googlegroup s.com>.
For more options, visit this group at http://groups.google.com/group/jclouds?hl=en.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nirmal Fernando  
View profile  
 More options Nov 19 2012, 1:24 am
From: Nirmal Fernando <nir...@wso2.com>
Date: Mon, 19 Nov 2012 11:53:41 +0530
Local: Mon, Nov 19 2012 1:23 am
Subject: Re: Associating a public IP for an Openstack-nova instance

I am using JClouds 1.5.0 and here's how I've done the IP association.

public String associateAddress(IaasProvider iaasInfo, NodeMetadata node) {

        ComputeServiceContext context =
iaasInfo.getComputeService().getContext();
        @SuppressWarnings("unchecked")
        RestContext<NovaClient, NovaAsyncClient> restContext =
context.unwrap(RestContext.class);

        NovaClient novaClient = restContext.getApi();
        String region = ComputeServiceBuilderUtil.extractRegion(iaasInfo);

        FloatingIPClient floatingIp =
novaClient.getFloatingIPExtensionForZone(region).get();

        String ip;
        try {
            ip = floatingIp.allocate().getIp();

        } catch (InsufficientResourcesException e) {
            ArrayList<FloatingIP> unassignedIps =

Lists.newArrayList(Iterables.filter(floatingIp.listFloatingIPs(),

new Predicate<FloatingIP>() {

@Override

public boolean apply(FloatingIP arg0) {

return arg0.getFixedIp() == null;

                                                                          }

}));

            // try to prevent multiple parallel launches from choosing the
same
            // ip.
            Collections.shuffle(unassignedIps);
            ip = Iterables.getLast(unassignedIps).getIp();
        }

        // wait till the fixed IP address gets assigned - this is needed
before we associate a public IP
        do{
            try {
                Thread.sleep(1000);
            } catch (InterruptedException ignore) {}
        }
        while(node.getPrivateAddresses() == null);

        floatingIp.addFloatingIPToServer(ip, node.getProviderId());

NodeMetadataBuilder.fromNodeMetadata(node).publicAddresses(ImmutableSet.of( ip)).build();

        log.info("Successfully associated an IP address "+ip+" for node
with id: "+node.getId());

        return ip;
    }

===========
Note that above 'wait' is needed or else, you'll encounter following issue.

Caused by: org.jclouds.http.HttpResponseException: command: POST
http://192.168.16.20:8774/v2/8cxxxxxxxxxxxx40a821exxxxxxxx/servers/01...
failed with response: HTTP/1.1 400 Bad Request; content:
[{"badRequest": {"message": "No fixed ips associated to instance", "code":
400}}]
    at
org.jclouds.openstack.nova.v2_0.handlers.NovaErrorHandler.handleError(NovaE rrorHandler.java:48)
    at
org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErro rHandler.java:69)
    at
org.jclouds.http.internal.BaseHttpCommandExecutorService$HttpResponseCallab le.shouldContinue(BaseHttpCommandExecutorService.java:197)
    at
org.jclouds.http.internal.BaseHttpCommandExecutorService$HttpResponseCallab le.call(BaseHttpCommandExecutorService.java:167)
    at
org.jclouds.http.internal.BaseHttpCommandExecutorService$HttpResponseCallab le.call(BaseHttpCommandExecutorService.java:135)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.j ava:886)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java: 908)
    at java.lang.Thread.run(Thread.java:662)

One suggestion : this floating API's Java doc needs a revisit.. Its wording
is bit confusing. (My personal thought, just for your attention)

Thanks everyone for all the tips!! :-)

On Fri, Nov 9, 2012 at 7:49 PM, Everett Toews
<everett.to...@rackspace.com>wrote:

--

Thanks & regards,
Nirmal

Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: +94715779733
Blog: http://nirmalfdo.blogspot.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adrian Cole  
View profile  
 More options Nov 24 2012, 1:36 pm
From: Adrian Cole <adrian.f.c...@gmail.com>
Date: Sat, 24 Nov 2012 10:36:04 -0800
Local: Sat, Nov 24 2012 1:36 pm
Subject: Re: Associating a public IP for an Openstack-nova instance
thanks for posting the solution!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »