mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
conf: Add support for setting timeout and readahead size for network disks
Some disk backends support configuring the readahead buffer or timeout for requests. Add the knobs to the XML. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
3b076391be
commit
63fd461773
@ -2852,6 +2852,8 @@
|
|||||||
<cookies>
|
<cookies>
|
||||||
<cookie name="test">somevalue</cookie>
|
<cookie name="test">somevalue</cookie>
|
||||||
</cookies>
|
</cookies>
|
||||||
|
<readahead size='65536'/>
|
||||||
|
<timeout seconds='6'/>
|
||||||
</source>
|
</source>
|
||||||
<target dev='hde' bus='ide' tray='open'/>
|
<target dev='hde' bus='ide' tray='open'/>
|
||||||
<readonly/>
|
<readonly/>
|
||||||
@ -3402,6 +3404,20 @@
|
|||||||
must conform to the HTTP specification.
|
must conform to the HTTP specification.
|
||||||
<span class="since">Since 6.2.0</span>
|
<span class="since">Since 6.2.0</span>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt><code>readahead</code></dt>
|
||||||
|
<dd>
|
||||||
|
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.
|
||||||
|
<span class="since">Since 6.2.0</span>
|
||||||
|
</dd>
|
||||||
|
<dt><code>timeout</code></dt>
|
||||||
|
<dd>
|
||||||
|
Specifies the connection timeout for protocols which support it.
|
||||||
|
Note that '0' is considered as if the value is not provided.
|
||||||
|
<span class="since">Since 6.2.0</span>
|
||||||
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -1808,6 +1808,25 @@
|
|||||||
</element>
|
</element>
|
||||||
</define>
|
</define>
|
||||||
|
|
||||||
|
<define name="diskSourceNetworkProtocolPropsCommon">
|
||||||
|
<optional>
|
||||||
|
<element name="readahead">
|
||||||
|
<attribute name="size">
|
||||||
|
<ref name="positiveInteger"/>
|
||||||
|
</attribute>
|
||||||
|
<empty/>
|
||||||
|
</element>
|
||||||
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<element name="timeout">
|
||||||
|
<attribute name="seconds">
|
||||||
|
<ref name="positiveInteger"/>
|
||||||
|
</attribute>
|
||||||
|
<empty/>
|
||||||
|
</element>
|
||||||
|
</optional>
|
||||||
|
</define>
|
||||||
|
|
||||||
<define name="diskSourceNetworkProtocolSSLVerify">
|
<define name="diskSourceNetworkProtocolSSLVerify">
|
||||||
<element name="ssl">
|
<element name="ssl">
|
||||||
<attribute name="verify">
|
<attribute name="verify">
|
||||||
@ -1854,6 +1873,7 @@
|
|||||||
<optional>
|
<optional>
|
||||||
<ref name="diskSourceNetworkProtocolHTTPCookies"/>
|
<ref name="diskSourceNetworkProtocolHTTPCookies"/>
|
||||||
</optional>
|
</optional>
|
||||||
|
<ref name="diskSourceNetworkProtocolPropsCommon"/>
|
||||||
</element>
|
</element>
|
||||||
</define>
|
</define>
|
||||||
|
|
||||||
@ -1873,6 +1893,7 @@
|
|||||||
<optional>
|
<optional>
|
||||||
<ref name="diskSourceNetworkProtocolHTTPCookies"/>
|
<ref name="diskSourceNetworkProtocolHTTPCookies"/>
|
||||||
</optional>
|
</optional>
|
||||||
|
<ref name="diskSourceNetworkProtocolPropsCommon"/>
|
||||||
</element>
|
</element>
|
||||||
</define>
|
</define>
|
||||||
|
|
||||||
@ -1892,6 +1913,7 @@
|
|||||||
<optional>
|
<optional>
|
||||||
<ref name="diskSourceNetworkProtocolSSLVerify"/>
|
<ref name="diskSourceNetworkProtocolSSLVerify"/>
|
||||||
</optional>
|
</optional>
|
||||||
|
<ref name="diskSourceNetworkProtocolPropsCommon"/>
|
||||||
</element>
|
</element>
|
||||||
</define>
|
</define>
|
||||||
|
|
||||||
@ -1910,6 +1932,7 @@
|
|||||||
<optional>
|
<optional>
|
||||||
<ref name="encryption"/>
|
<ref name="encryption"/>
|
||||||
</optional>
|
</optional>
|
||||||
|
<ref name="diskSourceNetworkProtocolPropsCommon"/>
|
||||||
</element>
|
</element>
|
||||||
</define>
|
</define>
|
||||||
|
|
||||||
|
@ -9500,6 +9500,19 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
|
|||||||
return -1;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24632,6 +24645,12 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf,
|
|||||||
|
|
||||||
virDomainDiskSourceFormatNetworkCookies(childBuf, src);
|
virDomainDiskSourceFormatNetworkCookies(childBuf, src);
|
||||||
|
|
||||||
|
if (src->readahead)
|
||||||
|
virBufferAsprintf(childBuf, "<readahead size='%llu'/>\n", src->readahead);
|
||||||
|
|
||||||
|
if (src->timeout)
|
||||||
|
virBufferAsprintf(childBuf, "<timeout seconds='%llu'/>\n", src->timeout);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2383,6 +2383,8 @@ virStorageSourceCopy(const virStorageSource *src,
|
|||||||
def->discard = src->discard;
|
def->discard = src->discard;
|
||||||
def->detect_zeroes = src->detect_zeroes;
|
def->detect_zeroes = src->detect_zeroes;
|
||||||
def->sslverify = src->sslverify;
|
def->sslverify = src->sslverify;
|
||||||
|
def->readahead = src->readahead;
|
||||||
|
def->timeout = src->timeout;
|
||||||
|
|
||||||
/* storage driver metadata are not copied */
|
/* storage driver metadata are not copied */
|
||||||
def->drv = NULL;
|
def->drv = NULL;
|
||||||
|
@ -295,6 +295,9 @@ struct _virStorageSource {
|
|||||||
bool encryptionInherited;
|
bool encryptionInherited;
|
||||||
virStoragePRDefPtr pr;
|
virStoragePRDefPtr pr;
|
||||||
virTristateBool sslverify;
|
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 */
|
virStorageSourceNVMeDefPtr nvme; /* type == VIR_STORAGE_TYPE_NVME */
|
||||||
|
|
||||||
|
@ -49,6 +49,8 @@
|
|||||||
<cookie name='test'>testcookievalue</cookie>
|
<cookie name='test'>testcookievalue</cookie>
|
||||||
<cookie name='test2'>blurb</cookie>
|
<cookie name='test2'>blurb</cookie>
|
||||||
</cookies>
|
</cookies>
|
||||||
|
<readahead size='65536'/>
|
||||||
|
<timeout seconds='10'/>
|
||||||
</source>
|
</source>
|
||||||
<target dev='vdd' bus='virtio'/>
|
<target dev='vdd' bus='virtio'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
Loading…
Reference in New Issue
Block a user