Skip to content
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

CA-395626: Fix (server status report generation report) #5832

Merged

Conversation

last-genius
Copy link
Contributor

Concatenates the query value back after Uri.query splits the string separated by commas.

Uri.query splits the value string into several if they are separated with commas. Like this: "?k=v1,v2,v3" -> [("k", ["v1";"v2";"v3"])] This function concatenates these back. (i.e. into [("k", "v1,v2,v3")]).

It will not concatenate values entered for duplicate keys, as these will be separate tuples: "?k=v1,v2,v3&k=v4" -> [("k", ["v1"; "v2"; "v3"]); ("k", ["v4"])]

This was tested manually by issuing a host-get-system-status call:

$ xe host-get-system-status uuid=ed4342d9-eeaf-41a3-88d3-90c0d47c3f76   
output=tar filename=just.tar entries=xapi-debug,xen-info,xha-liveset,high-availability,cron,control-slice,firstboot,NVIDIA-logs,block-scheduler,xenserver-databases,multipath,disk-info,xenserver-logs,xenserver-install,process-list,xapi,host-crashdump-logs,xapi-subprocess,pam,observer,system-load,tapdisk-logs,kernel-info,xenserver-config,xenserver-domains,device-model,hardware-info,xenopsd,loopback-devices,system-services,system-logs,network-status,v6d,xspvscache,message-switch,VM-snapshot-schedule,xen-bugtool,xcp-rrdd-plugins,yum,fcoe,xapi-clusterd,vtpm,network-config,boot-loader,xenrt username=root password=(*)

==== Before:
/var/log/xensource.log:Jul 15 08:10:36 lcy2-dt29 xapi: [debug||122714 HTTP 127.0.0.1->
:::80|system-status download R:71d7056eb7d4|system_status] running /usr/sbin/xen-bugtool --entries=xapi-debug 
--silent --yestoall --output=tar --outfd=c0284748-dd7a-0200-6c1b-3a30ba3387c8

==== After:
/var/log/xensource.log:Jul 15 08:15:56 lcy2-dt29 xapi: [debug||190 HTTP 127.0.0.1->
:::80|system-status download R:4861c74180fc|system_status] running /usr/sbin/xen-bugtool
--entries=xapi-debug,xen-info,xha-liveset,high-availability,cron,control-slice,firstboot,NVIDIA-logs,block-scheduler,xenserver-databases,multipath,disk-info,xenserver-logs,xenserver-install,process-list,xapi,host-crashdump-logs,xapi-subprocess,pam,observer,system-load,tapdisk-logs,kernel-info,xenserver-config,xenserver-domains,device-model,hardware-info,xenopsd,loopback-devices,system-services,system-logs,network-status,v6d,xspvscache,message-switch,VM-snapshot-schedule,xen-bugtool,xcp-rrdd-plugins,yum,fcoe,xapi-clusterd,vtpm,network-config,boot-loader,xenrt --silent --yestoall --output=tar --outfd=fc3a22b6-ec90-59ec-7ae2-868d5c36c66e

Concatenates the query value back after Uri.query splits the string
separated by commas.

Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
@edwintorok
Copy link
Contributor

Can you add a unit test in test_server.ml? E.g. you can write. a new handler there that just echoes back a parameter, and then send it one with commas and check that you receive it back unchanged.

Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
@last-genius
Copy link
Contributor Author

Added a unit test.

@edwintorok edwintorok merged commit 42fb801 into xapi-project:master Jul 15, 2024
15 checks passed
@last-genius last-genius deleted the private/asultanov/query-fix branch July 15, 2024 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants