From nobody Sat May 4 12:11:57 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=1561030887; cv=none; d=zoho.com; s=zohoarc; b=LRthanBCINyVpCYDfJS0tCb0cG8UPXiV2fL5iwTZLE1pWEOc0ZvxFOURe/IcK/nDm3QphluCY8k8wFGXbpwf2F0THQRb+KFu9vrNwR+BQ+FUJ1ZI9GKa5JzmQjSrxsJOPeFxY9o2ZPlGJRuPh0wQU7mihCgodPHhf/gDi+vbZmU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561030887; 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=aQDJS5lbxparBS0oHckWbRXBSWjcmJmiop235Vbx7tc=; b=FTcQDPsytCt4MR6eB0twhcx2Fx4+a0lkPT1k1R1iPztEVQtL9aXD7iCRaw6D4xlNPYswk0JXRteqma0vwZ6Q6u/x756rDRCGhIlg9THXRAxxkflwrHxL5oApkvAKRI3DZayufoyQytAJoxwbi23jfupO3PHt1HAsdg62k55vSy8= 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 1561030887510488.85213304028525; Thu, 20 Jun 2019 04:41:27 -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 215EE3007403; Thu, 20 Jun 2019 11:41:20 +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 693D05C1A1; Thu, 20 Jun 2019 11:41:18 +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 CB18E19725; Thu, 20 Jun 2019 11:41:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5KBfDca001891 for ; Thu, 20 Jun 2019 07:41:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8446D60156; Thu, 20 Jun 2019 11:41:13 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7E2A360477 for ; Thu, 20 Jun 2019 11:41:11 +0000 (UTC) Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.68]) (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 16DB020264 for ; Thu, 20 Jun 2019 11:41:07 +0000 (UTC) Received: by mail-ed1-f68.google.com with SMTP id s49so4300351edb.1 for ; Thu, 20 Jun 2019 04:41:07 -0700 (PDT) Received: from archpc.localdomain (x8d1ee222.agdsn.tu-dresden.de. [141.30.226.34]) by smtp.gmail.com with ESMTPSA id u9sm5333185edm.71.2019.06.20.04.41.03 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 20 Jun 2019 04:41:03 -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=1mcyYvke4tQgQv/+ei74jUNIL3OAnFUoSqGe3oAxiB0=; b=bM5JMJZxmFB4tPqE1OlCF49tX/qRqRkvfEcqSd/wrouqFWQPDP9a6TMJEsESZnprP8 X6g1jcV/kJ3aP6Be7OTTJAtl31BFU0XZkDUKPInhrn2mlq1YsjS7oN99WYSxY0ZcdLT6 TCEy+UuOWmnF7fI1dPIpJN2Glbdxs8t1r1u0EvNb1Xwi2Q1BvJflJP6BwPFkRwdtEzZL kWr1pyiZ3XYjr6d+Gnrvf3pD5a3KthZsZuLEw2xJL6uKpw9jLJGGwMfj+QiAZS4KuB5E an/SuiX9md7xANvAZDskJd8XB8l2tUewCGE5vObZig5t+u9gyQx4JRhY7L55+nX5Rta6 alSQ== 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=1mcyYvke4tQgQv/+ei74jUNIL3OAnFUoSqGe3oAxiB0=; b=gCTap2WiFVKfJxV/ZhvKu3EykoZiXmP2jzyNTeD5upV15g5LvxOGhK0Cy447Nx103D mM4MxJsC5X6bdpwl5cRaRUdaVj0bKsGkQ/EXoEdCDETY/JRZfI4Tk/cGdNdOpL2HuFtP WgU/1lSwsd3vclIdb21yfHvjnI9mNxN8a0XnEXWX9eYnbBOgdHGF2fePRB54ZZaCaL1P kXVMbrTEF7ctFnBQX5NoXTc4GzEqH4LUCjYuX+9396tGmoeBmlA8tEKztmFoHD5+wZgC Mgj108D6xVJCrS6Giv59CmtxTMGGhFsXs4UDYpmGTj6O6VWKfWEgU4a2ZP4EmSst6mlb vsYw== X-Gm-Message-State: APjAAAV3L1AgzZlLw85rGkRdQpC6Bm30Scex1ISCYFe3UF9HCHWFtl3H Wm7HC3gKHAIWLALzW6XJUvXgM8DWT8D4Gg== X-Google-Smtp-Source: APXvYqxTfx5jVvVX3rp3m9jv/TRUoDmC23ZcQVyi5nJGQX2rF9xLOQ1yLFCUNzL/lbTjDrqvmulhvQ== X-Received: by 2002:a50:eb8b:: with SMTP id y11mr73242368edr.154.1561030865238; Thu, 20 Jun 2019 04:41:05 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Thu, 20 Jun 2019 13:41:01 +0200 Message-Id: <20190620114101.1568-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.29]); Thu, 20 Jun 2019 11:41:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 20 Jun 2019 11:41:07 +0000 (UTC) for IP:'209.85.208.68' DOMAIN:'mail-ed1-f68.google.com' HELO:'mail-ed1-f68.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.109 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS) 209.85.208.68 mail-ed1-f68.google.com 209.85.208.68 mail-ed1-f68.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH RFC] test_driver: check that the domain is running in testDomainGetTime 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.42]); Thu, 20 Jun 2019 11:41:25 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ilias Stamatis --- Currently in the test driver in APIs that would normally require guest agents and similar we are just checking if the domain is active (using virDomainObjCheckActive). But a domain will be active even if stopped, so I would say that most of the time this is not sufficient since we really want to now that the domain is actually running, not that it's just active. So something like what I include in this patch is needed instead. I wonder if it would make sense to add a new function such as testDomainAgentAvailable inspired by the QEMU driver. So the check whether the domain is actually running or not could be done there. Also, in that case I'm not sure if calling both virDomainObjCheckActive and testDomainAgentAvailable is needed. I feel like calling the second one only is sufficient. However, in the QEMU driver always both are called. Should I go ahead with implementing the testDomainAgentAvailable function and search for all the places in the test driver that it should be used instead of virDomainObjCheckActive? src/test/test_driver.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 2a0ffbc6c5..8e5bd4e670 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1984,17 +1984,33 @@ testDomainGetState(virDomainPtr domain, } static int -testDomainGetTime(virDomainPtr dom ATTRIBUTE_UNUSED, +testDomainGetTime(virDomainPtr dom, long long *seconds, unsigned int *nseconds, unsigned int flags) { + int ret =3D -1; + virDomainObjPtr vm =3D NULL; + virCheckFlags(0, -1); + if (!(vm =3D testDomObjFromDomain(dom))) + goto cleanup; + + if (virDomainObjGetState(vm, NULL) !=3D VIR_DOMAIN_RUNNING) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain is not running")); + goto cleanup; + } + *seconds =3D 627319920; *nseconds =3D 0; - return 0; + ret =3D 0; + + cleanup: + virDomainObjEndAPI(&vm); + return ret; } #define TEST_SAVE_MAGIC "TestGuestMagic" -- 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list