From nobody Sat May 4 16:59:45 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 1626938035364180.13693761311413; Thu, 22 Jul 2021 00:13: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-252-N9cmUo5lMQOjwQvm1FIz-w-1; Thu, 22 Jul 2021 03:13:52 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 28FECCC627; Thu, 22 Jul 2021 07:13:47 +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 0B5BB60854; Thu, 22 Jul 2021 07:13:47 +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 B97994A7C8; Thu, 22 Jul 2021 07:13:46 +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 16M7DiUM005282 for ; Thu, 22 Jul 2021 03:13:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id ADAFBEAF99; Thu, 22 Jul 2021 07:13:44 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A8FC0F41D7 for ; Thu, 22 Jul 2021 07:13:44 +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 8B13F89C7E1 for ; Thu, 22 Jul 2021 07:13:44 +0000 (UTC) Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-363-9hzl7q5KP3-Lvps_0agBIg-1; Thu, 22 Jul 2021 03:13:42 -0400 Received: by mail-pj1-f46.google.com with SMTP id my10so4908722pjb.1 for ; Thu, 22 Jul 2021 00:13:42 -0700 (PDT) Received: from localhost ([103.138.53.99]) by smtp.gmail.com with ESMTPSA id t19sm4563666pfg.216.2021.07.22.00.13.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 00:13:40 -0700 (PDT) X-MC-Unique: N9cmUo5lMQOjwQvm1FIz-w-1 X-MC-Unique: 9hzl7q5KP3-Lvps_0agBIg-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=8rYx7jLcQGokpA98JlDvco8pQ5ehlhenFFpuxxLkZaE=; b=thKtcFgY4CmQ5re5XCFU++AUd1gz05qDg1DdId4lmYUru2AZlDBSodltGNgfc4/R7F dDdmQlgLfDSHokZHo+tvXjmftVdsiU09TRJS3+9rvKLTZp6RPlMB4eXm9YwsIwY9jkLX peQV8cFLTFT03YyM262Z5gDu4TDQmS3aNRhz8X48sb23mKrCex4W09EcE+pkSMQEeiQJ ICr1sPJ5nsBpsyqoz7NCiZwHyGHPyJZD/jwhEYK5m05tituF2XlvlnxUSaQitoLbYq7k exPul+8UX5yIivIALoe8mXrwh/6m9zGWPVNFrUiBF2eJAwAvA/dSeP3V+2ZHdc3wRF2d 9Log== X-Gm-Message-State: AOAM530hMMr2dWG+3TcWV9YOIjFfaJ0N1kLbbYmCoslyKV27pd6n26Gp RRU0vi1D5lzAxzPZjz7DgR3yEY46njrqYiVpxoSucQ== X-Google-Smtp-Source: ABdhPJxi1AyqFSOPPkeV3NDm96xTjp/XqlewqgiEx+owHV2pjEf68jGLFz8PTcbG1j5HnWcH7fsJEw== X-Received: by 2002:a65:448b:: with SMTP id l11mr38556875pgq.218.1626938021055; Thu, 22 Jul 2021 00:13:41 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH 1/4] test_driver: Implement virDomainGetJobInfo Date: Thu, 22 Jul 2021 15:13:22 +0800 Message-Id: <20210722071325.428723-2-lukedyue@gmail.com> In-Reply-To: <20210722071325.428723-1-lukedyue@gmail.com> References: <20210722071325.428723-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.13 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: 1626938037641100002 Content-Type: text/plain; charset="utf-8" As in testDomainGetControlInfo, a background job should be running between 0-10000 seconds, so make the testDomainGetJobInfo consistent with it. Signed-off-by: Luke Yue --- src/test/test_driver.c | 51 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 892dc978f2..29b19d80f0 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2604,6 +2604,56 @@ testDomainGetOSType(virDomainPtr dom G_GNUC_UNUSED) return ret; } =20 +static int +testDomainGetJobInfoImpl(virDomainObj *dom, + virDomainJobInfoPtr info) +{ + testDomainObjPrivate *priv =3D dom->privateData; + + memset(info, 0, sizeof(*info)); + + if (priv->seconds < 10000) { + info->type =3D VIR_DOMAIN_JOB_BOUNDED; + info->dataTotal =3D 10000; + info->dataProcessed =3D priv->seconds; + info->dataRemaining =3D 10000 - priv->seconds; + info->timeElapsed =3D priv->seconds; + info->timeRemaining =3D 10000 - priv->seconds; + info->memTotal =3D 1048576; + info->memProcessed =3D 1048576 - priv->seconds; + info->memRemaining =3D priv->seconds; + info->fileTotal =3D 2097152; + info->fileProcessed =3D 2097152 - priv->seconds; + info->fileRemaining =3D priv->seconds; + } else if (priv->seconds < 30000 && priv->seconds >=3D 10000) { + info->type =3D VIR_DOMAIN_JOB_COMPLETED; + } else { + info->type =3D VIR_DOMAIN_JOB_NONE; + } + + return 0; +} + +static int +testDomainGetJobInfo(virDomainPtr dom, + virDomainJobInfoPtr info) +{ + virDomainObj *vm; + int ret =3D -1; + + if (!(vm =3D testDomObjFromDomain(dom))) + goto cleanup; + + if (virDomainObjCheckActive(vm) < 0) + goto cleanup; + + ret =3D testDomainGetJobInfoImpl(vm, info); + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + =20 static int testDomainGetLaunchSecurityInfo(virDomainPtr domain G_GNUC_UNUSED, @@ -9484,6 +9534,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainMemoryPeek =3D testDomainMemoryPeek, /* 5.4.0 */ .domainGetBlockInfo =3D testDomainGetBlockInfo, /* 5.7.0 */ .domainSetLifecycleAction =3D testDomainSetLifecycleAction, /* 5.7.0 */ + .domainGetJobInfo =3D testDomainGetJobInfo, /* 7.6.0 */ =20 .domainSnapshotNum =3D testDomainSnapshotNum, /* 1.1.4 */ .domainSnapshotListNames =3D testDomainSnapshotListNames, /* 1.1.4 */ --=20 2.32.0 From nobody Sat May 4 16:59:45 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 1626938042430402.178431642575; Thu, 22 Jul 2021 00:14: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-330-EQFu96ZaNOCupxcbUjpwzw-1; Thu, 22 Jul 2021 03:13:59 -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 A971110086C7; Thu, 22 Jul 2021 07:13:54 +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 5AE5BA22D; Thu, 22 Jul 2021 07:13: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 261BA4A7CB; Thu, 22 Jul 2021 07:13: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 16M7Dp7E005309 for ; Thu, 22 Jul 2021 03:13:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 57C7D2028651; Thu, 22 Jul 2021 07:13:51 +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 52CF82028644 for ; Thu, 22 Jul 2021 07:13:47 +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 8BE18800882 for ; Thu, 22 Jul 2021 07:13:47 +0000 (UTC) Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-364-zI-NO2LDP366eDTlQmJCDg-1; Thu, 22 Jul 2021 03:13:45 -0400 Received: by mail-pj1-f47.google.com with SMTP id u9-20020a17090a1f09b029017554809f35so2957466pja.5 for ; Thu, 22 Jul 2021 00:13:45 -0700 (PDT) Received: from localhost ([103.138.53.99]) by smtp.gmail.com with ESMTPSA id 73sm25314586pjz.24.2021.07.22.00.13.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 00:13:43 -0700 (PDT) X-MC-Unique: EQFu96ZaNOCupxcbUjpwzw-1 X-MC-Unique: zI-NO2LDP366eDTlQmJCDg-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=RN3sIwWpcvo+foXVQ4p6hhJZSb1yqQCVf/oebW3WESA=; b=f4rbPj0L9+6IZFwkYuc+AVbRLzTPipDWTCnrOFSlGBi4gai3Mm0Glv1mVgQZVy4yDf LGwlmbuL4OFg8PdQBewkSQnsyhPrD0Z7l4DXpao0dPBL+oXudVjOLGtMiKs12gko0r+I lSeCio3+wZYEGRqXK74fS3553fwceR73rNXRRrwbCK+1rnJZ1pvhWOMtE94VU9BoVxfi FbkBePTCCXCeqOaK5NVhSoNxhqF5dlvkJIAyTNVpaNlxioUun1UhB8nyutAYeb1nYCdk P2KZc3jn8TcZfgV9L7ED/hJ46pUsVgOdVYlhGXED/NVVzQ6dO/J0kkhxXkHy7cboxs5t aCZg== X-Gm-Message-State: AOAM530Cwa7yvztwhgCyBZTqLPVb+TRm2asaj+JYqzKZ6mlEX3kacfZr V2M/j3YGDkpn8m2BLyM+vb3vT39kCUf4DvswXPhwlA== X-Google-Smtp-Source: ABdhPJwQOPi7/HEaQwQPSOlVoVUNdn1EhbiVdV2Z2VR41h+9OAgZAKyHa/Q4vhRpZ8hqe7A96Y1x3g== X-Received: by 2002:a65:568c:: with SMTP id v12mr40783584pgs.88.1626938024067; Thu, 22 Jul 2021 00:13:44 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH 2/4] test_driver: Implement virDomainGetJobStats Date: Thu, 22 Jul 2021 15:13:23 +0800 Message-Id: <20210722071325.428723-3-lukedyue@gmail.com> In-Reply-To: <20210722071325.428723-1-lukedyue@gmail.com> References: <20210722071325.428723-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: 1626938044009100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Luke Yue --- 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 29b19d80f0..4af8ce42f2 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2654,6 +2654,95 @@ testDomainGetJobInfo(virDomainPtr dom, return ret; } =20 +static int +testDomainJobInfoToParams(virDomainJobInfoPtr info, + int *type, + virTypedParameterPtr *params, + int *nparams) +{ + virTypedParameterPtr par =3D NULL; + int maxpar =3D 0; + int npar =3D 0; + + if (virTypedParamsAddULLong(&par, &npar, &maxpar, + VIR_DOMAIN_JOB_DATA_TOTAL, + info->dataTotal) < 0 || + virTypedParamsAddULLong(&par, &npar, &maxpar, + VIR_DOMAIN_JOB_DATA_PROCESSED, + info->dataProcessed) < 0 || + virTypedParamsAddULLong(&par, &npar, &maxpar, + VIR_DOMAIN_JOB_DATA_REMAINING, + info->dataRemaining) < 0 || + virTypedParamsAddULLong(&par, &npar, &maxpar, + VIR_DOMAIN_JOB_TIME_ELAPSED, + info->timeElapsed) < 0 || + virTypedParamsAddULLong(&par, &npar, &maxpar, + VIR_DOMAIN_JOB_TIME_REMAINING, + info->timeRemaining) < 0 || + virTypedParamsAddULLong(&par, &npar, &maxpar, + VIR_DOMAIN_JOB_MEMORY_TOTAL, + info->memTotal) < 0 || + virTypedParamsAddULLong(&par, &npar, &maxpar, + VIR_DOMAIN_JOB_MEMORY_PROCESSED, + info->memProcessed) < 0 || + virTypedParamsAddULLong(&par, &npar, &maxpar, + VIR_DOMAIN_JOB_MEMORY_REMAINING, + info->memRemaining) < 0 || + virTypedParamsAddULLong(&par, &npar, &maxpar, + VIR_DOMAIN_JOB_DISK_TOTAL, + info->fileTotal) < 0 || + virTypedParamsAddULLong(&par, &npar, &maxpar, + VIR_DOMAIN_JOB_DISK_PROCESSED, + info->fileProcessed) < 0 || + virTypedParamsAddULLong(&par, &npar, &maxpar, + VIR_DOMAIN_JOB_DISK_REMAINING, + info->fileRemaining) < 0) + goto error; + + *type =3D info->type; + *params =3D par; + *nparams =3D npar; + return 0; + + error: + virTypedParamsFree(par, npar); + return -1; +} + +static int +testDomainGetJobStats(virDomainPtr domain, + int *type, + virTypedParameterPtr *params, + int *nparams, + unsigned int flags) +{ + virDomainJobInfo jobInfo; + virDomainObj *dom; + int ret =3D -1; + + virCheckFlags(0, -1); + + if (!(dom =3D testDomObjFromDomain(domain))) + return -1; + + if (testDomainGetJobInfoImpl(dom, &jobInfo) < 0) + goto cleanup; + + if (jobInfo.type =3D=3D VIR_DOMAIN_JOB_NONE) { + *type =3D VIR_DOMAIN_JOB_NONE; + *params =3D NULL; + *nparams =3D 0; + ret =3D 0; + goto cleanup; + } + + ret =3D testDomainJobInfoToParams(&jobInfo, type, params, nparams); + + cleanup: + virDomainObjEndAPI(&dom); + + return ret; +} =20 static int testDomainGetLaunchSecurityInfo(virDomainPtr domain G_GNUC_UNUSED, @@ -9535,6 +9624,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainGetBlockInfo =3D testDomainGetBlockInfo, /* 5.7.0 */ .domainSetLifecycleAction =3D testDomainSetLifecycleAction, /* 5.7.0 */ .domainGetJobInfo =3D testDomainGetJobInfo, /* 7.6.0 */ + .domainGetJobStats =3D testDomainGetJobStats, /* 7.6.0 */ =20 .domainSnapshotNum =3D testDomainSnapshotNum, /* 1.1.4 */ .domainSnapshotListNames =3D testDomainSnapshotListNames, /* 1.1.4 */ --=20 2.32.0 From nobody Sat May 4 16:59:45 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 1626938041249488.8390912082797; Thu, 22 Jul 2021 00:14:01 -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-66-sDvfVkjFP_mrmdddWEW1tQ-1; Thu, 22 Jul 2021 03:13:58 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB478CC636; Thu, 22 Jul 2021 07:13:51 +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 8A7D56298C; Thu, 22 Jul 2021 07:13:51 +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 4969F1819AC2; Thu, 22 Jul 2021 07:13:51 +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 16M7Do9e005304 for ; Thu, 22 Jul 2021 03:13:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 860CDF41D7; Thu, 22 Jul 2021 07:13:50 +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 812B5EAF99 for ; Thu, 22 Jul 2021 07:13:50 +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 6A1AF811E78 for ; Thu, 22 Jul 2021 07:13:50 +0000 (UTC) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-462-SFMJq1urMI-l61tfFADNeA-1; Thu, 22 Jul 2021 03:13:47 -0400 Received: by mail-pl1-f180.google.com with SMTP id y3so3443096plp.4 for ; Thu, 22 Jul 2021 00:13:47 -0700 (PDT) Received: from localhost ([103.138.53.99]) by smtp.gmail.com with ESMTPSA id x7sm19533671pfu.158.2021.07.22.00.13.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 00:13:46 -0700 (PDT) X-MC-Unique: sDvfVkjFP_mrmdddWEW1tQ-1 X-MC-Unique: SFMJq1urMI-l61tfFADNeA-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=FKojgH3dMSeg/rsSW+DiX880xvo2b5R1Mlqz1cXThIw=; b=a6MHBSPirtqW9Eg1mvS9aDeZ9O6XJ1RsnBoHETTgbv5fbnwrIr3nw1aJhRx0AZTSAD 89wT6ke7aCEArgedpQK9xOnBCW6SOWSCLGPGOL5pGruByg3rt+jnT6bfFi5PVDsoWOHv cD8/PcsTlFszUglN/O/5De++lXGhR487sWqRgfIpNwRZTkIrOJltoc1w8xv9JWDlBIao D4F7htLUomqgsyPJug5kUPtxyquMW8PiaiEa3wrc+Qcp4idXYxEv8zeURgnVrQvve7WO nzSbd4/C1NLNnv90iVWgJ26C2vEZQCJxonky+Z6k5RMKuf0s18b84fDMRE7QvhBkZS/m LZfw== X-Gm-Message-State: AOAM532Qb3u85lqQX4YuU7dIBrXYJn6Uq/kB2HmFjsRgMMIWr1JIPNpb +C9oFBgcYbvsyNtrivHP9NiTJfJJrJW4PS59/RpkXQ== X-Google-Smtp-Source: ABdhPJzeMErm44WDSv0oC9y0Rn2ePjCkRFwgwD+aQhDR9hVEx1YoPnK1WX95tvjOcKVzvdMjBgVEDA== X-Received: by 2002:a17:90b:1244:: with SMTP id gx4mr39035913pjb.192.1626938026690; Thu, 22 Jul 2021 00:13:46 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH 3/4] test_driver: Implement virDomainAbortJob Date: Thu, 22 Jul 2021 15:13:24 +0800 Message-Id: <20210722071325.428723-4-lukedyue@gmail.com> In-Reply-To: <20210722071325.428723-1-lukedyue@gmail.com> References: <20210722071325.428723-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.15 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: 1626938041894100003 Content-Type: text/plain; charset="utf-8" As the job should be running between 0-10000 seconds, so if the API is triggered between 0-10000 seconds, it will set time to 10000, so that the job status will be completed. Otherwise, there is no job active and report error. Signed-off-by: Luke Yue --- src/test/test_driver.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 4af8ce42f2..b31ab95101 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2744,6 +2744,34 @@ testDomainGetJobStats(virDomainPtr domain, return ret; } =20 +static int +testDomainAbortJob(virDomainPtr dom) +{ + virDomainObj *vm; + int ret =3D -1; + testDomainObjPrivate *priv; + + if (!(vm =3D testDomObjFromDomain(dom))) + goto cleanup; + + if (virDomainObjCheckActive(vm) < 0) + goto cleanup; + + priv =3D vm->privateData; + + if (priv->seconds >=3D 10000) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("no job is active on the domain")); + } else { + priv->seconds =3D 10000; + ret =3D 0; + } + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + static int testDomainGetLaunchSecurityInfo(virDomainPtr domain G_GNUC_UNUSED, virTypedParameterPtr *params G_GNUC_UNUSED, @@ -9625,6 +9653,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainSetLifecycleAction =3D testDomainSetLifecycleAction, /* 5.7.0 */ .domainGetJobInfo =3D testDomainGetJobInfo, /* 7.6.0 */ .domainGetJobStats =3D testDomainGetJobStats, /* 7.6.0 */ + .domainAbortJob =3D testDomainAbortJob, /* 7.6.0 */ =20 .domainSnapshotNum =3D testDomainSnapshotNum, /* 1.1.4 */ .domainSnapshotListNames =3D testDomainSnapshotListNames, /* 1.1.4 */ --=20 2.32.0 From nobody Sat May 4 16:59:45 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 1626938046364708.0849160918792; Thu, 22 Jul 2021 00:14:06 -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-446-NwViHlGuPRiLNxuHw3-kXQ-1; Thu, 22 Jul 2021 03:14:03 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7CB83802B56; Thu, 22 Jul 2021 07:13:57 +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 5CC026E6E7; Thu, 22 Jul 2021 07:13:57 +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 2A8984A704; Thu, 22 Jul 2021 07:13:57 +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 16M7Dtib005344 for ; Thu, 22 Jul 2021 03:13:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3EB49103430; Thu, 22 Jul 2021 07:13:55 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 395EEEAF99 for ; Thu, 22 Jul 2021 07:13:53 +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 83B1489C7DD for ; Thu, 22 Jul 2021 07:13:53 +0000 (UTC) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-562-FeuPHyFUOCq3q5IMN1c0DA-1; Thu, 22 Jul 2021 03:13:51 -0400 Received: by mail-pj1-f52.google.com with SMTP id j8-20020a17090aeb08b0290173bac8b9c9so2978715pjz.3 for ; Thu, 22 Jul 2021 00:13:50 -0700 (PDT) Received: from localhost ([103.138.53.99]) by smtp.gmail.com with ESMTPSA id p3sm2019903pjt.0.2021.07.22.00.13.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 00:13:49 -0700 (PDT) X-MC-Unique: NwViHlGuPRiLNxuHw3-kXQ-1 X-MC-Unique: FeuPHyFUOCq3q5IMN1c0DA-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=4vaBEvpGUcGHPTl5QJ3LblCDWR2Rs6peVfujp9L8BeQ=; b=GvBaWk6V2Bq/nJ0ZDcA8tJIUthU7bDL58irKISDoYR3LhD5Q/eD1NLV05Das9VzKj9 EYSOxPQo/pavfaBEsEraV8zR9x58AXFgOA5o2kPC47M429a16yZvA/1nELziJPrtCsCz 68DlDdnsdRiFywl6PBXKfYVqpJ/+XzL4BpghocbtdtuagagZsKp8DfXV3NAZMX2XZXwC wfXmAmXEMNCVZpgDJhU767+2/E9EOW+ygk4Ka854ZBDffyjyR1/uUmEhCDoOj7i9099e BYjVvzyW4FUAohnLNR54NNs4JHYNcvDW69cg7yws/SHNP6ytonnLJi/4gQCdqauWZJ6e jWvg== X-Gm-Message-State: AOAM531fTcjbob5GarmL9r0/7bCufydcyGEipdZLuqqYe4LamcBOZbZt 7U1wujqAFQ2iyVCpAD3gDe4pit96Xy0gcYSdVhYw+Q== X-Google-Smtp-Source: ABdhPJzqErY+oI/uR98Nf8B3LF2uS+ZOz0aPZy3KL6+/3/EAinoAU6c+TDp2DoHRIa/bRd2iQcWbeg== X-Received: by 2002:a17:903:230b:b029:129:bd60:cd20 with SMTP id d11-20020a170903230bb0290129bd60cd20mr31010029plh.72.1626938029912; Thu, 22 Jul 2021 00:13:49 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH 4/4] virshtest: add test for domjobinfo Date: Thu, 22 Jul 2021 15:13:25 +0800 Message-Id: <20210722071325.428723-5-lukedyue@gmail.com> In-Reply-To: <20210722071325.428723-1-lukedyue@gmail.com> References: <20210722071325.428723-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.11 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: 1626938048644100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Luke Yue --- tests/virshtest.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/virshtest.c b/tests/virshtest.c index fe0c420958..88609af89c 100644 --- a/tests/virshtest.c +++ b/tests/virshtest.c @@ -257,6 +257,13 @@ static int testCompareDomControlInfoByName(const void = *data G_GNUC_UNUSED) return testCompareOutputLit(exp, NULL, argv); } =20 +static int testCompareDomJobInfoByName(const void *data G_GNUC_UNUSED) +{ + const char *const argv[] =3D { VIRSH_CUSTOM, "domjobinfo", "fc4", NULL= }; + const char *exp =3D "Job type: None \n\n"; + return testCompareOutputLit(exp, NULL, argv); +} + struct testInfo { const char *const *argv; const char *result; @@ -345,6 +352,10 @@ mymain(void) testCompareDomControlInfoByName, NULL) !=3D 0) ret =3D -1; =20 + if (virTestRun("virsh domjobinfo (by name)", + testCompareDomJobInfoByName, 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.32.0