From nobody Mon Feb 9 15:08:59 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 163171988860428.274383016274555; Wed, 15 Sep 2021 08:31:28 -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-137-Abf6ZQqXNImb54_vZiJQJA-1; Wed, 15 Sep 2021 11:31:26 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2A88BA0CD2; Wed, 15 Sep 2021 15:31:19 +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 095545C3DF; Wed, 15 Sep 2021 15:31:19 +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 C78A14EA38; Wed, 15 Sep 2021 15:31:18 +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 18FFVH39028950 for ; Wed, 15 Sep 2021 11:31:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 381CCDEE85; Wed, 15 Sep 2021 15:31:17 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 32AC3DEED7 for ; Wed, 15 Sep 2021 15:31:14 +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 0F4FB101A529 for ; Wed, 15 Sep 2021 15:31:14 +0000 (UTC) Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-99-eyQxZecXNRuar_t_mI4MBw-1; Wed, 15 Sep 2021 11:31:12 -0400 Received: by mail-pj1-f53.google.com with SMTP id j1so2390977pjv.3 for ; Wed, 15 Sep 2021 08:31:12 -0700 (PDT) Received: from localhost ([103.149.249.103]) by smtp.gmail.com with ESMTPSA id i8sm309879pfo.117.2021.09.15.08.31.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 08:31:09 -0700 (PDT) X-MC-Unique: Abf6ZQqXNImb54_vZiJQJA-1 X-MC-Unique: eyQxZecXNRuar_t_mI4MBw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wL5SXtWr/pBo+ikOFqeJ8AsLglmSorrYOXecUO5m0Tg=; b=4EJ0WUuP9FKc8TVCXoqS5cPMQxxp1z60+uDtf5cFQmKClOOtpPpaC4myO2jMJvP9cu tI7y5kEAQPmf23p4nPeKJ4Yrx9hWLlmLIsVP33JuRWM0nNGePrzCtYinitEkZ5xi0KWx 65qiyfsWbCAFQogL+WcAHV+yZDQUxj5SHXOF+OzByNYxNf5MUHZqoqkGtEvWqs3PI0E9 edrO/MeYMcXRHG/qFUrLWZwMyMuaxXPiVRbv24N5C2bB10FfeWtl0HzXMu0CXyC/aJAS oK3oQOzIPp0t3+gbS4sPac5NoX1wR6Cwxp7qw357QemLUqZcFgAWrgiKDavFuYoRPWg4 Qaxg== X-Gm-Message-State: AOAM533K0+0VxuHeJYDBEB+EQqzgt3mWnpn+KyeimLR2ipwKdB9weuih dwwufpMH2nnXPDBXNwHNuZW+eMDshbwBZ8tGPTk= X-Google-Smtp-Source: ABdhPJyvkG0mZDmdQeyzhvnxMLLRkfOdamR7TcIwa+L/gs/+ZrEgDcaSutyWeEp1C/AlbRhWMW4qOw== X-Received: by 2002:a17:90a:29a4:: with SMTP id h33mr436863pjd.88.1631719870282; Wed, 15 Sep 2021 08:31:10 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH v4 08/11] test_driver: Implement testDomainSetIOThreadParams Date: Wed, 15 Sep 2021 23:30:29 +0800 Message-Id: <20210915153032.121221-9-lukedyue@gmail.com> In-Reply-To: <20210915153032.121221-1-lukedyue@gmail.com> References: <20210915153032.121221-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.79 on 10.11.54.5 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.79 on 10.5.11.16 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: 1631719891970100003 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 43c0822c87..7cff26776a 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -9617,6 +9617,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 @@ -9648,6 +9649,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; } } @@ -9792,6 +9803,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 */ @@ -9862,6 +9951,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainAddIOThread =3D testDomainAddIOThread, /* 7.8.0 */ .domainDelIOThread =3D testDomainDelIOThread, /* 7.8.0 */ .domainPinIOThread =3D testDomainPinIOThread, /* 7.8.0 */ + .domainSetIOThreadParams =3D testDomainSetIOThreadParams, /* 7.8.0 */ .domainGetSecurityLabel =3D testDomainGetSecurityLabel, /* 7.5.0 */ .nodeGetSecurityModel =3D testNodeGetSecurityModel, /* 7.5.0 */ .domainGetXMLDesc =3D testDomainGetXMLDesc, /* 0.1.4 */ --=20 2.33.0