From nobody Mon Feb 9 04:03:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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=1585577150; cv=none; d=zohomail.com; s=zohoarc; b=EcEwAv7EtGS391oRJAamlZj4xOQ93xL9AkGSudm76LrW9H/LPWQz2euHtgCdt9cxc90DnIG5r+t6h81AKu1V//5dG3v1yeBpc9qm71Rg/uNYpKrbEhPPK89QAEj/sVHDhUMa+/q3QYyYGOysTgs8Om06Jk0ZJkijt3WTSD9FzLQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585577150; 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=ZemumB3kskpbZ11Dfnjbx0qHjZQAL9ukFt3vPOMmBrw=; b=FjJvXxjSEje7StZeRB9lbTLJBLUA+LHj2zLkWqybj/7nr/68JCL1j9oX8dL4lj85qnrAClSCnKJ9pS8XofY6ZRovedKJqC/RiDZ6wW5SGrVLW8+2Oeu4cBmU+PdlJFkGcowHH5hLD8eYMfyST5sg1oO9RPm4H9CFvdoGVjsTVao= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585577150038632.3326240405105; Mon, 30 Mar 2020 07:05:50 -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-250-ByTQX8DSNMGaqMgNPiYWAA-1; Mon, 30 Mar 2020 10:05:39 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 37AEB8018A5; Mon, 30 Mar 2020 14:05:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0986B5C1B5; Mon, 30 Mar 2020 14:05:34 +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 A284C18089D5; Mon, 30 Mar 2020 14:05:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02UE5ITT021596 for ; Mon, 30 Mar 2020 10:05:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7C439A7D0; Mon, 30 Mar 2020 14:05:18 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3E06A7EC for ; Mon, 30 Mar 2020 14:05:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585577148; 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=ZemumB3kskpbZ11Dfnjbx0qHjZQAL9ukFt3vPOMmBrw=; b=SURE5ZXQiy9ZPsmxOvx92Et0QoHPVSG7wzfm5onMW/wFf7ZM4nznf6jhkLoqGEjyP4Ps3R XirYa4TfakxBFg+lTuCA9jWJ0M+ngzKdtLlk5uDu6jwMiVPfzO7eWCQ3HefhgkO1tYs/OQ 3tTxTxyy/Hyeb4j+Mf/5mcuP23KrgnY= X-MC-Unique: ByTQX8DSNMGaqMgNPiYWAA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 2/4] conf: Add support for http(s) query strings Date: Mon, 30 Mar 2020 16:05:07 +0200 Message-Id: <4a1945b7875cdf7a3389c791a288ad42a8e6e715.1585576985.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.16 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" Add a new attribute for holding the query part for http(s) disks. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- docs/formatdomain.html.in | 7 ++++++- docs/schemas/domaincommon.rng | 6 ++++++ src/conf/domain_conf.c | 5 +++++ src/util/virstoragefile.c | 1 + src/util/virstoragefile.h | 1 + tests/qemuxml2argvdata/disk-network-http.xml | 2 +- .../qemuxml2xmloutdata/disk-network-http.x86_64-latest.xml | 2 +- 7 files changed, 21 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 6dbf449698..aaeb05961f 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2847,7 +2847,7 @@ </disk> <disk type=3D'network' device=3D'cdrom'> <driver name=3D'qemu' type=3D'raw'/> - <source protocol=3D"http" name=3D"url_path"> + <source protocol=3D"http" name=3D"url_path" query=3D"foo=3Dbar&= amp;baz=3Dflurb> <host name=3D"hostname" port=3D"80"/> <cookies> <cookie name=3D"test">somevalue</cookie> @@ -3113,6 +3113,11 @@ ('tls' Since 4.5.0)

+

For protocols http and https an + optional attribute query specifies the query st= ring. + (Since 6.2.0) +

+

For "iscsi" (since 1.0.4), t= he name attribute may include a logical unit numbe= r, separated from the target's name by a slash (e.g., diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 5de17593c1..1807df521c 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1869,6 +1869,9 @@ + + + @@ -1894,6 +1897,9 @@ + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 27bc5a797b..914e03c705 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9482,6 +9482,10 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, /* config file currently only works with remote disks */ src->configFile =3D virXPathString("string(./config/@file)", ctxt); + if (src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_HTTP || + src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_HTTPS) + src->query =3D virXMLPropString(node, "query"); + if (virDomainStorageNetworkParseHosts(node, &src->hosts, &src->nhosts)= < 0) return -1; @@ -24591,6 +24595,7 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrB= uf, path =3D g_strdup_printf("%s/%s", src->volume, src->path); virBufferEscapeString(attrBuf, " name=3D'%s'", path ? path : src->path= ); + virBufferEscapeString(attrBuf, " query=3D'%s'", src->query); if (src->haveTLS !=3D VIR_TRISTATE_BOOL_ABSENT && !(flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE && diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index c43e52d1f6..bccef863b4 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -2418,6 +2418,7 @@ virStorageSourceCopy(const virStorageSource *src, def->compat =3D g_strdup(src->compat); def->tlsAlias =3D g_strdup(src->tlsAlias); def->tlsCertdir =3D g_strdup(src->tlsCertdir); + def->query =3D g_strdup(src->query); if (src->sliceStorage) def->sliceStorage =3D virStorageSourceSliceCopy(src->sliceStorage); diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 9427057f94..7939c09cd5 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -284,6 +284,7 @@ struct _virStorageSource { char *snapshot; /* for storage systems supporting internal snapshots */ char *configFile; /* some storage systems use config file as part of the source definition */ + char *query; /* query string for HTTP based protocols */ size_t nhosts; virStorageNetHostDefPtr hosts; size_t ncookies; diff --git a/tests/qemuxml2argvdata/disk-network-http.xml b/tests/qemuxml2a= rgvdata/disk-network-http.xml index 93e6617433..3abf499019 100644 --- a/tests/qemuxml2argvdata/disk-network-http.xml +++ b/tests/qemuxml2argvdata/disk-network-http.xml @@ -42,7 +42,7 @@ - + diff --git a/tests/qemuxml2xmloutdata/disk-network-http.x86_64-latest.xml b= /tests/qemuxml2xmloutdata/disk-network-http.x86_64-latest.xml index cf36331286..aaae21c5af 100644 --- a/tests/qemuxml2xmloutdata/disk-network-http.x86_64-latest.xml +++ b/tests/qemuxml2xmloutdata/disk-network-http.x86_64-latest.xml @@ -49,7 +49,7 @@ - + --=20 2.24.1