mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
qemu: migration: Remove pre-blockdev code paths
Assume that QEMU_CAPS_BLOCKDEV is present and remove all code executed when it's not. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
b74d17279d
commit
6111b23522
@ -1071,44 +1071,6 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virDomainObj *vm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
qemuMigrationSrcNBDStorageCopyDriveMirror(virDomainObj *vm,
|
|
||||||
const char *diskAlias,
|
|
||||||
const char *host,
|
|
||||||
int port,
|
|
||||||
const char *socket,
|
|
||||||
unsigned long long mirror_speed,
|
|
||||||
bool mirror_shallow)
|
|
||||||
{
|
|
||||||
g_autofree char *nbd_dest = NULL;
|
|
||||||
int mon_ret;
|
|
||||||
|
|
||||||
if (socket) {
|
|
||||||
nbd_dest = g_strdup_printf("nbd+unix:///%s?socket=%s",
|
|
||||||
diskAlias, socket);
|
|
||||||
} else if (strchr(host, ':')) {
|
|
||||||
nbd_dest = g_strdup_printf("nbd:[%s]:%d:exportname=%s", host, port,
|
|
||||||
diskAlias);
|
|
||||||
} else {
|
|
||||||
nbd_dest = g_strdup_printf("nbd:%s:%d:exportname=%s", host, port,
|
|
||||||
diskAlias);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_MIGRATION_OUT) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
mon_ret = qemuMonitorDriveMirror(qemuDomainGetMonitor(vm),
|
|
||||||
diskAlias, nbd_dest, "raw",
|
|
||||||
mirror_speed, 0, 0, mirror_shallow, true);
|
|
||||||
|
|
||||||
qemuDomainObjExitMonitor(vm);
|
|
||||||
if (mon_ret < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemuMigrationSrcNBDStorageCopyOne(virDomainObj *vm,
|
qemuMigrationSrcNBDStorageCopyOne(virDomainObj *vm,
|
||||||
virDomainDiskDef *disk,
|
virDomainDiskDef *disk,
|
||||||
@ -1121,13 +1083,9 @@ qemuMigrationSrcNBDStorageCopyOne(virDomainObj *vm,
|
|||||||
const char *tlsHostname,
|
const char *tlsHostname,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
qemuDomainObjPrivate *priv = vm->privateData;
|
|
||||||
qemuDomainDiskPrivate *diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
qemuDomainDiskPrivate *diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||||
qemuBlockJobData *job = NULL;
|
qemuBlockJobData *job = NULL;
|
||||||
g_autofree char *diskAlias = NULL;
|
g_autofree char *diskAlias = NULL;
|
||||||
const char *jobname = NULL;
|
|
||||||
const char *sourcename = NULL;
|
|
||||||
bool persistjob = false;
|
|
||||||
bool syncWrites = !!(flags & VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES);
|
bool syncWrites = !!(flags & VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES);
|
||||||
int rc;
|
int rc;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -1138,34 +1096,18 @@ qemuMigrationSrcNBDStorageCopyOne(virDomainObj *vm,
|
|||||||
if (!(job = qemuBlockJobDiskNew(vm, disk, QEMU_BLOCKJOB_TYPE_COPY, diskAlias)))
|
if (!(job = qemuBlockJobDiskNew(vm, disk, QEMU_BLOCKJOB_TYPE_COPY, diskAlias)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
|
|
||||||
jobname = diskAlias;
|
|
||||||
sourcename = qemuDomainDiskGetTopNodename(disk);
|
|
||||||
persistjob = true;
|
|
||||||
} else {
|
|
||||||
jobname = NULL;
|
|
||||||
sourcename = diskAlias;
|
|
||||||
persistjob = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
qemuBlockJobSyncBegin(job);
|
qemuBlockJobSyncBegin(job);
|
||||||
|
|
||||||
if (flags & VIR_MIGRATE_TLS ||
|
rc = qemuMigrationSrcNBDStorageCopyBlockdev(vm,
|
||||||
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
|
disk, diskAlias,
|
||||||
rc = qemuMigrationSrcNBDStorageCopyBlockdev(vm, disk, jobname,
|
qemuDomainDiskGetTopNodename(disk),
|
||||||
sourcename, persistjob,
|
true,
|
||||||
host, port, socket,
|
host, port, socket,
|
||||||
mirror_speed,
|
mirror_speed,
|
||||||
mirror_shallow,
|
mirror_shallow,
|
||||||
tlsAlias,
|
tlsAlias,
|
||||||
tlsHostname,
|
tlsHostname,
|
||||||
syncWrites);
|
syncWrites);
|
||||||
} else {
|
|
||||||
rc = qemuMigrationSrcNBDStorageCopyDriveMirror(vm, diskAlias,
|
|
||||||
host, port, socket,
|
|
||||||
mirror_speed,
|
|
||||||
mirror_shallow);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
diskPriv->migrating = true;
|
diskPriv->migrating = true;
|
||||||
@ -2660,26 +2602,11 @@ qemuMigrationSrcBeginPhase(virQEMUDriver *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_INC)) {
|
if (flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_INC)) {
|
||||||
if (flags & VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES &&
|
|
||||||
!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
|
|
||||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
|
||||||
_("VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES is not supported by this QEMU"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & VIR_MIGRATE_TUNNELLED) {
|
if (flags & VIR_MIGRATE_TUNNELLED) {
|
||||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
|
|
||||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||||
_("migration of non-shared storage is not supported with tunnelled migration and this QEMU"));
|
_("migration of non-shared storage is not supported with tunnelled migration and this QEMU"));
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nmigrate_disks) {
|
|
||||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
|
||||||
_("Selecting disks to migrate is not implemented for tunnelled migration"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (nmigrate_disks) {
|
if (nmigrate_disks) {
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
/* Check user requested only known disk targets. */
|
/* Check user requested only known disk targets. */
|
||||||
@ -2696,7 +2623,6 @@ qemuMigrationSrcBeginPhase(virQEMUDriver *driver,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
priv->nbdPort = 0;
|
priv->nbdPort = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user