From nobody Sun Feb 8 20:23:44 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=1654087871; cv=none; d=zohomail.com; s=zohoarc; b=OUxFlUYpq2hPf1IWLHz1CUeZDRHOysQoR0Dv7amtUr+rO7+PpkrN3rIHOZqhoJttZAargqD38nNkws3d4XcryzFQQULSXHDvQNh9e47VlpvQB3kZhLUzdeYH+smmmxWGRMaCKrGslsccG9BCt9858cAU9EtvfkNLLNjG04MvmVo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654087871; h=Content-Type:Content-Transfer-Encoding:Cc: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=TuqX7DgWUhCrcR4c1oUTC0EtkTTyz//XOIagbUnWFgw=; b=kUJdXXmzYtSEpYLUJE5pdfOwX/3gd2jf8pJPYqae1rO4CzeefCwVnuSZOxkPkoO8+pPWT0UW34p3fnda0He/BdVHKhfLhZQbkeBES2NPWSxtrWqMgjZIzJFfki6p8MtRpj80WE4jqdstSUw++/JFZK9LPRkY/z8QXQPn+cZ+aJ8= 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 1654087871445181.7733244562636; Wed, 1 Jun 2022 05:51:11 -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-262-ikRDQMDnMfKJ638bOue7sw-1; Wed, 01 Jun 2022 08:50:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F2C2118E004B; Wed, 1 Jun 2022 12:50:35 +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 DD86282882; Wed, 1 Jun 2022 12:50:35 +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 EB734194E101; Wed, 1 Jun 2022 12:50:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1AB841947B94 for ; Wed, 1 Jun 2022 12:50:28 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D00C81410F3B; Wed, 1 Jun 2022 12:50:27 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.227]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AEF2B1410DDB; Wed, 1 Jun 2022 12:50:27 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 6A454245B55; Wed, 1 Jun 2022 14:50:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654087870; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=TuqX7DgWUhCrcR4c1oUTC0EtkTTyz//XOIagbUnWFgw=; b=DB+mSl8vy7pk/Nftpt1V54tHJbl/VloTfwnBK/SmTditvYGEqHiYS/ECAzLYOBStItakHV gYbCCh6DgDvmP01SNRRkY1S2Rjm2d3BOAG8LX8zZ3zRqs0gVBDc65uUhx/QRvva2yPt+Gm 5bnGiShGWqfmdIy//yVHF/EO9zocJzs= X-MC-Unique: ikRDQMDnMfKJ638bOue7sw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 09/81] qemu: Introduce qemuProcessCleanupMigrationJob Date: Wed, 1 Jun 2022 14:49:09 +0200 Message-Id: <23f5a05ce5f84ab365477226dd558e13d223806b.1654087150.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 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: , Cc: Peter Krempa , Pavel Hrdina Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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: 1654087871866100002 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 Reviewed-by: Pavel Hrdina --- Notes: Version 2: - no change 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 0d39c67dfc..2f0167299f 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3360,6 +3360,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 9866d2bf35..8641534be4 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -241,3 +241,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