cloudstack-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Emrich <martin.emr...@empolis.com>
Subject AW: API deploy virtualmachine failed with custom offering [SOLVED]
Date Thu, 24 Mar 2016 16:20:34 GMT
FWIW, I found it:

The problem in my application was the signing algorithm, which worked perfectly as long as
no quotable characters were in the request (which was the case until details[0] came around).

What lead me astray was the misleading error message when using cloudmonkey:

(local) 🐵 > deploy virtualmachine zoneid=9c667177-4f6e-4d51-b841-2b83f5e851ac domainid=6ff469a6-d975-11e5-98dc-001e8c29bd11
templateid=14c5e883-c6c3-4fed-83d5-451d1064dcad networkids=9cb521cf-4e31-4e4e-9cc3-0594c0d86b23
 serviceofferingid=8aab1d01-1ec3-4eec-85ab-6caba370288a details[0].cpuNumber=2 details[0].cpuSpeed=1000
details[0].memory=512 name=test1

...
jobresult:
virtualmachine:
id = ee9ea8b3-447d-4e2f-b07c-ca8180b2331e
...

 (local) 🐵 > deploy virtualmachine zoneid=9c667177-4f6e-4d51-b841-2b83f5e851ac domainid=6ff469a6-d975-11e5-98dc-001e8c29bd11
templateid=14c5e883-c6c3-4fed-83d5-451d1064dcad networkids=9cb521cf-4e31-4e4e-9cc3-0594c0d86b23
 serviceofferingid=8aab1d01-1ec3-4eec-85ab-6caba370288a details[0].cpuNumber=2 details[0].cpuSpeed=1000
details[0].Memory=512 name=test1
Error 401 Authentication error
errorcode = 401
errortext = unable to verify user credentials and/or request signature
uuidList:

Note the only difference is the lower case "memory". I fixed my application by _not_ quoting
the agument keys, only the values, for the signature generation.

Cheers,

Martin

-----Ursprüngliche Nachricht-----
Von: Martin Emrich [mailto:martin.emrich@empolis.com] 
Gesendet: Mittwoch, 23. März 2016 17:29
An: users@cloudstack.apache.org
Betreff: AW: API deploy virtualmachine failed with custom offering

Hi!

Sorry, same effect:

(local) 🐵 > deploy virtualmachine zoneid=9c667177-4f6e-4d51-b841-2b83f5e851ac domainid=6ff469a6-d975-11e5-98dc-001e8c29bd11
templateid=14c5e883-c6c3-4fed-83d5-451d1064dcad networkids=9cb521cf-4e31-4e4e-9cc3-0594c0d86b23
 serviceofferingid=8aab1d01-1ec3-4eec-85ab-6caba370288a details[0].cpuNumber=2 details[0].cpuSpeed=1000
details[0].Memory=512 name=test1 Error 401 Authentication error errorcode = 401 errortext
= unable to verify user credentials and/or request signature
uuidList:

(BTW: testing now on my litte test cloud running 4.7.1, cloudmonkey is 5.3.2)

Thanks,

Martin

-----Ursprüngliche Nachricht-----
Von: Patrick Miller [mailto:patrick.miller@sungardas.com]
Gesendet: Mittwoch, 23. März 2016 16:50
An: users@cloudstack.apache.org
Betreff: Re: API deploy virtualmachine failed with custom offering

Martin:
If you look at the ui test for memory
details%5B0%5D.memory=512      Notice there is no "M"  megabytes is implied.

Please try:
deploy virtualmachine zoneid=9c667177-4f6e-4d51-b841-2b83f5e851ac
domainid=6ff469a6-d975-11e5-98dc-001e8c29bd11
templateid=14c5e883-c6c3-4fed-83d5-451d1064dcad
networkids=9cb521cf-4e31-4e4e-9cc3-0594c0d86b23
serviceofferingid=8aab1d01-1ec3-4eec-85ab-6caba370288a
details[0].cpuNumber=2 details[0].cpuSpeed=1000 details[0].memory=512
name=test1

Just removing the "M" from 512.

Hope this helps.

Patrick

Patrick Miller ▪ Senior Systems Engineer ▪ Sungard Availability Services
2481 Deerwood Dr, San Ramon, Ca 94583 ▪  Office: 925-831-7738 patrick.miller@sungardas.com
<patrick.miller@sungard.com> ▪ www.sungardas.com


CONFIDENTIALITY:  This e-mail (including any attachments) may contain confidential, proprietary
and privileged information, and unauthorized disclosure or use is prohibited.  If you received
this e-mail in error, please notify the sender and delete this e-mail from your system.

On Wed, Mar 23, 2016 at 8:14 AM, Martin Emrich <martin.emrich@empolis.com>
wrote:

> Hi!
>
> I also tried with [0], but it fails, too.
>
> The command line:
>
> (local) 🐵 > deploy virtualmachine
> zoneid=9c667177-4f6e-4d51-b841-2b83f5e851ac
> domainid=6ff469a6-d975-11e5-98dc-001e8c29bd11
> templateid=14c5e883-c6c3-4fed-83d5-451d1064dcad
> networkids=42b962bf-27f1-434b-bd14-239a909a206e
> serviceofferingid=8aab1d01-1ec3-4eec-85ab-6caba370288a
> details[0].cpuNumber=2 details[0].cpuSpeed=1000 details[0].Memory=512M
> name=test1
> Error 401 Authentication error
> errorcode = 401
> errortext = unable to verify user credentials and/or request signature
> uuidList:
>
> From the cloudmonkey log:
>
> 2016-03-23 15:09:23,953 - connectionpool.py:207 - [INFO] Starting new 
> HTTP connection (1): localhost
> 2016-03-23 15:09:23,984 - connectionpool.py:387 - [DEBUG] "GET
> /client/api?networkids=42b962bf-27f1-434b-bd14-239a909a206e&domainid=6
> ff469a6-d975-11e5-98dc-001e8c29bd11&apiKey=M5-9oj4BbFevrrNL92dHA3N_ema
> WHirVzFLxhKenCT8z8dMpzb1PmeeAJv2ICmNuSsnj6tl371T8VYxjGtPLJg&name=test1
> &details%5B0%5D.cpuSpeed=1000&expires=2016-03-23T14%3A19%3A23%2B0000&s
> ignatureversion=3&zoneid=9c667177-4f6e-4d51-b841-2b83f5e851ac&details%
> 5B0%5D.cpuNumber=2&command=deployVirtualMachine&templateid=14c5e883-c6
> c3-4fed-83d5-451d1064dcad&response=json&signature=VDammkzNSFJI25IZNRzM
> X9I0K7U%3D&serviceofferingid=8aab1d01-1ec3-4eec-85ab-6caba370288a&deta
> ils%5B0%5D.Memory=512M
> HTTP/1.1" 401 137
> 2016-03-23 15:09:23,985 - requester.py:49 - [DEBUG] Request sent:
> http://localhost:8080/client/api?networkids=42b962bf-27f1-434b-bd14-23
> 9a909a206e&domainid=6ff469a6-d975-11e5-98dc-001e8c29bd11&apiKey=M5-9oj
> 4BbFevrrNL92dHA3N_emaWHirVzFLxhKenCT8z8dMpzb1PmeeAJv2ICmNuSsnj6tl371T8
> VYxjGtPLJg&name=test1&details%5B0%5D.cpuSpeed=1000&expires=2016-03-23T
> 14%3A19%3A23%2B0000&signatureversion=3&zoneid=9c667177-4f6e-4d51-b841-
> 2b83f5e851ac&details%5B0%5D.cpuNumber=2&command=deployVirtualMachine&t
> emplateid=14c5e883-c6c3-4fed-83d5-451d1064dcad&response=json&signature
> =VDammkzNSFJI25IZNRzMX9I0K7U%3D&serviceofferingid=8aab1d01-1ec3-4eec-8
> 5ab-6caba370288a&details%5B0%5D.Memory=512M
> 2016-03-23 15:09:23,985 - requester.py:49 - [DEBUG] Response received:
> {"deployvirtualmachineresponse":{"uuidList":[],"errorcode":401,"errort
> ext":"unable to verify user credentials and/or request signature"}}
> 2016-03-23 15:09:23,985 - requester.py:49 - [DEBUG] Error: 401 
> Authentication error
> 2016-03-23 15:09:23,985 - requester.py:49 - [DEBUG] ======== END 
> Request ========
>
> This is the corresponding line in the cloudstack management log:
>
> 2016-03-23 15:09:23,963 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-10:ctx-57c16d4d) (logid:e9a26d51) ===START===
> 0:0:0:0:0:0:0:1 -- GET
> networkids=42b962bf-27f1-434b-bd14-239a909a206e&domainid=6ff469a6-d975
> -11e5-98dc-001e8c29bd11&apiKey=M5-9oj4BbFevrrNL92dHA3N_emaWHirVzFLxhKe
> nCT8z8dMpzb1PmeeAJv2ICmNuSsnj6tl371T8VYxjGtPLJg&name=test1&details%5B0
> %5D.cpuSpeed=1000&expires=2016-03-23T14%3A19%3A23%2B0000&signaturevers
> ion=3&zoneid=9c667177-4f6e-4d51-b841-2b83f5e851ac&details%5B0%5D.cpuNu
> mber=2&command=deployVirtualMachine&templateid=14c5e883-c6c3-4fed-83d5
> -451d1064dcad&response=json&signature=VDammkzNSFJI25IZNRzMX9I0K7U%3D&s
> erviceofferingid=8aab1d01-1ec3-4eec-85ab-6caba370288a&details%5B0%5D.M
> emory=512M
> 2016-03-23 15:09:23,966 INFO  [c.c.a.ApiServer] 
> (catalina-exec-10:ctx-57c16d4d ctx-d31c96e2) (logid:e9a26d51) User
> signature: VDammkzNSFJI25IZNRzMX9I0K7U= is not equaled to computed
> signature: +JnMQMYaEovhHAgcMSqShFHx5NY=
> 2016-03-23 15:09:23,975 DEBUG [c.c.a.ApiServlet] 
> (catalina-exec-10:ctx-57c16d4d ctx-d31c96e2) (logid:e9a26d51) 
> ===END===
> 0:0:0:0:0:0:0:1 -- GET
> networkids=42b962bf-27f1-434b-bd14-239a909a206e&domainid=6ff469a6-d975
> -11e5-98dc-001e8c29bd11&apiKey=M5-9oj4BbFevrrNL92dHA3N_emaWHirVzFLxhKe
> nCT8z8dMpzb1PmeeAJv2ICmNuSsnj6tl371T8VYxjGtPLJg&name=test1&details%5B0
> %5D.cpuSpeed=1000&expires=2016-03-23T14%3A19%3A23%2B0000&signaturevers
> ion=3&zoneid=9c667177-4f6e-4d51-b841-2b83f5e851ac&details%5B0%5D.cpuNu
> mber=2&command=deployVirtualMachine&templateid=14c5e883-c6c3-4fed-83d5
> -451d1064dcad&response=json&signature=VDammkzNSFJI25IZNRzMX9I0K7U%3D&s
> erviceofferingid=8aab1d01-1ec3-4eec-85ab-6caba370288a&details%5B0%5D.M
> emory=512M
>
> If I just change "Memory" to "memory", I get this (I know, there's 
> also another network ID):
>
> (local) 🐵 > deploy virtualmachine
> zoneid=9c667177-4f6e-4d51-b841-2b83f5e851ac
> domainid=6ff469a6-d975-11e5-98dc-001e8c29bd11
> templateid=14c5e883-c6c3-4fed-83d5-451d1064dcad
> networkids=9cb521cf-4e31-4e4e-9cc3-0594c0d86b23
> serviceofferingid=8aab1d01-1ec3-4eec-85ab-6caba370288a
> details[0].cpuNumber=2 details[0].cpuSpeed=1000 details[0].Memory=512M
> name=test1
> Error 401 Authentication error
> errorcode = 401
> errortext = unable to verify user credentials and/or request signature
> uuidList:
>
> (local) 🐵 > deploy virtualmachine
> zoneid=9c667177-4f6e-4d51-b841-2b83f5e851ac
> domainid=6ff469a6-d975-11e5-98dc-001e8c29bd11
> templateid=14c5e883-c6c3-4fed-83d5-451d1064dcad
> networkids=9cb521cf-4e31-4e4e-9cc3-0594c0d86b23
> serviceofferingid=8aab1d01-1ec3-4eec-85ab-6caba370288a
> details[0].cpuNumber=2 details[0].cpuSpeed=1000 details[0].memory=512M
> name=test1
> Error 431: Invalid memory value, specify a value between 32 and
> 2147483647 MB cserrorcode = 4350 errorcode = 431 errortext = Invalid 
> memory value, specify a value between 32 and
> 2147483647 MB
> uuidList:
>
> So it looks like the key is only being validated when the commands are 
> validated successfully: If the call would be valid, it fails at the 
> key check, otherwise it is rejected, too.
>
> Creating a VM via the Web GUI works fine, here's a request from the
> management.log:
>
> 2016-03-23 15:10:03,242 DEBUG [c.c.a.ApiServlet]
> (catalina-exec-12:ctx-1c7c46b2) (logid:2387765e) ===START===
> 172.24.187.83
> -- GET
> command=deployVirtualMachine&response=json&zoneid=9c667177-4f6e-4d51-b
> 841-2b83f5e851ac&templateid=14c5e883-c6c3-4fed-83d5-451d1064dcad&hyper
> visor=XenServer&serviceofferingid=8aab1d01-1ec3-4eec-85ab-6caba370288a
> &details%5B0%5D.cpuNumber=2&details%5B0%5D.cpuSpeed=1000&details%5B0%5
> D.memory=512&iptonetworklist%5B0%5D.networkid=9cb521cf-4e31-4e4e-9cc3-
> 0594c0d86b23&displayname=test2&name=test2&_=1458742213708
> 2016-03-23 15:10:03,260 DEBUG [c.c.u.AccountManagerImpl]
> (catalina-exec-12:ctx-1c7c46b2 ctx-e288c668) (logid:2387765e) Access 
> granted to Acct[f191fec4-d975-11e5-98dc-001e8c29bd11-admin] to
> org.apache.cloudstack.quota.vo.ServiceOfferingVO$$EnhancerByCGLIB$$837
> 82f89@580c534b
> by AffinityGroupAccessChecker
>
> There's no signature at all, but the _ is probably some kind of 
> session ID...
>
> Ciao
>
> Martin
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Rohit Yadav [mailto:rohit.yadav@shapeblue.com]
> Gesendet: Mittwoch, 23. März 2016 15:28
> An: users@cloudstack.apache.org
> Betreff: RE: API deploy virtualmachine failed with custom offering
>
> Hi Martin,
>
> The details argument for this API is a map, CloudMonkey simply wraps 
> given arguments and creates a HTTP request so for maps it's always 
> been a syntax like map[0].key=value. The usage of maps has been documented here:
>
> https://cwiki.apache.org/confluence/display/CLOUDSTACK/CloudStack+clou
> dmonkey+CLI#CloudStackcloudmonkeyCLI-Argumentpassing
>
> This has not changed since 4.1/4.2. You may also debug by tailing 
> cloudmonkey logs if you get further issues: tail -f ~/.cloudmonkey/log
>
> Though I think it's a good idea to automatically add this weird syntax 
> so users can pass maps directly as map.key=value (your syntax). I'll 
> see what I can do to fix this :)
>
> Regards.
>
> Regards,
>
> Rohit Yadav
>
> rohit.yadav@shapeblue.com
> www.shapeblue.com
> 53 Chandos Place, Covent Garden, London  WC2N 4HSUK @shapeblue
>
> -----Original Message-----
> From: Martin Emrich [mailto:martin.emrich@empolis.com]
> Sent: Wednesday, March 23, 2016 2:50 PM
> To: users@cloudstack.apache.org
> Subject: API deploy virtualmachine failed with custom offering
>
> HI!
>
> I try to deploy a virtual machine with a custom offering via the API. 
> But I get "401 unable to verify user credentials and/or request signature".
> First I thought my signing code is wonky (although it worked fine for 
> over a year now)... But if I use cloudmonkey I get the same:
>
> (local) > deploy virtualmachine
> zoneid=e99e796c-4e5c-4549-a0d7-ddd3d8526c06
> domainid=5b6fbb96-db68-11e3-86e7-0030487e0d0c name=martin1
> serviceofferingid=d16eb08f-ad36-496e-a7bd-b5e43f104ce6
> details.cpuSpeed=1000 details.Memory=1024MB details.cpuNumber=2 
> networkids=0ba76ecd-39cf-403e-bbf7-68e4c44e43ac
> templateid=dc3c32ca-21a2-46a4-83f1-229d83b0588d
> Error 401 Authentication error
> errorcode = 401
> errortext = unable to verify user credentials and/or request signature
> uuidList:
> (local) >
>
> It only happens when I specify the details[0] values, so maybe there's 
> something wrong regarding the square braces []?
>
> I use ACS 4.8.0, and I remember that it worked some time ago with 4.4.3.
>
> Thanks for any hints!
>
> Regards
>
> Martin
>
>
Mime
View raw message