From nobody Wed Nov 27 02:45:47 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=1562075544; cv=none; d=zoho.com; s=zohoarc; b=F/3BXs6N/YsXbT5WVX+pqejBaztpDaijBtUljwNfQMnjS+m3rgLTD1wTps9wrmBFsMeXo0eq1xPYMgNIPz79/3SE1usdiwHEkb8V+VHdD9Rb+6dxDcP5Q1PULBtHiUSx+VmJ4xoVwpH7g1Xpcyve/9im9bUlLGvXqpEcJzDb5SU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562075544; 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=gGeZ9Z+edJGIDPniSW/cqulq+oIHheqIETZANVO9mNg=; b=oK5NANDskMwAIt8EQE78C9OSKyhM+Lb7TCDh3al6pAJ5tRhK3PcU5HOzLEbkE1mgJdAv7Sbwn9RuYmFwFmFF3pXfvMgxUT/eVtLZlVXqT8cu1ukEboJwEUkXB7gpY5yWOILFfgFN8+WHIm6i3I7jdEPKxsvIEYX6EEoS/1drmeU= 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 1562075544201221.9926780353935; Tue, 2 Jul 2019 06:52:24 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id D19D03091851; Tue, 2 Jul 2019 13:52:10 +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 032C917508; Tue, 2 Jul 2019 13:52:09 +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 B628C18363C1; Tue, 2 Jul 2019 13:52:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x62Dq5Rx030072 for ; Tue, 2 Jul 2019 09:52:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 98DFE17508; Tue, 2 Jul 2019 13:52:05 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 92FCF5C29A for ; Tue, 2 Jul 2019 13:52:03 +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 300B130833BE for ; Tue, 2 Jul 2019 13:51:46 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id n4so17897385wrw.13 for ; Tue, 02 Jul 2019 06:51:46 -0700 (PDT) Received: from archpc.localdomain (x8d1ee222.agdsn.tu-dresden.de. [141.30.226.34]) by smtp.gmail.com with ESMTPSA id p4sm15355004wrx.97.2019.07.02.06.51.43 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 02 Jul 2019 06:51:43 -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=8tpG0XuxsnW/g9sXmPRZp6tJOrxT9fNaROKggEG1ggk=; b=uHbIaGo5zTQRacRCuP+Q8AtjsHSJdgoYA0/TWsGU7qLtS8oUXTHRnUftE8gEWCtspr RRyJstE6KOS7Zy8vGnzIdeJ9zBkdBeQ+lVNXbgMY178TJo4kYEuxI+nvLuwkXYsMd3/1 rlGxld4dxVLBr6nzEBn8O0+cQD1/vK9WHaFn+O9vmjAXMfxiFq4wGJSeBxksVkf2wv10 tJ6OkugHRAoyrIBybPO1cccmTbi4qt0fCh33C5OEFwwdHhv1Gfc6jHPk1KOiZT8rfzWY 57maNoKwVfqlWdAXp9ErGE+JDEZgnNovEnNHL4HVCtzpmi9dz1aHptyQa9F6yNR1eFL4 HhHw== 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=8tpG0XuxsnW/g9sXmPRZp6tJOrxT9fNaROKggEG1ggk=; b=PP491J5o24ldUTqp9D4VvBtCfYz4VzsRug2bjmWgBTSulPbQQYMa9YJ9LKzBfPbCCa LU9TT6jG1w5CE6tClbAbOGpVkY8PY/CFl2VCgnw/CZBKlS0GPgwlVcxGZP2Q5Svrl+Rv kS3kjwkt+cYtgqdhjftEmvZYF4HNAK93Z3pafFkLFOCnth3iIe/bPif7PDSZZ0YXl9OC QA6SMGuygazUvPtv+tgwML27UrJ5SQ3ccWoby7GX0JRLAodM1uSCzRcIdbxlPKu9GUL9 gOaqYH6/wbYkDAZAAPqIhCVaWHUd1KS1MpZ+iX1z9QrwFJANIaPE6x1G8oB1tnpqWKty LjAw== X-Gm-Message-State: APjAAAX+tRoAUys7oTJvQp/DgbLSMqW1Z/5DnnhzG0z4pW/hSI7GQf5F cQ8/NEal8VxPP21vK/bpnwqMauBk6sE= X-Google-Smtp-Source: APXvYqyo3td0VkRp3vfVS6Ydls1oyEXdr5R13y5nhtExLIrhQgk38jnJM0+G/XQUkBuEO4kNgmqWBw== X-Received: by 2002:adf:f483:: with SMTP id l3mr25372661wro.256.1562075504513; Tue, 02 Jul 2019 06:51:44 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Tue, 2 Jul 2019 15:49:44 +0200 Message-Id: <20190702134944.6258-5-stamatis.iliass@gmail.com> In-Reply-To: <20190702134944.6258-1-stamatis.iliass@gmail.com> References: <20190702134944.6258-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.44]); Tue, 02 Jul 2019 13:51:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 02 Jul 2019 13:51:46 +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: 1.392 * (DKIM_ADSP_CUSTOM_MED, DKIM_INVALID, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, 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.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 4/4] test_driver: implement testDomainGetInterfaceParameters 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 02 Jul 2019 13:52:23 +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 | 58 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 15894d98ad..d2a7d2f840 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2935,6 +2935,63 @@ testDomainGetNumaParameters(virDomainPtr dom, } +static int +testDomainGetInterfaceParameters(virDomainPtr dom, + const char *device, + virTypedParameterPtr params, + int *nparams, + unsigned int flags) +{ + virNetDevBandwidthRate in =3D {0}; + virNetDevBandwidthRate out =3D {0}; + virDomainObjPtr vm =3D NULL; + virDomainDefPtr def =3D NULL; + virDomainNetDefPtr net =3D NULL; + 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 7; + return 0; + } + + if (!(vm =3D testDomObjFromDomain(dom))) + return -1; + + if (!(def =3D virDomainObjGetOneDef(vm, flags))) + goto cleanup; + + if (!(net =3D virDomainNetFind(def, device))) + goto cleanup; + + if (net->bandwidth) { + if (net->bandwidth->in) + in =3D *net->bandwidth->in; + if (net->bandwidth->out) + out =3D *net->bandwidth->out; + } + + TEST_SET_PARAM(0, VIR_DOMAIN_BANDWIDTH_IN_AVERAGE, VIR_TYPED_PARAM_UIN= T, in.average); + TEST_SET_PARAM(1, VIR_DOMAIN_BANDWIDTH_IN_PEAK, VIR_TYPED_PARAM_UINT, = in.peak); + TEST_SET_PARAM(2, VIR_DOMAIN_BANDWIDTH_IN_BURST, VIR_TYPED_PARAM_UINT,= in.burst); + TEST_SET_PARAM(3, VIR_DOMAIN_BANDWIDTH_IN_FLOOR, VIR_TYPED_PARAM_UINT,= in.floor); + TEST_SET_PARAM(4, VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE, VIR_TYPED_PARAM_UI= NT, out.average); + TEST_SET_PARAM(5, VIR_DOMAIN_BANDWIDTH_OUT_PEAK, VIR_TYPED_PARAM_UINT,= out.peak); + TEST_SET_PARAM(6, VIR_DOMAIN_BANDWIDTH_OUT_BURST, VIR_TYPED_PARAM_UINT= , out.burst); + + if (*nparams > 7) + *nparams =3D 7; + + ret =3D 0; + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + + #undef TEST_SET_PARAM @@ -7372,6 +7429,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainGetXMLDesc =3D testDomainGetXMLDesc, /* 0.1.4 */ .domainGetMemoryParameters =3D testDomainGetMemoryParameters, /* 5.6.0= */ .domainGetNumaParameters =3D testDomainGetNumaParameters, /* 5.6.0 */ + .domainGetInterfaceParameters =3D testDomainGetInterfaceParameters, /*= 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