]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
ch: explicitly set INFILESIZE to 0
authorPraveen K Paladugu <praveenkpaladugu@gmail.com>
Fri, 11 Oct 2024 18:13:11 +0000 (13:13 -0500)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 15 Nov 2024 12:15:41 +0000 (13:15 +0100)
While sending API requests that don't need any body, explicitly set
CURLOPT_INFILESIZE to 0.

Without this option, curl sends a chunked request with `Expect: 100-continue`
header. The client, in this case curl, expects a response from the server,
ch in this case, to respond within a timeout period.

If guest definition has a PCI passthrough device configuration,
cloud-hypervisor process cannot respond within above mentioned timeout.
Even if cloud-hypervisor responds after the timeout, curl cannot read
the response. Because of this, virsh request to create a guest, hangs. This
only happens while using "mshv" hypervisor.

By setting CURLOPT_INFILESIZE to O, curl drops the Expect header and
sychronously waits for server to respond.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/ch/ch_monitor.c

index 935239a721a1293283c6569708f21209b08a67f9..690aea37c8e7e3cfe1c276323ce57bfb445749d4 100644 (file)
@@ -685,6 +685,7 @@ virCHMonitorPutNoContent(virCHMonitor *mon, const char *endpoint)
     curl_easy_setopt(mon->handle, CURLOPT_URL, url);
     curl_easy_setopt(mon->handle, CURLOPT_UPLOAD, 1L);
     curl_easy_setopt(mon->handle, CURLOPT_HTTPHEADER, NULL);
+    curl_easy_setopt(mon->handle, CURLOPT_INFILESIZE, 0L);
 
     responseCode = virCHMonitorCurlPerform(mon->handle);