rackspace cloudfiles servicenet

223 views
Skip to first unread message

Ross

unread,
Oct 30, 2012, 6:57:03 PM10/30/12
to jcl...@googlegroups.com
Hi,

I have just started to use jclouds to work with cloudfiles in rackspace.
So far I have managed to get synchronous and async upload working, but I have been unable to find out how to configure jclouds to use the rackspace servicenet address for access (as I understand it there is a significant cost advantage to use snet for data uploaded from within the rackspace datacentre).

I can see that the selected Endpoint contains both the publicURL (https://storage101.ord1.clouddrive.com/...) and the internalURL (https://snet-storage101.ord1.clouddrive.com/).
The internalURL contains the servicenet address that I need to use for upload.

Is there a way to configure jclouds to use servicenet?
If not, what code would I need to write to use the snet address? I see that the EndpointToSupplierURI is configured to use PublicURLOrInternalIfNull - can I write a different implementation and then hook it into jclouds somehow?

I am using jclouds 1.5.2, and using the provider 'cloudfiles-us'.

Thanks for any help
Ross

Adrian Cole

unread,
Oct 30, 2012, 7:41:33 PM10/30/12
to jcl...@googlegroups.com, jclou...@googlegroups.com
surprisingly, I don't see an issue on this, though I'm sure we discussed it.

http://code.google.com/p/jclouds/issues/list?q=internalUrl

As a temporary patch, you can make a guice module that sorts this.

ex.

public class ForceInternalUrlModule extends AbstractModule {
private static class InternalOnly extends PublicURLOrInternalIfNull {
// override logic
}

public void configure(){
bind(PublicURLOrInternalIfNull.class).to(InternalOnly.class);
}
}

then, in ContextBuilder, pass ForceInternalUrlModule to the modules method.

Make sense?
-A
> --
> You received this message because you are subscribed to the Google Groups
> "jclouds" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/jclouds/-/Um140vnw4MUJ.
> To post to this group, send email to jcl...@googlegroups.com.
> To unsubscribe from this group, send email to
> jclouds+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/jclouds?hl=en.

Ross

unread,
Oct 30, 2012, 8:27:07 PM10/30/12
to jcl...@googlegroups.com, jclou...@googlegroups.com
Thanks, that works.

Do you want me to raise an issue for this?

For reference for anybody else wanting to do this, my code is:

public class RackspaceServicenetModule extends AbstractModule {

    @Override
    protected void configure() {
        bind(EndpointToSupplierURI.class).to(InternalURLSupplier.class);
    }

    @Singleton
    public static class InternalURLSupplier implements EndpointToSupplierURI {
        @Override
        public Supplier<URI> apply(Endpoint input) {

            System.err.println("InternalURLSupplier:" + input);
            return Suppliers.ofInstance(input.getInternalURL() != null ? input.getInternalURL() : input.getPublicURL());
        }

        public String toString() {
            return "supplyInternalURL()";
        }
    }
}

...
        ProviderMetadata provider = Providers.withId("cloudfiles-us");
        ContextBuilder builder = ContextBuilder.newBuilder(provider).credentials(userName, apiKey);
        if (useServicenet) {
            builder.modules(ImmutableSet.<Module>of(new RackspaceServicenetModule()));
        }
        return builder.build(BlobStoreContext.class);



Thanks,
Ross

Adrian Cole

unread,
Oct 30, 2012, 8:30:33 PM10/30/12
to jcl...@googlegroups.com, jclou...@googlegroups.com
Yeah, please do. Thanks for sharing the workaround, Ross!
-A
> https://groups.google.com/d/msg/jclouds/-/UYJunQFs5WIJ.

Ross

unread,
Oct 30, 2012, 9:50:45 PM10/30/12
to jcl...@googlegroups.com, jclou...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages