From nobody Mon Feb 9 02:11:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1627560709015308.2440049466991; Thu, 29 Jul 2021 05:11:49 -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-283-YzPkfdrzOTuaIcSpoiZfbg-1; Thu, 29 Jul 2021 08:11:46 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DEE5D1006C83; Thu, 29 Jul 2021 12:11:39 +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 B72E6100EB3E; Thu, 29 Jul 2021 12:11:39 +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 827994A70B; Thu, 29 Jul 2021 12:11:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16TCBZUg014751 for ; Thu, 29 Jul 2021 08:11:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 82CC220BC8D1; Thu, 29 Jul 2021 12:11:35 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7E7A620287D4 for ; Thu, 29 Jul 2021 12:11:32 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2F9AA18A01A9 for ; Thu, 29 Jul 2021 12:11:32 +0000 (UTC) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-507-A-73FkdoOTqIsmKoeVqXFg-1; Thu, 29 Jul 2021 08:11:27 -0400 Received: by mail-pl1-f170.google.com with SMTP id d17so6709156plh.10 for ; Thu, 29 Jul 2021 05:11:27 -0700 (PDT) Received: from localhost ([103.138.53.99]) by smtp.gmail.com with ESMTPSA id j16sm3762337pfi.165.2021.07.29.05.11.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 05:11:26 -0700 (PDT) X-MC-Unique: YzPkfdrzOTuaIcSpoiZfbg-1 X-MC-Unique: A-73FkdoOTqIsmKoeVqXFg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wnSajLfVCNAnFlvcbebQMR/xxu9YazXA2VIvvwiL8Jc=; b=O8W1zsFxgbGUqx/ME8rXTFl7u1z9613TzMxkbzy0UFX7KGEAdf5uDPHBr9bp7cVt49 TtfBosqULehpmO7xFxx6Azi94AEpkczclYZv8oTwahQWiUpGc32F46V2ujVJu1Hw5Vil qJhoTHCdi0lxZH5l8w/6Y/Ob33A3emA+fFi4O0l+CZ4cYCKtfRfYC/uHhszPK0/Gmeh6 7r055PsF45LHv3zN8zivlAXqtPf2n0yzkDtSb8ATFk0AUVHuYvu2pHxHWkoF0Oe1YQha SiicDgvyxyDnai/X9PJJFxTKF2e8hHE8YAbsee2Swc78OZY4wS6S9Eun+hwHOI8IwVZa bX3g== X-Gm-Message-State: AOAM530LqWoqQtbDyi3pv6geU4MDs3j6DY+TpcNebcL8mcWuUy9+ulM7 9guX20UzjftskpM6wUnEZbx5EVRViuM6NiD0ToWL1g== X-Google-Smtp-Source: ABdhPJy0c9dzHIjnP7TPtXVw+MpPFztnew4V4c7rLOK32oRAOoSWs3Hit1AdQYFPnj5zutsR1vc4GQ== X-Received: by 2002:aa7:9a4a:0:b029:328:abeb:a339 with SMTP id x10-20020aa79a4a0000b0290328abeba339mr4868915pfj.29.1627560686381; Thu, 29 Jul 2021 05:11:26 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH v2 08/11] test_driver: Implement testDomainSetIOThreadParams Date: Thu, 29 Jul 2021 20:10:55 +0800 Message-Id: <20210729121058.454431-9-lukedyue@gmail.com> In-Reply-To: <20210729121058.454431-1-lukedyue@gmail.com> References: <20210729121058.454431-1-lukedyue@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1627560710497100002 Content-Type: text/plain; charset="utf-8" Signed-off-by: Luke Yue --- src/test/test_driver.c | 90 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index f192e800bf..ca36e655f4 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -9419,6 +9419,7 @@ testDomainGetIOThreadInfo(virDomainPtr dom, typedef enum { VIR_DOMAIN_IOTHREAD_ACTION_ADD, VIR_DOMAIN_IOTHREAD_ACTION_DEL, + VIR_DOMAIN_IOTHREAD_ACTION_MOD, } virDomainIOThreadAction; =20 static int @@ -9450,6 +9451,16 @@ testDomainChgIOThread(virDomainObj *vm, =20 virDomainIOThreadIDDel(def, iothread_id); =20 + break; + + case VIR_DOMAIN_IOTHREAD_ACTION_MOD: + if (!(virDomainIOThreadIDFind(def, iothread_id))) { + virReportError(VIR_ERR_INVALID_ARG, + _("cannot find IOThread '%u' in iothreadids= "), + iothread_id); + return ret; + } + break; } } @@ -9594,6 +9605,84 @@ testDomainPinIOThread(virDomainPtr dom, return ret; } =20 +static int +testDomainIOThreadParseParams(virTypedParameterPtr params, + int nparams, + testIOThreadInfo *iothread) +{ + if (virTypedParamsValidate(params, nparams, + VIR_DOMAIN_IOTHREAD_POLL_MAX_NS, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_IOTHREAD_POLL_GROW, + VIR_TYPED_PARAM_UINT, + VIR_DOMAIN_IOTHREAD_POLL_SHRINK, + VIR_TYPED_PARAM_UINT, + NULL) < 0) + return -1; + + if (virTypedParamsGetULLong(params, nparams, + VIR_DOMAIN_IOTHREAD_POLL_MAX_NS, + &iothread->poll_max_ns) < 0) + return -1; + + if (virTypedParamsGetUInt(params, nparams, + VIR_DOMAIN_IOTHREAD_POLL_GROW, + &iothread->poll_grow) < 0) + return -1; + + if (virTypedParamsGetUInt(params, nparams, + VIR_DOMAIN_IOTHREAD_POLL_SHRINK, + &iothread->poll_shrink) < 0) + return -1; + + return 0; +} + +static int +testDomainSetIOThreadParams(virDomainPtr dom, + unsigned int iothread_id, + virTypedParameterPtr params, + int nparams, + unsigned int flags) +{ + virDomainObj *vm =3D NULL; + testDomainObjPrivate *priv; + size_t i; + int ret =3D -1; + + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE, -1); + + if (iothread_id =3D=3D 0) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("invalid value of 0 for iothread_id")); + goto cleanup; + } + + if (!(vm =3D testDomObjFromDomain(dom))) + goto cleanup; + + if (testDomainChgIOThread(vm, iothread_id, + VIR_DOMAIN_IOTHREAD_ACTION_MOD, flags) < 0) + goto cleanup; + + priv =3D vm->privateData; + + for (i =3D 0; i < priv->iothreads->len; i++) { + testIOThreadInfo *iothread =3D &g_array_index(priv->iothreads, + testIOThreadInfo, i); + if (iothread->iothread_id =3D=3D iothread_id) { + if (testDomainIOThreadParseParams(params, nparams, iothread) <= 0) + goto cleanup; + ret =3D 0; + break; + } + } + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + /* * Test driver */ @@ -9664,6 +9753,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainAddIOThread =3D testDomainAddIOThread, /* 7.7.0 */ .domainDelIOThread =3D testDomainDelIOThread, /* 7.7.0 */ .domainPinIOThread =3D testDomainPinIOThread, /* 7.7.0 */ + .domainSetIOThreadParams =3D testDomainSetIOThreadParams, /* 7.7.0 */ .domainGetSecurityLabel =3D testDomainGetSecurityLabel, /* 7.5.0 */ .nodeGetSecurityModel =3D testNodeGetSecurityModel, /* 7.5.0 */ .domainGetXMLDesc =3D testDomainGetXMLDesc, /* 0.1.4 */ --=20 2.32.0