|
|
fbe740 |
From 3050ddce41896311b8c3ad06f148bea358e597b8 Mon Sep 17 00:00:00 2001
|
|
|
fbe740 |
Message-Id: <3050ddce41896311b8c3ad06f148bea358e597b8@dist-git>
|
|
|
fbe740 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Date: Mon, 16 Mar 2020 22:11:58 +0100
|
|
|
fbe740 |
Subject: [PATCH] conf: Add support for setting timeout and readahead size for
|
|
|
fbe740 |
network disks
|
|
|
fbe740 |
MIME-Version: 1.0
|
|
|
fbe740 |
Content-Type: text/plain; charset=UTF-8
|
|
|
fbe740 |
Content-Transfer-Encoding: 8bit
|
|
|
fbe740 |
|
|
|
fbe740 |
Some disk backends support configuring the readahead buffer or timeout
|
|
|
fbe740 |
for requests. Add the knobs to the XML.
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
(cherry picked from commit 63fd46177367c6653c4c986558f6d0e4a700cfcc)
|
|
|
fbe740 |
|
|
|
fbe740 |
https://bugzilla.redhat.com/show_bug.cgi?id=1804750
|
|
|
fbe740 |
Message-Id: <2694bc6f9a327f89d82da18320e7137152915ad3.1584391727.git.pkrempa@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
---
|
|
|
fbe740 |
docs/formatdomain.html.in | 16 +++++++++++++
|
|
|
fbe740 |
docs/schemas/domaincommon.rng | 23 +++++++++++++++++++
|
|
|
fbe740 |
src/conf/domain_conf.c | 19 +++++++++++++++
|
|
|
fbe740 |
src/util/virstoragefile.c | 2 ++
|
|
|
fbe740 |
src/util/virstoragefile.h | 3 +++
|
|
|
fbe740 |
.../disk-network-http.xml | 2 ++
|
|
|
fbe740 |
6 files changed, 65 insertions(+)
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
|
|
fbe740 |
index 5a10d64e83..2b8f9eabc2 100644
|
|
|
fbe740 |
--- a/docs/formatdomain.html.in
|
|
|
fbe740 |
+++ b/docs/formatdomain.html.in
|
|
|
fbe740 |
@@ -2842,6 +2842,8 @@
|
|
|
fbe740 |
<cookies>
|
|
|
fbe740 |
<cookie name="test">somevalue</cookie>
|
|
|
fbe740 |
</cookies>
|
|
|
fbe740 |
+ <readahead size='65536'/>
|
|
|
fbe740 |
+ <timeout seconds='6'/>
|
|
|
fbe740 |
</source>
|
|
|
fbe740 |
<target dev='hde' bus='ide' tray='open'/>
|
|
|
fbe740 |
<readonly/>
|
|
|
fbe740 |
@@ -3392,6 +3394,20 @@
|
|
|
fbe740 |
must conform to the HTTP specification.
|
|
|
fbe740 |
Since 6.2.0
|
|
|
fbe740 |
|
|
|
fbe740 |
+ readahead
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ Specifies the size of the readahead buffer for protocols
|
|
|
fbe740 |
+ which support it. (all 'curl' based drivers in qemu). The size
|
|
|
fbe740 |
+ is in bytes. Note that '0' is considered as if the value is not
|
|
|
fbe740 |
+ provided.
|
|
|
fbe740 |
+ Since 6.2.0
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ timeout
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ Specifies the connection timeout for protocols which support it.
|
|
|
fbe740 |
+ Note that '0' is considered as if the value is not provided.
|
|
|
fbe740 |
+ Since 6.2.0
|
|
|
fbe740 |
+
|
|
|
fbe740 |
|
|
|
fbe740 |
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
|
|
fbe740 |
index bdf35e64f6..3a0edbed97 100644
|
|
|
fbe740 |
--- a/docs/schemas/domaincommon.rng
|
|
|
fbe740 |
+++ b/docs/schemas/domaincommon.rng
|
|
|
fbe740 |
@@ -1808,6 +1808,25 @@
|
|
|
fbe740 |
</element>
|
|
|
fbe740 |
</define>
|
|
|
fbe740 |
|
|
|
fbe740 |
+ <define name="diskSourceNetworkProtocolPropsCommon">
|
|
|
fbe740 |
+ <optional>
|
|
|
fbe740 |
+ <element name="readahead">
|
|
|
fbe740 |
+ <attribute name="size">
|
|
|
fbe740 |
+ <ref name="positiveInteger"/>
|
|
|
fbe740 |
+ </attribute>
|
|
|
fbe740 |
+ <empty/>
|
|
|
fbe740 |
+ </element>
|
|
|
fbe740 |
+ </optional>
|
|
|
fbe740 |
+ <optional>
|
|
|
fbe740 |
+ <element name="timeout">
|
|
|
fbe740 |
+ <attribute name="seconds">
|
|
|
fbe740 |
+ <ref name="positiveInteger"/>
|
|
|
fbe740 |
+ </attribute>
|
|
|
fbe740 |
+ <empty/>
|
|
|
fbe740 |
+ </element>
|
|
|
fbe740 |
+ </optional>
|
|
|
fbe740 |
+ </define>
|
|
|
fbe740 |
+
|
|
|
fbe740 |
<define name="diskSourceNetworkProtocolSSLVerify">
|
|
|
fbe740 |
<element name="ssl">
|
|
|
fbe740 |
<attribute name="verify">
|
|
|
fbe740 |
@@ -1854,6 +1873,7 @@
|
|
|
fbe740 |
<optional>
|
|
|
fbe740 |
<ref name="diskSourceNetworkProtocolHTTPCookies"/>
|
|
|
fbe740 |
</optional>
|
|
|
fbe740 |
+ <ref name="diskSourceNetworkProtocolPropsCommon"/>
|
|
|
fbe740 |
</element>
|
|
|
fbe740 |
</define>
|
|
|
fbe740 |
|
|
|
fbe740 |
@@ -1873,6 +1893,7 @@
|
|
|
fbe740 |
<optional>
|
|
|
fbe740 |
<ref name="diskSourceNetworkProtocolHTTPCookies"/>
|
|
|
fbe740 |
</optional>
|
|
|
fbe740 |
+ <ref name="diskSourceNetworkProtocolPropsCommon"/>
|
|
|
fbe740 |
</element>
|
|
|
fbe740 |
</define>
|
|
|
fbe740 |
|
|
|
fbe740 |
@@ -1892,6 +1913,7 @@
|
|
|
fbe740 |
<optional>
|
|
|
fbe740 |
<ref name="diskSourceNetworkProtocolSSLVerify"/>
|
|
|
fbe740 |
</optional>
|
|
|
fbe740 |
+ <ref name="diskSourceNetworkProtocolPropsCommon"/>
|
|
|
fbe740 |
</element>
|
|
|
fbe740 |
</define>
|
|
|
fbe740 |
|
|
|
fbe740 |
@@ -1910,6 +1932,7 @@
|
|
|
fbe740 |
<optional>
|
|
|
fbe740 |
<ref name="encryption"/>
|
|
|
fbe740 |
</optional>
|
|
|
fbe740 |
+ <ref name="diskSourceNetworkProtocolPropsCommon"/>
|
|
|
fbe740 |
</element>
|
|
|
fbe740 |
</define>
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
fbe740 |
index d066d3aac1..8aec85e83c 100644
|
|
|
fbe740 |
--- a/src/conf/domain_conf.c
|
|
|
fbe740 |
+++ b/src/conf/domain_conf.c
|
|
|
fbe740 |
@@ -9409,6 +9409,19 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
|
|
|
fbe740 |
return -1;
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
+ if (src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTP ||
|
|
|
fbe740 |
+ src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTPS ||
|
|
|
fbe740 |
+ src->protocol == VIR_STORAGE_NET_PROTOCOL_FTP ||
|
|
|
fbe740 |
+ src->protocol == VIR_STORAGE_NET_PROTOCOL_FTPS) {
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ if (virXPathULongLong("string(./readahead/@size)", ctxt, &src->readahead) == -2 ||
|
|
|
fbe740 |
+ virXPathULongLong("string(./timeout/@seconds)", ctxt, &src->timeout) == -2) {
|
|
|
fbe740 |
+ virReportError(VIR_ERR_XML_ERROR, "%s",
|
|
|
fbe740 |
+ _("invalid readahead size or timeout"));
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
+ }
|
|
|
fbe740 |
+ }
|
|
|
fbe740 |
+
|
|
|
fbe740 |
return 0;
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
@@ -24413,6 +24426,12 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf,
|
|
|
fbe740 |
|
|
|
fbe740 |
virDomainDiskSourceFormatNetworkCookies(childBuf, src);
|
|
|
fbe740 |
|
|
|
fbe740 |
+ if (src->readahead)
|
|
|
fbe740 |
+ virBufferAsprintf(childBuf, "<readahead size='%llu'/>\n", src->readahead);
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ if (src->timeout)
|
|
|
fbe740 |
+ virBufferAsprintf(childBuf, "<timeout seconds='%llu'/>\n", src->timeout);
|
|
|
fbe740 |
+
|
|
|
fbe740 |
return 0;
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
|
|
|
fbe740 |
index 6350168d73..7893e054c3 100644
|
|
|
fbe740 |
--- a/src/util/virstoragefile.c
|
|
|
fbe740 |
+++ b/src/util/virstoragefile.c
|
|
|
fbe740 |
@@ -2383,6 +2383,8 @@ virStorageSourceCopy(const virStorageSource *src,
|
|
|
fbe740 |
def->discard = src->discard;
|
|
|
fbe740 |
def->detect_zeroes = src->detect_zeroes;
|
|
|
fbe740 |
def->sslverify = src->sslverify;
|
|
|
fbe740 |
+ def->readahead = src->readahead;
|
|
|
fbe740 |
+ def->timeout = src->timeout;
|
|
|
fbe740 |
|
|
|
fbe740 |
/* storage driver metadata are not copied */
|
|
|
fbe740 |
def->drv = NULL;
|
|
|
fbe740 |
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
|
|
|
fbe740 |
index 1c7c046ad6..1abdaf89ce 100644
|
|
|
fbe740 |
--- a/src/util/virstoragefile.h
|
|
|
fbe740 |
+++ b/src/util/virstoragefile.h
|
|
|
fbe740 |
@@ -296,6 +296,9 @@ struct _virStorageSource {
|
|
|
fbe740 |
bool encryptionInherited;
|
|
|
fbe740 |
virStoragePRDefPtr pr;
|
|
|
fbe740 |
virTristateBool sslverify;
|
|
|
fbe740 |
+ /* both values below have 0 as default value */
|
|
|
fbe740 |
+ unsigned long long readahead; /* size of the readahead buffer in bytes */
|
|
|
fbe740 |
+ unsigned long long timeout; /* connection timeout in seconds */
|
|
|
fbe740 |
|
|
|
fbe740 |
virStorageSourceNVMeDefPtr nvme; /* type == VIR_STORAGE_TYPE_NVME */
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/tests/genericxml2xmlindata/disk-network-http.xml b/tests/genericxml2xmlindata/disk-network-http.xml
|
|
|
fbe740 |
index bafb77c8ec..a8430b8365 100644
|
|
|
fbe740 |
--- a/tests/genericxml2xmlindata/disk-network-http.xml
|
|
|
fbe740 |
+++ b/tests/genericxml2xmlindata/disk-network-http.xml
|
|
|
fbe740 |
@@ -49,6 +49,8 @@
|
|
|
fbe740 |
<cookie name='test'>testcookievalue</cookie>
|
|
|
fbe740 |
<cookie name='test2'>blurb</cookie>
|
|
|
fbe740 |
</cookies>
|
|
|
fbe740 |
+ <readahead size='65536'/>
|
|
|
fbe740 |
+ <timeout seconds='10'/>
|
|
|
fbe740 |
</source>
|
|
|
fbe740 |
<target dev='vdd' bus='virtio'/>
|
|
|
fbe740 |
</disk>
|
|
|
fbe740 |
--
|
|
|
fbe740 |
2.25.1
|
|
|
fbe740 |
|