libvirt/src/qemu/qemu_backup.h
Peter Krempa b37fdfb9d4 backup: Store error message for failed backups
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=1812827

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-04-24 08:56:57 +02:00

61 lines
2.1 KiB
C

/*
* qemu_backup.h: Implementation and handling of the backup jobs
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#pragma once
int
qemuBackupBegin(virDomainObjPtr vm,
const char *backupXML,
const char *checkpointXML,
unsigned int flags);
char *
qemuBackupGetXMLDesc(virDomainObjPtr vm,
unsigned int flags);
void
qemuBackupJobCancelBlockjobs(virDomainObjPtr vm,
virDomainBackupDefPtr backup,
bool terminatebackup,
int asyncJob);
void
qemuBackupNotifyBlockjobEnd(virDomainObjPtr vm,
virDomainDiskDefPtr disk,
qemuBlockjobState state,
const char *errmsg,
unsigned long long cur,
unsigned long long end,
int asyncJob);
void
qemuBackupJobTerminate(virDomainObjPtr vm,
qemuDomainJobStatus jobstatus);
int
qemuBackupGetJobInfoStats(virQEMUDriverPtr driver,
virDomainObjPtr vm,
qemuDomainJobInfoPtr jobInfo);
/* exported for testing */
virJSONValuePtr
qemuBackupDiskPrepareOneBitmapsChain(virDomainMomentDefPtr *incremental,
virStorageSourcePtr backingChain,
virHashTablePtr blockNamedNodeData,
const char *diskdst);