mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
conf: Add support for http(s) query strings
Add a new attribute for holding the query part for http(s) disks. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
b24281c934
commit
5636812472
@ -2847,7 +2847,7 @@
|
|||||||
</disk>
|
</disk>
|
||||||
<disk type='network' device='cdrom'>
|
<disk type='network' device='cdrom'>
|
||||||
<driver name='qemu' type='raw'/>
|
<driver name='qemu' type='raw'/>
|
||||||
<source protocol="http" name="url_path">
|
<source protocol="http" name="url_path" query="foo=bar&amp;baz=flurb>
|
||||||
<host name="hostname" port="80"/>
|
<host name="hostname" port="80"/>
|
||||||
<cookies>
|
<cookies>
|
||||||
<cookie name="test">somevalue</cookie>
|
<cookie name="test">somevalue</cookie>
|
||||||
@ -3113,6 +3113,11 @@
|
|||||||
('tls' <span class="since">Since 4.5.0</span>)
|
('tls' <span class="since">Since 4.5.0</span>)
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>For protocols <code>http</code> and <code>https</code> an
|
||||||
|
optional attribute <code>query</code> specifies the query string.
|
||||||
|
(<span class="since">Since 6.2.0</span>)
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>For "iscsi" (<span class="since">since 1.0.4</span>), the
|
<p>For "iscsi" (<span class="since">since 1.0.4</span>), the
|
||||||
<code>name</code> attribute may include a logical unit number,
|
<code>name</code> attribute may include a logical unit number,
|
||||||
separated from the target's name by a slash (e.g.,
|
separated from the target's name by a slash (e.g.,
|
||||||
|
@ -1869,6 +1869,9 @@
|
|||||||
</choice>
|
</choice>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="name"/>
|
<attribute name="name"/>
|
||||||
|
<optional>
|
||||||
|
<attribute name="query"/>
|
||||||
|
</optional>
|
||||||
<ref name="diskSourceCommon"/>
|
<ref name="diskSourceCommon"/>
|
||||||
<ref name="diskSourceNetworkHost"/>
|
<ref name="diskSourceNetworkHost"/>
|
||||||
<optional>
|
<optional>
|
||||||
@ -1894,6 +1897,9 @@
|
|||||||
</choice>
|
</choice>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="name"/>
|
<attribute name="name"/>
|
||||||
|
<optional>
|
||||||
|
<attribute name="query"/>
|
||||||
|
</optional>
|
||||||
<ref name="diskSourceCommon"/>
|
<ref name="diskSourceCommon"/>
|
||||||
<ref name="diskSourceNetworkHost"/>
|
<ref name="diskSourceNetworkHost"/>
|
||||||
<optional>
|
<optional>
|
||||||
|
@ -9482,6 +9482,10 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
|
|||||||
/* config file currently only works with remote disks */
|
/* config file currently only works with remote disks */
|
||||||
src->configFile = virXPathString("string(./config/@file)", ctxt);
|
src->configFile = virXPathString("string(./config/@file)", ctxt);
|
||||||
|
|
||||||
|
if (src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTP ||
|
||||||
|
src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTPS)
|
||||||
|
src->query = virXMLPropString(node, "query");
|
||||||
|
|
||||||
if (virDomainStorageNetworkParseHosts(node, &src->hosts, &src->nhosts) < 0)
|
if (virDomainStorageNetworkParseHosts(node, &src->hosts, &src->nhosts) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -24591,6 +24595,7 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf,
|
|||||||
path = g_strdup_printf("%s/%s", src->volume, src->path);
|
path = g_strdup_printf("%s/%s", src->volume, src->path);
|
||||||
|
|
||||||
virBufferEscapeString(attrBuf, " name='%s'", path ? path : src->path);
|
virBufferEscapeString(attrBuf, " name='%s'", path ? path : src->path);
|
||||||
|
virBufferEscapeString(attrBuf, " query='%s'", src->query);
|
||||||
|
|
||||||
if (src->haveTLS != VIR_TRISTATE_BOOL_ABSENT &&
|
if (src->haveTLS != VIR_TRISTATE_BOOL_ABSENT &&
|
||||||
!(flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE &&
|
!(flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE &&
|
||||||
|
@ -2418,6 +2418,7 @@ virStorageSourceCopy(const virStorageSource *src,
|
|||||||
def->compat = g_strdup(src->compat);
|
def->compat = g_strdup(src->compat);
|
||||||
def->tlsAlias = g_strdup(src->tlsAlias);
|
def->tlsAlias = g_strdup(src->tlsAlias);
|
||||||
def->tlsCertdir = g_strdup(src->tlsCertdir);
|
def->tlsCertdir = g_strdup(src->tlsCertdir);
|
||||||
|
def->query = g_strdup(src->query);
|
||||||
|
|
||||||
if (src->sliceStorage)
|
if (src->sliceStorage)
|
||||||
def->sliceStorage = virStorageSourceSliceCopy(src->sliceStorage);
|
def->sliceStorage = virStorageSourceSliceCopy(src->sliceStorage);
|
||||||
@ -2696,6 +2697,7 @@ virStorageSourceClear(virStorageSourcePtr def)
|
|||||||
VIR_FREE(def->volume);
|
VIR_FREE(def->volume);
|
||||||
VIR_FREE(def->snapshot);
|
VIR_FREE(def->snapshot);
|
||||||
VIR_FREE(def->configFile);
|
VIR_FREE(def->configFile);
|
||||||
|
VIR_FREE(def->query);
|
||||||
virStorageSourceNetCookiesClear(def);
|
virStorageSourceNetCookiesClear(def);
|
||||||
virStorageSourcePoolDefFree(def->srcpool);
|
virStorageSourcePoolDefFree(def->srcpool);
|
||||||
virBitmapFree(def->features);
|
virBitmapFree(def->features);
|
||||||
|
@ -284,6 +284,7 @@ struct _virStorageSource {
|
|||||||
char *snapshot; /* for storage systems supporting internal snapshots */
|
char *snapshot; /* for storage systems supporting internal snapshots */
|
||||||
char *configFile; /* some storage systems use config file as part of
|
char *configFile; /* some storage systems use config file as part of
|
||||||
the source definition */
|
the source definition */
|
||||||
|
char *query; /* query string for HTTP based protocols */
|
||||||
size_t nhosts;
|
size_t nhosts;
|
||||||
virStorageNetHostDefPtr hosts;
|
virStorageNetHostDefPtr hosts;
|
||||||
size_t ncookies;
|
size_t ncookies;
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
</disk>
|
</disk>
|
||||||
<disk type='network' device='disk'>
|
<disk type='network' device='disk'>
|
||||||
<driver name='qemu' type='raw'/>
|
<driver name='qemu' type='raw'/>
|
||||||
<source protocol='https' name='test4.img'>
|
<source protocol='https' name='test4.img' query='par=val&other=ble'>
|
||||||
<host name='example.org' port='1234'/>
|
<host name='example.org' port='1234'/>
|
||||||
<ssl verify='no'/>
|
<ssl verify='no'/>
|
||||||
<cookies>
|
<cookies>
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
</disk>
|
</disk>
|
||||||
<disk type='network' device='disk'>
|
<disk type='network' device='disk'>
|
||||||
<driver name='qemu' type='raw'/>
|
<driver name='qemu' type='raw'/>
|
||||||
<source protocol='https' name='test4.img'>
|
<source protocol='https' name='test4.img' query='par=val&other=ble'>
|
||||||
<host name='example.org' port='1234'/>
|
<host name='example.org' port='1234'/>
|
||||||
<ssl verify='no'/>
|
<ssl verify='no'/>
|
||||||
<cookies>
|
<cookies>
|
||||||
|
Loading…
Reference in New Issue
Block a user