-
Notifications
You must be signed in to change notification settings - Fork 71
config: fix setting postrequest config #190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR apache#161 introduced `postrequest` config but there was no way to update that config other than updating the config file. This PR fixes the behaviour. Also adds a log to highlight what HTTP method is used. Signed-off-by: Abhishek Kumar <[email protected]>
|
✅ Build complete for PR #190. 🔗 Download the cmk binaries (expires on September 05, 2025) |
sureshanaparti
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clgtm
kiranchavala
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
-
Enabled the global setting "enforce.post.requests.and.timestamps” to true
-
On the cmk
(admin) 🐱 > set postrequest false
(admin) 🐱 > create volume name=test5 diskofferingid=2c8a9190-3099-4598-95b1-19560bd40210 zoneid=5ae50b9f-6280-4c4b-9551-ee48da867034
[debug] ExecLine line:create volume name=test5 diskofferingid=2c8a9190-3099-4598-95b1-19560bd40210 zoneid=5ae50b9f-6280-4c4b-9551-ee48da867034
[debug] ExecCmd args: create, volume, name=test5, diskofferingid=2c8a9190-3099-4598-95b1-19560bd40210, zoneid=5ae50b9f-6280-4c4b-9551-ee48da867034
[debug] NewAPIRequest API request URL:http://10.0.35.15:8080/client/api?apiKey=LIN6rqXuaJwMPfGYFh13qDwYz5VNNz1J2J6qIOWcd3oLQOq0WtD4CwRundBL6rzXToa3lQOC_vKjI3nkHtiD8Q&command=createVolume&diskofferingid=2c8a9190-3099-4598-95b1-19560bd40210&expires=2025-08-26T10%3A03%3A51Z&name=test5&response=json&signatureversion=3&zoneid=5ae50b9f-6280-4c4b-9551-ee48da867034&signature=XQ5zgA1Z%2F33lGP4es1L%2FJZwsXeM%3D
[debug] Using HTTP GET for the request: http://10.0.35.15:8080/client/api?apiKey=LIN6rqXuaJwMPfGYFh13qDwYz5VNNz1J2J6qIOWcd3oLQOq0WtD4CwRundBL6rzXToa3lQOC_vKjI3nkHtiD8Q&command=createVolume&diskofferingid=2c8a9190-3099-4598-95b1-19560bd40210&expires=2025-08-26T10%3A03%3A51Z&name=test5&response=json&signatureversion=3&zoneid=5ae50b9f-6280-4c4b-9551-ee48da867034&signature=XQ5zgA1Z%2F33lGP4es1L%2FJZwsXeM%3D
[debug] NewAPIRequest response status code:400
[debug] NewAPIRequest response body:{"createvolumeresponse":{"uuidList":[],"errorcode":400,"cserrorcode":9999,"errortext":"State changing command createVolume needs to be sent using POST request"}}
🙈 Error: (HTTP 400, error code 9999) State changing command createVolume needs to be sent using POST request
- On cmk change the parameter to true
(admin) 🐱 > set postrequest true
[debug] ExecLine line:set postrequest true
[debug] ExecCmd args: set, postrequest, true
[debug] Set command received:postrequest values:true
[debug] UpdateConfig key:postrequest value:true update:true
[debug] Trying to read API cache from:/Users/kiranchavala/.cmk/profiles/admin.cache
(admin) 🐱 > create volume name=test5 diskofferingid=2c8a9190-3099-4598-95b1-19560bd40210 zoneid=5ae50b9f-6280-4c4b-9551-ee48da867034
[debug] ExecLine line:create volume name=test5 diskofferingid=2c8a9190-3099-4598-95b1-19560bd40210 zoneid=5ae50b9f-6280-4c4b-9551-ee48da867034
[debug] ExecCmd args: create, volume, name=test5, diskofferingid=2c8a9190-3099-4598-95b1-19560bd40210, zoneid=5ae50b9f-6280-4c4b-9551-ee48da867034
[debug] NewAPIRequest API request URL:http://10.0.35.15:8080/client/api?apiKey=LIN6rqXuaJwMPfGYFh13qDwYz5VNNz1J2J6qIOWcd3oLQOq0WtD4CwRundBL6rzXToa3lQOC_vKjI3nkHtiD8Q&command=createVolume&diskofferingid=2c8a9190-3099-4598-95b1-19560bd40210&expires=2025-08-26T10%3A05%3A48Z&name=test5&response=json&signatureversion=3&zoneid=5ae50b9f-6280-4c4b-9551-ee48da867034
[debug] Using HTTP POST for the request: http://10.0.35.15:8080/client/api
[debug] NewAPIRequest response status code:200
[debug] NewAPIRequest response body:{"createvolumeresponse":{"id":"942f7f51-c410-4036-bbde-2ff80812f285","jobid":"3a94e2da-28af-46e3-a0c4-6316ae405f6b"}}
⣯ 😹 polling for async API result[debug] NewAPIRequest API request URL:http://10.0.35.15:8080/client/api?apiKey=LIN6rqXuaJwMPfGYFh13qDwYz5VNNz1J2J6qIOWcd3oLQOq0WtD4CwRundBL6rzXToa3lQOC_vKjI3nkHtiD8Q&command=queryAsyncJobResult&expires=2025-08-26T10%3A05%3A51Z&jobid=3a94e2da-28af-46e3-a0c4-6316ae405f6b&response=json&signatureversion=3
[debug] Using HTTP POST for the request: http://10.0.35.15:8080/client/api
⡿ 😻 polling for async API result[debug] NewAPIRequest response status code:200
[debug] NewAPIRequest response body:{"queryasyncjobresultresponse":{"accountid":"41afc720-7731-11f0-9a5b-1e00900003a2","account":"admin","domainid":"f8f8593c-7730-11f0-9a5b-1e00900003a2","domainpath":"ROOT","userid":"41b07ac1-7731-11f0-9a5b-1e00900003a2","cmd":"org.apache.cloudstack.api.command.admin.volume.CreateVolumeCmdByAdmin","jobprocstatus":0,"jobresultcode":0,"jobresulttype":"object","jobresult":{"volume":{"id":"942f7f51-c410-4036-bbde-2ff80812f285","name":"test5","zoneid":"5ae50b9f-6280-4c4b-9551-ee48da867034","zonename":"ref-trl-9219-k-Mol8-kiran-chavala","type":"DATADISK","provisioningtype":"thin","size":5368709120,"created":"2025-08-26T09:50:49+0000","state":"Allocated","account":"admin","domainid":"f8f8593c-7730-11f0-9a5b-1e00900003a2","domain":"ROOT","domainpath":"/","storagetype":"shared","hypervisor":"None","diskofferingid":"2c8a9190-3099-4598-95b1-19560bd40210","diskofferingname":"Small","diskofferingdisplaytext":"Small Disk, 5 GB","destroyed":false,"isextractable":true,"displayvolume":true,"quiescevm":false,"supportsstoragesnapshot":false,"deleteprotection":false,"tags":[],"hasannotations":false,"jobid":"3a94e2da-28af-46e3-a0c4-6316ae405f6b","jobstatus":0}},"jobinstancetype":"Volume","jobinstanceid":"942f7f51-c410-4036-bbde-2ff80812f285","created":"2025-08-26T09:50:49+0000","completed":"2025-08-26T09:50:49+0000","jobid":"3a94e2da-28af-46e3-a0c4-6316ae405f6b","jobstatus":1}}
{
"volume": {
"account": "admin",
"created": "2025-08-26T09:50:49+0000",
"deleteprotection": false,
"destroyed": false,
"diskofferingdisplaytext": "Small Disk, 5 GB",
"diskofferingid": "2c8a9190-3099-4598-95b1-19560bd40210",
"diskofferingname": "Small",
"displayvolume": true,
"domain": "ROOT",
"domainid": "f8f8593c-7730-11f0-9a5b-1e00900003a2",
"domainpath": "/",
"hasannotations": false,
"hypervisor": "None",
"id": "942f7f51-c410-4036-bbde-2ff80812f285",
"isextractable": true,
"jobid": "3a94e2da-28af-46e3-a0c4-6316ae405f6b",
"jobstatus": 0,
"name": "test5",
"provisioningtype": "thin",
"quiescevm": false,
"size": 5368709120,
"state": "Allocated",
"storagetype": "shared",
"supportsstoragesnapshot": false,
"tags": [],
"type": "DATADISK",
"zoneid": "5ae50b9f-6280-4c4b-9551-ee48da867034",
"zonename": "ref-trl-9219-k-Mol8-kiran-chavala"
}
}
PR #161 introduced
postrequestconfig but there was no way to update that config other than updating the config file. This PR fixes the behaviour. Also adds a log to highlight what HTTP method is used.Tested changing config;