From nobody Mon Apr 29 07:02:35 2024 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.zohomail.com; dkim=fail; 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 1513246571025402.3266881434595; Thu, 14 Dec 2017 02:16:11 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 95C3F13A5F; Thu, 14 Dec 2017 10:16:09 +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 2A32F69731; Thu, 14 Dec 2017 10:16:09 +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 3A09E4BB79; Thu, 14 Dec 2017 10:16:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vBEAG5F1023341 for ; Thu, 14 Dec 2017 05:16:05 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5FFD460F9F; Thu, 14 Dec 2017 10:16:05 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 58D1160F87 for ; Thu, 14 Dec 2017 10:16:02 +0000 (UTC) Received: from mail-it0-f65.google.com (mail-it0-f65.google.com [209.85.214.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 91EA77EA85 for ; Thu, 14 Dec 2017 10:16:01 +0000 (UTC) Received: by mail-it0-f65.google.com with SMTP id z6so10107999iti.4 for ; Thu, 14 Dec 2017 02:16:01 -0800 (PST) Received: from localhost.localdomain ([210.12.16.251]) by smtp.gmail.com with ESMTPSA id y35sm2399251ita.20.2017.12.14.02.15.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Dec 2017 02:16:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=zn645fJ5yDb9nTYKeWT/afBc6wRT4LBRHYJyvMRCUHA=; b=HAmTbl6IZq42y/qwIHsDIiPIQo+UJFW/KSQixdoT/shtuEjGVEtlxRGCXgyMlV3OMO KGAG8CPYK0peReS5za0xs6+oKNzoUeR3fShp9qhTg6mi9Oh+fed3EBi8mNrwoHxagNYe ddnWIu7HO6IDeIXV2JFSaR7EkZBOU6A7OXylIt3duuToxI6B+Fvn5Q94mEpKjcWg9Och 4vZHKGcD+rOFeMry0Z9wLghZpR7lRlk1y6aYuRF9KlFuAefUipJgva1yRTibmw9/UGCW kS97Uo548n8rDdR8y8xUfTWSOKxs6vh6x3mY0F/aGUv1n0pM8a/3sBEcHjVHsZ7mEQHo QACg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=zn645fJ5yDb9nTYKeWT/afBc6wRT4LBRHYJyvMRCUHA=; b=GuLoFgVFQKnr+2OwgrKhl68l4tu4+AO4itttcKho2a+grTFxvcXoh1yePgqvw1I3jT e7nQPLE9E+FdLuHr3DhWUid6glcroGy9P/FHl1KTpF611M48BupSUji6nj3KFSaMcLQV 5O+M72YO7TSYJ8pzk3cXUoGZVfWpdsSgEChxe/RbILeofxk/RNpUf0ENEiS5DwTs0J2Y nJUV4py2+Rlck72eEigrmuuvkl8Pq6ALJBCYfQjwl97YziLzg/tK7EUvI7LzAEm/qwHP 9WwQMLPKdyjwYxffxsM3+jcRcbuQ1zAEwuuF6k8u7UYmVcsaySfxfRyMb4syduQEcByC vMcQ== X-Gm-Message-State: AKGB3mIH2+rTXvCZVJSFoXOYUI1fte/FOrdg/fV3Z9JYXCgL+iTaIWez Pa1t5YqHR4t0LTEyJtYHvfP0rkI9W1M= X-Google-Smtp-Source: ACJfBotAXT4pbrsiemMBBVsQLvaCd/JUPhRlBZp2fJrkXBN/GEqLzNyNo58r7h04cjGeKmmym7fOkg== X-Received: by 10.36.86.3 with SMTP id o3mr2897960itb.18.1513246560752; Thu, 14 Dec 2017 02:16:00 -0800 (PST) From: lichstor@gmail.com To: libvir-list@redhat.com Date: Thu, 14 Dec 2017 18:14:36 +0800 Message-Id: <20171214101436.62479-1-lichstor@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 14 Dec 2017 10:16:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 14 Dec 2017 10:16:01 +0000 (UTC) for IP:'209.85.214.65' DOMAIN:'mail-it0-f65.google.com' HELO:'mail-it0-f65.google.com' FROM:'lichstor@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.13 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.214.65 mail-it0-f65.google.com 209.85.214.65 mail-it0-f65.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: zhangshengyu Subject: [libvirt] [PATCH] add support of iSER transport type in qemu with libiscsi 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 14 Dec 2017 10:16:10 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: zhangshengyu --- src/conf/domain_conf.c | 13 ++++++++ src/qemu/qemu_block.c | 17 +++++++++- src/util/virstoragefile.c | 3 +- src/util/virstoragefile.h | 1 + tests/qemuxml2argvdata/disk-drive-network-iser.xml | 37 ++++++++++++++++++= ++++ 5 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 tests/qemuxml2argvdata/disk-drive-network-iser.xml diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 66e21c4bd..bf20cfd0c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7201,6 +7201,9 @@ virDomainHostdevSubsysSCSIiSCSIDefParseXML(xmlNodePtr= sourcenode, iscsisrc->src->type =3D VIR_STORAGE_TYPE_NETWORK; iscsisrc->src->protocol =3D VIR_STORAGE_NET_PROTOCOL_ISCSI; =20 +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("virDomainHostdevSubsysSCSIiSCSIDefParseXML")= ); + if (!(iscsisrc->src->path =3D virXMLPropString(sourcenode, "name"))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing iSCSI hostdev source path name")); @@ -8416,6 +8419,7 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, unsigned int flags) { char *protocol =3D NULL; + char *transport =3D NULL; char *haveTLS =3D NULL; char *tlsCfg =3D NULL; int tlsCfgVal; @@ -8427,6 +8431,10 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, goto cleanup; } =20 + if (!(transport =3D virXMLPropString(node, "transport"))) { + VIR_WARN("missing network source transport type"); + } + =20 if ((src->protocol =3D virStorageNetProtocolTypeFromString(protocol)) = <=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown protocol type '%s'"), protocol); @@ -8495,6 +8503,9 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, if (virDomainStorageNetworkParseHosts(node, &src->hosts, &src->nhosts)= < 0) goto cleanup; =20 + if(src->hosts) + src->hosts->transport =3D virStorageNetHostTransportTypeFromString= (transport); + virStorageSourceNetworkAssignDefaultPorts(src); =20 ret =3D 0; @@ -22326,6 +22337,8 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrB= uf, =20 VIR_FREE(path); =20 + virBufferEscapeString(attrBuf, " transport=3D'%s'", "iser"); + if (src->haveTLS !=3D VIR_TRISTATE_BOOL_ABSENT && !(flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE && src->tlsFromConfig)) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 585f0255e..dcd7c6a5e 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -506,6 +506,20 @@ qemuBlockStorageSourceBuildJSONSocketAddress(virStorag= eNetHostDefPtr host, goto cleanup; break; =20 + case VIR_STORAGE_NET_HOST_TRANS_ISER: + transport =3D "iser"; + if (virAsprintf(&port, "%u", host->port) < 0) + goto cleanup; + + if (virJSONValueObjectCreate(&server, + "s:type", transport, + "s:host", host->name, + "s:port", port, + NULL) < 0) + goto cleanup; + + + break; case VIR_STORAGE_NET_HOST_TRANS_UNIX: if (virJSONValueObjectCreate(&server, "s:type", "unix", @@ -831,7 +845,8 @@ qemuBlockStorageSourceGetISCSIProps(virStorageSourcePtr= src) "s:portal", portal, "s:target", target, "u:lun", lun, - "s:transport", "tcp", + "s:transport",=20 + virStorageNetHostTransportTypeTo= String(src->hosts->transport), "S:user", username, "S:password-secret", objalias, NULL)); diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 6594715e5..02d62a68e 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -92,7 +92,8 @@ VIR_ENUM_IMPL(virStorageNetProtocol, VIR_STORAGE_NET_PROT= OCOL_LAST, VIR_ENUM_IMPL(virStorageNetHostTransport, VIR_STORAGE_NET_HOST_TRANS_LAST, "tcp", "unix", - "rdma") + "rdma", + "iser") =20 VIR_ENUM_IMPL(virStorageSourcePoolMode, VIR_STORAGE_SOURCE_POOL_MODE_LAST, diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 24382a0a6..4eb650186 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -147,6 +147,7 @@ typedef enum { VIR_STORAGE_NET_HOST_TRANS_TCP, VIR_STORAGE_NET_HOST_TRANS_UNIX, VIR_STORAGE_NET_HOST_TRANS_RDMA, + VIR_STORAGE_NET_HOST_TRANS_ISER, =20 VIR_STORAGE_NET_HOST_TRANS_LAST } virStorageNetHostTransport; diff --git a/tests/qemuxml2argvdata/disk-drive-network-iser.xml b/tests/qem= uxml2argvdata/disk-drive-network-iser.xml new file mode 100644 index 000000000..b3f4f9bfb --- /dev/null +++ b/tests/qemuxml2argvdata/disk-drive-network-iser.xml @@ -0,0 +1,37 @@ + + QEMUGuest1 + e301d9ab-f5ad-47bf-988c-9645577a1af4 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + + + + + + + + + + + + + + + + + + --=20 2.13.6 (Apple Git-96) -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list