From nobody Sun Feb 8 13:38:49 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1652196175; cv=none; d=zohomail.com; s=zohoarc; b=l7wsFdhks3aIYNJxC/VNnIM4ilS2FnRQkIO1RKa388lTdpHbh++4a8nD2GJkOq9Aa+XT0QLEvgOeu04rbACGLimsK2fiO0dn2NAD/BfYl0IDIIrrHJ4vvfJ918Ekkt0RM9A1LYcAaoRh8cZ6bh4JnCVfq0h3f9ZzX5mHE3eyJCE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652196175; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kyS+P7j/bP+a8xdFoZiEskSBEfhYUPUyTnNt4yicoF8=; b=lPYKi7wibGeuZiE/GkntWIyFVlipzs2sQxmd3nVrlqvGmqKVTUZ77hlg+bIPswemDLnJY30pwouIqoqX4QK7H8KMackvPZyC0Wn6cu7PW8BXPLnC3+v3CO/eQrkGHeuBO9vTa3Z8t88Kz8gsLHlOjpdEhE77Ze2a3jf3bJgF7xQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1652196175753680.0284372908294; Tue, 10 May 2022 08:22:55 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-602-fRvjsyEzO--FpEvNnTjdQw-1; Tue, 10 May 2022 11:22:40 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8E293803792; Tue, 10 May 2022 15:21:51 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B43614E1D8A; Tue, 10 May 2022 15:21:51 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6B1AB1947B86; Tue, 10 May 2022 15:21:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 193A9194706B for ; Tue, 10 May 2022 15:21:47 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id EA024463EC9; Tue, 10 May 2022 15:21:46 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.187]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C994B463ECC for ; Tue, 10 May 2022 15:21:46 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 8013C2445F0; Tue, 10 May 2022 17:21:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652196174; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=kyS+P7j/bP+a8xdFoZiEskSBEfhYUPUyTnNt4yicoF8=; b=YXhjl7Ozv4NQOMZDW4B6xo9Xtq/8CLyRBuAozfPxefxba402FF212fFYdMtOZ8lZNjx7UE zTitQlvrPNXDa/vaOGHn5rzPgFlTeUDLwyiPV+rZ4QVGv5ngIGnnU0wbLKGwWIwcPB/GxO 0k7y+k9xpAkeUZv3zmuxcXnE7IifuNA= X-MC-Unique: fRvjsyEzO--FpEvNnTjdQw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 11/80] qemu: Introduce qemuProcessCleanupMigrationJob Date: Tue, 10 May 2022 17:20:32 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 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-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652196176731100001 Content-Type: text/plain; charset="utf-8" The function can be used as a callback for qemuDomainCleanupAdd to automatically clean up a migration job when a domain is destroyed. Signed-off-by: Jiri Denemark Reviewed-by: Peter Krempa --- src/qemu/qemu_process.c | 25 +++++++++++++++++++++++++ src/qemu/qemu_process.h | 3 +++ 2 files changed, 28 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index a3192a7196..dba3ad8c87 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3431,6 +3431,31 @@ qemuProcessUpdateState(virQEMUDriver *driver, virDom= ainObj *vm) return 0; } =20 + +void +qemuProcessCleanupMigrationJob(virQEMUDriver *driver, + virDomainObj *vm) +{ + qemuDomainObjPrivate *priv =3D vm->privateData; + virDomainState state; + int reason; + + state =3D virDomainObjGetState(vm, &reason); + + VIR_DEBUG("driver=3D%p, vm=3D%s, asyncJob=3D%s, state=3D%s, reason=3D%= s", + driver, vm->def->name, + virDomainAsyncJobTypeToString(priv->job.asyncJob), + virDomainStateTypeToString(state), + virDomainStateReasonToString(state, reason)); + + if (priv->job.asyncJob !=3D VIR_ASYNC_JOB_MIGRATION_IN && + priv->job.asyncJob !=3D VIR_ASYNC_JOB_MIGRATION_OUT) + return; + + qemuDomainObjDiscardAsyncJob(vm); +} + + static int qemuProcessRecoverMigrationIn(virQEMUDriver *driver, virDomainObj *vm, diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index f81bfd930a..73e6110eee 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -244,3 +244,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuProcessQMP, qemuProce= ssQMPFree); int qemuProcessQMPStart(qemuProcessQMP *proc); =20 bool qemuProcessRebootAllowed(const virDomainDef *def); + +void qemuProcessCleanupMigrationJob(virQEMUDriver *driver, + virDomainObj *vm); --=20 2.35.1