From nobody Mon Feb 9 03:12:01 2026 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