Hi Bikram, Please go through the management-server.log or vmops.log when you call this API and observe the stack trace of the error, you will get to know what is the exact error on running that SQL query. Accordingly, update or fix the DAO as suggested by David.
Regards, Harikrishna ________________________________ From: David Jumani <david.jum...@shapeblue.com> Sent: Friday, June 25, 2021 4:06 PM To: dev <dev@cloudstack.apache.org> Subject: Re: Error in hitting resetSSHKeyForVirtualMachine api Hi Bikram, In addition to what Rohit had mentioned, also go through https://github.com/shapeblue/hackerbook/blob/main/hack/db.md to ensure that the DAO is properly implemented so the query is generated correctly ________________________________ From: Rohit Yadav <rohit.ya...@shapeblue.com> Sent: Friday, June 25, 2021 3:45 PM To: dev <dev@cloudstack.apache.org>; David Jumani <david.jum...@shapeblue.com> Subject: Re: Error in hitting resetSSHKeyForVirtualMachine api Hi Bikram, (FYI - Bikram is our GSoC21 [1] student, cc @David Jumani<mailto:david.jum...@shapeblue.com> primary mentor) * Are you hitting this on the latest mainβ branch? * Is the ssh key registered in the DB a valid SSH key and are you testing this using Simulator or KVM (or something else)? * Is the keypairs parameter something you've introduced as part of your project? Is it handled properly at the API implement (refer https://github.com/shapeblue/hackerbook/blob/main/hack/api.md#introduction) [1] https://cwiki.apache.org/confluence/display/CLOUDSTACK/GSoC+2021 Regards. Rohit Yadav Principal Engineer rohit.ya...@shapeblue.com www.shapeblue.com<http://www.shapeblue.com> ________________________________ From: Daan Hoogland <daan.hoogl...@gmail.com> Sent: Friday, June 25, 2021 13:19 To: dev <dev@cloudstack.apache.org> Subject: Re: Error in hitting resetSSHKeyForVirtualMachine api Bikram, I see and extra parameter "keypairs" that would not be recognised and hence ignored but otherwise your cli seem correct according to [1] I think you hit a bug, please investigate the logs and create an issue at [2] if you feel it is a cloudstack issue or at [3] if it is a cmk issue [1] http://cloudstack.apache.org/api/apidocs-4.15/apis/resetSSHKeyForVirtualMachine.html [2] https://github.com/apache/cloudstack/issues/new/choose [3] https://github.com/apache/cloudstack-cloudmonkey/issues/new/choose regards, On Fri, Jun 25, 2021 at 9:01 AM Bikram Biswas <bickrombishs...@gmail.com> wrote: > Here is the command and message in cloudmonkey. The VM is connected with > the ssh-key-pair with the name 'myname' > > (bicrxm) π± > reset sshkeyforvirtualmachine account=admin > domainid=a7509cc5-d50e-11eb-afe0-646e69d9cd09 keypair=myname > id=c9e37866-2314-46f8-8741-9b2d045ad40a keypairs=myname > { > "accountid": "a751fb3a-d50e-11eb-afe0-646e69d9cd09", > "cmd": > "org.apache.cloudstack.api.command.admin.vm.ResetVMSSHKeyCmdByAdmin", > "completed": "2021-06-25T12:24:47+0530", > "created": "2021-06-25T12:24:45+0530", > "jobid": "53db8eca-cf4c-4eb6-a9f2-a37d54af0f7d", > "jobinstanceid": "c9e37866-2314-46f8-8741-9b2d045ad40a", > "jobinstancetype": "VirtualMachine", > "jobprocstatus": 0, > "jobresult": { > "errorcode": 530, > "errortext": "Caught: com.mysql.cj.jdbc.ClientPreparedStatement: > SELECT ssh_keypairs.id, ssh_keypairs.account_id, ssh_keypairs.domain_id, > ssh_keypairs.keypair_name, ssh_keypairs.fingerprint, > ssh_keypairs.public_key FROM ssh_keypairs WHERE ssh_keypairs.account_id = > 2 AND ssh_keypairs.domain_id = 1 AND ssh_keypairs.keypair_name = ** NOT > SPECIFIED ** ORDER BY ssh_keypairs.keypair_name DESC " > }, > "jobresultcode": 530, > "jobresulttype": "object", > "jobstatus": 2, > "userid": "a781b145-d50e-11eb-afe0-646e69d9cd09" > } > π Error: async API failed for job 53db8eca-cf4c-4eb6-a9f2-a37d54af0f7d > (bicrxm) π± > > > -- Daan