From nobody Mon Feb 9 00:56:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1493377899287512.218346910363; Fri, 28 Apr 2017 04:11:39 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8E384A794; Fri, 28 Apr 2017 11:11:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5A8888EE5C; Fri, 28 Apr 2017 11:11:37 +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 061EA5ED63; Fri, 28 Apr 2017 11:11:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v3SBAZIR004450 for ; Fri, 28 Apr 2017 07:10:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5C54F9533B; Fri, 28 Apr 2017 11:10:35 +0000 (UTC) Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id B390778352; Fri, 28 Apr 2017 11:10:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8E384A794 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8E384A794 From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 28 Apr 2017 13:10:27 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH v2 4/4] qemu: command: Implement ssl verification configuration 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 28 Apr 2017 11:11:38 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Allow disabling of SSL certificate validation for HTTPS and FTPS drives in qemu. --- src/qemu/qemu_command.c | 22 +++++++-- .../qemuxml2argv-disk-drive-network-http.args | 37 +++++++++++++++ .../qemuxml2argv-disk-drive-network-http.xml | 52 ++++++++++++++++++= ++++ 3 files changed, 107 insertions(+), 4 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-= http.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-= http.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 196716a6f..2c4704aa6 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1528,10 +1528,24 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk, } virBufferAddLit(buf, ","); - if (disk->src->type =3D=3D VIR_STORAGE_TYPE_NETWORK && - disk->src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_GLUSTER) { - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_GLUSTER_DEBUG_LEVEL)) - virBufferAsprintf(buf, "file.debug=3D%d,", cfg->glusterDebugLe= vel); + if (disk->src->type =3D=3D VIR_STORAGE_TYPE_NETWORK) { + if ((disk->src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_FTPS || + disk->src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_HTTPS) && + disk->src->sslverify !=3D VIR_TRISTATE_BOOL_ABSENT) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCK_CURL_SSLVERIFY))= { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("can't set SSL verification for https/ftp= s disks")); + goto cleanup; + } + + virBufferAsprintf(buf, "file.sslverify=3D%s,", + virTristateSwitchTypeToString(disk->src->ssl= verify)); + } + + if (disk->src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_GLUSTER) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_GLUSTER_DEBUG_LEVEL)) + virBufferAsprintf(buf, "file.debug=3D%d,", cfg->glusterDeb= ugLevel); + } } if (secinfo && secinfo->type =3D=3D VIR_DOMAIN_SECRET_INFO_TYPE_AES) { diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-http.ar= gs b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-http.args new file mode 100644 index 000000000..e1bfd42a8 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-http.args @@ -0,0 +1,37 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i686 \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-drive file=3Dhttp://example.org:80/test.img,format=3Draw,if=3Dnone,\ +id=3Ddrive-virtio-disk0 \ +-device virtio-blk-pci,bus=3Dpci.0,addr=3D0x3,drive=3Ddrive-virtio-disk0,\ +id=3Dvirtio-disk0 \ +-drive file=3Dhttps://example.org:443/test2.img,format=3Draw,if=3Dnone,\ +id=3Ddrive-virtio-disk1 \ +-device virtio-blk-pci,bus=3Dpci.0,addr=3D0x4,drive=3Ddrive-virtio-disk1,\ +id=3Dvirtio-disk1 \ +-drive 'file=3Dhttp://example.org:1234/test3.img,\ +file.cookie=3Dtest=3Dtestcookievalue; test2=3Dblurb,format=3Draw,if=3Dnone= ,\ +id=3Ddrive-virtio-disk2' \ +-device virtio-blk-pci,bus=3Dpci.0,addr=3D0x5,drive=3Ddrive-virtio-disk2,\ +id=3Dvirtio-disk2 \ +-drive 'file=3Dhttps://example.org:1234/test4.img,file.sslverify=3Doff,\ +file.cookie=3Dtest=3Dtestcookievalue; test2=3Dblurb,format=3Draw,if=3Dnone= ,\ +id=3Ddrive-virtio-disk3' \ +-device virtio-blk-pci,bus=3Dpci.0,addr=3D0x6,drive=3Ddrive-virtio-disk3,\ +id=3Dvirtio-disk3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-http.xm= l b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-http.xml new file mode 100644 index 000000000..50bd6a0e0 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-http.xml @@ -0,0 +1,52 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list