[libvirt] [PATCH 1/4] libxl: rename goto label

Jim Fehlig jfehlig at suse.com
Tue Jul 8 21:52:14 UTC 2014


In libxlDomainMigrationPrepare(), the cleanup label handles error
conditions and should be renamed as such for clarity.

Signed-off-by: Jim Fehlig <jfehlig at suse.com>
---
 src/libxl/libxl_migration.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index 53d961c..cfbbcd0 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -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]);
-- 
1.8.4.5




More information about the libvir-list mailing list