From nobody Mon May 6 04:31:54 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 1629367502742922.0466620755345; Thu, 19 Aug 2021 03:05:02 -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-440-Kfp2jZrnOHG4SFE7vGfVXA-1; Thu, 19 Aug 2021 06:04:59 -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 C44DA760C5; Thu, 19 Aug 2021 10:04:54 +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 9CEDFBA6F; Thu, 19 Aug 2021 10:04:54 +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 66EBC181A2AB; Thu, 19 Aug 2021 10:04:54 +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 17JA4pYm028055 for ; Thu, 19 Aug 2021 06:04:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 04099215728D; Thu, 19 Aug 2021 10:04:51 +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 F2F7C20BDB36 for ; Thu, 19 Aug 2021 10:04:41 +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 ECBC4100B8D2 for ; Thu, 19 Aug 2021 10:04:40 +0000 (UTC) Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-51-xqZWaAuVOqCCL16OPIJMrQ-1; Thu, 19 Aug 2021 06:04:38 -0400 Received: by mail-pf1-f181.google.com with SMTP id a21so4995214pfh.5 for ; Thu, 19 Aug 2021 03:04:38 -0700 (PDT) Received: from localhost ([38.94.109.214]) by smtp.gmail.com with ESMTPSA id h17sm2743417pfh.192.2021.08.19.03.04.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 03:04:36 -0700 (PDT) X-MC-Unique: Kfp2jZrnOHG4SFE7vGfVXA-1 X-MC-Unique: xqZWaAuVOqCCL16OPIJMrQ-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=1DlGypTqIKgdGv7dpVmC5riYY0a8znDI0Gle94EsLA0=; b=d+mIEmYeJn82WN/WD7xwi3A1fQgamSNrM79JkEQB4px6ZLO3FO0rLuWgDwLJksCRsb YHLdkcuZA7cFs40Y3bn93dZY9z1vpZFS4gLLdAUGLj5JBbfE1imDhkih5Xm/0U46FGW+ 2ELdbErd7V0R5zr95rBqVfeCwWnCnRjipd7XOzwEgWI3xaDteSCXt7QzwQ51QAYWeblI gQXGaetZFPpFtwOF35XM4LNRIEIJg632WK6yr2tMk6+oTCgZB5Snr6ieStnx0/sXmDF5 bhuq4MROPve2HloIBcFJHi7ovJErQ51Bd+cntCF9rEUdRRj9Kz8zKMfD7St/CKRXUTRw GDgg== X-Gm-Message-State: AOAM533uvc+fQe/LFBO7Gv5jymJMU+qkByVmr92TtzdiMbsma65eomTw qFGKyb4KrR+dpo5kftbe7IOxhfBcq7QBmyMW X-Google-Smtp-Source: ABdhPJwikHySpRHckRK7SY8x14bqxiBSrs/eGGhWrD523aEC3Y0AI4vvUfHAGpx9mwybKChLssLO0Q== X-Received: by 2002:a63:5024:: with SMTP id e36mr13406193pgb.66.1629367477211; Thu, 19 Aug 2021 03:04:37 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH v2 1/3] test_driver: Implement virDomainGetBlkioParameters Date: Thu, 19 Aug 2021 18:04:29 +0800 Message-Id: <20210819100431.148962-2-lukedyue@gmail.com> In-Reply-To: <20210819100431.148962-1-lukedyue@gmail.com> References: <20210819100431.148962-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.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: 1629367504537100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Luke Yue Reviewed-by: Martin Kletzander --- 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 b096d49ac6..23176000b6 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -3290,6 +3290,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 && \ @@ -9522,6 +9568,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.7.0 */ .connectListDefinedDomains =3D testConnectListDefinedDomains, /* 0.1.1= 1 */ .connectNumOfDefinedDomains =3D testConnectNumOfDefinedDomains, /* 0.1= .11 */ .domainCreate =3D testDomainCreate, /* 0.1.11 */ --=20 2.33.0 From nobody Mon May 6 04:31:54 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 162936749569814.872327448394344; Thu, 19 Aug 2021 03:04:55 -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-231-FLw1ZK9XM-idLJZ5tdeQKg-1; Thu, 19 Aug 2021 06:04:53 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 006C4100806A; Thu, 19 Aug 2021 10:04:48 +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 AE4C219D9D; Thu, 19 Aug 2021 10:04:46 +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 545CF4BB7C; Thu, 19 Aug 2021 10:04:44 +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 17JA4h8M028029 for ; Thu, 19 Aug 2021 06:04:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8AE9B200FA65; Thu, 19 Aug 2021 10:04:43 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 85F39200E667 for ; Thu, 19 Aug 2021 10:04:43 +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 6E219805F7C for ; Thu, 19 Aug 2021 10:04:43 +0000 (UTC) Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-530-SMHVjYUcPm6Ljz97YbRPPQ-1; Thu, 19 Aug 2021 06:04:41 -0400 Received: by mail-pg1-f169.google.com with SMTP id 17so5406264pgp.4 for ; Thu, 19 Aug 2021 03:04:41 -0700 (PDT) Received: from localhost ([38.94.109.214]) by smtp.gmail.com with ESMTPSA id c23sm3423979pgb.74.2021.08.19.03.04.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 03:04:39 -0700 (PDT) X-MC-Unique: FLw1ZK9XM-idLJZ5tdeQKg-1 X-MC-Unique: SMHVjYUcPm6Ljz97YbRPPQ-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=mjfGignRDaQpa9iQtvAHP/puwQ5Upf+0sqEPl5A+AaM=; b=n7drcQW1yrKzYTTRozMYN5xBMGml78/39gStaeUYKxLqPNao6wk08jao5crEfx1paR v7S9haQh7RfM0QA+3AMLA00vCabWUvFJ/WceNb79AadjWLj5NeQR9vDBgZEjeply0y0T gncWZc/rZtlPX53Zbmz5BnEUx3uOEsUuz3SGMyrgiMwEguImfDGcvjkpSWynAa/POPLN x8Q4Y8BHXrC0/HWaBi1RT1On1tNFM94GkqQUy2EgN1HnGvjmfXSy2dQKM6E4EJw1OUhG usxQ+u2iHI4ms928uahEJwJoBh+ykNONLCHV1sMQoudGaly8OJIsiSdzbBZ97lMs+WFc KzoA== X-Gm-Message-State: AOAM532+DPBX/E56WNjhZv1I7keG13S+MZ/Ru7cG2FzBJuMCf/S8CiaA Lj4UGx+kSeItaufDXnAJXS1I0UH32XhlPQLU X-Google-Smtp-Source: ABdhPJycRYhrnQMExQrz7bxkluCPCqoK0A1Tf99ATyIk4ahb2wCj8YfybesW/0+emqqVLnxXuKy2qA== X-Received: by 2002:a63:4e5a:: with SMTP id o26mr13411466pgl.19.1629367479925; Thu, 19 Aug 2021 03:04:39 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH v2 2/3] test_driver: Implement virDomainSetBlkioParameters Date: Thu, 19 Aug 2021 18:04:30 +0800 Message-Id: <20210819100431.148962-3-lukedyue@gmail.com> In-Reply-To: <20210819100431.148962-1-lukedyue@gmail.com> References: <20210819100431.148962-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.23 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: 1629367497586100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Luke Yue Reviewed-by: Martin Kletzander --- 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 23176000b6..3aab8377c5 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" @@ -3290,6 +3291,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, @@ -9568,6 +9616,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.7.0 */ .domainGetBlkioParameters =3D testDomainGetBlkioParameters, /* 7.7.0 */ .connectListDefinedDomains =3D testConnectListDefinedDomains, /* 0.1.1= 1 */ .connectNumOfDefinedDomains =3D testConnectNumOfDefinedDomains, /* 0.1= .11 */ --=20 2.33.0 From nobody Mon May 6 04:31:54 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 1629367503345838.1497129780112; Thu, 19 Aug 2021 03:05:03 -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-456-FKj7hWCmPKKcxS4EcB-8bw-1; Thu, 19 Aug 2021 06:05:00 -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 92CFD1082926; Thu, 19 Aug 2021 10:04:55 +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 6DBC6BA6F; Thu, 19 Aug 2021 10:04:55 +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 10560181A2AE; Thu, 19 Aug 2021 10:04:55 +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 17JA4nap028044 for ; Thu, 19 Aug 2021 06:04:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8F2C5FA747; Thu, 19 Aug 2021 10:04:49 +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 8A8ABFA73E for ; Thu, 19 Aug 2021 10:04:46 +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 165D28026D9 for ; Thu, 19 Aug 2021 10:04:46 +0000 (UTC) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-336-4qC1AhdJPbGmYFWMozMpmQ-1; Thu, 19 Aug 2021 06:04:44 -0400 Received: by mail-pf1-f175.google.com with SMTP id g14so5000130pfm.1 for ; Thu, 19 Aug 2021 03:04:43 -0700 (PDT) Received: from localhost ([38.94.109.214]) by smtp.gmail.com with ESMTPSA id e4sm3288029pgt.22.2021.08.19.03.04.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 03:04:42 -0700 (PDT) X-MC-Unique: FKj7hWCmPKKcxS4EcB-8bw-1 X-MC-Unique: 4qC1AhdJPbGmYFWMozMpmQ-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=D4MkGPEVMtgkIFLsTqzAvHkVbkFw5LpYgzUNvef9BhY=; b=okqupKFGSRAr0NHwwMsi1BTk2J+tG7OOfcJZTuQBOx3qMG7NzHy93xIlCYwQGuK/S9 +/9e31B/+sxxKgaIT3Kw/yaup7TtZau+WTuUJKYGynYwqqTYDiOZ0dLfCRYI1fWg79bo TOUgXi76svE6U7iRwnxvDPkzVeayYPjDVAyyxd6vtcZXmgNEvj1oFQgcXDJwfC2SZtGX bU8gRPtTf8ILFttLA7VMhkBz83SCyHKNw150uxV738bnTTIQBRDhI3vO0KuxEClbEbu6 W5ITWlByp/IJhqIn98KWe2Q2k5tB4JxsHuz6bTsmcoPqg+NC4CM5gbR5EJPKNytN6n+w 9zBw== X-Gm-Message-State: AOAM533Qo9sP6jctLCUHdkk/LWRHqJ2liU1cpx9lcM3SqNw9zxrPlNwT VVkeKFDPDEyfwwexES8mJmmiXjOC7Mv9dCgO X-Google-Smtp-Source: ABdhPJxaojfF0ks3SnYYigYJPLPUx1xprhj+rdbglxfZUyNRpwfk6Js9kL1wjIFbgxAYyU26ZOFkvA== X-Received: by 2002:a63:7343:: with SMTP id d3mr13468868pgn.169.1629367482678; Thu, 19 Aug 2021 03:04:42 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH v2 3/3] tests: Test BlkioParameters related functions for test driver Date: Thu, 19 Aug 2021 18:04:31 +0800 Message-Id: <20210819100431.148962-4-lukedyue@gmail.com> In-Reply-To: <20210819100431.148962-1-lukedyue@gmail.com> References: <20210819100431.148962-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: 1629367504634100002 Content-Type: text/plain; charset="utf-8" Signed-off-by: Luke Yue Reviewed-by: Martin Kletzander --- examples/xml/test/testdomfv0.xml | 11 ++++++ examples/xml/test/testnodeinline.xml | 11 ++++++ tests/virshtest.c | 55 ++++++++++++++++++++++++++++ 3 files changed, 77 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 60970145a0..9165d9302d 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 751e8ffc49..87da1f5889 100644 --- a/tests/virshtest.c +++ b/tests/virshtest.c @@ -30,6 +30,8 @@ main(void) tainted: custom device tree blob used\n\ tainted: use of deprecated configuration settings\n\ deprecated configuration: CPU model Deprecated-Test" +# define GET_BLKIO_PARAMETER "/dev/hda,700" +# define SET_BLKIO_PARAMETER "/dev/hda,1000" =20 static const char *dominfo_fc4 =3D "\ Id: 2\n\ @@ -70,6 +72,25 @@ Security label: " SECURITY_LABEL "\n\ Messages: " FC5_MESSAGES "\n\ \n"; =20 +static const char *get_blkio_parameters =3D "\ +weight : 800\n\ +device_weight : " GET_BLKIO_PARAMETER "\n\ +device_read_iops_sec: " GET_BLKIO_PARAMETER "\n\ +device_write_iops_sec: " GET_BLKIO_PARAMETER "\n\ +device_read_bytes_sec: " GET_BLKIO_PARAMETER "\n\ +device_write_bytes_sec: " GET_BLKIO_PARAMETER "\n\ +\n"; + +static const char *set_blkio_parameters =3D "\ +\n\ +weight : 500\n\ +device_weight : " SET_BLKIO_PARAMETER "\n\ +device_read_iops_sec: " SET_BLKIO_PARAMETER "\n\ +device_write_iops_sec: " SET_BLKIO_PARAMETER "\n\ +device_read_bytes_sec: " SET_BLKIO_PARAMETER "\n\ +device_write_bytes_sec: " SET_BLKIO_PARAMETER "\n\ +\n"; + static int testFilterLine(char *buffer, const char *toRemove) { @@ -291,6 +312,32 @@ static int testCompareDomControlInfoByName(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 get_blkio_parameters; + return testCompareOutputLit(exp, NULL, argv); +} + +static int testCompareSetBlkioParameters(const void *data G_GNUC_UNUSED) +{ + const char *const argv[] =3D { VIRSH_CUSTOM, "blkiotune fv0\ + --weight 500\ + --device-weights\ + " SET_BLKIO_PARAMETER "\ + --device-read-iops-sec\ + " SET_BLKIO_PARAMETER "\ + --device-write-iops-sec\ + " SET_BLKIO_PARAMETER "\ + --device-read-bytes-sec\ + " SET_BLKIO_PARAMETER "\ + --device-write-bytes-sec\ + " SET_BLKIO_PARAMETER ";\ + blkiotune fv0", NULL }; + const char *exp =3D set_blkio_parameters; + return testCompareOutputLit(exp, NULL, argv); +} + struct testInfo { const char *const *argv; const char *result; @@ -383,6 +430,14 @@ mymain(void) testCompareDomControlInfoByName, 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.33.0