cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Will Stevens <wstev...@cloudops.com>
Subject Re: CloudStack API Question
Date Thu, 14 Feb 2013 20:17:32 GMT
If you are trying to launch a VM, you need to do the following 3 calls
'listZones', 'listServiceOfferings', 'listTemplates' in order to get the
details you need to actually call 'deployVirtualMachine'.


On Thu, Feb 14, 2013 at 3:13 PM, Mike Tutkowski <
mike.tutkowski@solidfire.com> wrote:

> At the moment, I only have a couple Compute Offerings, Primary Storages,
> etc., so I just assumed the indexing started at 1 and hard coded that.
>
>
> On Thu, Feb 14, 2013 at 1:12 PM, Mike Tutkowski <
> mike.tutkowski@solidfire.com> wrote:
>
> > Which leads me to my next question, do I have to run a query to get the
> > IDs of templates and such or is that something visible in the GUI I can
> > just look at and hard code in my program for the time being?
> >
> >
> > On Thu, Feb 14, 2013 at 1:11 PM, Mike Tutkowski <
> > mike.tutkowski@solidfire.com> wrote:
> >
> >> Actually, when I do a copy/paste of the URL into Chrome, this is what I
> >> get back:
> >>
> >> <deployvirtualmachineresponse cloud-stack-version="4.1.0-SNAPSHOT">
> >> <errorcode>431</errorcode>
> >> <cserrorcode>4350</cserrorcode>
> >> <errortext>
> >> Unable to use system template 1 to deploy a user vm
> >> </errortext>
> >> </deployvirtualmachineresponse>
> >>
> >>
> >> On Thu, Feb 14, 2013 at 1:08 PM, Mike Tutkowski <
> >> mike.tutkowski@solidfire.com> wrote:
> >>
> >>> I think I fixed the signature issue because now I get a new error code:
> >>>  431
> >>>
> >>> 431 Request Header Fields Too Large (RFC 6585<
> http://tools.ietf.org/html/rfc6585>
> >>> ) The server is unwilling to process the request because either an
> >>> individual header field, or all the header fields collectively, are too
> >>> large.[18]<
> http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#cite_note-rfc6585-18
> >
> >>>
> >>> I'm using a GET request.  Maybe I have to do this as a POST request?
> >>>
> >>>
> >>> On Thu, Feb 14, 2013 at 12:46 PM, Mike Tutkowski <
> >>> mike.tutkowski@solidfire.com> wrote:
> >>>
> >>>> Cool...thanks, Will.
> >>>>
> >>>> It sounds like if I get the signature right, then I should be good.
> >>>>
> >>>> Looking into it now.
> >>>>
> >>>>
> >>>> On Thu, Feb 14, 2013 at 12:45 PM, Will Stevens <wstevens@cloudops.com
> >wrote:
> >>>>
> >>>>> Looking at what you pasted in.  I think you forgot to add the api
key
> >>>>> to
> >>>>> the request parameters before you sorted them and then generated
your
> >>>>> signature.  In short, your signature is wrong...
> >>>>>
> >>>>>
> >>>>> On Thu, Feb 14, 2013 at 2:40 PM, Will Stevens <wstevens@cloudops.com
> >
> >>>>> wrote:
> >>>>>
> >>>>> > When you generated your signature, did you first sort the
> parameters
> >>>>> being
> >>>>> > passed alphabetically?  If you didn't then the signature which
you
> >>>>> > generated is wrong.
> >>>>> >
> >>>>> > Something to check anyway...
> >>>>> >
> >>>>> >
> >>>>> > On Thu, Feb 14, 2013 at 2:35 PM, Mike Tutkowski <
> >>>>> > mike.tutkowski@solidfire.com> wrote:
> >>>>> >
> >>>>> >> So, my next API question.  :)
> >>>>> >>
> >>>>> >> I am getting a 401 with the following Java code.  A 401
is
> >>>>> authentication
> >>>>> >> related, but I'm not sure if I need to provide a username
and
> >>>>> password
> >>>>> >> because I didn't see that in the example on the web that
I'm
> >>>>> following.
> >>>>> >>
> >>>>> >> Any thoughts?
> >>>>> >>
> >>>>> >> Thanks!
> >>>>> >>
> >>>>> >>   final String strHost = "127.0.0.1:8080/";
> >>>>> >>
> >>>>> >>    final String strFinalUrl = "http://" + strHost + strApiUrl
+
> >>>>> >> "&apiKey="+ strApiKey +
> >>>>> >> "&signature=" + strEncodedSignature;
> >>>>> >>
> >>>>> >>    System.out.println(strFinalUrl);
> >>>>> >>
> >>>>> >>    final HttpClient client = new DefaultHttpClient();
> >>>>> >>
> >>>>> >>  final HttpResponse response = client.execute(new
> >>>>> HttpGet(strFinalUrl));
> >>>>> >>
> >>>>> >>    if (response.getStatusLine().getStatusCode() != 200)
> >>>>> >>
> >>>>> >>  {
> >>>>> >>
> >>>>> >>   throw new RuntimeException("Failed on CloudStack
> >>>>> deployVirtualMachine
> >>>>> >> API
> >>>>> >> call : HTTP error code : " +
> >>>>> response.getStatusLine().getStatusCode());
> >>>>> >>
> >>>>> >>  }
> >>>>> >>
> >>>>> >> The URL I'm printing looks like this:
> >>>>> >>
> >>>>> >>
> >>>>> >>
> >>>>> >>
> >>>>>
> http://127.0.0.1:8080/client/api?command=deployVirtualMachine&serviceOfferingId=1&diskOfferingId=1&templateId=1&zoneId=1&apiKey=X0U60K_Qgodb6nL5csNcAzRiz2cKiwx-tjBj1dTMLSVxkdmD0QtUhFzDf3MCmwGnC3z2dQPo0j3x_XJYmoEBmg&signature=CJvLoJ%2ByvUM12OUNb9hxyD1Gsjw%3D
> >>>>> >>
> >>>>> >>
> >>>>> >>
> >>>>> >> On Wed, Feb 13, 2013 at 12:06 PM, Mike Tutkowski <
> >>>>> >> mike.tutkowski@solidfire.com> wrote:
> >>>>> >>
> >>>>> >> > Thanks, David - that was very useful info. :)
> >>>>> >> >
> >>>>> >> > I'm not completely up to speed yet on what CloudStack
considers
> a
> >>>>> domain
> >>>>> >> > versus an account versus a user, but I found this
page and am
> >>>>> going
> >>>>> >> through
> >>>>> >> > it now:
> >>>>> >> >
> >>>>> >> > http://wiki.cloudstack.org/pages/viewpage.action?pageId=8224884
> >>>>> >> >
> >>>>> >> >
> >>>>> >> > On Wed, Feb 13, 2013 at 11:21 AM, David Grizzanti
<
> >>>>> >> > david.grizzanti@sungard.com> wrote:
> >>>>> >> >
> >>>>> >> >> Mike,
> >>>>> >> >>
> >>>>> >> >> In the UI if you go to "Accounts" in the left
hand sidebar ->
> >>>>> click the
> >>>>> >> >> name of an account (i.e. "admin") -> under
Details click "View
> >>>>> Users"
> >>>>> >> ->
> >>>>> >> >> click the Username of the user in question (i.e.
"admin") and
> >>>>> the API
> >>>>> >> and
> >>>>> >> >> Secrety Key should be listed under the Details
there.
> >>>>> >> >>
> >>>>> >> >> Hope that helps!
> >>>>> >> >>
> >>>>> >> >> --
> >>>>> >> >> David Grizzanti
> >>>>> >> >> Software Engineer - SunGard Availability Services
> >>>>> >> >> 401 N. Broad Street, Philadelphia, PA 19108
> >>>>> >> >> o: 215-446-1431 - e: david.grizzanti@sungard.com
> >>>>> >> >>
> >>>>> >> >> On Feb 13, 2013, at 12:44 PM, Mike Tutkowski wrote:
> >>>>> >> >>
> >>>>> >> >> > OK, just getting around to doing this now.
> >>>>> >> >> >
> >>>>> >> >> > It looks like the Generate Keys command worked
(I didn't get
> >>>>> an error
> >>>>> >> >> > message), but I'm not sure where to look
in the GUI to find
> >>>>> these
> >>>>> >> keys.
> >>>>> >> >> >
> >>>>> >> >> > Would you mind pointing that out for me?
> >>>>> >> >> >
> >>>>> >> >> > Thanks!!
> >>>>> >> >> >
> >>>>> >> >> >
> >>>>> >> >> > On Tue, Feb 12, 2013 at 9:07 PM, Will Stevens
<
> >>>>> wstevens@cloudops.com
> >>>>> >> >
> >>>>> >> >> wrote:
> >>>>> >> >> >
> >>>>> >> >> >> If its a fresh install, you will access
the client at:
> >>>>> >> >> >> the.machines.ip:8080/client/
> >>>>> >> >> >> Login with username/password of: admin/password
> >>>>> >> >> >> Click: Accounts -> admin -> View
Users -> admin -> (in the
> >>>>> main
> >>>>> >> window
> >>>>> >> >> >> there are 3 buttons at the top left of
the screen, mouse
> over
> >>>>> the
> >>>>> >> right
> >>>>> >> >> >> most one of the 3 and it should say 'Generate
Keys', click
> >>>>> that)
> >>>>> >> >> >>
> >>>>> >> >> >> You can follow that same process for
any user who has an
> >>>>> account.
> >>>>> >> >> >>
> >>>>> >> >> >>
> >>>>> >> >> >>
> >>>>> >> >> >>
> >>>>> >> >> >>
> >>>>> >> >> >> On Tue, Feb 12, 2013 at 10:26 PM, Mike
Tutkowski <
> >>>>> >> >> >> mike.tutkowski@solidfire.com> wrote:
> >>>>> >> >> >>
> >>>>> >> >> >>> Can you point me to the location
in the GUI where I can
> >>>>> generate
> >>>>> >> keys?
> >>>>> >> >> >>>
> >>>>> >> >> >>> Thanks!
> >>>>> >> >> >>>
> >>>>> >> >> >>>
> >>>>> >> >> >>> On Tue, Feb 12, 2013 at 4:17 PM,
Will Stevens <
> >>>>> >> wstevens@cloudops.com>
> >>>>> >> >> >>> wrote:
> >>>>> >> >> >>>
> >>>>> >> >> >>>> They do not expire, but in the
UI you can regenerate the
> >>>>> keys, so
> >>>>> >> in
> >>>>> >> >> >> that
> >>>>> >> >> >>>> case they would change.
> >>>>> >> >> >>>>
> >>>>> >> >> >>>>
> >>>>> >> >> >>>> On Tue, Feb 12, 2013 at 6:13
PM, Mike Tutkowski <
> >>>>> >> >> >>>> mike.tutkowski@solidfire.com>
wrote:
> >>>>> >> >> >>>>
> >>>>> >> >> >>>>> to "say" (I mean) :)
> >>>>> >> >> >>>>>
> >>>>> >> >> >>>>>
> >>>>> >> >> >>>>> On Tue, Feb 12, 2013 at 4:13
PM, Mike Tutkowski <
> >>>>> >> >> >>>>> mike.tutkowski@solidfire.com>
wrote:
> >>>>> >> >> >>>>>
> >>>>> >> >> >>>>>> Sounds good...and these
do not expire?  Is that accurate
> >>>>> to day?
> >>>>> >> >> >>>>>>
> >>>>> >> >> >>>>>>
> >>>>> >> >> >>>>>> On Tue, Feb 12, 2013
at 4:03 PM, Will Stevens <
> >>>>> >> >> >> wstevens@cloudops.com
> >>>>> >> >> >>>>>> wrote:
> >>>>> >> >> >>>>>>
> >>>>> >> >> >>>>>>> Every role uses the
same procedure.  They all need an
> >>>>> api key
> >>>>> >> and
> >>>>> >> >> >>>> secret
> >>>>> >> >> >>>>>>> key.
> >>>>> >> >> >>>>>>>
> >>>>> >> >> >>>>>>>
> >>>>> >> >> >>>>>>> On Tue, Feb 12, 2013
at 5:54 PM, Mike Tutkowski <
> >>>>> >> >> >>>>>>> mike.tutkowski@solidfire.com>
wrote:
> >>>>> >> >> >>>>>>>
> >>>>> >> >> >>>>>>>> Thanks for the
info.
> >>>>> >> >> >>>>>>>>
> >>>>> >> >> >>>>>>>> So, I see we
have three roles in CloudStack:  Root
> >>>>> Admin,
> >>>>> >> Domain
> >>>>> >> >> >>>>> Admin,
> >>>>> >> >> >>>>>>> and
> >>>>> >> >> >>>>>>>> User.
> >>>>> >> >> >>>>>>>>
> >>>>> >> >> >>>>>>>> When submitting
API commands, does the submitter -
> >>>>> regardless
> >>>>> >> of
> >>>>> >> >> >>>> role
> >>>>> >> >> >>>>> -
> >>>>> >> >> >>>>>>>> have to provide
an API Key and Secret Key (or is that
> >>>>> >> something,
> >>>>> >> >> >>>> say,
> >>>>> >> >> >>>>>>> the
> >>>>> >> >> >>>>>>>> Root Admin doesn't
have to do)?
> >>>>> >> >> >>>>>>>>
> >>>>> >> >> >>>>>>>> Thanks!
> >>>>> >> >> >>>>>>>>
> >>>>> >> >> >>>>>>>>
> >>>>> >> >> >>>>>>>> On Tue, Feb 12,
2013 at 3:33 PM, David Nalley <
> >>>>> david@gnsa.us>
> >>>>> >> >> >>>> wrote:
> >>>>> >> >> >>>>>>>>
> >>>>> >> >> >>>>>>>>> On Tue, Feb
12, 2013 at 5:27 PM, Mike Tutkowski
> >>>>> >> >> >>>>>>>>> <mike.tutkowski@solidfire.com>
wrote:
> >>>>> >> >> >>>>>>>>>> So, I'm
looking at these comments now:
> >>>>> >> >> >>>>>>>>>>
> >>>>> >> >> >>>>>>>>>> 2.3.
Getting Started
> >>>>> >> >> >>>>>>>>>> To get
started using the CloudStack API, you should
> >>>>> have the
> >>>>> >> >> >>>>>>> following:
> >>>>> >> >> >>>>>>>>>>
> >>>>> >> >> >>>>>>>>>>   - URL
of the CloudStack server you wish to
> integrate
> >>>>> >> >> >> with.
> >>>>> >> >> >>>>>>>>>>   - Both
the API Key and Secret Key for an account.
> >>>>> This
> >>>>> >> >> >>> should
> >>>>> >> >> >>>>>>> have
> >>>>> >> >> >>>>>>>>> been
> >>>>> >> >> >>>>>>>>>>   generated
by the administrator of the cloud
> >>>>> instance and
> >>>>> >> >> >>>> given
> >>>>> >> >> >>>>> to
> >>>>> >> >> >>>>>>>> you.
> >>>>> >> >> >>>>>>>>>>   - Familiarity
with HTTP GET/POST and query
> strings.
> >>>>> >> >> >>>>>>>>>>   - Knowledge
of either XML or JSON.
> >>>>> >> >> >>>>>>>>>>   - Knowledge
of a programming language that can
> >>>>> generate
> >>>>> >> >> >>> HTTP
> >>>>> >> >> >>>>>>>> requests;
> >>>>> >> >> >>>>>>>>>>   for
example, Java or PHP.
> >>>>> >> >> >>>>>>>>>>
> >>>>> >> >> >>>>>>>>>>
> >>>>> >> >> >>>>>>>>>> I'm not
sure how to generate the API Key and Secret
> >>>>> Key for
> >>>>> >> >> >> an
> >>>>> >> >> >>>>>>> account.
> >>>>> >> >> >>>>>>>>>> Can someone
point me to instructions for this?
> >>>>> >> >> >>>>>>>>>>
> >>>>> >> >> >>>>>>>>>> Thanks!
> >>>>> >> >> >>>>>>>>>>
> >>>>> >> >> >>>>>>>>>
> >>>>> >> >> >>>>>>>>>
> >>>>> >> >> >>>>>>>>>
> >>>>> >> >> >>>>>>>>
> >>>>> >> >> >>>>>>>
> >>>>> >> >> >>>>>
> >>>>> >> >> >>>>
> >>>>> >> >> >>>
> >>>>> >> >> >>
> >>>>> >> >>
> >>>>> >>
> >>>>>
> http://incubator.apache.org/cloudstack/docs/api/apidocs-4.0.0/root_admin/registerUserKeys.html
> >>>>> >> >> >>>>>>>>> Please file
a bug for the DevGuide documentation not
> >>>>> being
> >>>>> >> >> >> clear
> >>>>> >> >> >>>> on
> >>>>> >> >> >>>>>>> this
> >>>>> >> >> >>>>>>>>> issue
> >>>>> >> >> >>>>>>>>>
> >>>>> >> >> >>>>>>>>> -David
> >>>>> >> >> >>>>>>>>>
> >>>>> >> >> >>>>>>>>
> >>>>> >> >> >>>>>>>>
> >>>>> >> >> >>>>>>>>
> >>>>> >> >> >>>>>>>> --
> >>>>> >> >> >>>>>>>> *Mike Tutkowski*
> >>>>> >> >> >>>>>>>> *Senior CloudStack
Developer, SolidFire Inc.*
> >>>>> >> >> >>>>>>>> e: mike.tutkowski@solidfire.com
> >>>>> >> >> >>>>>>>> o: 303.746.7302
> >>>>> >> >> >>>>>>>> Advancing the
way the world uses the
> >>>>> >> >> >>>>>>>> cloud<
> >>>>> http://solidfire.com/solution/overview/?video=play>
> >>>>> >> >> >>>>>>>> *™*
> >>>>> >> >> >>>>>>>>
> >>>>> >> >> >>>>>>>
> >>>>> >> >> >>>>>>
> >>>>> >> >> >>>>>>
> >>>>> >> >> >>>>>>
> >>>>> >> >> >>>>>> --
> >>>>> >> >> >>>>>> *Mike Tutkowski*
> >>>>> >> >> >>>>>> *Senior CloudStack Developer,
SolidFire Inc.*
> >>>>> >> >> >>>>>> e: mike.tutkowski@solidfire.com
> >>>>> >> >> >>>>>> o: 303.746.7302
> >>>>> >> >> >>>>>> Advancing the way the
world uses the cloud<
> >>>>> >> >> >>>>> http://solidfire.com/solution/overview/?video=play>
> >>>>> >> >> >>>>>> *™*
> >>>>> >> >> >>>>>>
> >>>>> >> >> >>>>>
> >>>>> >> >> >>>>>
> >>>>> >> >> >>>>>
> >>>>> >> >> >>>>> --
> >>>>> >> >> >>>>> *Mike Tutkowski*
> >>>>> >> >> >>>>> *Senior CloudStack Developer,
SolidFire Inc.*
> >>>>> >> >> >>>>> e: mike.tutkowski@solidfire.com
> >>>>> >> >> >>>>> o: 303.746.7302
> >>>>> >> >> >>>>> Advancing the way the world
uses the
> >>>>> >> >> >>>>> cloud<http://solidfire.com/solution/overview/?video=play
> >
> >>>>> >> >> >>>>> *™*
> >>>>> >> >> >>>>>
> >>>>> >> >> >>>>
> >>>>> >> >> >>>
> >>>>> >> >> >>>
> >>>>> >> >> >>>
> >>>>> >> >> >>> --
> >>>>> >> >> >>> *Mike Tutkowski*
> >>>>> >> >> >>> *Senior CloudStack Developer, SolidFire
Inc.*
> >>>>> >> >> >>> e: mike.tutkowski@solidfire.com
> >>>>> >> >> >>> o: 303.746.7302
> >>>>> >> >> >>> Advancing the way the world uses
the
> >>>>> >> >> >>> cloud<http://solidfire.com/solution/overview/?video=play>
> >>>>> >> >> >>> *™*
> >>>>> >> >> >>>
> >>>>> >> >> >>
> >>>>> >> >> >
> >>>>> >> >> >
> >>>>> >> >> >
> >>>>> >> >> > --
> >>>>> >> >> > *Mike Tutkowski*
> >>>>> >> >> > *Senior CloudStack Developer, SolidFire Inc.*
> >>>>> >> >> > e: mike.tutkowski@solidfire.com
> >>>>> >> >> > o: 303.746.7302
> >>>>> >> >> > Advancing the way the world uses the
> >>>>> >> >> > cloud<http://solidfire.com/solution/overview/?video=play>
> >>>>> >> >> > *™*
> >>>>> >> >>
> >>>>> >> >>
> >>>>> >> >
> >>>>> >> >
> >>>>> >> > --
> >>>>> >> > *Mike Tutkowski*
> >>>>> >> > *Senior CloudStack Developer, SolidFire Inc.*
> >>>>> >> > e: mike.tutkowski@solidfire.com
> >>>>> >> > o: 303.746.7302
> >>>>> >> > Advancing the way the world uses the cloud<
> >>>>> >> http://solidfire.com/solution/overview/?video=play>
> >>>>> >> > *™*
> >>>>> >> >
> >>>>> >>
> >>>>> >>
> >>>>> >>
> >>>>> >> --
> >>>>> >> *Mike Tutkowski*
> >>>>> >> *Senior CloudStack Developer, SolidFire Inc.*
> >>>>> >> e: mike.tutkowski@solidfire.com
> >>>>> >> o: 303.746.7302
> >>>>> >> Advancing the way the world uses the
> >>>>> >> cloud<http://solidfire.com/solution/overview/?video=play>
> >>>>> >> *™*
> >>>>> >>
> >>>>> >
> >>>>> >
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> *Mike Tutkowski*
> >>>> *Senior CloudStack Developer, SolidFire Inc.*
> >>>> e: mike.tutkowski@solidfire.com
> >>>> o: 303.746.7302
> >>>> Advancing the way the world uses the cloud<
> http://solidfire.com/solution/overview/?video=play>
> >>>> *™*
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> *Mike Tutkowski*
> >>> *Senior CloudStack Developer, SolidFire Inc.*
> >>> e: mike.tutkowski@solidfire.com
> >>> o: 303.746.7302
> >>> Advancing the way the world uses the cloud<
> http://solidfire.com/solution/overview/?video=play>
> >>> *™*
> >>>
> >>
> >>
> >>
> >> --
> >> *Mike Tutkowski*
> >> *Senior CloudStack Developer, SolidFire Inc.*
> >> e: mike.tutkowski@solidfire.com
> >> o: 303.746.7302
> >> Advancing the way the world uses the cloud<
> http://solidfire.com/solution/overview/?video=play>
> >> *™*
> >>
> >
> >
> >
> > --
> > *Mike Tutkowski*
> > *Senior CloudStack Developer, SolidFire Inc.*
> > e: mike.tutkowski@solidfire.com
> > o: 303.746.7302
> > Advancing the way the world uses the cloud<
> http://solidfire.com/solution/overview/?video=play>
> > *™*
> >
>
>
>
> --
> *Mike Tutkowski*
> *Senior CloudStack Developer, SolidFire Inc.*
> e: mike.tutkowski@solidfire.com
> o: 303.746.7302
> Advancing the way the world uses the
> cloud<http://solidfire.com/solution/overview/?video=play>
> *™*
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message