From nobody Tue Feb 10 19:15:09 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 1628765829781228.12700782867535; Thu, 12 Aug 2021 03:57:09 -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-507-jolFFhsgONGvno7FfddnGQ-1; Thu, 12 Aug 2021 06:57:07 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3F5CE1853025; Thu, 12 Aug 2021 10:57:02 +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 2411F620DE; Thu, 12 Aug 2021 10:57:02 +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 60AA6181A2A6; Thu, 12 Aug 2021 10:57:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17CAoa5K015209 for ; Thu, 12 Aug 2021 06:50:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5242D117C2D4; Thu, 12 Aug 2021 10:50:36 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4D33B117C2D2 for ; Thu, 12 Aug 2021 10:50:36 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 35928800182 for ; Thu, 12 Aug 2021 10:50:36 +0000 (UTC) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-278-y9XXlhe-NZi_73s4TszVjg-1; Thu, 12 Aug 2021 06:50:34 -0400 Received: by mail-pl1-f179.google.com with SMTP id k2so6712115plk.13 for ; Thu, 12 Aug 2021 03:50:34 -0700 (PDT) Received: from localhost ([38.94.109.214]) by smtp.gmail.com with ESMTPSA id i5sm9825155pjk.47.2021.08.12.03.50.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Aug 2021 03:50:32 -0700 (PDT) X-MC-Unique: jolFFhsgONGvno7FfddnGQ-1 X-MC-Unique: y9XXlhe-NZi_73s4TszVjg-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=ltZXuSB9vRxIUqKbquzDwUL5o67rx0noi1e6g2b0dSA=; b=XdEfYimObRFInHUp8r6pomLlSrzBW7zRILIUzLI0jMZF0qyK5nH9zxQjVPPxsJJqnS C8mDklWqoOcekidK2YDM3xqabrkWcxus214WdT5FI548KmBwYTnQdpcX4Zy6drM1A1YW pC3U/PbuFzdA2bxThvAvJJ5VIfjtpTcBkogxd6+vTvMiZGMWeLyuwHXbgzQ1xMTjla9K wAOkHIg33VJoPPkCsIfe/3VBbJVjMNEv9DB2rAUA7M3dEUkOEpUrzQ96GU1PMGONX6iR ByZpm9ntjrUMKpSiuCi88YrDTV/kNQlkjPOMnqhN7NdCMQWdaXhkYw+YkGeEu2joxh2A ksnQ== X-Gm-Message-State: AOAM533xSk1Gg+pSXxY695d3w8WG0hAJWLa4s1HJp9kgpvR/TqnjyyLI hxguEzQAEZRbFKYF5+Ub7TpFTpx4MK1XHdoTYrU= X-Google-Smtp-Source: ABdhPJyGmSDVk0CxWMuQ5apgcN7Xh9b951n+D8YX9HpXZUfuc/kFCF7Sa6ZLja/HXNZNEwchL4rs1A== X-Received: by 2002:a17:90b:3805:: with SMTP id mq5mr3367652pjb.207.1628765433028; Thu, 12 Aug 2021 03:50:33 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH v3 08/11] test_driver: Implement testDomainSetIOThreadParams Date: Thu, 12 Aug 2021 18:49:59 +0800 Message-Id: <20210812105002.197134-9-lukedyue@gmail.com> In-Reply-To: <20210812105002.197134-1-lukedyue@gmail.com> References: <20210812105002.197134-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.3 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.11 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: 1628765831803100001 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 385c8b3ad3..1d439a89b6 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -9521,6 +9521,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 @@ -9552,6 +9553,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; } } @@ -9696,6 +9707,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 */ @@ -9766,6 +9855,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