mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
libxl: rename goto label
In libxlDomainMigrationPrepare(), the cleanup label handles error conditions and should be renamed as such for clarity.
This commit is contained in:
parent
110b959fc5
commit
92cd6b677e
@ -288,31 +288,31 @@ libxlDomainMigrationPrepare(virConnectPtr dconn,
|
||||
VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
|
||||
VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
|
||||
NULL)))
|
||||
goto cleanup;
|
||||
goto error;
|
||||
|
||||
/* Create socket connection to receive migration data */
|
||||
if (!uri_in) {
|
||||
if ((hostname = virGetHostname()) == NULL)
|
||||
goto cleanup;
|
||||
goto error;
|
||||
|
||||
if (STRPREFIX(hostname, "localhost")) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("hostname on destination resolved to localhost,"
|
||||
" but migration requires an FQDN"));
|
||||
goto cleanup;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (virPortAllocatorAcquire(driver->migrationPorts, &port) < 0)
|
||||
goto cleanup;
|
||||
goto error;
|
||||
|
||||
if (virAsprintf(uri_out, "tcp://%s:%d", hostname, port) < 0)
|
||||
goto cleanup;
|
||||
goto error;
|
||||
} else {
|
||||
if (!(STRPREFIX(uri_in, "tcp://"))) {
|
||||
/* not full URI, add prefix tcp:// */
|
||||
char *tmp;
|
||||
if (virAsprintf(&tmp, "tcp://%s", uri_in) < 0)
|
||||
goto cleanup;
|
||||
goto error;
|
||||
uri = virURIParse(tmp);
|
||||
VIR_FREE(tmp);
|
||||
} else {
|
||||
@ -323,28 +323,28 @@ libxlDomainMigrationPrepare(virConnectPtr dconn,
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("unable to parse URI: %s"),
|
||||
uri_in);
|
||||
goto cleanup;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (uri->server == NULL) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("missing host in migration URI: %s"),
|
||||
uri_in);
|
||||
goto cleanup;
|
||||
goto error;
|
||||
} else {
|
||||
hostname = uri->server;
|
||||
}
|
||||
|
||||
if (uri->port == 0) {
|
||||
if (virPortAllocatorAcquire(driver->migrationPorts, &port) < 0)
|
||||
goto cleanup;
|
||||
goto error;
|
||||
|
||||
} else {
|
||||
port = uri->port;
|
||||
}
|
||||
|
||||
if (virAsprintf(uri_out, "tcp://%s:%d", hostname, port) < 0)
|
||||
goto cleanup;
|
||||
goto error;
|
||||
}
|
||||
|
||||
snprintf(portstr, sizeof(portstr), "%d", port);
|
||||
@ -352,14 +352,14 @@ libxlDomainMigrationPrepare(virConnectPtr dconn,
|
||||
if (virNetSocketNewListenTCP(hostname, portstr, &socks, &nsocks) < 0) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||
_("Fail to create socket for incoming migration"));
|
||||
goto cleanup;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (libxlMigrationDstArgsInitialize() < 0)
|
||||
goto cleanup;
|
||||
goto error;
|
||||
|
||||
if (!(args = virObjectNew(libxlMigrationDstArgsClass)))
|
||||
goto cleanup;
|
||||
goto error;
|
||||
|
||||
args->conn = dconn;
|
||||
args->vm = vm;
|
||||
@ -395,12 +395,12 @@ libxlDomainMigrationPrepare(virConnectPtr dconn,
|
||||
virObjectUnref(args);
|
||||
|
||||
if (!nsocks_listen)
|
||||
goto cleanup;
|
||||
goto error;
|
||||
|
||||
ret = 0;
|
||||
goto done;
|
||||
|
||||
cleanup:
|
||||
error:
|
||||
for (i = 0; i < nsocks; i++) {
|
||||
virNetSocketClose(socks[i]);
|
||||
virObjectUnref(socks[i]);
|
||||
|
Loading…
Reference in New Issue
Block a user