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

qemu: backup: Return 'def' instead of 'obj' from qemuBackupBeginCollectIncrementalCheckpoints

The object itself has no extra value and it would make testing the code
harder. Refactor it to remove just the definition pointer.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
上级 0b27b655
...@@ -174,7 +174,7 @@ qemuBackupDiskDataCleanup(virDomainObjPtr vm, ...@@ -174,7 +174,7 @@ qemuBackupDiskDataCleanup(virDomainObjPtr vm,
static int static int
qemuBackupDiskPrepareOneBitmaps(struct qemuBackupDiskData *dd, qemuBackupDiskPrepareOneBitmaps(struct qemuBackupDiskData *dd,
virJSONValuePtr actions, virJSONValuePtr actions,
virDomainMomentObjPtr *incremental) virDomainMomentDefPtr *incremental)
{ {
g_autoptr(virJSONValue) mergebitmaps = NULL; g_autoptr(virJSONValue) mergebitmaps = NULL;
g_autoptr(virJSONValue) mergebitmapsstore = NULL; g_autoptr(virJSONValue) mergebitmapsstore = NULL;
...@@ -188,7 +188,7 @@ qemuBackupDiskPrepareOneBitmaps(struct qemuBackupDiskData *dd, ...@@ -188,7 +188,7 @@ qemuBackupDiskPrepareOneBitmaps(struct qemuBackupDiskData *dd,
while (*incremental) { while (*incremental) {
if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(mergebitmaps, if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(mergebitmaps,
dd->domdisk->src->nodeformat, dd->domdisk->src->nodeformat,
(*incremental)->def->name) < 0) (*incremental)->name) < 0)
return -1; return -1;
incremental++; incremental++;
...@@ -232,7 +232,7 @@ qemuBackupDiskPrepareDataOne(virDomainObjPtr vm, ...@@ -232,7 +232,7 @@ qemuBackupDiskPrepareDataOne(virDomainObjPtr vm,
virDomainBackupDiskDefPtr backupdisk, virDomainBackupDiskDefPtr backupdisk,
struct qemuBackupDiskData *dd, struct qemuBackupDiskData *dd,
virJSONValuePtr actions, virJSONValuePtr actions,
virDomainMomentObjPtr *incremental, virDomainMomentDefPtr *incremental,
virQEMUDriverConfigPtr cfg, virQEMUDriverConfigPtr cfg,
bool removeStore) bool removeStore)
{ {
...@@ -323,7 +323,7 @@ qemuBackupDiskPrepareDataOnePull(virJSONValuePtr actions, ...@@ -323,7 +323,7 @@ qemuBackupDiskPrepareDataOnePull(virJSONValuePtr actions,
static ssize_t static ssize_t
qemuBackupDiskPrepareData(virDomainObjPtr vm, qemuBackupDiskPrepareData(virDomainObjPtr vm,
virDomainBackupDefPtr def, virDomainBackupDefPtr def,
virDomainMomentObjPtr *incremental, virDomainMomentDefPtr *incremental,
virJSONValuePtr actions, virJSONValuePtr actions,
virQEMUDriverConfigPtr cfg, virQEMUDriverConfigPtr cfg,
struct qemuBackupDiskData **rdd, struct qemuBackupDiskData **rdd,
...@@ -505,24 +505,27 @@ qemuBackupBeginPullExportDisks(virDomainObjPtr vm, ...@@ -505,24 +505,27 @@ qemuBackupBeginPullExportDisks(virDomainObjPtr vm,
* @vm: domain object * @vm: domain object
* @incrFrom: name of checkpoint representing starting point of incremental backup * @incrFrom: name of checkpoint representing starting point of incremental backup
* *
* Returns a NULL terminated list of pointers to checkpoints in chronological * Returns a NULL terminated list of pointers to checkpoint definitions in
* order starting from the 'current' checkpoint until reaching @incrFrom. * chronological order starting from the 'current' checkpoint until reaching
* @incrFrom.
*/ */
static virDomainMomentObjPtr * static virDomainMomentDefPtr *
qemuBackupBeginCollectIncrementalCheckpoints(virDomainObjPtr vm, qemuBackupBeginCollectIncrementalCheckpoints(virDomainObjPtr vm,
const char *incrFrom) const char *incrFrom)
{ {
virDomainMomentObjPtr n = virDomainCheckpointGetCurrent(vm->checkpoints); virDomainMomentObjPtr n = virDomainCheckpointGetCurrent(vm->checkpoints);
g_autofree virDomainMomentObjPtr *incr = NULL; g_autofree virDomainMomentDefPtr *incr = NULL;
size_t nincr = 0; size_t nincr = 0;
while (n) { while (n) {
if (VIR_APPEND_ELEMENT_COPY(incr, nincr, n) < 0) virDomainMomentDefPtr def = n->def;
if (VIR_APPEND_ELEMENT_COPY(incr, nincr, def) < 0)
return NULL; return NULL;
if (STREQ(n->def->name, incrFrom)) { if (STREQ(def->name, incrFrom)) {
virDomainMomentObjPtr terminator = NULL; def = NULL;
if (VIR_APPEND_ELEMENT_COPY(incr, nincr, terminator) < 0) if (VIR_APPEND_ELEMENT_COPY(incr, nincr, def) < 0)
return NULL; return NULL;
return g_steal_pointer(&incr); return g_steal_pointer(&incr);
...@@ -648,7 +651,7 @@ qemuBackupBegin(virDomainObjPtr vm, ...@@ -648,7 +651,7 @@ qemuBackupBegin(virDomainObjPtr vm,
bool pull = false; bool pull = false;
virDomainMomentObjPtr chk = NULL; virDomainMomentObjPtr chk = NULL;
g_autoptr(virDomainCheckpointDef) chkdef = NULL; g_autoptr(virDomainCheckpointDef) chkdef = NULL;
g_autofree virDomainMomentObjPtr *incremental = NULL; g_autofree virDomainMomentDefPtr *incremental = NULL;
g_autoptr(virJSONValue) actions = NULL; g_autoptr(virJSONValue) actions = NULL;
struct qemuBackupDiskData *dd = NULL; struct qemuBackupDiskData *dd = NULL;
ssize_t ndd = 0; ssize_t ndd = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册