From nobody Mon Feb 9 00:30:45 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530696292863814.81173870736; Wed, 4 Jul 2018 02:24:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C580B8553E; Wed, 4 Jul 2018 09:24:51 +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 7E2F7D717A; Wed, 4 Jul 2018 09:24:51 +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 229FC1800B70; Wed, 4 Jul 2018 09:24:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w649O962000788 for ; Wed, 4 Jul 2018 05:24:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id DDF72178BD; Wed, 4 Jul 2018 09:24:08 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-103.brq.redhat.com [10.40.204.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E7947C5D for ; Wed, 4 Jul 2018 09:24:08 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 4 Jul 2018 11:23:41 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 07/10] viriscsitest: Test virISCSIConnectionLogin 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.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 04 Jul 2018 09:24:52 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Introduce one basic test that tests the simplest case: logging into portal without any IQN. Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- tests/viriscsitest.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tests/viriscsitest.c b/tests/viriscsitest.c index 3bb3993196..a7287069ba 100644 --- a/tests/viriscsitest.c +++ b/tests/viriscsitest.c @@ -94,6 +94,16 @@ static void testIscsiadmCb(const char *const*args, args[8] && STREQ(args[8], "nonpersistent") && args[9] =3D=3D NULL) { ignore_value(VIR_STRDUP(*output, iscsiadmSendtargetsOutput)); + } else if (args[0] && STREQ(args[0], ISCSIADM) && + args[1] && STREQ(args[1], "--mode") && + args[2] && STREQ(args[2], "node") && + args[3] && STREQ(args[3], "--portal") && + args[4] && STREQ(args[4], "10.20.30.40:3260,1") && + args[5] && STREQ(args[5], "--targetname") && + args[6] && STREQ(args[6], "iqn.2004-06.example:example1:isc= si.test") && + args[7] && STREQ(args[7], "--login") && + args[8] =3D=3D NULL) { + /* nada */ } else { *status =3D -1; } @@ -175,6 +185,32 @@ testISCSIScanTargets(const void *data) return ret; } =20 + +struct testConnectionInfoLogin { + const char *portal; + const char *initiatoriqn; + const char *target; +}; + + +static int +testISCSIConnectionLogin(const void *data) +{ + const struct testConnectionInfoLogin *info =3D data; + int ret =3D -1; + + virCommandSetDryRun(NULL, testIscsiadmCb, NULL); + + if (virISCSIConnectionLogin(info->portal, info->initiatoriqn, info->ta= rget) < 0) + goto cleanup; + + ret =3D 0; + cleanup: + virCommandSetDryRun(NULL, NULL, NULL); + return ret; +} + + static int mymain(void) { @@ -213,6 +249,16 @@ mymain(void) if (virTestRun("ISCSI scan targets", testISCSIScanTargets, &infoTarget= s) < 0) rv =3D -1; =20 +# define DO_LOGIN_TEST(portal, iqn, target) \ + do { \ + struct testConnectionInfoLogin info =3D {portal, iqn, target }; \ + if (virTestRun("ISCSI login " portal, \ + testISCSIConnectionLogin, &info) < 0) \ + rv =3D -1; \ + } while (0) + + DO_LOGIN_TEST("10.20.30.40:3260,1", NULL, "iqn.2004-06.example:example= 1:iscsi.test"); + if (rv < 0) return EXIT_FAILURE; return EXIT_SUCCESS; --=20 2.16.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list