From nobody Tue Dec 16 02:35:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1589514501; cv=none; d=zohomail.com; s=zohoarc; b=IPDXCWJ+ZsLhc5/Xh2OZbGfHGN8ShSm3vorINuAftiUkv1eTKkLJMmuPXwcK6XSwZpfssJfq1InZ2JlbVuJMm2kSNJqqO7dIrMAlsd3gMc43X/9SLz+s94hZf0bLIA79TOpSuq2O9AwXekn9KR47B5w5NWb8mNBgqb9luFaY1k0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589514501; h=Content-Type:Content-Transfer-Encoding:Cc: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=xz1bQEJrTH/dFYfcYALFDP/Sr7IY5vx6ghVusOkvTjY=; b=ByLp3lRxgltq99JeF5YhrFnvADcAlqufmvLL2CUe8gSTBb2b23P7ilA/T3CswgCoWlmO8/SotWtBT1lthIggP5ugyXKbxeBEIKOop6GUXr6ek7N4ZqbOAN9YPant7RdtvN/jdRjS0sOnfMiZX8d4xQb4Lgv6wJoCC6E8AGM7U/U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1589514501187510.0604101457277; Thu, 14 May 2020 20:48:21 -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-94-XP22rGeROpe2CiYaLH9qCw-1; Thu, 14 May 2020 23:48:17 -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 6B2EC107ACCD; Fri, 15 May 2020 03:48:12 +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 47787261D7; Fri, 15 May 2020 03:48:12 +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 1A4271809563; Fri, 15 May 2020 03:48:12 +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 04F3kT4s012975 for ; Thu, 14 May 2020 23:46:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9CC28261D7; Fri, 15 May 2020 03:46:29 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-13-111.pek2.redhat.com [10.72.13.111]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7D372B6DE; Fri, 15 May 2020 03:46:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589514499; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=xz1bQEJrTH/dFYfcYALFDP/Sr7IY5vx6ghVusOkvTjY=; b=Y241MOF6RYSI1cGOeWaLbVmcMiQPHOHlH1NowtpqxBJhtWhWmqYMHuLM+01xdoc0XFAcfW nLXKo9w+mDD6wUJNZ68Nav3fSx9TyeWwqoiYAHTeX7YCSimikOrZzp623Bpk19rIggQWNE T2iKSjgxBdYqwlmLL3Ba6MEk46HAasA= X-MC-Unique: XP22rGeROpe2CiYaLH9qCw-1 From: Han Han To: libvir-list@redhat.com Subject: [PATCH v2 3/6] qemu: Implement the iSCSI iSER Date: Fri, 15 May 2020 11:46:02 +0800 Message-Id: <20200515034606.5810-4-hhan@redhat.com> In-Reply-To: <20200515034606.5810-1-hhan@redhat.com> References: <20200515034606.5810-1-hhan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: pkrempa@redhat.com, Han Han , david.schweizer@davischw.ch 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" The iSCSI iSER transport is introdcued since QEMU 2.9. For blockdev json, it will appear at 'transport' field: 'json:{...,{"driver": "iscsi","transport":"iser",...}}' For legacy drive filename as iscsi uri, it will start with 'iser' scheme: iser://[[username][%]@][:]// Signed-off-by: Han Han --- src/qemu/qemu_block.c | 11 +++++++++-- src/qemu/qemu_command.c | 3 +++ src/qemu/qemu_domain.c | 9 +++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 6f9c7071..4261e110 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -421,7 +421,10 @@ qemuBlockStorageSourceGetURI(virStorageSourcePtr src) if (src->hosts->transport =3D=3D VIR_STORAGE_NET_HOST_TRANS_TCP) { uri->port =3D src->hosts->port; =20 - uri->scheme =3D g_strdup(virStorageNetProtocolTypeToString(src->pr= otocol)); + if (src->iscsiIser) + uri->scheme =3D g_strdup("iser"); + else + uri->scheme =3D g_strdup(virStorageNetProtocolTypeToString(src= ->protocol)); } else { uri->scheme =3D g_strdup_printf("%s+%s", virStorageNetProtocolTypeToString(sr= c->protocol), @@ -746,6 +749,7 @@ qemuBlockStorageSourceGetISCSIProps(virStorageSourcePtr= src, char *lunStr =3D NULL; char *username =3D NULL; char *objalias =3D NULL; + const char *transport =3D "tcp"; g_autofree char *portal =3D NULL; unsigned int lun =3D 0; virJSONValuePtr ret =3D NULL; @@ -761,6 +765,9 @@ qemuBlockStorageSourceGetISCSIProps(virStorageSourcePtr= src, * } */ =20 + if (src->iscsiIser) + transport =3D "iser"; + target =3D g_strdup(src->path); =20 /* Separate the target and lun */ @@ -791,7 +798,7 @@ qemuBlockStorageSourceGetISCSIProps(virStorageSourcePtr= src, "s:portal", portal, "s:target", target, "u:lun", lun, - "s:transport", "tcp", + "s:transport", transport, "S:user", username, "S:password-secret", objalias, "S:initiator-name", src->initiat= or.iqn, diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index bfe70ed2..1d5a302a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5087,6 +5087,9 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd, qemuDomainStorageSourcePrivatePtr srcPriv =3D QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(iscsisrc->src); =20 + if (qemuDomainValidateStorageSource(iscsisrc->src, qemuCap= s, true) < 0) + return -1; + if (qemuBuildDiskSecinfoCommandLine(cmd, srcPriv ? srcPriv->secinfo : NULL) < 0) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a1b250fd..41e97bf7 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5318,6 +5318,15 @@ qemuDomainValidateStorageSource(virStorageSourcePtr = src, return -1; } =20 + if (qemuCaps) { + if (src->iscsiIser && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_ISCSI_ISER)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("iSCSI iSER is not supported with this QEMU binary")); + return -1; + } + } + return 0; } =20 --=20 2.25.0