config: fix setting postrequest config#190
Merged
shwstppr merged 1 commit intoapache:mainfrom Aug 26, 2025
Merged
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 <abhishek.mrt22@gmail.com>
|
✅ Build complete for PR #190. 🔗 Download the cmk binaries (expires on September 05, 2025) |
kiranchavala
approved these changes
Aug 26, 2025
Member
kiranchavala
left a comment
There was a problem hiding this comment.
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"
}
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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;