diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 9430ccdee1..b6ddfa8e0c 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2852,6 +2852,8 @@
<cookies>
<cookie name="test">somevalue</cookie>
</cookies>
+ <readahead size='65536'/>
+ <timeout seconds='6'/>
</source>
<target dev='hde' bus='ide' tray='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 it.
+ 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 f3de76efe4..71535f53f5 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 == VIR_STORAGE_NET_PROTOCOL_HTTP ||
+ src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTPS ||
+ src->protocol == VIR_STORAGE_NET_PROTOCOL_FTP ||
+ src->protocol == VIR_STORAGE_NET_PROTOCOL_FTPS) {
+
+ if (virXPathULongLong("string(./readahead/@size)", ctxt, &src->readahead) == -2 ||
+ virXPathULongLong("string(./timeout/@seconds)", ctxt, &src->timeout) == -2) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("invalid readahead size or timeout"));
+ return -1;
+ }
+ }
+
return 0;
}
@@ -24632,6 +24645,12 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf,
virDomainDiskSourceFormatNetworkCookies(childBuf, src);
+ if (src->readahead)
+ virBufferAsprintf(childBuf, "\n", src->readahead);
+
+ if (src->timeout)
+ virBufferAsprintf(childBuf, "\n", src->timeout);
+
return 0;
}
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 266e9c489e..a80bffa015 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2383,6 +2383,8 @@ virStorageSourceCopy(const virStorageSource *src,
def->discard = src->discard;
def->detect_zeroes = src->detect_zeroes;
def->sslverify = src->sslverify;
+ def->readahead = src->readahead;
+ def->timeout = src->timeout;
/* storage driver metadata are not copied */
def->drv = 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 == VIR_STORAGE_TYPE_NVME */
diff --git a/tests/genericxml2xmlindata/disk-network-http.xml b/tests/genericxml2xmlindata/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
+
+