mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-10 07:20:02 +00:00
qemuMigrationDstStartNBDServer: Refactor cleanup
There's nothing under the 'cleanup:' label thus the whole code can be simplified. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
43f027b57c
commit
36e11cca83
@ -541,7 +541,6 @@ qemuMigrationDstStartNBDServer(virQEMUDriver *driver,
|
|||||||
const char *nbdURI,
|
const char *nbdURI,
|
||||||
const char *tls_alias)
|
const char *tls_alias)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
qemuDomainObjPrivate *priv = vm->privateData;
|
qemuDomainObjPrivate *priv = vm->privateData;
|
||||||
size_t i;
|
size_t i;
|
||||||
virStorageNetHostDef server = {
|
virStorageNetHostDef server = {
|
||||||
@ -610,22 +609,22 @@ qemuMigrationDstStartNBDServer(virQEMUDriver *driver,
|
|||||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
||||||
_("Cannot migrate empty or read-only disk %1$s"),
|
_("Cannot migrate empty or read-only disk %1$s"),
|
||||||
disk->dst);
|
disk->dst);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(diskAlias = qemuAliasDiskDriveFromDisk(disk)))
|
if (!(diskAlias = qemuAliasDiskDriveFromDisk(disk)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (!server_started &&
|
if (!server_started &&
|
||||||
server.transport == VIR_STORAGE_NET_HOST_TRANS_TCP) {
|
server.transport == VIR_STORAGE_NET_HOST_TRANS_TCP) {
|
||||||
if (server.port) {
|
if (server.port) {
|
||||||
if (virPortAllocatorSetUsed(server.port) < 0)
|
if (virPortAllocatorSetUsed(server.port) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
unsigned short port = 0;
|
unsigned short port = 0;
|
||||||
|
|
||||||
if (virPortAllocatorAcquire(driver->migrationPorts, &port) < 0)
|
if (virPortAllocatorAcquire(driver->migrationPorts, &port) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
server.port = port;
|
server.port = port;
|
||||||
}
|
}
|
||||||
@ -635,7 +634,7 @@ qemuMigrationDstStartNBDServer(virQEMUDriver *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_MIGRATION_IN) < 0)
|
if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_MIGRATION_IN) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (!server_started) {
|
if (!server_started) {
|
||||||
if (qemuMonitorNBDServerStart(priv->mon, &server, tls_alias) < 0)
|
if (qemuMonitorNBDServerStart(priv->mon, &server, tls_alias) < 0)
|
||||||
@ -648,14 +647,11 @@ qemuMigrationDstStartNBDServer(virQEMUDriver *driver,
|
|||||||
qemuDomainObjExitMonitor(vm);
|
qemuDomainObjExitMonitor(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
exit_monitor:
|
exit_monitor:
|
||||||
qemuDomainObjExitMonitor(vm);
|
qemuDomainObjExitMonitor(vm);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user