Question

I wrote code that uses jclouds' HP cloud compute service, and everything worked well.

Yesterday I opened a new account on HP, and the code failed. Getting an error about version - so I assume HP upgraded their openstack version, however I can't find documentation anywhere to what should be changed in jclodus.

This is my code

  public static ComputeServiceContext createJcloudsContext(String project, String key, String secretKey ) {
    ServerConfig serverConfig = ApplicationContext.get().conf().server;
    ComputeServiceContext context;
    Properties overrides = new Properties();
    overrides.put("jclouds.keystone.credential-type", "apiAccessKeyCredentials");
    context = ContextBuilder.newBuilder( serverConfig.cloudProvider.label )
            .credentials( project + ":" + key, secretKey )
            .overrides(overrides)
            .buildView(ComputeServiceContext.class);
    return context;
}

And this is the error

java.util.NoSuchElementException: no endpoints for apiType compute are of version 1.1, or version agnostic: [Service{type=compute, name=Compute, endpoints=[Endpoint{versionId=2, region=region-a.geo-1, publicURL=https://region-a.geo-1.compute.hpcloudsvc.com/v2/10050594585198, internalURL=null, adminURL=null, versionInfo=https://region-a.geo-1.compute.hpcloudsvc.com/v2/, versionList=https://region-a.geo-1.compute.hpcloudsvc.com, tenantId=10050594585198}, Endpoint{versionId=2, region=region-b.geo-1, publicURL=https://region-b.geo-1.compute.hpcloudsvc.com/v2/10050594585198, internalURL=null, adminURL=null, versionInfo=https://region-b.geo-1.compute.hpcloudsvc.com/v2/, versionList=https://region-b.geo-1.compute.hpcloudsvc.com, tenantId=10050594585198}]}]

EDIT: Barak's answer was good for the code snippet I posted - minimal code snippet for reproduction. It seems that afterwards I get the same error for another line. below is the full code snippet. Here is my code

    final String provider = "hpcloud-compute";

    final String user = USER_VALUE;
    final String key = KEY_VALUE;

    Properties overrides = new Properties();
    overrides.setProperty("jclouds.keystone.credential-type", "apiAccessKeyCredentials");
    overrides.setProperty(Constants.PROPERTY_ENDPOINT, "https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/");
    overrides.setProperty("jclouds.api-version", "2");

    ComputeServiceContext context = ContextBuilder
            .newBuilder(provider)
            .credentials(user, key)
            .overrides(overrides)
            .buildView(ComputeServiceContext.class);

    Set<? extends ComputeMetadata> computeMetadatas = context.getComputeService().listNodes();
    ((RestContext<NovaApi, NovaAsyncApi>)context.unwrap()).getApi().getKeyPairExtensionForZone(zone);
    ((RestContext<NovaApi, NovaAsyncApi>)context.unwrap()).getApi().getSecurityGroupExtensionForZone(zone);

EDIT:

Turns out, the new HP cloud does not have availability zone "az1","az2"... Instead, I need to pass "region-b.geo-1" and it works!

Was it helpful?

Solution

Add the following override:

overrides.put("jclouds.api-version":"2")

You may want to have a look at this forum post for more details: https://cloudifysource.zendesk.com/entries/30497773-Can-we-use-cloudify-with-HP-Cloud-environment-13-5-

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top