From nobody Mon Feb 9 01:21:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1583771110; cv=none; d=zohomail.com; s=zohoarc; b=icqjp3DmpInKFyskVwrqNqtOku73geCzZT1gGHkIF+xt4R1C+PSwFbpqP242eEN5+/x6bxpAGZpAsgYhvPNVns17vkjcnuNm1MUq+mfgz/EbSRCp3rph2HAS8demC3DBFl8AwirbvjCeF1SdnYW91nRzn9ksqlsZgqJEoeR6d+c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583771110; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LmHvwOSvg2VSCDnIyCO2i8CoIRrqhzKIAh6ETPbOUcM=; b=EXZBmcR12i0aYhzxAc7itFHeNQedVm4rKKgY7dDgh2+POw0X/R9X0RqWzLl+ju8rykXeWy8/uHyf+qYUxaxlEzt1cXGcJ38mttXlpjj5maKj+G36XwxhfBTokbinMRdpTwSC3tsCxiNfT4XgjVu8jmXLR4J1kSbIzrdwBjfz0NE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1583771110781215.64663031802786; Mon, 9 Mar 2020 09:25:10 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-259-ik71AFWLO_KmDLlIUm699g-1; Mon, 09 Mar 2020 12:24:04 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BE1C4800D54; Mon, 9 Mar 2020 16:23:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 91C5A60C05; Mon, 9 Mar 2020 16:23:56 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 38B2F86A1D; Mon, 9 Mar 2020 16:23:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 029GNRJm020810 for ; Mon, 9 Mar 2020 12:23:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 32BE7909E9; Mon, 9 Mar 2020 16:23:27 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id ADEE19051C for ; Mon, 9 Mar 2020 16:23:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583771109; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=LmHvwOSvg2VSCDnIyCO2i8CoIRrqhzKIAh6ETPbOUcM=; b=YzoGbpxcFBaUA4A51qMfzlMl1sFVqQifU2vaiP/VHuc8uTWCwpzdRmMpuTzpWdap32F9nN xkSWbGhf1/s8FMdPZSoFqwVnMI1Tx7Ki/fiwBOWAYvL9heROQVpV5KUXVSPNJHDkv0cHuB yTFb/5hy0HyOfkKC40SlVwqlbn90/5c= X-MC-Unique: ik71AFWLO_KmDLlIUm699g-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 15/30] conf: Add support for setting timeout and readahead size for network disks Date: Mon, 9 Mar 2020 17:22:55 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Some disk backends support configuring the readahead buffer or timeout for requests. Add the knobs to the XML. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- docs/formatdomain.html.in | 16 +++++++++++++ docs/schemas/domaincommon.rng | 23 +++++++++++++++++++ src/conf/domain_conf.c | 19 +++++++++++++++ src/util/virstoragefile.c | 2 ++ src/util/virstoragefile.h | 3 +++ .../disk-network-http.xml | 2 ++ 6 files changed, 65 insertions(+) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index dfea614907..79cf82522f 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2852,6 +2852,8 @@ <cookies> <cookie name=3D"test">somevalue</cookie> </cookies> + <readahead size=3D'65536'/> + <timeout seconds=3D'6'/> </source> <target dev=3D'hde' bus=3D'ide' tray=3D'open'/> <readonly/> @@ -3402,6 +3404,20 @@ must conform to the HTTP specification. Since 6.2.0 +
readahead
+
+ Specifies the size of the readahead buffer for protocols + which support it. (all 'curl' based drivers in qemu). The size + is in bytes. Note that '0' is considered as if the value is not + provided. + Since 6.2.0 +
+
timeout
+
+ Specifies the connection timeout for protocols which support i= t. + Note that '0' is considered as if the value is not provided. + Since 6.2.0 +

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 85d6484dbd..6805420451 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1808,6 +1808,25 @@ + + + + + + + + + + + + + + + + + + + @@ -1854,6 +1873,7 @@ + @@ -1873,6 +1893,7 @@ + @@ -1892,6 +1913,7 @@ + @@ -1910,6 +1932,7 @@ + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index dc7a47dd21..81352c7b5d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9500,6 +9500,19 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, return -1; } + if (src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_HTTP || + src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_HTTPS || + src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_FTP || + src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_FTPS) { + + if (virXPathULongLong("string(./readahead/@size)", ctxt, &src->rea= dahead) =3D=3D -2 || + virXPathULongLong("string(./timeout/@seconds)", ctxt, &src->ti= meout) =3D=3D -2) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("invalid readahead size or timeout")); + return -1; + } + } + return 0; } @@ -24631,6 +24644,12 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attr= Buf, virDomainDiskSourceFormatNetworkCookies(childBuf, src); + if (src->readahead) + virBufferAsprintf(childBuf, "\n", src->r= eadahead); + + if (src->timeout) + virBufferAsprintf(childBuf, "\n", src->= timeout); + return 0; } diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index fb5fff5c5f..9e740419eb 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -2383,6 +2383,8 @@ virStorageSourceCopy(const virStorageSource *src, def->discard =3D src->discard; def->detect_zeroes =3D src->detect_zeroes; def->sslverify =3D src->sslverify; + def->readahead =3D src->readahead; + def->timeout =3D src->timeout; /* storage driver metadata are not copied */ def->drv =3D NULL; diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 95d9501dd8..dd2186c4ff 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -295,6 +295,9 @@ struct _virStorageSource { bool encryptionInherited; virStoragePRDefPtr pr; virTristateBool sslverify; + /* both values below have 0 as default value */ + unsigned long long readahead; /* size of the readahead buffer in bytes= */ + unsigned long long timeout; /* connection timeout in seconds */ virStorageSourceNVMeDefPtr nvme; /* type =3D=3D VIR_STORAGE_TYPE_NVME = */ diff --git a/tests/genericxml2xmlindata/disk-network-http.xml b/tests/gener= icxml2xmlindata/disk-network-http.xml index bafb77c8ec..a8430b8365 100644 --- a/tests/genericxml2xmlindata/disk-network-http.xml +++ b/tests/genericxml2xmlindata/disk-network-http.xml @@ -49,6 +49,8 @@ testcookievalue blurb + + --=20 2.24.1