From nobody Mon Feb 9 00:07:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1587031010; cv=none; d=zohomail.com; s=zohoarc; b=FXTPgA+/djnV22HlMq/rj3nQLoFBCFOm0ZEaUXn1rUWZHxRuAgTHa/CjgnmokWk6HbjJI6dZQh4jsLgVmkxFIiplZOweYqkYUqiCysihRVXAh3W2J/TumPhVvM/k6NATCHkXFeUiOXZVHypNll7WdkfAtVzZ/tVVURQqyLqEwN0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587031010; 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=qXUM3O7UtUOMpQaq3GfqUxE+ZhKvljoCXartqWlscII=; b=E5+t8ie8GkixzqeVNKFdNKiwBEqmXlWqLnRIDF9ycZYMEPaCC+TeZ7xDGD1++SyCXbKR3/nSfnazaElvvHXuICMqhRVf2sraIisSaU02G3mTOpTvHBPfTYjPTJLVVaX1z/83OUWL2M2CB+dVKuc0TqZXBm+sybWM2kS5zp+7BXc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1587031010739140.34813342937218; Thu, 16 Apr 2020 02:56:50 -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-329-dO4rKbnZNQmtp65AZKYhXA-1; Thu, 16 Apr 2020 05:56:47 -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 1216410753F4; Thu, 16 Apr 2020 09:56:11 +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 D52E3272A5; Thu, 16 Apr 2020 09:56:10 +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 7D5D118089CF; Thu, 16 Apr 2020 09:56:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03G9tuEV020206 for ; Thu, 16 Apr 2020 05:55:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id A4C555DA7B; Thu, 16 Apr 2020 09:55:56 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 18BA15DA2C for ; Thu, 16 Apr 2020 09:55:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587031009; 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=qXUM3O7UtUOMpQaq3GfqUxE+ZhKvljoCXartqWlscII=; b=AqdD3uVEhcTkOef3GFq5zLwBx91zYgcbpN5N4SqDIFFquYcjJiYiOGCizZaRZ14WSjgPVA qvL7UwDRd2jPp8FoaKeqgqS79/rAASzVbrv1AqDjvZctI72LAW2CxRfXl4NZsDxAvmUiyg SUl3nokXfvEJwNZqfsawgKXizbAtK4w= X-MC-Unique: dO4rKbnZNQmtp65AZKYhXA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/5] backup: Store error message for failed backups Date: Thu, 16 Apr 2020 11:55:46 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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 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 a backup job fails midway it's hard to figure out what happened as it's running asynchronous. Use the VIR_DOMAIN_JOB_ERRMSG job statistics field to pass through the error from the first failed backup-blockjob so that both the consumer of the virDomainGetJobStats and the corresponding event can see the error. event 'job-completed' for domain backup-test: operation: 9 time_elapsed: 46 disk_total: 104857600 disk_processed: 10158080 disk_remaining: 94699520 success: 0 errmsg: No space left on device virsh domjobinfo backup-test --completed --anystats Job type: Failed Operation: Backup Time elapsed: 46 ms File processed: 9.688 MiB File remaining: 90.312 MiB File total: 100.000 MiB Error message: No space left on device https://bugzilla.redhat.com/show_bug.cgi?id=3D1812827 Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/conf/backup_conf.c | 1 + src/conf/backup_conf.h | 2 ++ src/qemu/qemu_backup.c | 10 ++++++++-- src/qemu/qemu_backup.h | 1 + src/qemu/qemu_blockjob.c | 2 +- src/qemu/qemu_domain.c | 4 ++++ 6 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c index 64c8f6cc09..c5677cdb05 100644 --- a/src/conf/backup_conf.c +++ b/src/conf/backup_conf.c @@ -65,6 +65,7 @@ virDomainBackupDefFree(virDomainBackupDefPtr def) return; g_free(def->incremental); + g_free(def->errmsg); virStorageNetHostDefFree(1, def->server); for (i =3D 0; i < def->ndisks; i++) { diff --git a/src/conf/backup_conf.h b/src/conf/backup_conf.h index 672fd52ee7..b5685317c5 100644 --- a/src/conf/backup_conf.h +++ b/src/conf/backup_conf.h @@ -79,6 +79,8 @@ struct _virDomainBackupDef { unsigned long long push_total; unsigned long long pull_tmp_used; unsigned long long pull_tmp_total; + + char *errmsg; /* error message of failed sub-blockjob */ }; typedef enum { diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 03d34c9378..80fc5d77f8 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -650,6 +650,7 @@ qemuBackupJobTerminate(virDomainObjPtr vm, 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); @@ -951,6 +952,7 @@ void qemuBackupNotifyBlockjobEnd(virDomainObjPtr vm, virDomainDiskDefPtr disk, qemuBlockjobState state, + const char *errmsg, unsigned long long cur, unsigned long long end, int asyncJob) @@ -964,8 +966,8 @@ qemuBackupNotifyBlockjobEnd(virDomainObjPtr vm, virDomainBackupDefPtr backup =3D priv->backup; size_t i; - VIR_DEBUG("vm: '%s', disk:'%s', state:'%d'", - vm->def->name, disk->dst, state); + VIR_DEBUG("vm: '%s', disk:'%s', state:'%d' errmsg:'%s'", + vm->def->name, disk->dst, state, NULLSTR(errmsg)); if (!backup) return; @@ -985,6 +987,10 @@ qemuBackupNotifyBlockjobEnd(virDomainObjPtr vm, backup->push_total +=3D end; } + /* record first error message */ + if (!backup->errmsg) + backup->errmsg =3D g_strdup(errmsg); + for (i =3D 0; i < backup->ndisks; i++) { virDomainBackupDiskDefPtr backupdisk =3D backup->disks + i; diff --git a/src/qemu/qemu_backup.h b/src/qemu/qemu_backup.h index 3321ba0b6f..b19c3bf1c9 100644 --- a/src/qemu/qemu_backup.h +++ b/src/qemu/qemu_backup.h @@ -38,6 +38,7 @@ void qemuBackupNotifyBlockjobEnd(virDomainObjPtr vm, virDomainDiskDefPtr disk, qemuBlockjobState state, + const char *errmsg, unsigned long long cur, unsigned long long end, int asyncJob); diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 2032c0c1c5..b9eecd3f98 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -1435,7 +1435,7 @@ qemuBlockJobProcessEventConcludedBackup(virQEMUDriver= Ptr driver, g_autoptr(qemuBlockStorageSourceAttachData) backend =3D NULL; g_autoptr(virJSONValue) actions =3D NULL; - qemuBackupNotifyBlockjobEnd(vm, job->disk, newstate, + qemuBackupNotifyBlockjobEnd(vm, job->disk, newstate, job->errmsg, progressCurrent, progressTotal, asyncJob); if (job->data.backup.store && diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index dba222dde5..22bb808177 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -836,6 +836,10 @@ qemuDomainBackupJobInfoToParams(qemuDomainJobInfoPtr j= obInfo, VIR_DOMAIN_JOB_SUCCESS) < 0) return -1; + if (jobInfo->errmsg && + virTypedParamListAddString(par, jobInfo->errmsg, VIR_DOMAIN_JOB_ER= RMSG) < 0) + return -1; + *nparams =3D virTypedParamListStealParams(par, params); *type =3D qemuDomainJobStatusToType(jobInfo->status); return 0; --=20 2.26.0