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

qemu: migration: Don't pass around flags for different API

The NBD migration code uses drive/blockdev-mirror internally. In those
APIs we pass around flags for the monitor commands which are based on
the flags for the virDomainBlockRebase API. Since there's only one flag
which changes, pass it around explicitly rather than obscuring it in a
bitfield.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 47d610e9
......@@ -785,7 +785,7 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriverPtr driver,
const char *host,
int port,
unsigned long long mirror_speed,
unsigned int mirror_flags,
unsigned int mirror_shallow,
const char *tlsAlias)
{
VIR_AUTOPTR(qemuBlockStorageSourceAttachData) data = NULL;
......@@ -793,6 +793,10 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriverPtr driver,
int mon_ret = 0;
int ret = -1;
VIR_AUTOUNREF(virStorageSourcePtr) copysrc = NULL;
unsigned int mirror_flags = 0;
if (mirror_shallow)
mirror_flags |= VIR_DOMAIN_BLOCK_REBASE_SHALLOW;
VIR_DEBUG("starting blockdev mirror for disk=%s to host=%s", diskAlias, host);
......@@ -861,11 +865,15 @@ qemuMigrationSrcNBDStorageCopyDriveMirror(virQEMUDriverPtr driver,
const char *host,
int port,
unsigned long long mirror_speed,
unsigned int mirror_flags)
bool mirror_shallow)
{
char *nbd_dest = NULL;
int mon_ret;
int ret = -1;
unsigned int mirror_flags = VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT;
if (mirror_shallow)
mirror_flags |= VIR_DOMAIN_BLOCK_REBASE_SHALLOW;
if (strchr(host, ':')) {
if (virAsprintf(&nbd_dest, "nbd:[%s]:%d:exportname=%s",
......@@ -903,7 +911,7 @@ qemuMigrationSrcNBDStorageCopyOne(virQEMUDriverPtr driver,
const char *host,
int port,
unsigned long long mirror_speed,
unsigned int mirror_flags,
bool mirror_shallow,
const char *tlsAlias,
unsigned int flags)
{
......@@ -926,13 +934,13 @@ qemuMigrationSrcNBDStorageCopyOne(virQEMUDriverPtr driver,
disk, diskAlias,
host, port,
mirror_speed,
mirror_flags,
mirror_shallow,
tlsAlias);
} else {
rc = qemuMigrationSrcNBDStorageCopyDriveMirror(driver, vm, diskAlias,
host, port,
mirror_speed,
mirror_flags);
mirror_shallow);
}
if (rc < 0)
......@@ -987,7 +995,7 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr driver,
int port;
size_t i;
unsigned long long mirror_speed = speed;
unsigned int mirror_flags = VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT;
bool mirror_shallow = *migrate_flags & QEMU_MONITOR_MIGRATE_NON_SHARED_INC;
int rv;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
......@@ -1005,9 +1013,6 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr driver,
port = mig->nbd->port;
mig->nbd->port = 0;
if (*migrate_flags & QEMU_MONITOR_MIGRATE_NON_SHARED_INC)
mirror_flags |= VIR_DOMAIN_BLOCK_REBASE_SHALLOW;
for (i = 0; i < vm->def->ndisks; i++) {
virDomainDiskDefPtr disk = vm->def->disks[i];
......@@ -1016,7 +1021,7 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr driver,
continue;
if (qemuMigrationSrcNBDStorageCopyOne(driver, vm, disk, host, port,
mirror_speed, mirror_flags,
mirror_speed, mirror_shallow,
tlsAlias, flags) < 0)
goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册