mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: backup: Propagate bitmap metadata into qemuBackupDiskPrepareOneBitmapsChain
The function will require the bitmap topology for the full implementation. To facilitate testing, add the propagation of the necessary data beforehand so that the test code can stay unchanged during the changes. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
3323e85bf6
commit
775228dccf
@ -172,7 +172,9 @@ qemuBackupDiskDataCleanup(virDomainObjPtr vm,
|
|||||||
|
|
||||||
static virJSONValuePtr
|
static virJSONValuePtr
|
||||||
qemuBackupDiskPrepareOneBitmapsChain(virDomainMomentDefPtr *incremental,
|
qemuBackupDiskPrepareOneBitmapsChain(virDomainMomentDefPtr *incremental,
|
||||||
virStorageSourcePtr backingChain)
|
virStorageSourcePtr backingChain,
|
||||||
|
virHashTablePtr blockNamedNodeData G_GNUC_UNUSED,
|
||||||
|
const char *diskdst G_GNUC_UNUSED)
|
||||||
{
|
{
|
||||||
g_autoptr(virJSONValue) ret = NULL;
|
g_autoptr(virJSONValue) ret = NULL;
|
||||||
|
|
||||||
@ -198,13 +200,16 @@ qemuBackupDiskPrepareOneBitmapsChain(virDomainMomentDefPtr *incremental,
|
|||||||
static int
|
static int
|
||||||
qemuBackupDiskPrepareOneBitmaps(struct qemuBackupDiskData *dd,
|
qemuBackupDiskPrepareOneBitmaps(struct qemuBackupDiskData *dd,
|
||||||
virJSONValuePtr actions,
|
virJSONValuePtr actions,
|
||||||
virDomainMomentDefPtr *incremental)
|
virDomainMomentDefPtr *incremental,
|
||||||
|
virHashTablePtr blockNamedNodeData)
|
||||||
{
|
{
|
||||||
g_autoptr(virJSONValue) mergebitmaps = NULL;
|
g_autoptr(virJSONValue) mergebitmaps = NULL;
|
||||||
g_autoptr(virJSONValue) mergebitmapsstore = NULL;
|
g_autoptr(virJSONValue) mergebitmapsstore = NULL;
|
||||||
|
|
||||||
if (!(mergebitmaps = qemuBackupDiskPrepareOneBitmapsChain(incremental,
|
if (!(mergebitmaps = qemuBackupDiskPrepareOneBitmapsChain(incremental,
|
||||||
dd->domdisk->src)))
|
dd->domdisk->src,
|
||||||
|
blockNamedNodeData,
|
||||||
|
dd->domdisk->dst)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!(mergebitmapsstore = virJSONValueCopy(mergebitmaps)))
|
if (!(mergebitmapsstore = virJSONValueCopy(mergebitmaps)))
|
||||||
@ -246,6 +251,7 @@ qemuBackupDiskPrepareDataOne(virDomainObjPtr vm,
|
|||||||
struct qemuBackupDiskData *dd,
|
struct qemuBackupDiskData *dd,
|
||||||
virJSONValuePtr actions,
|
virJSONValuePtr actions,
|
||||||
virDomainMomentDefPtr *incremental,
|
virDomainMomentDefPtr *incremental,
|
||||||
|
virHashTablePtr blockNamedNodeData,
|
||||||
virQEMUDriverConfigPtr cfg,
|
virQEMUDriverConfigPtr cfg,
|
||||||
bool removeStore)
|
bool removeStore)
|
||||||
{
|
{
|
||||||
@ -274,7 +280,8 @@ qemuBackupDiskPrepareDataOne(virDomainObjPtr vm,
|
|||||||
if (incremental) {
|
if (incremental) {
|
||||||
dd->incrementalBitmap = g_strdup_printf("backup-%s", dd->domdisk->dst);
|
dd->incrementalBitmap = g_strdup_printf("backup-%s", dd->domdisk->dst);
|
||||||
|
|
||||||
if (qemuBackupDiskPrepareOneBitmaps(dd, actions, incremental) < 0)
|
if (qemuBackupDiskPrepareOneBitmaps(dd, actions, incremental,
|
||||||
|
blockNamedNodeData) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,6 +344,7 @@ static ssize_t
|
|||||||
qemuBackupDiskPrepareData(virDomainObjPtr vm,
|
qemuBackupDiskPrepareData(virDomainObjPtr vm,
|
||||||
virDomainBackupDefPtr def,
|
virDomainBackupDefPtr def,
|
||||||
virDomainMomentDefPtr *incremental,
|
virDomainMomentDefPtr *incremental,
|
||||||
|
virHashTablePtr blockNamedNodeData,
|
||||||
virJSONValuePtr actions,
|
virJSONValuePtr actions,
|
||||||
virQEMUDriverConfigPtr cfg,
|
virQEMUDriverConfigPtr cfg,
|
||||||
struct qemuBackupDiskData **rdd,
|
struct qemuBackupDiskData **rdd,
|
||||||
@ -359,7 +367,8 @@ qemuBackupDiskPrepareData(virDomainObjPtr vm,
|
|||||||
ndisks++;
|
ndisks++;
|
||||||
|
|
||||||
if (qemuBackupDiskPrepareDataOne(vm, backupdisk, dd, actions,
|
if (qemuBackupDiskPrepareDataOne(vm, backupdisk, dd, actions,
|
||||||
incremental, cfg, removeStore) < 0)
|
incremental, blockNamedNodeData,
|
||||||
|
cfg, removeStore) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (def->type == VIR_DOMAIN_BACKUP_TYPE_PULL) {
|
if (def->type == VIR_DOMAIN_BACKUP_TYPE_PULL) {
|
||||||
@ -745,8 +754,14 @@ qemuBackupBegin(virDomainObjPtr vm,
|
|||||||
goto endjob;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ndd = qemuBackupDiskPrepareData(vm, def, incremental, actions, cfg, &dd,
|
if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, QEMU_ASYNC_JOB_BACKUP) < 0)
|
||||||
reuse)) <= 0) {
|
goto endjob;
|
||||||
|
blockNamedNodeData = qemuMonitorBlockGetNamedNodeData(priv->mon);
|
||||||
|
if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || !blockNamedNodeData)
|
||||||
|
goto endjob;
|
||||||
|
|
||||||
|
if ((ndd = qemuBackupDiskPrepareData(vm, def, incremental, blockNamedNodeData,
|
||||||
|
actions, cfg, &dd, reuse)) <= 0) {
|
||||||
if (ndd == 0) {
|
if (ndd == 0) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("no disks selected for backup"));
|
_("no disks selected for backup"));
|
||||||
@ -755,12 +770,6 @@ qemuBackupBegin(virDomainObjPtr vm,
|
|||||||
goto endjob;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, QEMU_ASYNC_JOB_BACKUP) < 0)
|
|
||||||
goto endjob;
|
|
||||||
blockNamedNodeData = qemuMonitorBlockGetNamedNodeData(priv->mon);
|
|
||||||
if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || !blockNamedNodeData)
|
|
||||||
goto endjob;
|
|
||||||
|
|
||||||
if (qemuBackupDiskPrepareStorage(vm, dd, ndd, blockNamedNodeData, reuse) < 0)
|
if (qemuBackupDiskPrepareStorage(vm, dd, ndd, blockNamedNodeData, reuse) < 0)
|
||||||
goto endjob;
|
goto endjob;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user