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
Date Wed, 23 Mar 2016 15:14:32 GMT
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=6ff469a6-d975-11e5-98dc-001e8c29bd11&apiKey=M5-9oj4BbFevrrNL92dHA3N_emaWHirVzFLxhKenCT8z8dMpzb1PmeeAJv2ICmNuSsnj6tl371T8VYxjGtPLJg&name=test1&details%5B0%5D.cpuSpeed=1000&expires=2016-03-23T14%3A19%3A23%2B0000&signatureversion=3&zoneid=9c667177-4f6e-4d51-b841-2b83f5e851ac&details%5B0%5D.cpuNumber=2&command=deployVirtualMachine&templateid=14c5e883-c6c3-4fed-83d5-451d1064dcad&response=json&signature=VDammkzNSFJI25IZNRzMX9I0K7U%3D&serviceofferingid=8aab1d01-1ec3-4eec-85ab-6caba370288a&details%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-239a909a206e&domainid=6ff469a6-d975-11e5-98dc-001e8c29bd11&apiKey=M5-9oj4BbFevrrNL92dHA3N_emaWHirVzFLxhKenCT8z8dMpzb1PmeeAJv2ICmNuSsnj6tl371T8VYxjGtPLJg&name=test1&details%5B0%5D.cpuSpeed=1000&expires=2016-03-23T14%3A19%3A23%2B0000&signatureversion=3&zoneid=9c667177-4f6e-4d51-b841-2b83f5e851ac&details%5B0%5D.cpuNumber=2&command=deployVirtualMachine&templateid=14c5e883-c6c3-4fed-83d5-451d1064dcad&response=json&signature=VDammkzNSFJI25IZNRzMX9I0K7U%3D&serviceofferingid=8aab1d01-1ec3-4eec-85ab-6caba370288a&details%5B0%5D.Memory=512M
2016-03-23 15:09:23,985 - requester.py:49 - [DEBUG] Response received: {"deployvirtualmachineresponse":{"uuidList":[],"errorcode":401,"errortext":"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_emaWHirVzFLxhKenCT8z8dMpzb1PmeeAJv2ICmNuSsnj6tl371T8VYxjGtPLJg&name=test1&details%5B0%5D.cpuSpeed=1000&expires=2016-03-23T14%3A19%3A23%2B0000&signatureversion=3&zoneid=9c667177-4f6e-4d51-b841-2b83f5e851ac&details%5B0%5D.cpuNumber=2&command=deployVirtualMachine&templateid=14c5e883-c6c3-4fed-83d5-451d1064dcad&response=json&signature=VDammkzNSFJI25IZNRzMX9I0K7U%3D&serviceofferingid=8aab1d01-1ec3-4eec-85ab-6caba370288a&details%5B0%5D.Memory=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_emaWHirVzFLxhKenCT8z8dMpzb1PmeeAJv2ICmNuSsnj6tl371T8VYxjGtPLJg&name=test1&details%5B0%5D.cpuSpeed=1000&expires=2016-03-23T14%3A19%3A23%2B0000&signatureversion=3&zoneid=9c667177-4f6e-4d51-b841-2b83f5e851ac&details%5B0%5D.cpuNumber=2&command=deployVirtualMachine&templateid=14c5e883-c6c3-4fed-83d5-451d1064dcad&response=json&signature=VDammkzNSFJI25IZNRzMX9I0K7U%3D&serviceofferingid=8aab1d01-1ec3-4eec-85ab-6caba370288a&details%5B0%5D.Memory=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-b841-2b83f5e851ac&templateid=14c5e883-c6c3-4fed-83d5-451d1064dcad&hypervisor=XenServer&serviceofferingid=8aab1d01-1ec3-4eec-85ab-6caba370288a&details%5B0%5D.cpuNumber=2&details%5B0%5D.cpuSpeed=1000&details%5B0%5D.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$$83782f89@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+cloudmonkey+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