qemu: domain: Extract NBD disk migration private data formatting

We will be adding source data to it so extract it to a separate function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Peter Krempa 2018-03-05 17:00:44 +01:00
parent ceb151b24b
commit 0d6ec712d3

View File

@ -2067,6 +2067,23 @@ qemuDomainObjPrivateXMLFormatPR(virBufferPtr buf,
} }
static void
qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPtr buf,
virDomainObjPtr vm)
{
size_t i;
virDomainDiskDefPtr disk;
qemuDomainDiskPrivatePtr diskPriv;
for (i = 0; i < vm->def->ndisks; i++) {
disk = vm->def->disks[i];
diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
virBufferAsprintf(buf, "<disk dev='%s' migrating='%s'/>\n",
disk->dst, diskPriv->migrating ? "yes" : "no");
}
}
static int static int
qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf, qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf,
virDomainObjPtr vm, virDomainObjPtr vm,
@ -2098,18 +2115,8 @@ qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf,
if (priv->job.asyncJob != QEMU_ASYNC_JOB_NONE) if (priv->job.asyncJob != QEMU_ASYNC_JOB_NONE)
virBufferAsprintf(&attrBuf, " flags='0x%lx'", priv->job.apiFlags); virBufferAsprintf(&attrBuf, " flags='0x%lx'", priv->job.apiFlags);
if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT) { if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT)
size_t i; qemuDomainObjPrivateXMLFormatNBDMigration(&childBuf, vm);
virDomainDiskDefPtr disk;
qemuDomainDiskPrivatePtr diskPriv;
for (i = 0; i < vm->def->ndisks; i++) {
disk = vm->def->disks[i];
diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
virBufferAsprintf(&childBuf, "<disk dev='%s' migrating='%s'/>\n",
disk->dst, diskPriv->migrating ? "yes" : "no");
}
}
if (priv->job.migParams) if (priv->job.migParams)
qemuMigrationParamsFormat(&childBuf, priv->job.migParams); qemuMigrationParamsFormat(&childBuf, priv->job.migParams);