From nobody Sat May 4 10:45:58 2024 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=1585577131; cv=none; d=zohomail.com; s=zohoarc; b=l9AoJIy+Ux30x5PbsNJ/vcrJ9mPFxc/b6ko8Wa5MRzPQmaOSuPSqas/FZbG/zU3fFBQCC04Wh7z7Yez3A9qQCNkp6XDbWsg+MyFBqsWksBc0uncnQSUYrGeUAcDIQTjyjK2mteaExGNAalT8/0UAv8gmMi6XYQZf4iho4xJVE14= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585577131; 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=cLXwbscgFE4n10c4biCSWnBCQWJZOzEWeJtMF//W284=; b=aB8HmlFyy3rDI4mwNKSsHxQj2Be7ZLwGz1qIDNAeyTaAtOgpfTl3RsLok0WsExROxBttyimqb937eKPFYhFVfcauOORNxvvNLdsnW97CG9nLpnhC+CB6OWRLyQcwNqYgWGeOr0klQ9/HZMV4vt5phTCMReCn+NZGz7me5SicHGE= 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 1585577131227105.23586985221698; Mon, 30 Mar 2020 07:05:31 -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-196-HH2vd9XwMUGfFajh-peH9w-1; Mon, 30 Mar 2020 10:05:27 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9FF7E8017CE; Mon, 30 Mar 2020 14:05:21 +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 5E56160BE2; Mon, 30 Mar 2020 14:05:21 +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 BCA8B1809567; Mon, 30 Mar 2020 14:05:18 +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 02UE5HNY021591 for ; Mon, 30 Mar 2020 10:05:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id A2E06A7D2; Mon, 30 Mar 2020 14:05:17 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 272ACA7D0 for ; Mon, 30 Mar 2020 14:05:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585577129; 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=cLXwbscgFE4n10c4biCSWnBCQWJZOzEWeJtMF//W284=; b=X8trrUqlcsGKQDvIsMbCGXHWJCu0inyQjXYR8W7dJdmFpJsJIXtIMFCd6dhYjEamkHtdkC 4rDZ0t/gjBAIOyQP1W1wbkH0EfdEbSMff1RXd7+LZz83mjQptGd04f7VasL7ttQ2HZQul7 3cCGGkql3aV/R9ENdxZpxvdQnGMLxzQ= X-MC-Unique: HH2vd9XwMUGfFajh-peH9w-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 1/4] docs: formatdomain: Mention missing protocols Date: Mon, 30 Mar 2020 16:05:06 +0200 Message-Id: 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.12 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" http, https, ftp, ftps, and tftp were not mentioned in the documentation. Note that 'ssh' is still omitted as it's used only internally. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- docs/formatdomain.html.in | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 28e779b90a..6dbf449698 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3096,10 +3096,11 @@
The protocol attribute specifies the protocol to access to the requested image. Possible values are "nbd", - "iscsi", "rbd", "sheepdog", "gluster" or "vxhs". + "iscsi", "rbd", "sheepdog", "gluster", "vxhs", "http", "http= s", + "ftp", ftps", or "tftp". -

If the protocol attribute is "rbd", "sheepdo= g", - "gluster", or "vxhs", an additional attribute name +

For any protocol other than nbd + an additional attribute name is mandatory to specify which volume/image will be used.

--=20 2.24.1 From nobody Sat May 4 10:45:58 2024 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 From nobody Sat May 4 10:45:58 2024 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=1585577148; cv=none; d=zohomail.com; s=zohoarc; b=OiTTZ/TN+6F23QrA9dYsai0fwZR/w0121R2fD3jFjQuAxIylHjWvXAyMxb158c/ohFRQg7UuamYX4nIS+edS5yb3HZ5E+XiDpSy8fxossPHqu4HnPanV1LVVcdgcEl3+mUbEbVdagvt8y74GJrcmU8TFOGGEZ2MTkJXoWCnBzaE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585577148; 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=8sBC+yGXIxwwk88pyui72rYCvSm+fIsOTJXhwP72yEU=; b=m+F6sg8pIm4jqxMzBDQfDNJUOeZ8lttT9/2KwdzNtLsmaJwMY8gcvtjJAmWaDoWHqmAYgQA8vMbAm16y581meR1n9kDuSi5sAhQ9ULPFNehVFnO3PopF6OkPAKILsEtyzV151hvjaufJ7aOD8ApHqHx3UYv0ioNhFW9yqfKfj5w= 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 1585577148349701.9272682729421; Mon, 30 Mar 2020 07:05:48 -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-300-DgU-kT5QOFGVkIqnt2urhQ-1; Mon, 30 Mar 2020 10:05:44 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3F4E3800D5E; Mon, 30 Mar 2020 14:05:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 064D860BE1; Mon, 30 Mar 2020 14:05:38 +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 A72B0944CD; Mon, 30 Mar 2020 14:05:37 +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 02UE5JbE021604 for ; Mon, 30 Mar 2020 10:05:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5FF01CFE1; Mon, 30 Mar 2020 14:05:19 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id CDCA9A7D0 for ; Mon, 30 Mar 2020 14:05:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585577147; 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=8sBC+yGXIxwwk88pyui72rYCvSm+fIsOTJXhwP72yEU=; b=fibOKafemCyJCPRc2xDLxeNw4aNsYWgaI5+tPr4JZTY6G2QMkOQf3P3ZDSn2/L6v6DL1MA Om0BqJ3vZU7kwPVS6v886ZKL8Y5dbtJiixsUl6v7K+htmWXagng66bnBvKhAuC+gdYnhnx Jl5fNBGZvoqAOMygkeKVQUBEc6jZF4k= X-MC-Unique: DgU-kT5QOFGVkIqnt2urhQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 3/4] qemuBlockStorageSourceGetURI: Pass through query component Date: Mon, 30 Mar 2020 16:05:08 +0200 Message-Id: <20ad45ee6a189ee0ee6c1c1bad57a547bf660b2d.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.12 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" If the storage source has the query part set, format it in the output. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_block.c | 2 ++ src/qemu/qemu_domain.c | 9 +++++++++ tests/qemuxml2argvdata/disk-cdrom-network.args | 4 ++-- .../disk-cdrom-network.x86_64-2.12.0.args | 4 ++-- .../disk-cdrom-network.x86_64-latest.args | 3 ++- tests/qemuxml2argvdata/disk-cdrom-network.xml | 2 +- .../disk-network-http.x86_64-latest.args | 5 +++-- 7 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 648c3f1026..2ce14615a0 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -437,6 +437,8 @@ qemuBlockStorageSourceGetURI(virStorageSourcePtr src) } } + uri->query =3D g_strdup(src->query); + uri->server =3D g_strdup(src->hosts->name); return g_steal_pointer(&uri); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index adda17a49f..dd48b6fff3 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7132,6 +7132,15 @@ qemuDomainValidateStorageSource(virStorageSourcePtr = src, } } + if (src->query && + (actualType !=3D VIR_STORAGE_TYPE_NETWORK || + (src->protocol !=3D VIR_STORAGE_NET_PROTOCOL_HTTPS && + src->protocol !=3D VIR_STORAGE_NET_PROTOCOL_HTTP))) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("query is supported only with HTTP(S) protocols")= ); + return -1; + } + return 0; } diff --git a/tests/qemuxml2argvdata/disk-cdrom-network.args b/tests/qemuxml= 2argvdata/disk-cdrom-network.args index be19bad68a..81ff324a0f 100644 --- a/tests/qemuxml2argvdata/disk-cdrom-network.args +++ b/tests/qemuxml2argvdata/disk-cdrom-network.args @@ -30,8 +30,8 @@ id=3Ddrive-ide0-0-0,readonly=3Don \ -drive file=3Dftps://host.name:990/url/path/file.iso,format=3Draw,if=3Dnon= e,\ id=3Ddrive-ide0-0-1,readonly=3Don \ -device ide-cd,bus=3Dide.0,unit=3D1,drive=3Ddrive-ide0-0-1,id=3Dide0-0-1 \ --drive file=3Dhttps://host.name:443/url/path/file.iso,format=3Draw,if=3Dno= ne,\ -id=3Ddrive-ide0-1-0,readonly=3Don \ +-drive 'file=3Dhttps://host.name:443/url/path/file.iso?test=3Dval,format= =3Draw,\ +if=3Dnone,id=3Ddrive-ide0-1-0,readonly=3Don' \ -device ide-cd,bus=3Dide.1,unit=3D0,drive=3Ddrive-ide0-1-0,id=3Dide0-1-0 \ -drive file=3Dtftp://host.name:69/url/path/file.iso,format=3Draw,if=3Dnone= ,\ id=3Ddrive-ide0-1-1,readonly=3Don \ diff --git a/tests/qemuxml2argvdata/disk-cdrom-network.x86_64-2.12.0.args b= /tests/qemuxml2argvdata/disk-cdrom-network.x86_64-2.12.0.args index 1ece3d6f46..81f6b400aa 100644 --- a/tests/qemuxml2argvdata/disk-cdrom-network.x86_64-2.12.0.args +++ b/tests/qemuxml2argvdata/disk-cdrom-network.x86_64-2.12.0.args @@ -32,8 +32,8 @@ id=3Ddrive-ide0-0-0,readonly=3Don \ -drive file=3Dftps://host.name:990/url/path/file.iso,format=3Draw,if=3Dnon= e,\ id=3Ddrive-ide0-0-1,readonly=3Don \ -device ide-cd,bus=3Dide.0,unit=3D1,drive=3Ddrive-ide0-0-1,id=3Dide0-0-1 \ --drive file=3Dhttps://host.name:443/url/path/file.iso,format=3Draw,if=3Dno= ne,\ -id=3Ddrive-ide0-1-0,readonly=3Don \ +-drive 'file=3Dhttps://host.name:443/url/path/file.iso?test=3Dval,format= =3Draw,\ +if=3Dnone,id=3Ddrive-ide0-1-0,readonly=3Don' \ -device ide-cd,bus=3Dide.1,unit=3D0,drive=3Ddrive-ide0-1-0,id=3Dide0-1-0 \ -drive file=3Dtftp://host.name:69/url/path/file.iso,format=3Draw,if=3Dnone= ,\ id=3Ddrive-ide0-1-1,readonly=3Don \ diff --git a/tests/qemuxml2argvdata/disk-cdrom-network.x86_64-latest.args b= /tests/qemuxml2argvdata/disk-cdrom-network.x86_64-latest.args index 0b4ac07f07..2515b256d0 100644 --- a/tests/qemuxml2argvdata/disk-cdrom-network.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-cdrom-network.x86_64-latest.args @@ -37,7 +37,8 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -blockdev '{"node-name":"libvirt-3-format","read-only":true,"driver":"raw"= ,\ "file":"libvirt-3-storage"}' \ -device ide-cd,bus=3Dide.0,unit=3D1,drive=3Dlibvirt-3-format,id=3Dide0-0-1= \ --blockdev '{"driver":"https","url":"https://host.name:443/url/path/file.is= o",\ +-blockdev '{"driver":"https",\ +"url":"https://host.name:443/url/path/file.iso?test=3Dval",\ "node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":true,"driver":"raw"= ,\ "file":"libvirt-2-storage"}' \ diff --git a/tests/qemuxml2argvdata/disk-cdrom-network.xml b/tests/qemuxml2= argvdata/disk-cdrom-network.xml index 0bdc0e1883..44473f8ad4 100644 --- a/tests/qemuxml2argvdata/disk-cdrom-network.xml +++ b/tests/qemuxml2argvdata/disk-cdrom-network.xml @@ -39,7 +39,7 @@ - + diff --git a/tests/qemuxml2argvdata/disk-network-http.x86_64-latest.args b/= tests/qemuxml2argvdata/disk-network-http.x86_64-latest.args index ed44424dc3..7b4674a588 100644 --- a/tests/qemuxml2argvdata/disk-network-http.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-network-http.x86_64-latest.args @@ -55,8 +55,9 @@ id=3Dvirtio-disk2 \ -object secret,id=3Dlibvirt-1-storage-httpcookie-secret0,\ data=3DDrPR9NA6GKJb7qi1KbjHaealKEMVtOWUl2h3yvO5lgIh6cyLHemmlg+h9fcgwREA,\ keyid=3DmasterKey0,iv=3DAAECAwQFBgcICQoLDA0ODw=3D=3D,format=3Dbase64 \ --blockdev '{"driver":"https","url":"https://example.org:1234/test4.img",\ -"sslverify":false,"cookie-secret":"libvirt-1-storage-httpcookie-secret0",\ +-blockdev '{"driver":"https",\ +"url":"https://example.org:1234/test4.img?par=3Dval&other=3Dble","sslverif= y":false,\ +"cookie-secret":"libvirt-1-storage-httpcookie-secret0",\ "node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ",\ "file":"libvirt-1-storage"}' \ --=20 2.24.1 From nobody Sat May 4 10:45:58 2024 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=1585577132; cv=none; d=zohomail.com; s=zohoarc; b=fmJKxlPjA27YWQE8s/1uCeijABuKMZTASA0v9EDe2SqbFcthhN1Td8uN6SWGw0B6TkYA6GrBaoXO/xBl4YH2cy8SHby1neHeQCZo6QO023UfXN1KMhs7UlrGDjj74x7bW3R9ZJbbz0AhOlxokEff/zTnNDj0ac0wBgXECvMI28A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585577132; 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=WuWOKLO05hh6gJvbnTs15I7Zsgi4CjUW9O3h/Ld/jq8=; b=bIWq9ItJi/kb0uUsysfENqs8DOM1oehtLVv+3fjwJ6FPeBgRrnyL5rZsPioXbHIKQRzfWmT/b+B1aryn3enqVshMjwYdYEApcUZFM+mZ1qg2czXUke0x0zuPYKTo4D3YIzDkZ2nseghiOBBuYQC2Mi+3sd8P8928mz4rXCgTZMo= 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 15855771324851018.9861155801455; Mon, 30 Mar 2020 07:05:32 -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-426-42yUnDWuO8WjcQyZbLM_Ww-1; Mon, 30 Mar 2020 10:05:28 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C68C68018A1; Mon, 30 Mar 2020 14:05:22 +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 8C404A7D0; Mon, 30 Mar 2020 14:05:22 +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 DFE1318089C8; Mon, 30 Mar 2020 14:05:21 +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 02UE5K3j021614 for ; Mon, 30 Mar 2020 10:05:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 31C50A7D0; Mon, 30 Mar 2020 14:05:20 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9BF6A7EC for ; Mon, 30 Mar 2020 14:05:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585577131; 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=WuWOKLO05hh6gJvbnTs15I7Zsgi4CjUW9O3h/Ld/jq8=; b=PjilgkYp77YmAj0y9ztS53lL4aaGjOBKotWiYAn7mTmQH3VU9AL9gXpYaV/jHaYd7oC8bP f5/Tqqlg7eAPCWlgQmKXK18j6htLchA9o9FEHcEjc7WbPTkU6q90Yo8w7sVBFMu5LixJe3 PZiMGjN4+Y3shDluGw3Z6TxsZ94ykno= X-MC-Unique: 42yUnDWuO8WjcQyZbLM_Ww-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 4/4] virStorageSourceParseBackingURI: Preserve query string of URI for http(s) Date: Mon, 30 Mar 2020 16:05:09 +0200 Message-Id: <235d0916fd35c887e305d97eb8b44b9c2640b7ce.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.84 on 10.5.11.23 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" For http/https URIs we need to preserve the query part as it may be important to refer to the image. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virstoragefile.c | 13 ++++++++++--- tests/virstoragetest.c | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index bccef863b4..069bc8d776 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -2852,9 +2852,16 @@ virStorageSourceParseBackingURI(virStorageSourcePtr = src, return -1; } - /* handle socket stored as a query */ - if (uri->query) - src->hosts->socket =3D g_strdup(STRSKIP(uri->query, "socket=3D")); + if (uri->query) { + if (src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_HTTP || + src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_HTTPS) { + src->query =3D g_strdup(uri->query); + } else { + /* handle socket stored as a query */ + if (STRPREFIX(uri->query, "socket=3D")) + src->hosts->socket =3D g_strdup(STRSKIP(uri->query, "socke= t=3D")); + } + } /* uri->path is NULL if the URI does not contain slash after host: * transport://host:port */ diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 10d5421150..6e8ebeba13 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -1632,7 +1632,7 @@ mymain(void) "\"file.url\": \"https://host/folder/es= x6.5-rhel7.7-x86%5f64/esx6.5-rhel7.7-x86%5f64-flat.vmdk?dcPath=3Ddata&dsNam= e=3Desx6.5-matrix\"," "\"file.timeout\": 2000" "}", - "\n" + "\n" " \n" " \n" " \n" @@ -1647,7 +1647,7 @@ mymain(void) "\"file.url\": \"https://host/folder/es= x6.5-rhel7.7-x86%5f64/esx6.5-rhel7.7-x86%5f64-flat.vmdk?dcPath=3Ddata&dsNam= e=3Desx6.5-matrix\"," "\"file.timeout\": 2000" "}", - "\n" + "\n" " \n" " \n" " \n" --=20 2.24.1