jclouds-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ignasi Barrera <n...@apache.org>
Subject Re: Example end-to-end walkthrough?
Date Mon, 09 Jan 2017 10:00:25 GMT
>
> Thanks.  I got the same suggestion from the team that created the ARM
> project.  I’ve almost got it running.  How would I figure out what
> parameters are needed / what can be overwritten?  Not sure how I would have
> known to use -Dazurecompute-arm.endpoint.  I see it in the
> azurecompute-arm project but it’s not clearly spelled out that it should be
> added when calling the compute service API.
>

There are some common properties and some provider-specific ones.
Unfortunately we don't have yet a page describing all the existing ones.
You can find the common properties here:
http://jclouds.apache.org/reference/javadoc/2.0.x/org/jclouds/Constants.html
The compute service specific properties here:
http://jclouds.apache.org/reference/javadoc/2.0.x/org/jclouds/compute/config/ComputeServiceProperties.html
And each provider often has a constants class with all its particular
properties. In the case of azurecompute-arm:
https://github.com/jclouds/jclouds-labs/blob/master/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/config/AzureComputeProperties.java


>
> Another question on getting the project to run.  I’m getting errors below
> about not finding images in default storage account and machine not found.
> I think I probably need to modify the code in the MainApp.Java, yes?
>

This is an expected behaviour when you have existing virtual machines, and
it is just a warning log message. The jclouds compute service has an
ImageExtension that allows users to create images (or snapshots) of
existing virtual machines. In Azure, those images are stored in the storage
account of the virtual machine itself, and the only way to list them is to
inspect the storage account of each existing VM. That's why the
"listImages" operations tries to access each VM's storage account, and why
you might see the warning message, if access there is denied. Under normal
circumstances you can safely ignore that message.


> Based on what I’m reading here, http://jclouds.apache.org/start/compute/
> , I think I should modify the templateBuilder object to get around the
> errors below?  Just not sure what to enter.  For example, how do I override
> the default location which seems to be eastasia?    The azurecompute-arm
> project says I can do jclouds.regions="northeurope" but not sure where to
> put that.
>

There are two different things here.

First, the "jclouds.regions" property is used to filter the regions jclouds
will take into account. By default, jclouds will connect to each region and
list images, VMs, etc, from all them. This can be time consuming, and
probably you don't want to work with all existing regions. That property
allows you to tell jclouds which regions you care about, so it does not try
to connect and get information from the rest. If you don't set it, all
regions will be considered by default.

The other thing is about selecting the location where the VM will run. This
can be set with the "templateBuilder.locationId" method, but if omitted,
jclouds will select one location that is compatible with the selected image
and hardware profile. AFAIK it is not the case of ARM, but some providers
don't have all hardware profiles (and/or images) available in all regions,
so jclouds makes sure to select a location where the selected
image/hardware pair can run.


> -Multiple entries with same key
>
> >Not sure what this means.  The only time I’ve seen key mentioned in the
> documentation is in relation to SSH keys.
>
>
> error: Multiple entries with same key: Standard_A0={id=Standard_A0,
> providerId=Standard_A0, name=Standard_A0, location={scope=REGION,
> id=southeastasia, description=Southeast Asia, parent=azurecompute-arm,
> iso3166Codes=[SG]}, processors=[{cores=1.0, speed=2.0}], ram=768,
> volumes=[{type=LOCAL, size=20480.0, bootDevice=false, durable=false},
> {type=LOCAL, size=1047552.0, bootDevice=false, durable=false}],
> supportsImage=ALWAYS_TRUE, userMetadata={maxDataDiskCount=1}} and
> Standard_A0={id=Standard_A0, providerId=Standard_A0, name=Standard_A0,
> location={scope=REGION, id=eastasia, description=East Asia,
> parent=azurecompute-arm, iso3166Codes=[HK]}, processors=[{cores=1.0,
> speed=2.0}], ram=768, volumes=[{type=LOCAL, size=20480.0, bootDevice=false,
> durable=false}, {type=LOCAL, size=1047552.0, bootDevice=false,
> durable=false}], supportsImage=ALWAYS_TRUE, userMetadata={
> maxDataDiskCount=1}}
>

This is the first time I see this error. Do you have a complete stacktrace?


HTH!



>
>
>
>
>
>
> *From:* Ignasi Barrera [mailto:nacx@apache.org]
> *Sent:* Saturday, January 7, 2017 5:17 AM
>
> *To:* user@jclouds.apache.org
> *Subject:* Re: Example end-to-end walkthrough?
>
>
>
> Good to see you progressed!
>
> You're almost there. The error you are getting is because the Azure ARM
> provider needs some additional configuration properties.
>
> As you might have already seen, when creating the jclouds context you can
> pass a set of configuration properties. This is done here [1] in the
> compute-basics example app, but jclouds also loads them from the system
> properties. You could use this to pass the additional properties when
> executing the jar file.
>
> The additional properties you need to set are:
>
> * azurecompute-arm.endpoint (because the endpoint is not fixed as it
> contains the subscription id).
> * oauth.endpoint (because it is not fixed as it contains the tenant id).
>
> You can follow the steps described in the Azure ARM README [2] to create
> an application you can use for jclouds. Once you have it, you should be
> able to run the examples with a command similar to:
>
> java  -Dazurecompute-arm.endpoint="https://management.azure.com/
> subscriptions/<Subscription-id>" \
>     -Doauth.endpoint="https://login.microsoftonline.com/<Tenant-id>/oauth2/token"
> \
>     -jar target/compute-basics-jar-with-dependencies.jar \
>
>     azurecompute-arm <Application-Id> <Password> mygroup add
>
>
> HTH!
>
>
>
> P.S. If you want to contribute or help improve the jclouds site, you can
> have a look at our "How to contribute documentation" guide [3]. Also, it
> would be great if you could add, once you manage to run the examples with
> Azure, the example command to the compute-basics README [4]. That will help
> other future users.
>
>
>
>
> [1] https://github.com/jclouds/jclouds-examples/blob/master/
> compute-basics/src/main/java/org/jclouds/examples/compute/
> basics/MainApp.java#L267-L271
> [2] https://github.com/jclouds/jclouds-labs/tree/master/
> azurecompute-arm#setting-up-test-credentials
>
> [3] https://cwiki.apache.org/confluence/display/JCLOUDS/How+to+Contribute+
> Documentation
>
> [4] https://github.com/jclouds/jclouds-examples/blob/
> master/compute-basics/README.md
>
>
>
> On 6 January 2017 at 23:42, Teo De Las Heras <teodelas@microsoft.com>
> wrote:
>
> I'm getting an error (below) and following up with the creators of the
> azurecompute-arm libraries.
>
> Documentation feedback: I'd be happy to write up / contribute a 'jclouds
> for dummies' page.  I'm sure it's easy for someone who understands or works
> with Maven / Java projects.  Without that background, it's hard to decipher
> how all the pieces work together.  Or maybe some additional links to
> relevant Maven documentation that explains what mvn install does, what
> pom.xml is for, how to add dependencies (to use jclouds-labs).
>
> Error I'm getting:
> java -jar target/compute-basics-jar-with-dependencies.jar
> azurecompute-arm <my application id> <mypassword> mygroup add
> >> initializing {id=azurecompute-arm, name=Microsoft Azure Resource
> Manager REST API, views=[org.jclouds.compute.ComputeServiceContext],
> endpointName=Resource Manager Endpoint ending in your Subscription Id,
> identityName=Azure Service Principal Application Id,
> credentialName=Optional.of(Azure Service Principal Application Password),
> documentation=https://msdn.microsoft.com/en-us/library/azure/dn790568.aspx,
> api=interface org.jclouds.azurecompute.arm.AzureComputeApi}
> Exception in thread "main" com.google.inject.CreationException: Guice
> creation errors:
>
> 1) No implementation for java.lang.String annotated with
> @com.google.inject.name.Named(value=oauth.endpoint) was bound.
>   at org.jclouds.oauth.v2.config.OAuthModule.oauthEndpoint(
> OAuthModule.java:63)
>
> 1 error
>         at com.google.inject.internal.Errors.
> throwCreationExceptionIfErrorsExist(Errors.java:435)
>         at com.google.inject.internal.InternalInjectorCreator.
> initializeStatically(InternalInjectorCreator.java:154)
>         at com.google.inject.internal.InternalInjectorCreator.build(
> InternalInjectorCreator.java:106)
>         at com.google.inject.Guice.createInjector(Guice.java:95)
>         at org.jclouds.ContextBuilder.buildInjector(ContextBuilder.
> java:405)
>         at org.jclouds.ContextBuilder.buildInjector(ContextBuilder.
> java:328)
>         at org.jclouds.ContextBuilder.buildView(ContextBuilder.java:615)
>         at org.jclouds.ContextBuilder.buildView(ContextBuilder.java:595)
>         at org.jclouds.examples.compute.basics.MainApp.
> initComputeService(MainApp.java:292)
>         at org.jclouds.examples.compute.basics.MainApp.main(MainApp.
> java:141)
>
>
> Teo
>
>
>
> -----Original Message-----
> From: Andrew Phillips [mailto:aphillips@qrmedia.com]
> Sent: Friday, January 6, 2017 3:25 PM
> To: user@jclouds.apache.org
> Subject: Re: Example end-to-end walkthrough?
>
> > I was completely confused by being directed to the github for the
> > azurecompute-arm as I thought that was an example I should be
> > following.
>
>
> Thanks for the update! Are things working now, or is there still something
> that's not doing what it should?
>
> Also, do you have any thoughts on what we could do to make the
> documentation clearer?
>
> ap
>
>
>

Mime
View raw message