From nobody Sat Feb 7 08:43:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1629112505723562.4237152396903; Mon, 16 Aug 2021 04:15:05 -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-582-9UTGAs3ePi658xCsHuZlSg-1; Mon, 16 Aug 2021 07:14:07 -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 6AEE187D548; Mon, 16 Aug 2021 11:14:02 +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 452D919C59; Mon, 16 Aug 2021 11:14:02 +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 022F8181A12D; Mon, 16 Aug 2021 11:14:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17GBE0AN020919 for ; Mon, 16 Aug 2021 07:14:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1F54310FFE72; Mon, 16 Aug 2021 11:14:00 +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 1A83C1005B78 for ; Mon, 16 Aug 2021 11:13:54 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 AC7DC866DF5 for ; Mon, 16 Aug 2021 11:13:54 +0000 (UTC) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-396-TDJ3CS7kNB-bpC7kwLKVgg-1; Mon, 16 Aug 2021 07:13:52 -0400 Received: by mail-pl1-f177.google.com with SMTP id n12so19652746plf.4 for ; Mon, 16 Aug 2021 04:13:52 -0700 (PDT) Received: from localhost ([103.138.53.99]) by smtp.gmail.com with ESMTPSA id m23sm9195301pjr.38.2021.08.16.04.13.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Aug 2021 04:13:50 -0700 (PDT) X-MC-Unique: 9UTGAs3ePi658xCsHuZlSg-1 X-MC-Unique: TDJ3CS7kNB-bpC7kwLKVgg-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=fZqaVz01Bb1Gp7gTyXwkadGzux7y3bVsQQtOE3KyIg8=; b=TgCF0A03OPZL+SyR5mxLrapGXQ8PJAOVW2URn1z4ag1KCJcqpDa0JXJrSiEpuK3R+w jo2EZYpALueEiCOFbxl13fbKd8/oeN6oqt8K/8ABJl8MWO7pEpkDJHlHbNz+EczZpgBJ BMCWf68zHxdJHI7m9/FLK6NmDi6FCcnaQnFdQ0vIgZeGJxVPBMic/89wpbqoi5LN8q0t T6klYZlYn2qbeqB/hqIDCKZsOSHBHvBhXCLxWLTbDNIY26vN97k5XqenhFjeNULBqSFT sO6OfmQmBruQBUuRlo3kHW9pW4vH+kiS8dcurJH9nbTYtpXRIQcIcjqTMQjOrN8FY3n7 fErA== X-Gm-Message-State: AOAM5302H2/icCsJ2yfbjvQqMhqnDtZsmhER6Yet00ST7K9aO6CDYU8P xq4RpHiQ2Hz8F785bKRMBEsE/cWbM5muZkQm43I= X-Google-Smtp-Source: ABdhPJxnVFMDEgBGjxKTj4LxFNwgGFZjtQGNElprZKTt9VJfYHO9BefL07WGrNhBWAPq5AX9rQQL9w== X-Received: by 2002:a65:6149:: with SMTP id o9mr15564749pgv.422.1629112430949; Mon, 16 Aug 2021 04:13:50 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH v2 3/4] test_driver: Implement virDomainAbortJob Date: Mon, 16 Aug 2021 19:13:36 +0800 Message-Id: <20210816111337.112671-4-lukedyue@gmail.com> In-Reply-To: <20210816111337.112671-1-lukedyue@gmail.com> References: <20210816111337.112671-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.3 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: 1629112506762100002 Content-Type: text/plain; charset="utf-8" As we are using jobState to store dummy job type, so just change it to VIR_DOMAIN_JOB_CANCELLED when try to abort a job. Signed-off-by: Luke Yue Reviewed-by: Martin Kletzander --- 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 93aeec7105..5043c57fe2 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2874,6 +2874,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->jobState =3D=3D VIR_DOMAIN_JOB_NONE) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("no job is active on the domain")); + } else { + priv->jobState =3D VIR_DOMAIN_JOB_CANCELLED; + ret =3D 0; + } + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + static int testDomainGetLaunchSecurityInfo(virDomainPtr domain G_GNUC_UNUSED, virTypedParameterPtr *params G_GNUC_UNUSED, @@ -9777,6 +9805,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainSetLifecycleAction =3D testDomainSetLifecycleAction, /* 5.7.0 */ .domainGetJobInfo =3D testDomainGetJobInfo, /* 7.7.0 */ .domainGetJobStats =3D testDomainGetJobStats, /* 7.7.0 */ + .domainAbortJob =3D testDomainAbortJob, /* 7.7.0 */ =20 .domainSnapshotNum =3D testDomainSnapshotNum, /* 1.1.4 */ .domainSnapshotListNames =3D testDomainSnapshotListNames, /* 1.1.4 */ --=20 2.32.0