From nobody Sun May 5 12:54:26 2024 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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=1614259816; cv=none; d=zohomail.com; s=zohoarc; b=QdXn/yDTsmif4758LuEgiVjJQShTf3iAABTRiH7jHIm0Rc6/vcv1/+/1n6EtI4QyvDu0KZSHGVNPL+Y87OYiHnrVprJ32CIf9VPqulA264zQPEWCXvqKX7QEzOWRqMadcnasAtjd+HPJXZlgOlBt9LmAKnwm8Zgal4FBd593Wvk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614259816; 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=hv5kDanazz/34o4b+TaUabH+pzo3pQDbaxejYN+Oflo=; b=Vl6NoXDA8OXyCtLaBA1yRrqgFEnUIjgSurxkESMXNxnfy1d+L5PzWKPKsy+3cNWRAmMvyLTN3NvMJTbhK0Skv8iRWrmBUXE6QiMjVcmp1Hao0bBuVU+d9HOYgM47vPuSYUrZD0d4Sj0QJR7Mh9Sp5/FZQi2sHGnOYgePfiCFTdo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= 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 161425981652542.76466443529273; Thu, 25 Feb 2021 05:30:16 -0800 (PST) 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-41-eS5q8ueYO9uTkGf5YNJvfA-1; Thu, 25 Feb 2021 08:30:11 -0500 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 8F5C8193578E; Thu, 25 Feb 2021 13:30:05 +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 5F9665D6D7; Thu, 25 Feb 2021 13:30:05 +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 1643C58077; Thu, 25 Feb 2021 13:30:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11PDTer1012669 for ; Thu, 25 Feb 2021 08:29:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id A86AB19801; Thu, 25 Feb 2021 13:29:40 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 158841346D for ; Thu, 25 Feb 2021 13:29:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614259815; 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=hv5kDanazz/34o4b+TaUabH+pzo3pQDbaxejYN+Oflo=; b=h4PWSjATz27ArWz6ztzWbUrvhXERRDMJWpc12r31OVXDJOvopo0CQ2OZAdgXCn0z/mpXvp qw8T/rJYRkSRGbIZTM1VHjHDQYVGNLdOymfC8EGkpgodaKrVdqf/Wr9ouweTNRJnawOjVF qLojAKMNzQTnlzFAS7qHN2va5TglQLo= X-MC-Unique: eS5q8ueYO9uTkGf5YNJvfA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/2] qemuBackupJobTerminate: Move cleanup of temp files earlier Date: Thu, 25 Feb 2021 14:29:31 +0100 Message-Id: <4b78d5f724aae9d7331691bd352945257a8ccb13.1614259713.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Upcoming patch will remove unnecessary actions if the VM crashed. The cleanup needs to be performed always, thus needs to be moved earlier. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_backup.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 423de9c719..d3d98c1d6a 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -560,21 +560,6 @@ qemuBackupJobTerminate(virDomainObjPtr vm, qemuDomainObjPrivatePtr priv =3D vm->privateData; size_t i; - qemuDomainJobInfoUpdateTime(priv->job.current); - - g_clear_pointer(&priv->job.completed, qemuDomainJobInfoFree); - priv->job.completed =3D qemuDomainJobInfoCopy(priv->job.current); - - priv->job.completed->stats.backup.total =3D priv->backup->push_total; - priv->job.completed->stats.backup.transferred =3D priv->backup->push_t= ransferred; - priv->job.completed->stats.backup.tmp_used =3D priv->backup->pull_tmp_= used; - priv->job.completed->stats.backup.tmp_total =3D priv->backup->pull_tmp= _total; - - priv->job.completed->status =3D jobstatus; - priv->job.completed->errmsg =3D g_strdup(priv->backup->errmsg); - - qemuDomainEventEmitJobCompleted(priv->driver, vm); - if (!(priv->job.apiFlags & VIR_DOMAIN_BACKUP_BEGIN_REUSE_EXTERNAL) && (priv->backup->type =3D=3D VIR_DOMAIN_BACKUP_TYPE_PULL || (priv->backup->type =3D=3D VIR_DOMAIN_BACKUP_TYPE_PUSH && @@ -598,6 +583,21 @@ qemuBackupJobTerminate(virDomainObjPtr vm, } } + qemuDomainJobInfoUpdateTime(priv->job.current); + + g_clear_pointer(&priv->job.completed, qemuDomainJobInfoFree); + priv->job.completed =3D qemuDomainJobInfoCopy(priv->job.current); + + priv->job.completed->stats.backup.total =3D priv->backup->push_total; + priv->job.completed->stats.backup.transferred =3D priv->backup->push_t= ransferred; + priv->job.completed->stats.backup.tmp_used =3D priv->backup->pull_tmp_= used; + priv->job.completed->stats.backup.tmp_total =3D priv->backup->pull_tmp= _total; + + priv->job.completed->status =3D jobstatus; + priv->job.completed->errmsg =3D g_strdup(priv->backup->errmsg); + + qemuDomainEventEmitJobCompleted(priv->driver, vm); + virDomainBackupDefFree(priv->backup); priv->backup =3D NULL; qemuDomainObjEndAsyncJob(priv->driver, vm); --=20 2.29.2 From nobody Sun May 5 12:54:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614259809; cv=none; d=zohomail.com; s=zohoarc; b=Gqzt94oSRYQJxglbSjLvKS3xrk9bx5qrEB2nR3kfdYbL4dMixFnxl88YFUBf3WEcG0auqct8MKJid9CLsXLjqkInC6fGiGK51bdlxudnHa11vT/+oOb89E8/uHtOU8RITgB8c/QZLHbUuVEz2EozbmDtAQ055C84MbR2S2Yp94g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614259809; 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=V8lWNeEkCqpNPjpbf11nW/DsY2hp6NaadGYL2Fe2J6M=; b=VT6iK1u376SIyWGcGorVeHWxe6JZ74XanyTOEznX/DX+KWgtevc7zZNUKB+scHpUuTI78aKZ/enq+RtzMZdwdnKrQrdWb0HIPksOVA0FOmICU9K4a/nlSIn81Oqbx3YiaeUE2f+7aan1sKF++ea4R2eIP7WfsHf0PkHEQMz9LgI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614259809341194.226750403256; Thu, 25 Feb 2021 05:30:09 -0800 (PST) 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-580-7374WbYbPhCj-mA4USAavw-1; Thu, 25 Feb 2021 08:30:05 -0500 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 0C205BBEE7; Thu, 25 Feb 2021 13:30:00 +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 C422027CA8; Thu, 25 Feb 2021 13:29:58 +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 3F15818095CB; Thu, 25 Feb 2021 13:29:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11PDTfrj012675 for ; Thu, 25 Feb 2021 08:29:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id AEFE61346D; Thu, 25 Feb 2021 13:29:41 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C127189C7 for ; Thu, 25 Feb 2021 13:29:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614259808; 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=V8lWNeEkCqpNPjpbf11nW/DsY2hp6NaadGYL2Fe2J6M=; b=YMBtE/NnymotIJVqTRZPeinhA0M086uiBCy3OxvteU/wAeN5Ky56KOdTK2ofy3A5fh2ixJ vs8S5M6KgvrW+6KPhlpXvcM46AmSVyfLfWNfoccLaDbCRcFXPMY6JKNrKMNxrelOt1jtV4 ApUIK6zSaeemwQtz5gbLfjYZgkO2o8E= X-MC-Unique: 7374WbYbPhCj-mA4USAavw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/2] qemuBackupJobTerminate: Don't calculate backup job stats if VM isn't active Date: Thu, 25 Feb 2021 14:29:32 +0100 Message-Id: <4f3cf7a6478579ef480eb346446fe4e72cbd6ffe.1614259713.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" If the VM isn't active calculating the job stats doesn't make sense. Additionally this prevents a crash of libvirtd if qemu terminates while libvirt wasn't running: Thread 28 "init-backup-tes" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffb9310640 (LWP 3201116)] qemuDomainJobInfoUpdateTime (jobInfo=3D0x0) at ../../../libvirt/src/qemu/qe= mu_domainjob.c:275 275 if (!jobInfo->started) (gdb) bt #0 qemuDomainJobInfoUpdateTime (jobInfo=3D0x0) at ../../../libvirt/src/qe= mu/qemu_domainjob.c:275 #1 0x00007fffcba1a12d in qemuBackupJobTerminate (vm=3D0x7fff9c1bc840, job= status=3DQEMU_DOMAIN_JOB_STATUS_CANCELED) at ../../../libvirt/src/qemu/qemu= _backup.c:563 #2 0x00007fffcbaefcae in qemuProcessStop (driver=3D0x7fff9c144ff0, vm=3D0x7fff9c1bc840, reason=3DVIR_DOMAIN_SHUT= OFF_DAEMON, asyncJob=3DQEMU_ASYNC_JOB_NONE, flags=3D) at ../../../libvirt/src/qemu/qemu_process.c:7812 #3 0x00007fffcbaf2a10 in qemuProcessReconnect (opaque=3D) = at ../../../libvirt/src/qemu/qemu_process.c:8578 #4 0x00007ffff7c46bb5 in virThreadHelper (data=3D) at ../.= ./../libvirt/src/util/virthread.c:233 #5 0x00007ffff6e453f9 in start_thread () at /lib64/libpthread.so.0 #6 0x00007ffff766fb53 in clone () at /lib64/libc.so.6 Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_backup.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index d3d98c1d6a..6ce29c28e1 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -583,6 +583,9 @@ qemuBackupJobTerminate(virDomainObjPtr vm, } } + if (!virDomainObjIsActive(vm)) + return; + qemuDomainJobInfoUpdateTime(priv->job.current); g_clear_pointer(&priv->job.completed, qemuDomainJobInfoFree); --=20 2.29.2