提交 a1521f84 编写于 作者: P Peter Krempa

qemu: Implement backup job APIs and qemu handling

This allows to start and manage the backup job.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 e8ae2ddb
......@@ -140,6 +140,7 @@
@SRCDIR@/src/phyp/phyp_driver.c
@SRCDIR@/src/qemu/qemu_agent.c
@SRCDIR@/src/qemu/qemu_alias.c
@SRCDIR@/src/qemu/qemu_backup.c
@SRCDIR@/src/qemu/qemu_block.c
@SRCDIR@/src/qemu/qemu_blockjob.c
@SRCDIR@/src/qemu/qemu_capabilities.c
......
......@@ -69,6 +69,8 @@ QEMU_DRIVER_SOURCES = \
qemu/qemu_vhost_user_gpu.h \
qemu/qemu_checkpoint.c \
qemu/qemu_checkpoint.h \
qemu/qemu_backup.c \
qemu/qemu_backup.h \
$(NULL)
......
此差异已折叠。
/*
* 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);
void
qemuBackupNotifyBlockjobEnd(virDomainObjPtr vm,
virDomainDiskDefPtr disk,
qemuBlockjobState state,
unsigned long long cur,
unsigned long long end);
......@@ -52,6 +52,7 @@
#include "qemu_blockjob.h"
#include "qemu_security.h"
#include "qemu_checkpoint.h"
#include "qemu_backup.h"
#include "virerror.h"
#include "virlog.h"
......@@ -17197,6 +17198,50 @@ qemuDomainCheckpointDelete(virDomainCheckpointPtr checkpoint,
}
static int
qemuDomainBackupBegin(virDomainPtr domain,
const char *backupXML,
const char *checkpointXML,
unsigned int flags)
{
virDomainObjPtr vm = NULL;
int ret = -1;
if (!(vm = qemuDomainObjFromDomain(domain)))
goto cleanup;
if (virDomainBackupBeginEnsureACL(domain->conn, vm->def) < 0)
goto cleanup;
ret = qemuBackupBegin(vm, backupXML, checkpointXML, flags);
cleanup:
virDomainObjEndAPI(&vm);
return ret;
}
static char *
qemuDomainBackupGetXMLDesc(virDomainPtr domain,
unsigned int flags)
{
virDomainObjPtr vm = NULL;
char *ret = NULL;
if (!(vm = qemuDomainObjFromDomain(domain)))
return NULL;
if (virDomainBackupGetXMLDescEnsureACL(domain->conn, vm->def) < 0)
goto cleanup;
ret = qemuBackupGetXMLDesc(vm, flags);
cleanup:
virDomainObjEndAPI(&vm);
return ret;
}
static int qemuDomainQemuMonitorCommand(virDomainPtr domain, const char *cmd,
char **result, unsigned int flags)
{
......@@ -22932,6 +22977,8 @@ static virHypervisorDriver qemuHypervisorDriver = {
.domainCheckpointDelete = qemuDomainCheckpointDelete, /* 5.6.0 */
.domainGetGuestInfo = qemuDomainGetGuestInfo, /* 5.7.0 */
.domainAgentSetResponseTimeout = qemuDomainAgentSetResponseTimeout, /* 5.10.0 */
.domainBackupBegin = qemuDomainBackupBegin, /* 6.0.0 */
.domainBackupGetXMLDesc = qemuDomainBackupGetXMLDesc, /* 6.0.0 */
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册