From nobody Tue May 7 04:36:37 2024 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 1626155097747564.4063078291688; Mon, 12 Jul 2021 22:44:57 -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-579-9IOUDkkNPc6MebO9CU2YCQ-1; Tue, 13 Jul 2021 01:44:55 -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 3DB669126B; Tue, 13 Jul 2021 05:44:49 +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 E2FAC60657; Tue, 13 Jul 2021 05:44:47 +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 E83DE1809C99; Tue, 13 Jul 2021 05:44:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16D5iiGO014778 for ; Tue, 13 Jul 2021 01:44:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id B1D94200D8E1; Tue, 13 Jul 2021 05:44:44 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AD428200D8CE for ; Tue, 13 Jul 2021 05:44:40 +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 D099C802700 for ; Tue, 13 Jul 2021 05:44:40 +0000 (UTC) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-137-PTt1VElvM_m7zds58X8v8A-1; Tue, 13 Jul 2021 01:44:38 -0400 Received: by mail-pl1-f180.google.com with SMTP id o8so1079947plg.11 for ; Mon, 12 Jul 2021 22:44:38 -0700 (PDT) Received: from localhost ([103.142.141.217]) by smtp.gmail.com with ESMTPSA id g9sm14536201pfr.133.2021.07.12.22.44.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 22:44:37 -0700 (PDT) X-MC-Unique: 9IOUDkkNPc6MebO9CU2YCQ-1 X-MC-Unique: PTt1VElvM_m7zds58X8v8A-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=GKt4CgeXQyOO5oN958TTFBQ8oTTfIOTrSJYNU/DXnJc=; b=JMFg62EKjqTz3Ysq8g8gorg3YbGSzwVwnn5M4v94TJbv/P5i/L6uyCZ+//1oTGjb+t QrMteb0o4mOYR6NBDAwTP75xPU2rclm2r4EJnVpTW6J293VBJt0whDmOOrawD58Dxwmk WHHFytkPeP8l9BOA424QY1z8qx5d6rZzB7xCebPCVZM24HkJ77rXxj/V7Gr5mY/7+ur6 aUWuzIaIJC6LstbP0ik4DYtBtD6b4xgZzYU8XyTcAi3ueM0svigrlFiwcgF4LRBMjZhy qHV7XyIIp/pD0dOkDGVnMD4TmHD2xYUkeBkv1sDZhCRSl1psNegDzd5yjH9//4Ge9pA6 DWmg== X-Gm-Message-State: AOAM531AZbAx0g5DQihO8i1FdPCDw+ftbu8SgV2UrpDHtywWZ8berSZK PzDd64OBAKLzDqR4iUKQ9PPe4+HhQlI96BxPKVk= X-Google-Smtp-Source: ABdhPJxlJKxr9ED8ixz7ygQCOQLCGFiTh5BNwxgmYyFiPGn5W9uRiXPoKap0dUOdOL/gz5lYqd9Pcw== X-Received: by 2002:a17:902:e5cb:b029:128:9962:ef60 with SMTP id u11-20020a170902e5cbb02901289962ef60mr2179900plf.59.1626155077424; Mon, 12 Jul 2021 22:44:37 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH 1/3] test_driver: Implement virDomainGetBlkioParameters Date: Tue, 13 Jul 2021 13:42:12 +0800 Message-Id: <20210713054214.203550-2-lukedyue@gmail.com> In-Reply-To: <20210713054214.203550-1-lukedyue@gmail.com> References: <20210713054214.203550-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.4 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: 1626155098884100002 Content-Type: text/plain; charset="utf-8" Signed-off-by: Luke Yue --- src/test/test_driver.c | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index ef0ddab54d..728b41ba6d 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -3158,6 +3158,52 @@ static char *testDomainGetXMLDesc(virDomainPtr domai= n, unsigned int flags) return ret; } =20 +static int +testDomainGetBlkioParameters(virDomainPtr dom, + virTypedParameterPtr params, + int *nparams, + unsigned int flags) +{ + virDomainObj *vm =3D NULL; + virDomainDef *def =3D NULL; + int maxparams =3D 6; + int ret =3D -1; + + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG | + VIR_TYPED_PARAM_STRING_OKAY, -1); + + if ((*nparams) =3D=3D 0) { + *nparams =3D 6; + return 0; + } else if (*nparams < maxparams) { + maxparams =3D *nparams; + } + + *nparams =3D 0; + + if (!(vm =3D testDomObjFromDomain(dom))) + return -1; + + if (!(def =3D virDomainObjGetOneDef(vm, flags))) + goto cleanup; + + if (virTypedParameterAssign(&(params[(*nparams)++]), + VIR_DOMAIN_BLKIO_WEIGHT, + VIR_TYPED_PARAM_UINT, + def->blkio.weight) < 0) + goto cleanup; + + if (virDomainGetBlkioParametersAssignFromDef(def, params, nparams, + maxparams) < 0) + goto cleanup; + + ret =3D 0; + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} =20 #define TEST_SET_PARAM(index, name, type, value) \ if (index < *nparams && \ @@ -9367,6 +9413,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainGetInterfaceParameters =3D testDomainGetInterfaceParameters, /*= 5.6.0 */ .domainSetBlockIoTune =3D testDomainSetBlockIoTune, /* 5.7.0 */ .domainGetBlockIoTune =3D testDomainGetBlockIoTune, /* 5.7.0 */ + .domainGetBlkioParameters =3D testDomainGetBlkioParameters, /* 7.6.0 */ .connectListDefinedDomains =3D testConnectListDefinedDomains, /* 0.1.1= 1 */ .connectNumOfDefinedDomains =3D testConnectNumOfDefinedDomains, /* 0.1= .11 */ .domainCreate =3D testDomainCreate, /* 0.1.11 */ --=20 2.32.0 From nobody Tue May 7 04:36:37 2024 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 1626155109351333.42253120751514; Mon, 12 Jul 2021 22:45: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-447-PYJcHkGmPs-XywptaufOeQ-1; Tue, 13 Jul 2021 01:45:07 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A17A21018720; Tue, 13 Jul 2021 05:45:01 +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 7C88460C9D; Tue, 13 Jul 2021 05:45:01 +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 3DFB04EA37; Tue, 13 Jul 2021 05:45:01 +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 16D5ipET014789 for ; Tue, 13 Jul 2021 01:44:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 66561C77E1; Tue, 13 Jul 2021 05:44:48 +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 60C68C77E8 for ; Tue, 13 Jul 2021 05:44:44 +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 4F8A2185A794 for ; Tue, 13 Jul 2021 05:44:44 +0000 (UTC) Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-412-Y3ZkVvy-O7WKkQhp1Y0ZWA-1; Tue, 13 Jul 2021 01:44:41 -0400 Received: by mail-pg1-f171.google.com with SMTP id 37so20653858pgq.0 for ; Mon, 12 Jul 2021 22:44:41 -0700 (PDT) Received: from localhost ([103.142.141.217]) by smtp.gmail.com with ESMTPSA id x30sm4325464pfh.126.2021.07.12.22.44.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 22:44:39 -0700 (PDT) X-MC-Unique: PYJcHkGmPs-XywptaufOeQ-1 X-MC-Unique: Y3ZkVvy-O7WKkQhp1Y0ZWA-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=elKcgetSyHDvkdhFd0hPWeLGUdPUuJ62q+YPHPGQcm0=; b=dk98ixT9RQy3eciqXDVrxoyPl26cV3fRv6CQpna6Y5844kXSGbzfqJyBohSZ+FlbR1 KaxscVL5nWqZ1i/U/EHeI2NHrORLa0SQnsraACBqiFNexG/4SXny+dsbI7Z7FS3CnYAN shFSJ0cK87mb/btic/4tc/r9PWNvR7+k+MxeY64/xs+l6KOlvlPsErEv2I7QXJBb/y51 zIkpDjcy9gQ4bfLEWNkvyfoC7eogO3Gc+EcbymZIt5RadwiI8hEpb1Wko746slYfHv1N GKyK8yvrcz7Oznfwm5TM7Z/Nx2Qe2V0VvmVF75YDX8jX++shC6Iui3y+9obNAo0Y0ONE 9ESw== X-Gm-Message-State: AOAM532hP+IoBAjXEZaZlaxDjwA7YOCT9GH3D7jprUVINYacFXgiX+F5 vFVsGJvWvIgFodr9ruHaAa8ieWmMU6ki1CXfSkk= X-Google-Smtp-Source: ABdhPJwxKg/uGrRuisbNZPy99/aCT1twkqC4+9PxnPbMQyG64PuPjJ3I6/GF7a92Eujk2v+GDL/Hxw== X-Received: by 2002:a65:4381:: with SMTP id m1mr2693249pgp.115.1626155079962; Mon, 12 Jul 2021 22:44:39 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH 2/3] test_driver: Implement virDomainSetBlkioParameters Date: Tue, 13 Jul 2021 13:42:13 +0800 Message-Id: <20210713054214.203550-3-lukedyue@gmail.com> In-Reply-To: <20210713054214.203550-1-lukedyue@gmail.com> References: <20210713054214.203550-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.12 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: 1626155109631100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Luke Yue --- src/test/meson.build | 1 + src/test/test_driver.c | 49 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/src/test/meson.build b/src/test/meson.build index f54585adfd..c0174ad856 100644 --- a/src/test/meson.build +++ b/src/test/meson.build @@ -17,6 +17,7 @@ if conf.has('WITH_TEST') ], include_directories: [ conf_inc_dir, + hypervisor_inc_dir, ], ) =20 diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 728b41ba6d..2a83cb4198 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -40,6 +40,7 @@ #include "interface_conf.h" #include "checkpoint_conf.h" #include "domain_conf.h" +#include "domain_driver.h" #include "domain_event.h" #include "network_event.h" #include "snapshot_conf.h" @@ -3158,6 +3159,53 @@ static char *testDomainGetXMLDesc(virDomainPtr domai= n, unsigned int flags) return ret; } =20 +static int +testDomainSetBlkioParameters(virDomainPtr dom, + virTypedParameterPtr params, + int nparams, + unsigned int flags) +{ + virDomainObj *vm =3D NULL; + virDomainDef *def; + int ret =3D -1; + + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); + + if (virTypedParamsValidate(params, nparams, + VIR_DOMAIN_BLKIO_WEIGHT, + VIR_TYPED_PARAM_UINT, + VIR_DOMAIN_BLKIO_DEVICE_WEIGHT, + VIR_TYPED_PARAM_STRING, + VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS, + VIR_TYPED_PARAM_STRING, + VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS, + VIR_TYPED_PARAM_STRING, + VIR_DOMAIN_BLKIO_DEVICE_READ_BPS, + VIR_TYPED_PARAM_STRING, + VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS, + VIR_TYPED_PARAM_STRING, + NULL) < 0) + return -1; + + if (!(vm =3D testDomObjFromDomain(dom))) + return -1; + + if (!(def =3D virDomainObjGetOneDef(vm, flags))) + goto cleanup; + + ret =3D 0; + + ret =3D virDomainDriverSetupPersistentDefBlkioParams(def, + params, + nparams); + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + + static int testDomainGetBlkioParameters(virDomainPtr dom, virTypedParameterPtr params, @@ -9413,6 +9461,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainGetInterfaceParameters =3D testDomainGetInterfaceParameters, /*= 5.6.0 */ .domainSetBlockIoTune =3D testDomainSetBlockIoTune, /* 5.7.0 */ .domainGetBlockIoTune =3D testDomainGetBlockIoTune, /* 5.7.0 */ + .domainSetBlkioParameters =3D testDomainSetBlkioParameters, /* 7.6.0 */ .domainGetBlkioParameters =3D testDomainGetBlkioParameters, /* 7.6.0 */ .connectListDefinedDomains =3D testConnectListDefinedDomains, /* 0.1.1= 1 */ .connectNumOfDefinedDomains =3D testConnectNumOfDefinedDomains, /* 0.1= .11 */ --=20 2.32.0 From nobody Tue May 7 04:36:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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 [170.10.133.124]) by mx.zohomail.com with SMTPS id 1626155099213777.2913491249303; Mon, 12 Jul 2021 22:44:59 -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-266-DjWSYo5rORyG5m6M0RIJuw-1; Tue, 13 Jul 2021 01:44:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 096041835AC8; Tue, 13 Jul 2021 05:44: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 B0E8E5D6BA; Tue, 13 Jul 2021 05:44:50 +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 739151809CAC; Tue, 13 Jul 2021 05:44:50 +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 16D5imot014790 for ; Tue, 13 Jul 2021 01:44:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id A9D5549C35; Tue, 13 Jul 2021 05:44:48 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 61BB3C77EB for ; Tue, 13 Jul 2021 05:44:47 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 0435480D090 for ; Tue, 13 Jul 2021 05:44:47 +0000 (UTC) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-31-jCkcs2v5MT2XM36NP5JcYg-1; Tue, 13 Jul 2021 01:44:44 -0400 Received: by mail-pl1-f178.google.com with SMTP id x16so9628826plg.3 for ; Mon, 12 Jul 2021 22:44:44 -0700 (PDT) Received: from localhost ([103.142.141.217]) by smtp.gmail.com with ESMTPSA id r10sm19878579pga.48.2021.07.12.22.44.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 22:44:42 -0700 (PDT) X-MC-Unique: DjWSYo5rORyG5m6M0RIJuw-1 X-MC-Unique: jCkcs2v5MT2XM36NP5JcYg-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=mixn7Ac42nPyBpa1wcAz1Sacm7Usyfk2+ufPkjQcPs0=; b=IxBM28HKD4UBNBkvMJFl5KQaoAermWRcZjJnIKoHJKbTzCyVnYeElsjuhv1RgTCMGV /YhL0QA+RLJ8fQh7eBywGNbZ9v0/bpEZ6o5M8wW4p7/uGBH6J97dWb0dWqErDTyTTIRR RvKK5+VHyVX529QfeH8s5TrFDhTHwbv7FWk1kvJ4TWrVOT6i0NLwug/3y3J/qmX20u7l dKaB3gmpQHN22jKWZQ12uc9uCcmwYUT3cINFw5qM5cEaosSR8UBznhkBY5DaefjcMeBy tZfkvR0RxDm8YeM/eI3QqZK0I82+IXwPxYKmUmkqyX6x/NYaZu3yt2EcCdLz0GKcHJyZ gKhQ== X-Gm-Message-State: AOAM532XV2HRQ2ca8fKJh8XGwiApEaI77U801eVQuCJ0mT6xltWLi7Ep OpQToHEhEXFiBXv4WcnmVBgC0Hvd6G2KVOqV3WQ= X-Google-Smtp-Source: ABdhPJzttAEGd1mJ7bb4xhjljppa6/KvcgQ70ZhuaQRa/7l6lckP61VpxgONPYpEpQRlPWJ8ON6nPg== X-Received: by 2002:a17:90b:3ec9:: with SMTP id rm9mr17611601pjb.41.1626155082910; Mon, 12 Jul 2021 22:44:42 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH 3/3] tests: Test BlkioParameters related functions for test driver Date: Tue, 13 Jul 2021 13:42:14 +0800 Message-Id: <20210713054214.203550-4-lukedyue@gmail.com> In-Reply-To: <20210713054214.203550-1-lukedyue@gmail.com> References: <20210713054214.203550-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.15 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: 1626155100940100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Luke Yue --- examples/xml/test/testdomfv0.xml | 11 +++++++++ examples/xml/test/testnodeinline.xml | 11 +++++++++ tests/virshtest.c | 36 ++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) diff --git a/examples/xml/test/testdomfv0.xml b/examples/xml/test/testdomfv= 0.xml index fc209cce29..e60b5d69b7 100644 --- a/examples/xml/test/testdomfv0.xml +++ b/examples/xml/test/testdomfv0.xml @@ -38,4 +38,15 @@ + + 800 + + /dev/hda + 700 + 700 + 700 + 700 + 700 + + diff --git a/examples/xml/test/testnodeinline.xml b/examples/xml/test/testn= odeinline.xml index 0ec0f1ace6..78f3c6a671 100644 --- a/examples/xml/test/testnodeinline.xml +++ b/examples/xml/test/testnodeinline.xml @@ -48,6 +48,17 @@ + + 800 + + /dev/hda + 700 + 700 + 700 + 700 + 700 + + fc4 diff --git a/tests/virshtest.c b/tests/virshtest.c index c1974c46cb..43daf8b9c2 100644 --- a/tests/virshtest.c +++ b/tests/virshtest.c @@ -22,6 +22,7 @@ main(void) =20 # define DOM_UUID "ef861801-45b9-11cb-88e3-afbfe5370493" # define SECURITY_LABEL "libvirt-test (enforcing)" +# define BLKIO_PARAMETER "/dev/hda,700" =20 static const char *dominfo_fc4 =3D "\ Id: 2\n\ @@ -43,6 +44,14 @@ static const char *domuuid_fc4 =3D DOM_UUID "\n\n"; static const char *domid_fc4 =3D "2\n\n"; static const char *domname_fc4 =3D "fc4\n\n"; static const char *domstate_fc4 =3D "running\n\n"; +static const char *blkioparameters =3D "\ +weight : 800\n\ +device_weight : " BLKIO_PARAMETER "\n\ +device_read_iops_sec: " BLKIO_PARAMETER "\n\ +device_write_iops_sec: " BLKIO_PARAMETER "\n\ +device_read_bytes_sec: " BLKIO_PARAMETER "\n\ +device_write_bytes_sec: " BLKIO_PARAMETER "\n\ +\n"; =20 static int testFilterLine(char *buffer, const char *toRemove) @@ -250,6 +259,25 @@ static int testCompareDomstateByName(const void *data = G_GNUC_UNUSED) return testCompareOutputLit(exp, NULL, argv); } =20 +static int testCompareGetBlkioParameters(const void *data G_GNUC_UNUSED) +{ + const char *const argv[] =3D { VIRSH_CUSTOM, "blkiotune", "fv0", NULL = }; + const char *exp =3D blkioparameters; + return testCompareOutputLit(exp, NULL, argv); +} + +static int testCompareSetBlkioParameters(const void *data G_GNUC_UNUSED) +{ + const char *const argv[] =3D { VIRSH_CUSTOM, "blkiotune", "fv0", + "--device-weights", "/dev/hda,500", + "--device-read-iops-sec", "/dev/hda,1000", + "--device-write-iops-sec", "/dev/hda,1000", + "--device-read-bytes-sec", "/dev/hda,26214400", + "--device-write-bytes-sec", "/dev/hda,26214400", NULL }; + const char *exp =3D "\n"; + return testCompareOutputLit(exp, NULL, argv); +} + struct testInfo { const char *const *argv; const char *result; @@ -334,6 +362,14 @@ mymain(void) testCompareDomstateByName, NULL) !=3D 0) ret =3D -1; =20 + if (virTestRun("virsh blkiotune (get parameters)", + testCompareGetBlkioParameters, NULL) !=3D 0) + ret =3D -1; + + if (virTestRun("virsh blkiotune (set parameters)", + testCompareSetBlkioParameters, NULL) !=3D 0) + ret =3D -1; + /* It's a bit awkward listing result before argument, but that's a * limitation of C99 vararg macros. */ # define DO_TEST(i, result, ...) \ --=20 2.32.0