From nobody Tue Nov 26 19:52:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1564239935; cv=none; d=zoho.com; s=zohoarc; b=Dfyp0QBzCkQ6UAP7POZRmRlrG3j5qwxsoBxGu5X370KKn8N1jHkAa+ikld/phbzPJ+IkrmqA7EnsOKTuPJWMrFsCR0XGXXglwC/5PCxRJmxmWozPpQP8jZCMPuqUPN3cnCvzGVx655Q8r2dHZ0fNAkXTIlrgk8mxGs6fruSpihE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564239935; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=GkeLlwLvuNuuz7BYglxBox3Tal412Tf/q1H1M1Xy8SE=; b=ZNUx8CQtTKo91Qwhqrc463fN7kGAZuLSJcdJ+K2IPSlLXkabSCNLUYdPZ+EuO1LXWX15x9qV/tjWHdhoaY9m8elmVdsclGd/KP9MmFk/Y8gzqjV+6PHcKYlz9YReOwWvQoWIyVIyGMUHLxmm3ojVshVEDH8pJvXo2/m+/n0/P5E= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1564239935842117.80338223798242; Sat, 27 Jul 2019 08:05:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5E6D63082DDD; Sat, 27 Jul 2019 15:05:34 +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 E7AFF6092D; Sat, 27 Jul 2019 15:05:33 +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 A20A341F63; Sat, 27 Jul 2019 15:05:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6RF5XLh013189 for ; Sat, 27 Jul 2019 11:05:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0ABAD5DA97; Sat, 27 Jul 2019 15:05:33 +0000 (UTC) Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 045B367138 for ; Sat, 27 Jul 2019 15:05:30 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D331F308FC4B for ; Sat, 27 Jul 2019 15:05:29 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id h19so39929490wme.0 for ; Sat, 27 Jul 2019 08:05:29 -0700 (PDT) Received: from archpc.localdomain (x8d1ee222.agdsn.tu-dresden.de. [141.30.226.34]) by smtp.gmail.com with ESMTPSA id g131sm39428925wmf.37.2019.07.27.08.05.27 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 27 Jul 2019 08:05:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Ft+A0KUw+DAEZRIrWlR1FGWEj6JZ9TKs3XjmxV7LxEY=; b=AE9LF0XvpF+YS6gcIo/wde6kXt4G/kdhE+hBcSNe7H32YkzUMoYCmc5Hu/N8Ey9OwY fE81LuqDyNh1UHdLJpXP2CCqzSJTGr05GRbS6FjL4sEC+dmW6VPgzPAytxZO2kGXs9T3 yv3aGmKhp4Z0Kh2SFmzWrEaXSrxJ+HqGyblQyW38xTkJK7jbw7zR46QZDkj4HTcJs7Sq unbfMQ0K+nNuyQjs/ph5HxnB9Awx94FOiDMFlXcDkJdIw02es9KdLxc5HKM2SCHfL7Ok Sr6KtvjwZvJ6sEhUVAaqtWlkpg+0ZHKSTchPoenGqCkZRDDBnZSEMdXmxmkxMVZTHxBM FdLg== 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=Ft+A0KUw+DAEZRIrWlR1FGWEj6JZ9TKs3XjmxV7LxEY=; b=g2qUiglNRta+NbZcyFv9vvU6hn7T6ekmMSTSYkGb0cHnEEGAAJjkrSvQYhSjS9nDsC rnL7pUsZgk7m8rLc8JQlPEK1RN6mJIqilA2aRSWddytTK2HrWcohfco+l09UqGodJsok sHYC4SyjGJxAWe0k0AF5TzCmSA8mgyXJwLgUrLz2syyACczkiCq6d0YGrwKFSY/b5/8L wFq3dpCRgTWmpvByWdMYh2LONyXzDTa0vhB79PJGVPGK1diNm8wfRirod5ojbaSoTHPF YlmLAgJpT1SMFGV06/N6nd64P3XeAdmelEBlXclCZ1Gs6o4Pim6ojGl/hSkkoA7Hmxsu 25Yg== X-Gm-Message-State: APjAAAWLVLLt0jXHMobzzIZZPf410grscbGiQpxDiSRJdgXvvjcF/GQ2 3tvnEXXG6i2WD6u9mcuNvjm/N8aiag0= X-Google-Smtp-Source: APXvYqxiCiplouwjfyAMjf+PNcg70k4MCL4fThooNE7/quqhJAXuj9w3rtUNFnTpev/Cdo1Gcjoe6Q== X-Received: by 2002:a1c:a686:: with SMTP id p128mr28191984wme.130.1564239928198; Sat, 27 Jul 2019 08:05:28 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Sat, 27 Jul 2019 17:04:37 +0200 Message-Id: <20190727150438.31288-2-stamatis.iliass@gmail.com> In-Reply-To: <20190727150438.31288-1-stamatis.iliass@gmail.com> References: <20190727150438.31288-1-stamatis.iliass@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Sat, 27 Jul 2019 15:05:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Sat, 27 Jul 2019 15:05:30 +0000 (UTC) for IP:'209.85.128.65' DOMAIN:'mail-wm1-f65.google.com' HELO:'mail-wm1-f65.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.099 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS) 209.85.128.65 mail-wm1-f65.google.com 209.85.128.65 mail-wm1-f65.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] test_driver: implement virDomainGetBlockIoTune 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Sat, 27 Jul 2019 15:05:34 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ilias Stamatis Reviewed-by: Erik Skultety --- 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 ab0f8b06d6..9f4e255e35 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -3500,6 +3500,95 @@ testDomainGetInterfaceParameters(virDomainPtr dom, virDomainObjEndAPI(&vm); return ret; } + + +static int +testDomainGetBlockIoTune(virDomainPtr dom, + const char *path, + virTypedParameterPtr params, + int *nparams, + unsigned int flags) +{ + virDomainObjPtr vm =3D NULL; + virDomainDefPtr def =3D NULL; + virDomainDiskDefPtr disk; + virDomainBlockIoTuneInfo reply =3D {0}; + int ret =3D -1; + + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG | + VIR_TYPED_PARAM_STRING_OKAY, -1); + + flags &=3D ~VIR_TYPED_PARAM_STRING_OKAY; + + if (*nparams =3D=3D 0) { + *nparams =3D 20; + return 0; + } + + if (!(vm =3D testDomObjFromDomain(dom))) + return -1; + + if (!(def =3D virDomainObjGetOneDef(vm, flags))) + goto cleanup; + + if (!(disk =3D virDomainDiskByName(def, path, true))) { + virReportError(VIR_ERR_INVALID_ARG, + _("disk '%s' was not found in the domain config"), + path); + goto cleanup; + } + + reply =3D disk->blkdeviotune; + if (VIR_STRDUP(reply.group_name, disk->blkdeviotune.group_name) < 0) + goto cleanup; + +#define ULL VIR_TYPED_PARAM_ULLONG + TEST_SET_PARAM(0, VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC, ULL, reply.= total_bytes_sec); + TEST_SET_PARAM(1, VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC, ULL, reply.r= ead_bytes_sec); + TEST_SET_PARAM(2, VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC, ULL, reply.= write_bytes_sec); + + TEST_SET_PARAM(3, VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC, ULL, reply.t= otal_iops_sec); + TEST_SET_PARAM(4, VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC, ULL, reply.re= ad_iops_sec); + TEST_SET_PARAM(5, VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC, ULL, reply.w= rite_iops_sec); + + TEST_SET_PARAM(6, VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX, ULL, re= ply.total_bytes_sec_max); + TEST_SET_PARAM(7, VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX, ULL, rep= ly.read_bytes_sec_max); + TEST_SET_PARAM(8, VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX, ULL, re= ply.write_bytes_sec_max); + + TEST_SET_PARAM(9, VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX, ULL, rep= ly.total_iops_sec_max); + TEST_SET_PARAM(10, VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX, ULL, rep= ly.read_iops_sec_max); + TEST_SET_PARAM(11, VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX, ULL, re= ply.write_iops_sec_max); + + TEST_SET_PARAM(12, VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC, ULL, reply.s= ize_iops_sec); + + TEST_SET_PARAM(13, VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME, VIR_TYPED_PARAM= _STRING, reply.group_name); + reply.group_name =3D NULL; + + TEST_SET_PARAM(14, VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX_LENGTH,= ULL, + reply.total_bytes_sec_max_length); + TEST_SET_PARAM(15, VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX_LENGTH, = ULL, + reply.read_bytes_sec_max_length); + TEST_SET_PARAM(16, VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX_LENGTH,= ULL, + reply.write_bytes_sec_max_length); + + TEST_SET_PARAM(17, VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX_LENGTH, = ULL, + reply.total_iops_sec_max_length); + TEST_SET_PARAM(18, VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX_LENGTH, U= LL, + reply.read_iops_sec_max_length); + TEST_SET_PARAM(19, VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX_LENGTH, = ULL, + reply.write_iops_sec_max_length); +#undef ULL + + if (*nparams > 20) + *nparams =3D 20; + + ret =3D 0; + cleanup: + VIR_FREE(reply.group_name); + virDomainObjEndAPI(&vm); + return ret; +} #undef TEST_SET_PARAM @@ -8512,6 +8601,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainGetNumaParameters =3D testDomainGetNumaParameters, /* 5.6.0 */ .domainSetInterfaceParameters =3D testDomainSetInterfaceParameters, /*= 5.6.0 */ .domainGetInterfaceParameters =3D testDomainGetInterfaceParameters, /*= 5.6.0 */ + .domainGetBlockIoTune =3D testDomainGetBlockIoTune, /* 5.6.0 */ .connectListDefinedDomains =3D testConnectListDefinedDomains, /* 0.1.1= 1 */ .connectNumOfDefinedDomains =3D testConnectNumOfDefinedDomains, /* 0.1= .11 */ .domainCreate =3D testDomainCreate, /* 0.1.11 */ -- 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Nov 26 19:52:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1564239964; cv=none; d=zoho.com; s=zohoarc; b=PzXeMn9HXKzuLiy7VImjKbCcTfkNnGD8o5sPpNdH/aZy2KYI9y+YbhA6e+XDA0NcfoMMu7Zd8mZ2KTUx8zwEZzGM1W/l1qXKK2+qE2G1WRtDTOyPYFfB1uKqvEYs/U2vjeLxfxSjYmEuoiK1nmCvfBCHuVC64nda29NKok3rIQU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564239964; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=uY/HrMxCOJLVzF0Rm3IM/qzUqC+ZWN3FNzOmb5xw9R4=; b=GsN8++UbzrgZLAxNg19QTL5LtUj/AWwazBplOr+tgvQvlWTvPvByqYtCggW8zCy9oEVy6iZI2ekdcOfpdlSRiSJxJvCsQxrp6HuGDrts6xDg1kkODemhJaaQFagFtdRtIvEw7KsUEHk0y+ZF7RG3mPdcNjdF++LQ8iDmZPOgjww= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1564239964227363.61872452066905; Sat, 27 Jul 2019 08:06:04 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 1F8DE308A9E0; Sat, 27 Jul 2019 15:06:03 +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 DF18419C68; Sat, 27 Jul 2019 15:06: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 A35883CBA; Sat, 27 Jul 2019 15:06:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6RF613F013222 for ; Sat, 27 Jul 2019 11:06:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7C22C1C9; Sat, 27 Jul 2019 15:06:01 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7665C62667 for ; Sat, 27 Jul 2019 15:05:59 +0000 (UTC) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF5FEC049D7C for ; Sat, 27 Jul 2019 15:05:57 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id x1so7395633wrr.9 for ; Sat, 27 Jul 2019 08:05:57 -0700 (PDT) Received: from archpc.localdomain (x8d1ee222.agdsn.tu-dresden.de. [141.30.226.34]) by smtp.gmail.com with ESMTPSA id g131sm39428925wmf.37.2019.07.27.08.05.55 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 27 Jul 2019 08:05:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=PFa7gckvjxRxWHTYXxqTcE0GkvZOFzENKjc8Yc9yC0M=; b=tkA1vrSo+7qYAgpdscp7FfEiWG/nFCrTxaZPcDVWW+1ETK5ejRNb3sym8QDNXXV61m IfKhDtTt014fUlJyWOVkEfahLgcwLTpLs2mkUsw6eNeek5WEE2N1Utyr9yHRQaMqbKz3 H62fwklVajO3OhnBwJZR3mZBpv6YER8dg3YfM/g+nJc02Z3O6G2dZLWAHc9Rg9wXPUXh uvHrChy+40t8BHQHo+fAwBFvdpXpSArCY6GGbA/4DnpgZNLww1s7/p52trXRbWr3FXJa bPZNICy/L4+kiG8F4Jz8L9ubMUwoQX3/tn4GsGWVZch7uhWMQHmNc2Gqjv2w7s4nFgOX XeRA== 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=PFa7gckvjxRxWHTYXxqTcE0GkvZOFzENKjc8Yc9yC0M=; b=tDLu6EE2FYJypq1mDFD2rkkpb8eCG1rdWSjpt9+Cz36P8r+PJiLp8k6XcXG2MqcKdZ YkhpkwMcd9/K7fAP0j0L/NmugpRKUlCJ4hjskQpiLBykHdAyuqaxJwQmXm69MCzQNqE+ QwlQNmOCNfWbmvYMAmodwFQIhXi/0VpbKD25i7W7463nnHEYA73OjFaXRcyr3WURVSAJ WhTG2kIcZFdEthZA1K6yBvBMXGXHYkJvrhRx3DD3v8jb+EUF4EfaS8UDpdoM22bo5b99 Gp12FK+g/kgWf0qeSt1uEqWuej7qq5RReMoV8iTIl0CaurMDuCDKJH23nxq2oa16uiDe c+Mg== X-Gm-Message-State: APjAAAV+3UIndJxZA0kYcNRaebCHE3qyfxbTPbYj6ZecvnnZUgd8Ipie 2l0/i92w6giEb3JgTATJqQU+PkjIVE4= X-Google-Smtp-Source: APXvYqxIe7DxLGCb4Z7htk2K9oAuf3SmsKyzkR8hcURomwBJIo7/sSVbySKxYBPpJy5Y0cYJTXF1Kw== X-Received: by 2002:a5d:4a49:: with SMTP id v9mr106877968wrs.44.1564239956331; Sat, 27 Jul 2019 08:05:56 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Sat, 27 Jul 2019 17:04:38 +0200 Message-Id: <20190727150438.31288-3-stamatis.iliass@gmail.com> In-Reply-To: <20190727150438.31288-1-stamatis.iliass@gmail.com> References: <20190727150438.31288-1-stamatis.iliass@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 27 Jul 2019 15:05:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 27 Jul 2019 15:05:58 +0000 (UTC) for IP:'209.85.221.65' DOMAIN:'mail-wr1-f65.google.com' HELO:'mail-wr1-f65.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.099 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS) 209.85.221.65 mail-wr1-f65.google.com 209.85.221.65 mail-wr1-f65.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] test_driver: implement virDomainSetBlockIoTune 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Sat, 27 Jul 2019 15:06:03 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ilias Stamatis --- I deliberately omitted the logic from qemuDomainSetBlockIoTuneDefaults in order to leave the function simpler. I think that in the case of the test driver it is ok. After all, how we handle the parameters it is supposed to be hypervisor-specific. src/test/test_driver.c | 196 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 9f4e255e35..3272ecf4b7 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -3502,6 +3502,201 @@ testDomainGetInterfaceParameters(virDomainPtr dom, } +static int +testDomainSetBlockIoTune(virDomainPtr dom, + const char *path, + virTypedParameterPtr params, + int nparams, + unsigned int flags) +{ + virDomainObjPtr vm =3D NULL; + virDomainDefPtr def =3D NULL; + virDomainBlockIoTuneInfo info =3D {0}; + virDomainDiskDefPtr conf_disk =3D NULL; + virTypedParameterPtr eventParams =3D NULL; + int eventNparams =3D 0; + int eventMaxparams =3D 0; + size_t i; + int ret =3D -1; + + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); + + if (virTypedParamsValidate(params, nparams, + VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME, + VIR_TYPED_PARAM_STRING, + VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX= _LENGTH, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX_= LENGTH, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX= _LENGTH, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX_= LENGTH, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX_L= ENGTH, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX_= LENGTH, + VIR_TYPED_PARAM_ULLONG, + NULL) < 0) + return -1; + + if (!(vm =3D testDomObjFromDomain(dom))) + return -1; + + if (!(def =3D virDomainObjGetOneDef(vm, flags))) + goto cleanup; + + if (!(conf_disk =3D virDomainDiskByName(def, path, true))) { + virReportError(VIR_ERR_INVALID_ARG, + _("missing persistent configuration for disk '%s'"), + path); + goto cleanup; + } + + info =3D conf_disk->blkdeviotune; + if (VIR_STRDUP(info.group_name, conf_disk->blkdeviotune.group_name) < = 0) + goto cleanup; + + if (virTypedParamsAddString(&eventParams, &eventNparams, &eventMaxpara= ms, + VIR_DOMAIN_TUNABLE_BLKDEV_DISK, path) < 0) + goto cleanup; + +#define SET_IOTUNE_FIELD(FIELD, BOOL, CONST) \ + if (STREQ(param->field, VIR_DOMAIN_BLOCK_IOTUNE_##CONST)) { \ + info.FIELD =3D param->value.ul; \ + if (virTypedParamsAddULLong(&eventParams, &eventNparams, \ + &eventMaxparams, \ + VIR_DOMAIN_TUNABLE_BLKDEV_##CONST, \ + param->value.ul) < 0) \ + goto cleanup; \ + continue; \ + } + + for (i =3D 0; i < nparams; i++) { + virTypedParameterPtr param =3D ¶ms[i]; + + if (param->value.ul > 1000000000000000LL) { + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, + _("block I/O throttle limit value must" + " be no more than %llu"), 1000000000000000LL); + goto cleanup; + } + + SET_IOTUNE_FIELD(total_bytes_sec, BYTES, TOTAL_BYTES_SEC); + SET_IOTUNE_FIELD(read_bytes_sec, BYTES, READ_BYTES_SEC); + SET_IOTUNE_FIELD(write_bytes_sec, BYTES, WRITE_BYTES_SEC); + SET_IOTUNE_FIELD(total_iops_sec, IOPS, TOTAL_IOPS_SEC); + SET_IOTUNE_FIELD(read_iops_sec, IOPS, READ_IOPS_SEC); + SET_IOTUNE_FIELD(write_iops_sec, IOPS, WRITE_IOPS_SEC); + + SET_IOTUNE_FIELD(total_bytes_sec_max, BYTES_MAX, TOTAL_BYTES_SEC_M= AX); + SET_IOTUNE_FIELD(read_bytes_sec_max, BYTES_MAX, READ_BYTES_SEC_MAX= ); + SET_IOTUNE_FIELD(write_bytes_sec_max, BYTES_MAX, WRITE_BYTES_SEC_M= AX); + SET_IOTUNE_FIELD(total_iops_sec_max, IOPS_MAX, TOTAL_IOPS_SEC_MAX); + SET_IOTUNE_FIELD(read_iops_sec_max, IOPS_MAX, READ_IOPS_SEC_MAX); + SET_IOTUNE_FIELD(write_iops_sec_max, IOPS_MAX, WRITE_IOPS_SEC_MAX); + SET_IOTUNE_FIELD(size_iops_sec, SIZE_IOPS, SIZE_IOPS_SEC); + + if (STREQ(param->field, VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME)) { + VIR_FREE(info.group_name); + if (VIR_STRDUP(info.group_name, param->value.s) < 0) + goto cleanup; + if (virTypedParamsAddString(&eventParams, + &eventNparams, + &eventMaxparams, + VIR_DOMAIN_TUNABLE_BLKDEV_GROUP_NA= ME, + param->value.s) < 0) + goto cleanup; + continue; + } + + SET_IOTUNE_FIELD(total_bytes_sec_max_length, BYTES_MAX_LENGTH, + TOTAL_BYTES_SEC_MAX_LENGTH); + SET_IOTUNE_FIELD(read_bytes_sec_max_length, BYTES_MAX_LENGTH, + READ_BYTES_SEC_MAX_LENGTH); + SET_IOTUNE_FIELD(write_bytes_sec_max_length, BYTES_MAX_LENGTH, + WRITE_BYTES_SEC_MAX_LENGTH); + SET_IOTUNE_FIELD(total_iops_sec_max_length, IOPS_MAX_LENGTH, + TOTAL_IOPS_SEC_MAX_LENGTH); + SET_IOTUNE_FIELD(read_iops_sec_max_length, IOPS_MAX_LENGTH, + READ_IOPS_SEC_MAX_LENGTH); + SET_IOTUNE_FIELD(write_iops_sec_max_length, IOPS_MAX_LENGTH, + WRITE_IOPS_SEC_MAX_LENGTH); + } +#undef SET_IOTUNE_FIELD + + if ((info.total_bytes_sec && info.read_bytes_sec) || + (info.total_bytes_sec && info.write_bytes_sec)) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("total and read/write of bytes_sec " + "cannot be set at the same time")); + goto cleanup; + } + + if ((info.total_iops_sec && info.read_iops_sec) || + (info.total_iops_sec && info.write_iops_sec)) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("total and read/write of iops_sec " + "cannot be set at the same time")); + goto cleanup; + } + + if ((info.total_bytes_sec_max && info.read_bytes_sec_max) || + (info.total_bytes_sec_max && info.write_bytes_sec_max)) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("total and read/write of bytes_sec_max " + "cannot be set at the same time")); + goto cleanup; + } + + if ((info.total_iops_sec_max && info.read_iops_sec_max) || + (info.total_iops_sec_max && info.write_iops_sec_max)) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("total and read/write of iops_sec_max " + "cannot be set at the same time")); + goto cleanup; + } + + if (virDomainDiskSetBlockIOTune(conf_disk, &info) < 0) + goto cleanup; + info.group_name =3D NULL; + + ret =3D 0; + cleanup: + VIR_FREE(info.group_name); + virDomainObjEndAPI(&vm); + if (eventNparams) + virTypedParamsFree(eventParams, eventNparams); + return ret; +} + + static int testDomainGetBlockIoTune(virDomainPtr dom, const char *path, @@ -8600,6 +8795,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainSetNumaParameters =3D testDomainSetNumaParameters, /* 5.6.0 */ .domainGetNumaParameters =3D testDomainGetNumaParameters, /* 5.6.0 */ .domainSetInterfaceParameters =3D testDomainSetInterfaceParameters, /*= 5.6.0 */ + .domainSetBlockIoTune =3D testDomainSetBlockIoTune, /* 5.6.0 */ .domainGetInterfaceParameters =3D testDomainGetInterfaceParameters, /*= 5.6.0 */ .domainGetBlockIoTune =3D testDomainGetBlockIoTune, /* 5.6.0 */ .connectListDefinedDomains =3D testConnectListDefinedDomains, /* 0.1.1= 1 */ -- 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list