From nobody Wed Nov 27 02:28:48 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=1557703623; cv=none; d=zoho.com; s=zohoarc; b=ToIAslc/hH8W2S7gcWo8y+TF93qGFOHd5vNOIp9JsVoafIFwWqHY/I9F141UoEqPmH5vFryU9WKaCWjW+7ahc368pAHaiHp4eOYmlrXXX/dyHil1C0Kd2lwzlHgH+wkn4g+uu/PVT9PnJ1N9QpZ87nQiIMNQdWljlqMv3zXbpS0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557703623; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=gyTFrvw4p02F6CgK0iJhWskEAHUqNFUfqwzgDMs6DFQ=; b=oarVcBbfIK7v0l5XSL5YW2dFaEK0IvzB17b9xKtBJypnAgUPRDJel7s/3BfTw6MhPaWMhruhabXL8IXvhzUmGdMG56HBJz+OEdcGib6HqHS66k3bZL7KOSgu9qB4KIZgfzhS5LZvsTk96bR/vo37OOFOs84158yEMapu5g39Vx0= 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 1557703623348713.2734925885684; Sun, 12 May 2019 16:27:03 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 20F473084248; Sun, 12 May 2019 23:26:59 +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 C41D93844; Sun, 12 May 2019 23:26:56 +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 0FED841F58; Sun, 12 May 2019 23:26:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4CNQoOp018101 for ; Sun, 12 May 2019 19:26:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 455496A96E; Sun, 12 May 2019 23:26:50 +0000 (UTC) Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 40D7D6A96A for ; Sun, 12 May 2019 23:26:47 +0000 (UTC) Received: from mail-ed1-f67.google.com (mail-ed1-f67.google.com [209.85.208.67]) (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 1BEE8308A946 for ; Sun, 12 May 2019 23:26:47 +0000 (UTC) Received: by mail-ed1-f67.google.com with SMTP id p26so14696496edr.2 for ; Sun, 12 May 2019 16:26:47 -0700 (PDT) Received: from archpc.localdomain (x8d1ee222.agdsn.tu-dresden.de. [141.30.226.34]) by smtp.gmail.com with ESMTPSA id y42sm2292019edb.95.2019.05.12.16.26.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 May 2019 16:26:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=0RXrvjHxfEJOqXGtXWO0eM+a0ElJ8sGAvof6QZQP7P8=; b=HzkEbUqlEy/zio1aBv45MQhSkYr1erV6JDtJWYjNDViZBW14KRsaGdc35hWboy1Frz GLNsoaa/5QhP730+dA0KECl8KJm0RMz1Jww2zMfrDrS0EQdtaVr2fmV7kstZ7+w3xu/Q C4TWodPUoziDRZAPixxAl5VWSXOOcqQp1oO3OZ84k+KwbnACvwO6EcrRWPZVzW37bcvE lYjbbssVsd6Wi0QaFYV+319VV8DjtB70Ai6OS4duz3cTSXgWtKUJ1rw9SEG+RCxW0DqB OX7sDXTvbUWGFKO+39R+o0xKRN3D12UC/ubvXcvLxKqkpWqD7FInG0a67bTODp9dsLc7 f+kw== 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:mime-version :content-transfer-encoding; bh=0RXrvjHxfEJOqXGtXWO0eM+a0ElJ8sGAvof6QZQP7P8=; b=tWayaKz7BIrI7hmmY7qRTxImTVNLTVMzdIN9ts2ENUJ6Rfx3PdJJddSDXxPQpUcxco jEIg/vL6+APdiTig3lFihn7FAdDGx0k4O/gz/H9bgqIPcOuG9OL8gQW1VOxHdm3wW94/ 2CZjuRzGWkMXv5LVQt+wWciCJ2PnaV1yIY9LB/PYXbsoc/HP6217iitgDAB4eytQOJpI cBtZpd+isuoB/dOTKhV6/L2GFd9WDyNQs/Asm29cbTWRhL1p5oemM8b2eaSJvGHRgx/D 9m5Ay/3wLZK5gP+SYc0e/qzlbcTxf78+/7/AgUV8/86nZRTB8BTknBtadX3UmB04mgJq tdaQ== X-Gm-Message-State: APjAAAUMs4QD/aLjJsQcGSafcFiDozlbCvGI70huhoH4KoC/oJG71JO7 aVzri+t7nlhoYN0vJe45AzIhp3tZAj7A0A== X-Google-Smtp-Source: APXvYqzOSALWAhd4bUcoSp7TqGw5GwOiAD3n87Ibi9bgUcZbv6jdyDoNb6jJHgliuQI0eY7CKspIGw== X-Received: by 2002:a50:cb4d:: with SMTP id h13mr26293832edi.110.1557703605466; Sun, 12 May 2019 16:26:45 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Mon, 13 May 2019 01:26:14 +0200 Message-Id: <20190512232613.30322-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.41]); Sun, 12 May 2019 23:26:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Sun, 12 May 2019 23:26:47 +0000 (UTC) for IP:'209.85.208.67' DOMAIN:'mail-ed1-f67.google.com' HELO:'mail-ed1-f67.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.111 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.208.67 mail-ed1-f67.google.com 209.85.208.67 mail-ed1-f67.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.41 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2] test_driver: implement virDomainGetDiskErrors 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Sun, 12 May 2019 23:27:01 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Return the number of disks present in the configuration of the test domain when called with @errors as NULL and @maxerrors as 0. Otherwise report an error for every second disk, assigning available error codes in a cyclic order. Signed-off-by: Ilias Stamatis --- src/test/test_driver.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index a06d1fc402..527c2f5d3b 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -3046,6 +3046,47 @@ static int testDomainSetAutostart(virDomainPtr domai= n, return 0; } +static int testDomainGetDiskErrors(virDomainPtr dom, + virDomainDiskErrorPtr errors, + unsigned int maxerrors, + unsigned int flags) +{ + virDomainObjPtr vm =3D NULL; + int ret =3D -1; + size_t i; + int n =3D 0; + int codes[] =3D {VIR_DOMAIN_DISK_ERROR_UNSPEC, VIR_DOMAIN_DISK_ERROR_N= O_SPACE}; + size_t ncodes =3D sizeof(codes) / sizeof(codes[0]); + + virCheckFlags(0, -1); + + if (!(vm =3D testDomObjFromDomain(dom))) + goto cleanup; + + if (virDomainObjCheckActive(vm) < 0) + goto cleanup; + + if (!errors) { + ret =3D vm->def->ndisks; + } else { + for (i =3D 1; i < vm->def->ndisks && n < maxerrors; i +=3D 2) { + if (VIR_STRDUP(errors[n].disk, vm->def->disks[i]->dst) < 0) + goto cleanup; + errors[n].error =3D codes[n % ncodes]; + n++; + } + ret =3D n; + } + + cleanup: + virDomainObjEndAPI(&vm); + if (ret < 0) { + for (i =3D 0; i < n; i++) + VIR_FREE(errors[i].disk); + } + return ret; +} + static char *testDomainGetSchedulerType(virDomainPtr domain ATTRIBUTE_UNUS= ED, int *nparams) { @@ -6832,6 +6873,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainUndefineFlags =3D testDomainUndefineFlags, /* 0.9.4 */ .domainGetAutostart =3D testDomainGetAutostart, /* 0.3.2 */ .domainSetAutostart =3D testDomainSetAutostart, /* 0.3.2 */ + .domainGetDiskErrors =3D testDomainGetDiskErrors, /* 5.4.0 */ .domainGetSchedulerType =3D testDomainGetSchedulerType, /* 0.3.2 */ .domainGetSchedulerParameters =3D testDomainGetSchedulerParameters, /*= 0.3.2 */ .domainGetSchedulerParametersFlags =3D testDomainGetSchedulerParameter= sFlags, /* 0.9.2 */ -- 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list