From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633827; cv=none; d=zohomail.com; s=zohoarc; b=UfeQhfeWVsk57rUlO+o/AWiVLeh9eEfg2jKil1apXcqv/A/1pXwXqzCj1JrtTMXBJ1yPCuQ3IaPkG1bfHx67vhOeTXchcy/I5jXgIRGIyRPEti8Udzj9tvLpKdqNCi76ASSan4k2oct37J5uiUT4abN/Pk8my4IkLNS9HPCkmC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633827; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FyRa1OkkgGhnQ2pwMqqxqrb3IOFAYTYqum59R35N2v4=; b=EH9sZwHxMNM8WkWxOMC/wDVcDW+sRd/xPRvtzl8m2zlSRNDt2cKd7Zo+HJmbsDwnd7FqRM1RTui9ooq0LvgHLECI1Dm8SMEXK9xWlqjwKeMSo4gIg/pPX6jika7GYERZJHfVR1jNgtVpjpv+ZIr77gCIJakyY3ARUA/dZrTDM10= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 159463382682313.429761094914966; Mon, 13 Jul 2020 02:50:26 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-219-jXEYVFNONO6rqmuEQDNTHg-1; Mon, 13 Jul 2020 05:50:22 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4805C19200C3; Mon, 13 Jul 2020 09:50:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0663F27CCC; Mon, 13 Jul 2020 09:50:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 33CB284350; Mon, 13 Jul 2020 09:50:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oCjn005624 for ; Mon, 13 Jul 2020 05:50:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id D8372E2A90; Mon, 13 Jul 2020 09:50:12 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D2F4AE2A9A for ; Mon, 13 Jul 2020 09:50:10 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3B48B833B7E for ; Mon, 13 Jul 2020 09:50:10 +0000 (UTC) Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-77-pDoVfzTmPbKpZ3WlxjGtAg-1; Mon, 13 Jul 2020 05:50:08 -0400 Received: by mail-qk1-f194.google.com with SMTP id z63so11529396qkb.8 for ; Mon, 13 Jul 2020 02:50:08 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:07 -0700 (PDT) X-MC-Unique: jXEYVFNONO6rqmuEQDNTHg-1 X-MC-Unique: pDoVfzTmPbKpZ3WlxjGtAg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FyRa1OkkgGhnQ2pwMqqxqrb3IOFAYTYqum59R35N2v4=; b=gbMKYN8dl8ace7cu6J7GGmrhbZg6p6X6oXzFyb83lC2rCUE2wlVJ0iDSvkpGUUhrZN vLo6CfXqcjGzC1S2zDw879J32HZ+deOqrbFFvkzEZTNzZIAuhgvawrPT0fz2yHIQqde9 Xg+BjC4+vIdczNcdi9edAGtnsTVTWyb1hrtQ0XjZRXwXVtIpJk17IBWh3MaPP7iwDfgc 0/qnrkllMuxQNKJ/yI5RszpvWnIPo5VKqQYivUeQgotL4/LxJRzu0SM9s9Ke3HhXbiqk qWYzikHA0gASNbH65B/6oKc04gHFKKW6wUlC1rRLRtqpjbyrIq0qcUGeE1aLUo24wETx pkRw== X-Gm-Message-State: AOAM532uRMIbxOG0WlFluvzTqQC5u0EYMstFS0CTxjpK2Ib4zysouCf3 B7LjU7fdLY93DsmWos2rrWqGm+6PLBY= X-Google-Smtp-Source: ABdhPJz3rtpd6LzLE/FsEYqumuQvq9sgG1TfYoTvN/FbZuSW2z46KktBKleNLTuMqzq0ur6VX3HnrA== X-Received: by 2002:a37:c87:: with SMTP id 129mr77300582qkm.319.1594633807488; Mon, 13 Jul 2020 02:50:07 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 01/25] libvirt-domain.c: modernize virDomainMigrateCheckNotLocal() Date: Mon, 13 Jul 2020 06:49:33 -0300 Message-Id: <20200713094957.1648405-2-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use g_autoptr() and remove the 'cleanup' label. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/libvirt-domain.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 9f65cba2e8..0941caa67f 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -3286,22 +3286,17 @@ virDomainMigrateVersion3Params(virDomainPtr domain, static int virDomainMigrateCheckNotLocal(const char *dconnuri) { - virURIPtr tempuri =3D NULL; - int ret =3D -1; + g_autoptr(virURI) tempuri =3D NULL; =20 if (!(tempuri =3D virURIParse(dconnuri))) - goto cleanup; + return -1; if (!tempuri->server || STRPREFIX(tempuri->server, "localhost")) { virReportInvalidArg(dconnuri, "%s", _("Attempt to migrate guest to the same host")= ); - goto cleanup; + return -1; } =20 - ret =3D 0; - - cleanup: - virURIFree(tempuri); - return ret; + return 0; } =20 =20 --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633833; cv=none; d=zohomail.com; s=zohoarc; b=EKetuwAx2ON+SWBmuIARY5JBiU2Qls6I6AdfGcLvh2P+wLfLlnOvQmNaVkCIluvyXml3r8SC/quQUhoQSEAHy8kDEQwXtvgWet079PJVW8pG/T79Mijxx5Tin2cUbVlr/3qH7v1F7jc/dkSF34dWOXxdsErOXsrZQnHR9OXPGNo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633833; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CNWwmPfm+Qjc5UrtbiXqffWKee+B5Ld760PZ6ht15ho=; b=nFmcnG0FQCRThI5cGVbA+XtRD43/9d6/LjeMvs3gcBSoSA/JWP6vCTKFm3Y3m9cnXrdKU39gF62v5vURjhqKDjFeTqb8ZjhYgnnPODdkjI5W71cgj5HZg7v951UvFx35L13Ohj2Vay4vPu98HDt4ZPY0kDzPXpc5EweBWXj8fto= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1594633833076511.6397820704973; Mon, 13 Jul 2020 02:50:33 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-332-AEv4B_BINZuZ4TpS_5ZirQ-1; Mon, 13 Jul 2020 05:50:27 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 844FE19200C5; Mon, 13 Jul 2020 09:50:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5E17A2DE76; Mon, 13 Jul 2020 09:50:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2CEAB94EF7; Mon, 13 Jul 2020 09:50:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oCXs005625 for ; Mon, 13 Jul 2020 05:50:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id D8407E2A92; Mon, 13 Jul 2020 09:50:12 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D34DAE38D3 for ; Mon, 13 Jul 2020 09:50:12 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0FC10100E7D0 for ; Mon, 13 Jul 2020 09:50:12 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-186-TZbxrFnkNHO7bE8Y2xhnZA-1; Mon, 13 Jul 2020 05:50:09 -0400 Received: by mail-qt1-f194.google.com with SMTP id j10so9406520qtq.11 for ; Mon, 13 Jul 2020 02:50:09 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:08 -0700 (PDT) X-MC-Unique: AEv4B_BINZuZ4TpS_5ZirQ-1 X-MC-Unique: TZbxrFnkNHO7bE8Y2xhnZA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CNWwmPfm+Qjc5UrtbiXqffWKee+B5Ld760PZ6ht15ho=; b=o++kqPaXBviNRsyR5rEd+weVkk0JaPiEafyrvzgs6+jlUxvTit330QCHTLHgbjGb/H pY2bns4QXmico3CbbZXSiF4S6o0EG+3Y87KzrWsCJS0X9faOLh2wCKdBnYz83N0bv7UJ 5OPm2aGSLR7FavtXinBOmawN43IxZScIwUhG6GRo2bh7K5LSOJaqwXxdm6JeLyhgyl1e hsvkY5Y3AB26X11YAc21umRBWkLRx4477PRAwNYPnmQQdmRqCmcM9KjWN1K6HJkpCPyZ fBjRyOAnyDRFRK5FcS34PVbtEPQMjDIMYb+aOUOSgZWldwQ471euYDK99U7FKPtk2q/r iaWg== X-Gm-Message-State: AOAM533n0pZKqKwu9rDTsY8uD4G6BRVDFPXIunZm10yr5jv8WK1VONkR 3biNP2YN4JsrN2APHTDYbQeBPBmx5Sw= X-Google-Smtp-Source: ABdhPJwtsIOGiLXpwqP3ijqs/U/dl4DD7TlcJnb4e4uNskZ6i/ZOKxbte4VHB6xyXBa/2PsQKYLB6g== X-Received: by 2002:aed:3883:: with SMTP id k3mr86217320qte.365.1594633808991; Mon, 13 Jul 2020 02:50:08 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 02/25] libvirt-domain.c: modernize virDomainMigrateVersion1 Date: Mon, 13 Jul 2020 06:49:34 -0300 Message-Id: <20200713094957.1648405-3-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use g_autofree on strings and remove the 'done' label since it's now unneeded. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/libvirt-domain.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 0941caa67f..6adb58a9ef 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -2726,9 +2726,8 @@ virDomainMigrateVersion1(virDomainPtr domain, const char *uri, unsigned long bandwidth) { - virDomainPtr ddomain =3D NULL; - char *uri_out =3D NULL; - char *cookie =3D NULL; + g_autofree char *uri_out =3D NULL; + g_autofree char *cookie =3D NULL; int cookielen =3D 0, ret; virDomainInfo info; unsigned int destflags; @@ -2758,12 +2757,12 @@ virDomainMigrateVersion1(virDomainPtr domain, if (dconn->driver->domainMigratePrepare (dconn, &cookie, &cookielen, uri, &uri_out, destflags, dname, bandwidth) =3D=3D -1) - goto done; + return NULL; =20 if (uri =3D=3D NULL && uri_out =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("domainMigratePrepare did not set uri")); - goto done; + return NULL; } if (uri_out) uri =3D uri_out; /* Did domainMigratePrepare change URI? */ @@ -2773,7 +2772,7 @@ virDomainMigrateVersion1(virDomainPtr domain, */ if (domain->conn->driver->domainMigratePerform (domain, cookie, cookielen, uri, flags, dname, bandwidth) =3D=3D -= 1) - goto done; + return NULL; =20 /* Get the destination domain and return it or error. * 'domain' no longer actually exists at this point @@ -2782,15 +2781,10 @@ virDomainMigrateVersion1(virDomainPtr domain, */ dname =3D dname ? dname : domain->name; if (dconn->driver->domainMigrateFinish) - ddomain =3D dconn->driver->domainMigrateFinish + return dconn->driver->domainMigrateFinish (dconn, dname, cookie, cookielen, uri, destflags); else - ddomain =3D virDomainLookupByName(dconn, dname); - - done: - VIR_FREE(uri_out); - VIR_FREE(cookie); - return ddomain; + return virDomainLookupByName(dconn, dname); } =20 =20 --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633832; cv=none; d=zohomail.com; s=zohoarc; b=g0+GiPqWvI6Zki3WQQYcUebuiu3DJYHzoJV/In4EE4B5bVSxbMy4poQPxkUWdSFtaqxw/W/m/SMpsrYzOv89JRrF07OKCUnNQjwDBUWJIEnylokL4Z9XN8pzdxny89pK17qR2i8yHyjfrFFrHvuJdy10bujYz3XEJu/tSoMziQA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633832; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=te+r/29lDJeDYL55G1FzJn3W59GZss5QOSXu4AboRcc=; b=E2rRywdoLBD4V9XKyjFJKoWgxOs14+ZsqcgvQxKmS3cYd/7ELIW2m791UqF5e63VxH02HQlhzdoXnxIfFcncAI72H2GPH6f/B+DTp3mq1HSDOJtsxjigtN0GCgbBrCvITOo9cHa4SPLuGUjXlHCB7Hv4wMlo3qYv4asuzfdUf84= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1594633832645883.0953963944471; Mon, 13 Jul 2020 02:50:32 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-148-FaBPyipkOjSyxrXOLg3ZtA-1; Mon, 13 Jul 2020 05:50:27 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 800408014D4; Mon, 13 Jul 2020 09:50:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5E8F276219; Mon, 13 Jul 2020 09:50:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2B8DA94EF4; Mon, 13 Jul 2020 09:50:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oEia005636 for ; Mon, 13 Jul 2020 05:50:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id AFA35E2A76; Mon, 13 Jul 2020 09:50:14 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AB379E2A92 for ; Mon, 13 Jul 2020 09:50:14 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 91E26924902 for ; Mon, 13 Jul 2020 09:50:14 +0000 (UTC) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-379-bbV2pjX9PXe-sSQ9SUlnyg-1; Mon, 13 Jul 2020 05:50:11 -0400 Received: by mail-qt1-f195.google.com with SMTP id g13so9420824qtv.8 for ; Mon, 13 Jul 2020 02:50:11 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:10 -0700 (PDT) X-MC-Unique: FaBPyipkOjSyxrXOLg3ZtA-1 X-MC-Unique: bbV2pjX9PXe-sSQ9SUlnyg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=te+r/29lDJeDYL55G1FzJn3W59GZss5QOSXu4AboRcc=; b=kzUIaaUXjWmlzV3kXXfyN/abEOWMvKsetPuptoFYKrNuZVGLvbrJ492YI79rcfsKy7 WNqDIxZKeelw7Jahllm+Seb+CjFZDmaLe+j/sA0iyNB6OFJenqpfllEZPtS7vKeiSFHV 3Mtmi8OIkdPtu22K1NutVJzhZHAGi7WIG3+bIhErJluo8Y+OLFpnZQiEHtR+RJF6O4uM 0y9wp5RLVv3/6OZtwnSbbqluHYsno5ECwdud5AT/I98pRGt40LJBZyrgLTeOTYJyhaZ7 fY1xepteBG6oahcHjx993zhljZvGV9itKvrr4pHAlj55iu+ldKSXsWT0Pd0aQ7/JSydS QQMw== X-Gm-Message-State: AOAM530KrAPMPkHVNro0vKIEDobsJfHg7NsE/M2BdJ0FzV0QJwV3UFLF y4YIN3Ne1IbZDjE3FuIeN7UGkKn4C7g= X-Google-Smtp-Source: ABdhPJzbADEETaNJriVkqanM+muFlpHucqgZeCUJfm3ijOgiCW7jqD6IACGDcPBxmE4UFAVqEZbhQQ== X-Received: by 2002:ac8:2fcd:: with SMTP id m13mr54474953qta.237.1594633810551; Mon, 13 Jul 2020 02:50:10 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 03/25] libvirt-domain.c: use g_autofree in virDomainMigrateVersion* functions Date: Mon, 13 Jul 2020 06:49:35 -0300 Message-Id: <20200713094957.1648405-4-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/libvirt-domain.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 6adb58a9ef..e379623ce4 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -2816,9 +2816,9 @@ virDomainMigrateVersion2(virDomainPtr domain, unsigned long bandwidth) { virDomainPtr ddomain =3D NULL; - char *uri_out =3D NULL; - char *cookie =3D NULL; - char *dom_xml =3D NULL; + g_autofree char *uri_out =3D NULL; + g_autofree char *cookie =3D NULL; + g_autofree char *dom_xml =3D NULL; int cookielen =3D 0, ret; virDomainInfo info; virErrorPtr orig_err =3D NULL; @@ -2873,7 +2873,6 @@ virDomainMigrateVersion2(virDomainPtr domain, ret =3D dconn->driver->domainMigratePrepare2 (dconn, &cookie, &cookielen, uri, &uri_out, destflags, dname, bandwidth, dom_xml); - VIR_FREE(dom_xml); if (ret =3D=3D -1) goto done; =20 @@ -2918,8 +2917,6 @@ virDomainMigrateVersion2(virDomainPtr domain, =20 done: virErrorRestore(&orig_err); - VIR_FREE(uri_out); - VIR_FREE(cookie); return ddomain; } =20 @@ -2965,10 +2962,10 @@ virDomainMigrateVersion3Full(virDomainPtr domain, unsigned int flags) { virDomainPtr ddomain =3D NULL; - char *uri_out =3D NULL; - char *cookiein =3D NULL; - char *cookieout =3D NULL; - char *dom_xml =3D NULL; + g_autofree char *uri_out =3D NULL; + g_autofree char *cookiein =3D NULL; + g_autofree char *cookieout =3D NULL; + g_autofree char *dom_xml =3D NULL; int cookieinlen =3D 0; int cookieoutlen =3D 0; int ret; @@ -3242,10 +3239,6 @@ virDomainMigrateVersion3Full(virDomainPtr domain, =20 done: virErrorRestore(&orig_err); - VIR_FREE(dom_xml); - VIR_FREE(uri_out); - VIR_FREE(cookiein); - VIR_FREE(cookieout); virTypedParamsFree(params, nparams); return ddomain; } --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633836; cv=none; d=zohomail.com; s=zohoarc; b=WQCTl4VrEGJn403qkEL8kBzsCLlRGhI1Iu0ZHC1pK7D+a3F/zqinCPbgkqlnxu8yi6Z+Br3/7oG29fQlujhit2l24VOXjQ4DtYArS+WkgNAaSuJLTA5fM6gxmf35z+RW9qDFRN/I2/9yFYJkwIGfg7o7hqGpz1Z3pGAJ5IGwyRM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633836; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=b+eFSZKu8caIxJCWvf1ieqsSyZQBfXaOSc4PcPkU5ig=; b=g4Zn2b9pW9C7n821O6VdcJ+dg5AEPc8eBV1jbZoH1nqJYbrfnAqljXudk60tiYsk0pz9+wMDzI1BSegwrnQwq44Z04sLZHV07Jjh8dMO4l6e6law1ebJQxb/Hfa+ObF4G0XR+T43VW6HTBxUiAreI3zveXJl66IYSDbhEwjCO8o= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1594633836202713.1056199450604; Mon, 13 Jul 2020 02:50:36 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-234-pBExjMwqPGy6gkUJr4CE0w-1; Mon, 13 Jul 2020 05:50:31 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D2A9C108E; Mon, 13 Jul 2020 09:50:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B32165C66E; Mon, 13 Jul 2020 09:50:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 80DB993F89; Mon, 13 Jul 2020 09:50:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oF7O005649 for ; Mon, 13 Jul 2020 05:50:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 226D5E2A79; Mon, 13 Jul 2020 09:50:15 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1E249DBF37 for ; Mon, 13 Jul 2020 09:50:15 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0570C8007C9 for ; Mon, 13 Jul 2020 09:50:15 +0000 (UTC) Received: from mail-qv1-f67.google.com (mail-qv1-f67.google.com [209.85.219.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-293-QFpWEfJOM2m6pOoTj1fkqA-1; Mon, 13 Jul 2020 05:50:12 -0400 Received: by mail-qv1-f67.google.com with SMTP id el4so5461581qvb.13 for ; Mon, 13 Jul 2020 02:50:12 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:11 -0700 (PDT) X-MC-Unique: pBExjMwqPGy6gkUJr4CE0w-1 X-MC-Unique: QFpWEfJOM2m6pOoTj1fkqA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=b+eFSZKu8caIxJCWvf1ieqsSyZQBfXaOSc4PcPkU5ig=; b=UA8QdtE62eB7EB+j87iY30dMyRcqqkzqBHMN3XN0a/AmKS6VrbVb9rNq62GkfdGBBC ym/YCmTUP0NgVb6ssA9k+zyLyYZ8vLGH1+7vvKGGna+H+0VekOP8+6WT8F99c48TKCQq wHzgtsUPyfd0V6HnUao6cWd8bYRvEkd2ocCwPXPvUpaJbbVaATRSslxMuXBB/sSYLzrW 7+h2PiCwuZnJnmZrvORA2H/f+6pd9NHzRe8AcNiwzq61pphNpxTJUrBN0FFAzrz98UzP j5h3SwIb6CHugBU9NaLPbiK/hyLCl8PGTi3dn66xjyaDs9yRRUjRIS4vYBIc/skGqv9A 7Dmg== X-Gm-Message-State: AOAM533O14a4e4XYr9qqqacA6ZaHfu3ntn+KcdhlBQNNKOfZzq1VUsNz nsLe7s5lpi64eeR4hu9cOnrUtCZasKI= X-Google-Smtp-Source: ABdhPJxfo4shK0AxJeKtbMzVn7FZA/JX/9f6VUfJgkhM+nVqaMwmW4YPx+40ofsg1CXMGTaX3mvvyA== X-Received: by 2002:a0c:fcc9:: with SMTP id i9mr58237312qvq.152.1594633812021; Mon, 13 Jul 2020 02:50:12 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 04/25] qemu_driver.c: modernize qemuDomainMigrateBegin3Params() Date: Mon, 13 Jul 2020 06:49:36 -0300 Message-Id: <20200713094957.1648405-5-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use g_autofree and remove the unneeded 'cleanup' label. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 8ea4197d00..6b47e28e99 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12346,14 +12346,13 @@ qemuDomainMigrateBegin3Params(virDomainPtr domain, { const char *xmlin =3D NULL; const char *dname =3D NULL; - const char **migrate_disks =3D NULL; + g_autofree const char **migrate_disks =3D NULL; int nmigrate_disks; - char *ret =3D NULL; virDomainObjPtr vm; =20 virCheckFlags(QEMU_MIGRATION_FLAGS, NULL); if (virTypedParamsValidate(params, nparams, QEMU_MIGRATION_PARAMETERS)= < 0) - goto cleanup; + return NULL; =20 if (virTypedParamsGetString(params, nparams, VIR_MIGRATE_PARAM_DEST_XML, @@ -12361,30 +12360,26 @@ qemuDomainMigrateBegin3Params(virDomainPtr domain, virTypedParamsGetString(params, nparams, VIR_MIGRATE_PARAM_DEST_NAME, &dname) < 0) - goto cleanup; + return NULL; =20 nmigrate_disks =3D virTypedParamsGetStringList(params, nparams, VIR_MIGRATE_PARAM_MIGRATE= _DISKS, &migrate_disks); =20 if (nmigrate_disks < 0) - goto cleanup; + return NULL; =20 if (!(vm =3D qemuDomainObjFromDomain(domain))) - goto cleanup; + return NULL; =20 if (virDomainMigrateBegin3ParamsEnsureACL(domain->conn, vm->def) < 0) { virDomainObjEndAPI(&vm); - goto cleanup; + return NULL; } =20 - ret =3D qemuMigrationSrcBegin(domain->conn, vm, xmlin, dname, - cookieout, cookieoutlen, - nmigrate_disks, migrate_disks, flags); - - cleanup: - VIR_FREE(migrate_disks); - return ret; + return qemuMigrationSrcBegin(domain->conn, vm, xmlin, dname, + cookieout, cookieoutlen, + nmigrate_disks, migrate_disks, flags); } =20 =20 --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633830; cv=none; d=zohomail.com; s=zohoarc; b=dkDxSOe9KTgO950s4jS1Isf9zGO97uKAZ9K/lMeZcksxEDqEIffofhkU4l5/UUvNLm/3FgMW6b9QXFt3y19W1na/TIOqm8/nx23Sknv+tLm3T8oV+cgcUhu6sRMVhRZ/7UptlSfnOk1uOjkxesAUNTrdiGyiH4fx6qjdno+aJ0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633830; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BmjXdBa553wBlTACxevXX9VIHco2o7/ebTayjJUFCPM=; b=TgEdVoAW0OQIeOWIyvrRubTLnLMJPaHOVMTHQMWDvOXtVmTjjExpU1skEr+DLJZOe6tLKKy117Ln7OQQJ8HlBrkdtCTD1+WMcnVSXtpJ6QI9AubLhmoXmIkSfT/tXbE2mKEppCR+nLXtWz+hPbrYnWEdXIHBK3RyMQ0mWm2sfrc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1594633830395359.9468169261721; Mon, 13 Jul 2020 02:50:30 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-470-BAyc69XYOoGF8c_Cljr6ow-1; Mon, 13 Jul 2020 05:50:26 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F302A106B242; Mon, 13 Jul 2020 09:50:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D53BC78A45; Mon, 13 Jul 2020 09:50:20 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9773F1809563; Mon, 13 Jul 2020 09:50:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oH1k005667 for ; Mon, 13 Jul 2020 05:50:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 651922026D67; Mon, 13 Jul 2020 09:50:17 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 60A832026D5D for ; Mon, 13 Jul 2020 09:50:17 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 47314100E7CE for ; Mon, 13 Jul 2020 09:50:17 +0000 (UTC) Received: from mail-qv1-f65.google.com (mail-qv1-f65.google.com [209.85.219.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-281-FGJ2Eor6OSWw-7f9TvLvew-1; Mon, 13 Jul 2020 05:50:14 -0400 Received: by mail-qv1-f65.google.com with SMTP id dm12so5483121qvb.9 for ; Mon, 13 Jul 2020 02:50:14 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:13 -0700 (PDT) X-MC-Unique: BAyc69XYOoGF8c_Cljr6ow-1 X-MC-Unique: FGJ2Eor6OSWw-7f9TvLvew-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BmjXdBa553wBlTACxevXX9VIHco2o7/ebTayjJUFCPM=; b=L0dsgtNtAWJxIRkflHrsgke78FU6BiVUYYTA9FQ7HaL+oooToyc8yoa2JSwmh/QR/Y MvIP0pfEHH6XFQToFXvU54Z20Az9QSEQ+HzxYli9Fdlpsoq0rrJo9Hs4s6f2N1mAj/FO 92MEbKcbEmye8Z3GDSHnhLDW5nyiwhqmJ5cWfyNuq6T/2YhOFCvxY8WXl9COQbqM6a66 gAViHHA+ui7hzSAn6cDXvvZslF+iEkiXdAH96gA45f4P/LsxCakVIvzr+V5aFcWlNi1Y bGyZz1wVcKp6SyPbNtH7sl4gdh/9ScBMcEzhGDGnQlJsXCwvjO6k9/2/d5DmPpYQjJvm 7dmA== X-Gm-Message-State: AOAM530oU6+ilqj+GrBqN/GWWSVjjfqvN73kKdrQ4f8xmE6g0EtEffYp SyTi5NXh8o/sJ3pA9BYvECgadtXGMUc= X-Google-Smtp-Source: ABdhPJz16QSX/C1njPNWtuafzVEClkuHFItRhWOrlLUT7oQjR16VN/uuw7GFXxWjgGCY3PyOdZ3wGA== X-Received: by 2002:ad4:476a:: with SMTP id d10mr79862007qvx.13.1594633813650; Mon, 13 Jul 2020 02:50:13 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 05/25] qemu_driver.c: modernize qemuDomainMigratePrepare3() Date: Mon, 13 Jul 2020 06:49:37 -0300 Message-Id: <20200713094957.1648405-6-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use g_autoptr() on pointers and remove the unneeded 'cleanup' label. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 6b47e28e99..4fe122f8ae 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12397,10 +12397,9 @@ qemuDomainMigratePrepare3(virConnectPtr dconn, const char *dom_xml) { virQEMUDriverPtr driver =3D dconn->privateData; - virDomainDefPtr def =3D NULL; + g_autoptr(virDomainDef) def =3D NULL; g_autofree char *origname =3D NULL; - qemuMigrationParamsPtr migParams =3D NULL; - int ret =3D -1; + g_autoptr(qemuMigrationParams) migParams =3D NULL; =20 virCheckFlags(QEMU_MIGRATION_FLAGS, -1); =20 @@ -12411,30 +12410,25 @@ qemuDomainMigratePrepare3(virConnectPtr dconn, virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Tunnelled migration requested but invalid " "RPC method called")); - goto cleanup; + return -1; } =20 if (!(migParams =3D qemuMigrationParamsFromFlags(NULL, 0, flags, QEMU_MIGRATION_DESTINAT= ION))) - goto cleanup; + return -1; =20 if (!(def =3D qemuMigrationAnyPrepareDef(driver, NULL, dom_xml, dname,= &origname))) - goto cleanup; + return -1; =20 if (virDomainMigratePrepare3EnsureACL(dconn, def) < 0) - goto cleanup; - - ret =3D qemuMigrationDstPrepareDirect(driver, dconn, - cookiein, cookieinlen, - cookieout, cookieoutlen, - uri_in, uri_out, - &def, origname, NULL, 0, NULL, 0, - migParams, flags); + return -1; =20 - cleanup: - qemuMigrationParamsFree(migParams); - virDomainDefFree(def); - return ret; + return qemuMigrationDstPrepareDirect(driver, dconn, + cookiein, cookieinlen, + cookieout, cookieoutlen, + uri_in, uri_out, + &def, origname, NULL, 0, NULL, 0, + migParams, flags); } =20 static int --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633836; cv=none; d=zohomail.com; s=zohoarc; b=SSDOXygo9QVlpfVrkIbqZF8smJzpyv3Zb+dunWc1upzz/fIAQbY9ouT/NSq5gRGVComIyq1X20Hx3xfBgyGohRH14F8u4d5VP1a+C0qdO2WriIxhCJOOmM/SzZDhCD5WAW9WwsusQlDplRW4Wt14lgIFbLWDkQNSh3upfFSJ+Gs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633836; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yiPFrWAmXsYHYl5AquiiCJAmqW65fGzF5tRp5nMtViU=; b=X2d/Jtn5NirRM8LqJTmVYHgLpSbdiPnkXFp3qYbrgRAIZiw02fvadYL791t4ejZS0kkc9u7FabyNR19Q5MqViQz1tRZ1IHape4ckwoN8uQSQi95Qghh8u9kuPLQwPLw4EHdSjhO+azZG82NSfU57uEP+rMG1/WyGTLewU5SIMzM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 159463383698952.042549706157956; Mon, 13 Jul 2020 02:50:36 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-30-VImAQKirP3ySrU92QSi8bQ-1; Mon, 13 Jul 2020 05:50:32 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 841FE8027E4; Mon, 13 Jul 2020 09:50:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 602C92DE6B; Mon, 13 Jul 2020 09:50:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2AE09180BACF; Mon, 13 Jul 2020 09:50:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oKgS005698 for ; Mon, 13 Jul 2020 05:50:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5521F2157F23; Mon, 13 Jul 2020 09:50:20 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4F9692157F24 for ; Mon, 13 Jul 2020 09:50:18 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5404418056A1 for ; Mon, 13 Jul 2020 09:50:18 +0000 (UTC) Received: from mail-qv1-f68.google.com (mail-qv1-f68.google.com [209.85.219.68]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-414-4u0BBroVNEy__3YBG_JVdw-1; Mon, 13 Jul 2020 05:50:16 -0400 Received: by mail-qv1-f68.google.com with SMTP id a14so5487537qvq.6 for ; Mon, 13 Jul 2020 02:50:15 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:14 -0700 (PDT) X-MC-Unique: VImAQKirP3ySrU92QSi8bQ-1 X-MC-Unique: 4u0BBroVNEy__3YBG_JVdw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yiPFrWAmXsYHYl5AquiiCJAmqW65fGzF5tRp5nMtViU=; b=E9RYYChp8Qf9cnxnotVRMI+KA48ap0RQpya8ohulE9kS6eD4YS9NrLpc8X7tt+cXLv 1lf6hasMbCeSyXWT43v+1lQw6JNyfCSSIuUDGZr0ky1+edB8moCncKYp9CiNWgjnOWA/ g9plVjSU41u0vR0vJujrI11v8RXrNUDvmA0aeAvOvIhnoJEJh/OfP9AUMszQYDom1OJ2 CBjKOyOma/Sm3dwC+VbL5q7ok79ZEiTBfQ8Q/5F9tBhKHkO3rHFNXtZAZyH57MhljoYz mRNjJc0GXM0n5bFZYI+KnE3EChXASjcQjr9Piw4BwcKb6LN89L9Me1noGfGVLYFuiDxB Nr/Q== X-Gm-Message-State: AOAM5326thuqse3Jk16GddJX/vRX8cOP43RF2boTYik86wH5WTC+/b/C IDs8CMcol2QJWSijfP47lC7EItAUWkQ= X-Google-Smtp-Source: ABdhPJx7FhWNIMyRJr99FuWmuSckcL2krmw258KJt0vy0PJMmhdVl5Gh1FRa6rEMsp7JpGw18ACKbw== X-Received: by 2002:a05:6214:18f2:: with SMTP id ep18mr65867995qvb.96.1594633815292; Mon, 13 Jul 2020 02:50:15 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 06/25] qemu_driver.c: modernize qemuDomainMigratePrepare3Params() Date: Mon, 13 Jul 2020 06:49:38 -0300 Message-Id: <20200713094957.1648405-7-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use variable autocleanup and remove the now obsolete 'cleanup' label. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 43 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4fe122f8ae..d133793ee1 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12444,21 +12444,20 @@ qemuDomainMigratePrepare3Params(virConnectPtr dco= nn, { virQEMUDriverPtr driver =3D dconn->privateData; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); - virDomainDefPtr def =3D NULL; + g_autoptr(virDomainDef) def =3D NULL; const char *dom_xml =3D NULL; const char *dname =3D NULL; const char *uri_in =3D NULL; const char *listenAddress =3D cfg->migrationAddress; int nbdPort =3D 0; int nmigrate_disks; - const char **migrate_disks =3D NULL; + g_autofree const char **migrate_disks =3D NULL; g_autofree char *origname =3D NULL; - qemuMigrationParamsPtr migParams =3D NULL; - int ret =3D -1; + g_autoptr(qemuMigrationParams) migParams =3D NULL; =20 - virCheckFlagsGoto(QEMU_MIGRATION_FLAGS, cleanup); + virCheckFlags(QEMU_MIGRATION_FLAGS, -1); if (virTypedParamsValidate(params, nparams, QEMU_MIGRATION_PARAMETERS)= < 0) - goto cleanup; + return -1; =20 if (virTypedParamsGetString(params, nparams, VIR_MIGRATE_PARAM_DEST_XML, @@ -12475,18 +12474,18 @@ qemuDomainMigratePrepare3Params(virConnectPtr dco= nn, virTypedParamsGetInt(params, nparams, VIR_MIGRATE_PARAM_DISKS_PORT, &nbdPort) < 0) - goto cleanup; + return -1; =20 nmigrate_disks =3D virTypedParamsGetStringList(params, nparams, VIR_MIGRATE_PARAM_MIGRATE= _DISKS, &migrate_disks); =20 if (nmigrate_disks < 0) - goto cleanup; + return -1; =20 if (!(migParams =3D qemuMigrationParamsFromFlags(params, nparams, flag= s, QEMU_MIGRATION_DESTINAT= ION))) - goto cleanup; + return -1; =20 if (flags & VIR_MIGRATE_TUNNELLED) { /* this is a logical error; we never should have gotten here with @@ -12495,28 +12494,22 @@ qemuDomainMigratePrepare3Params(virConnectPtr dco= nn, virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Tunnelled migration requested but invalid " "RPC method called")); - goto cleanup; + return -1; } =20 if (!(def =3D qemuMigrationAnyPrepareDef(driver, NULL, dom_xml, dname,= &origname))) - goto cleanup; + return -1; =20 if (virDomainMigratePrepare3ParamsEnsureACL(dconn, def) < 0) - goto cleanup; - - ret =3D qemuMigrationDstPrepareDirect(driver, dconn, - cookiein, cookieinlen, - cookieout, cookieoutlen, - uri_in, uri_out, - &def, origname, listenAddress, - nmigrate_disks, migrate_disks, nbd= Port, - migParams, flags); + return -1; =20 - cleanup: - qemuMigrationParamsFree(migParams); - VIR_FREE(migrate_disks); - virDomainDefFree(def); - return ret; + return qemuMigrationDstPrepareDirect(driver, dconn, + cookiein, cookieinlen, + cookieout, cookieoutlen, + uri_in, uri_out, + &def, origname, listenAddress, + nmigrate_disks, migrate_disks, nb= dPort, + migParams, flags); } =20 =20 --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633853; cv=none; d=zohomail.com; s=zohoarc; b=QmO+peQ3EwvVg7tbCPbHJM57ALr9gvfRBl0tGJ1Ste0ZcHiasgwhFZC/RTIDeNys3OCzKZyNR1ZjO9A2FKI8mR0ZRG2KQQ6jHXNnHAhNrnEKrNqOTTMCgk3YSt+EnlYtGOvvYYpUuKx8zfd+uqFyWnNfEZ8MsQ14Fr6kk/G8gIs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633853; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qBq7A4oLyV2El+M1V5B2FOvqD2jRuijsRnqnNu55M2U=; b=A1+N/b4BlhMLkXNiHTYu9kJDFglWfYaeXb/4RFj3Lq1KKX7NEyvpdPZlmxPjeWyfxtxXYKfyqOH8u41ZPapdmNhEcizb4Mu2cF071+mYKL89plA67eUhUuMZIPoEWZVIZkwHtnxDIW4CHTksLcIxAe6Bmcm25jHBoaZ7ZiXXf+o= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1594633853076375.88443941934725; Mon, 13 Jul 2020 02:50:53 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-366-QuagsucXPQ-uMBH5wAQySQ-1; Mon, 13 Jul 2020 05:50:49 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E893C8015F4; Mon, 13 Jul 2020 09:50:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CA14C5FC36; Mon, 13 Jul 2020 09:50:42 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9563E94F01; Mon, 13 Jul 2020 09:50:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oMcX005712 for ; Mon, 13 Jul 2020 05:50:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3F72510CD83D; Mon, 13 Jul 2020 09:50:22 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3A56A10CD859 for ; Mon, 13 Jul 2020 09:50:19 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 500B480CC35 for ; Mon, 13 Jul 2020 09:50:19 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-78-eGJn_H__PE-Yafgm2WCEFw-1; Mon, 13 Jul 2020 05:50:17 -0400 Received: by mail-qt1-f194.google.com with SMTP id u12so9398937qth.12 for ; Mon, 13 Jul 2020 02:50:17 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:16 -0700 (PDT) X-MC-Unique: QuagsucXPQ-uMBH5wAQySQ-1 X-MC-Unique: eGJn_H__PE-Yafgm2WCEFw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qBq7A4oLyV2El+M1V5B2FOvqD2jRuijsRnqnNu55M2U=; b=lIdOreYxxcJ217wJSYAHRQPhsc5G8f2QgzqEkJufANWZ0KxAs8qOtiXptAf1E/l9XD PYbU8rgJ+0cGYHWWiLf32UyPLw9Z4bMtIwsWw+pZTH4A6UdoFKWm14CHHPmdxY1S9Tx7 Uhn0zHJXkuJaF4KWcytJG14DhCB5VfTs50OVzEsXOidxAXyDxMpbYqO/dsY7NJqSjIg3 IB/Ix5m8EFgeVSm5e5a0hOYW9apezCiezMT+18MnwcXbGmyJpCp1BBQKnGM0FIXd4Hrh rj2p95+scdrPDuBOAEeX6ZsQbGQ5uUkdl5fcrcz3VhtuHEVCb1zVb8XBeRD39z6bY/Oi fjvg== X-Gm-Message-State: AOAM530nTy4k/HhqyVqdKNV6LxwutQr8GT0lFih3oJxeRo89QGC/N7k6 nyKm3K5gCM5vlk1WpGBwddFVIz0/5Ho= X-Google-Smtp-Source: ABdhPJzJ6I0W5NbfIeiynRYoXuwpSSkYN5rIbd+s0Jsc11ClAmvDy1u3XKBnL8pO6XQ6BN3eD2yHXg== X-Received: by 2002:ac8:1a07:: with SMTP id v7mr81739408qtj.329.1594633816717; Mon, 13 Jul 2020 02:50:16 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 07/25] qemu_migration.c: modernize qemuMigrationDstPrepare() Date: Mon, 13 Jul 2020 06:49:39 -0300 Message-Id: <20200713094957.1648405-8-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use g_autofree and remove the 'cleanup' label. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 4ef3245c75..e0077d731b 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2306,8 +2306,7 @@ qemuMigrationDstPrepare(virDomainObjPtr vm, int fd) { qemuDomainObjPrivatePtr priv =3D vm->privateData; - qemuProcessIncomingDefPtr inc =3D NULL; - char *migrateFrom =3D NULL; + g_autofree char *migrateFrom =3D NULL; =20 if (tunnel) { migrateFrom =3D g_strdup("stdio"); @@ -2329,7 +2328,7 @@ qemuMigrationDstPrepare(virDomainObjPtr vm, if (!hostIPv6Capable) { virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", _("host isn't capable of IPv6")); - goto cleanup; + return NULL; } /* IPv6 address must be escaped in brackets on the cmd lin= e */ encloseAddress =3D true; @@ -2358,12 +2357,8 @@ qemuMigrationDstPrepare(virDomainObjPtr vm, migrateFrom =3D g_strdup_printf(incFormat, protocol, listenAddress= , port); } =20 - inc =3D qemuProcessIncomingDefNew(priv->qemuCaps, listenAddress, - migrateFrom, fd, NULL); - - cleanup: - VIR_FREE(migrateFrom); - return inc; + return qemuProcessIncomingDefNew(priv->qemuCaps, listenAddress, + migrateFrom, fd, NULL); } =20 static int --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633849; cv=none; d=zohomail.com; s=zohoarc; b=a1czliYAN47Oe1GukEI0AGjntQ8qof/hc5M97BqRIWWO0HAMn0OkiJ9fiSqaijM3+RfiST2lroe2EcFcwF19izlaZIALPwt9JQNW7tb/6IZQeRejxCZmDlKun7JqbIGNqtO3zfr1B3LebkviGCzOmJWXuwgB19iJvFK6nvlU6hY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633849; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4UcCPZhBjyZyyiPsnpnRkC5YC7BSOCtZyrKp3KVYv2Y=; b=YeXm+N8u1CIxXMbxtciC2J+cR1OSB21phCYjpkfly5uCPj4+b1zxpAyDt3IQ3mOY+Ou+h1JF/LBBqwY1sbgYD+Ti906V0dsCRyKjbYU/m5JxmsSZc1me1Ee/LcgGT4xMwW530G1v2NTp0uRo3cw8uhvWfX1ZQhsWGwuKPhm2O1Y= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1594633849839220.84416323924358; Mon, 13 Jul 2020 02:50:49 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-334-HolxcR6hPhG_GsKYUgqtaw-1; Mon, 13 Jul 2020 05:50:46 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D625107BEF5; Mon, 13 Jul 2020 09:50:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5E58927DE90; Mon, 13 Jul 2020 09:50:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2FE0D94EFA; Mon, 13 Jul 2020 09:50:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oLSA005704 for ; Mon, 13 Jul 2020 05:50:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6C137E2A76; Mon, 13 Jul 2020 09:50:21 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 67B70E2A79 for ; Mon, 13 Jul 2020 09:50:21 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4FEB018056A6 for ; Mon, 13 Jul 2020 09:50:21 +0000 (UTC) Received: from mail-qv1-f65.google.com (mail-qv1-f65.google.com [209.85.219.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-498-hw64iCZkPiaJ7OsX8twFzw-1; Mon, 13 Jul 2020 05:50:19 -0400 Received: by mail-qv1-f65.google.com with SMTP id e3so5470649qvo.10 for ; Mon, 13 Jul 2020 02:50:18 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:17 -0700 (PDT) X-MC-Unique: HolxcR6hPhG_GsKYUgqtaw-1 X-MC-Unique: hw64iCZkPiaJ7OsX8twFzw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4UcCPZhBjyZyyiPsnpnRkC5YC7BSOCtZyrKp3KVYv2Y=; b=a2cV2Zm0qODY0xITW3iOtS33EJbK7V87Z/Btv8cwq+otJU2mZA1o2KFMYkZ2O3wY9H L9EV4qAENY80F3f6KPYwkxUMAQ/eCJhvsWy65IPmd8TBoTQk7uLP+eq3dDG98SpJqp/B apXUtPDG+v+4L/HszuZP6qoF5JNOO2UnTUw+MnsQ9XL9TZe+HvlFSYaDCHupMb+vTHoY pTGZcHHdrRSlGIzceEA7FNCQ2wvAdgXdYWGRheTnfIzrcDbt+PVZHPI8r73PeJwHWuwv ABvZCYcwJRuQZWEYmR68bYVAfbUAV0ZcXtyllbvYxvoEL+Qojx7mcm1CYlyi1Iw5qqtC +WMg== X-Gm-Message-State: AOAM533SItA0ATM+yoeTXltwfjKx1VC5QIR64iJwjB3+nY2Ff+pJPHQY 93s4bTCcs+xQBRFfbL3gO2BtpRaLTlA= X-Google-Smtp-Source: ABdhPJzzrR50tvHo2hbj3U/YL+Gh6nw8ukCxBEOorVLDQS0lCbGgPE5I4MtlebU3wNZvC6+lyVQJJQ== X-Received: by 2002:a0c:a992:: with SMTP id a18mr66780457qvb.211.1594633818215; Mon, 13 Jul 2020 02:50:18 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 08/25] qemu_migration.c: use g_auto* in qemuMigrationDstPrepareAny() Date: Mon, 13 Jul 2020 06:49:40 -0300 Message-Id: <20200713094957.1648405-9-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index e0077d731b..83a25e7a8f 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2389,7 +2389,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, qemuDomainObjPrivatePtr priv =3D NULL; qemuMigrationCookiePtr mig =3D NULL; bool tunnel =3D !!st; - char *xmlout =3D NULL; + g_autofree char *xmlout =3D NULL; unsigned int cookieFlags; unsigned int startFlags; qemuProcessIncomingDefPtr incoming =3D NULL; @@ -2397,7 +2397,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, bool stopProcess =3D false; bool relabel =3D false; int rv; - char *tlsAlias =3D NULL; + g_autofree char *tlsAlias =3D NULL; =20 virNWFilterReadLockFilterUpdates(); =20 @@ -2447,7 +2447,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, =20 /* Let migration hook filter domain XML */ if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) { - char *xml; + g_autofree char *xml =3D NULL; int hookret; =20 if (!(xml =3D qemuDomainDefFormatXML(driver, NULL, *def, @@ -2458,7 +2458,6 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, hookret =3D virHookCall(VIR_HOOK_DRIVER_QEMU, (*def)->name, VIR_HOOK_QEMU_OP_MIGRATE, VIR_HOOK_SUBOP_BEG= IN, NULL, xml, &xmlout); - VIR_FREE(xml); =20 if (hookret < 0) { goto cleanup; @@ -2467,7 +2466,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, VIR_DEBUG("Migrate hook filter returned nothing; using the" " original XML"); } else { - virDomainDefPtr newdef; + g_autoptr(virDomainDef) newdef =3D NULL; =20 VIR_DEBUG("Using hook-filtered domain XML: %s", xmlout); newdef =3D virDomainDefParseString(xmlout, driver->xmlopt,= NULL, @@ -2476,13 +2475,11 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, if (!newdef) goto cleanup; =20 - if (!qemuDomainDefCheckABIStability(driver, NULL, *def, ne= wdef)) { - virDomainDefFree(newdef); + if (!qemuDomainDefCheckABIStability(driver, NULL, *def, ne= wdef)) goto cleanup; - } =20 virDomainDefFree(*def); - *def =3D newdef; + *def =3D g_steal_pointer(&newdef); /* We should taint the domain here. However, @vm and there= fore * privateData too are still NULL, so just notice the fact= and * taint it later. */ @@ -2694,9 +2691,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, =20 cleanup: virErrorPreserveLast(&origErr); - VIR_FREE(tlsAlias); qemuProcessIncomingDefFree(incoming); - VIR_FREE(xmlout); VIR_FORCE_CLOSE(dataFD[0]); VIR_FORCE_CLOSE(dataFD[1]); if (ret < 0 && priv) { --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633854; cv=none; d=zohomail.com; s=zohoarc; b=NmVPNfGIvdFGhdlU/MyWAfBdGC5sATRZ0NZcHivDVsCTn979TIMg4Rz72ENMt+3q5nDDpOWyXYv8lWFhDpjPEdaRnrmogv765QZ30Ho1rtZDyNhzHl4EqnEWKNRgH6SS/3QCI10TpNIsfiM7t//SUxP7VI44Vkn4wcuaX3oJi3M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633854; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HH3zvRnMwhhkrs2uSETe6x9NZ8AIpNg/iVupe0wmJcw=; b=nW1kS4v6ObX0TPP1z9xdcPzdet77Lh86sxpcK+qs98LakIIoT/yyQ+IE32kIY8QF+EbK2wUmMIVn/HCD471ji7Iae/BFxUe4KfCKW73Fvei86x1DwR7qsjacODAf4h+hbdFddTJ5fwIjgDK+vL1MxlkWXjBsndLpIDyYUSJ5YUE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1594633854026386.934591049406; Mon, 13 Jul 2020 02:50:54 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-489-XSwnX4uAOoSmodRR0ua6UA-1; Mon, 13 Jul 2020 05:50:50 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 51C508027EC; Mon, 13 Jul 2020 09:50:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3123A76203; Mon, 13 Jul 2020 09:50:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id F04441809554; Mon, 13 Jul 2020 09:50:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oNNt005722 for ; Mon, 13 Jul 2020 05:50:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id F16982157F23; Mon, 13 Jul 2020 09:50:22 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ED72B2166BA2 for ; Mon, 13 Jul 2020 09:50:22 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D4529924902 for ; Mon, 13 Jul 2020 09:50:22 +0000 (UTC) Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-471-CoFZHcM3MuaT0Buk6ZzeYQ-1; Mon, 13 Jul 2020 05:50:20 -0400 Received: by mail-qk1-f195.google.com with SMTP id r22so11518441qke.13 for ; Mon, 13 Jul 2020 02:50:20 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:19 -0700 (PDT) X-MC-Unique: XSwnX4uAOoSmodRR0ua6UA-1 X-MC-Unique: CoFZHcM3MuaT0Buk6ZzeYQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HH3zvRnMwhhkrs2uSETe6x9NZ8AIpNg/iVupe0wmJcw=; b=HkiOePvIlfaR+2kAsjOcnqmdGR/5scnyGC2g5nuP11uFhn5W8AhYUSgfHg4buHQ1zF j6fwTYC4xYerVvts9TxCXpfubd3F/LCg7DCt1DQslIQdz7N8YKgZry4YvhBMLoMHq7hc 5q5YXu3RBsXAHI0TZLRm6xg+OaM5aXtBvoGlF7Udr5LpIHp4VMcMe17CCTLNtA7kbLBM +4SRfczNfkL2hgkcJUvW5lMWqintzmiaOSK8ez39SNSMNj7JLwWcBd/0zaa8FmvIY7k1 ybXorIu9fdDdHomX802XimbN9KSiFCJjsoCeexwnrI4CyiV0sthVWJYTNnyecG7YZuJT RWTA== X-Gm-Message-State: AOAM533tjyHj/jUeKKI3Apjn8DfJcxUQiSaUdPunhvpvWejgexLtgt1O fjeH37l8A3uR16dAvzlYjRCv8aEvgKQ= X-Google-Smtp-Source: ABdhPJxotmHHxqjX6HCp71GC01mFnI9NlRy6cS+cGST89HTm4lu9FXUgx/KRoiohsG/bRSijdWxV1w== X-Received: by 2002:a37:9e11:: with SMTP id h17mr79803423qke.347.1594633819735; Mon, 13 Jul 2020 02:50:19 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 09/25] qemu_migration_params.c: modernize qemuMigrationParamsFetch() Date: Mon, 13 Jul 2020 06:49:41 -0300 Message-Id: <20200713094957.1648405-10-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use g_autoptr() and remove the 'cleanup' label. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration_params.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index 6953badcfe..6273acd65a 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -1092,28 +1092,23 @@ qemuMigrationParamsFetch(virQEMUDriverPtr driver, qemuMigrationParamsPtr *migParams) { qemuDomainObjPrivatePtr priv =3D vm->privateData; - virJSONValuePtr jsonParams =3D NULL; - int ret =3D -1; + g_autoptr(virJSONValue) jsonParams =3D NULL; int rc; =20 *migParams =3D NULL; =20 if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - goto cleanup; + return -1; =20 rc =3D qemuMonitorGetMigrationParams(priv->mon, &jsonParams); =20 if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) - goto cleanup; + return -1; =20 if (!(*migParams =3D qemuMigrationParamsFromJSON(jsonParams))) - goto cleanup; - - ret =3D 0; + return -1; =20 - cleanup: - virJSONValueFree(jsonParams); - return ret; + return 0; } =20 =20 --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633866; cv=none; d=zohomail.com; s=zohoarc; b=G6GrCmZmXP2iHwjSpzaVmBsBS3xZRq7cz2LvGzFx49RecxU6pGWEos3bHxUqFRiTCktyH//go5rvDkROWsly396xDCKuJDnB1nMKHUIOj7CUlTK/aHiiQMlWo4Yyzpt+92uk3sWIL5pQ4XfupIln7n9gR9/snpeWXiIDtRNuBlw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633866; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dgEDJEXAEwG+MLInF3gwQELmrunVe/hTv5r8Vih5Gqc=; b=LvIHxIEkDkn8Vbqx6dBDhgvvBNTuAl01s9zM+Cex0/JzHXim36ufrJgU/yGfn+2PbnDErUSYb2GZDag5RzkToNmB2hCBFNDqadxRsdjr15hwIBUry7dGMNoG5Q1DvLVJGPvWiDC8/Iuwo10J6j1tpiWiVqKIP3k4J/BMtxEPALA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1594633866837935.3401422145519; Mon, 13 Jul 2020 02:51:06 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-317-I2X6hb6sOvWtDEU5RckcIA-1; Mon, 13 Jul 2020 05:51:03 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB8298027F0; Mon, 13 Jul 2020 09:50:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C9824100EBA9; Mon, 13 Jul 2020 09:50:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 973341806B0C; Mon, 13 Jul 2020 09:50:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oZ7r005836 for ; Mon, 13 Jul 2020 05:50:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id B3374E2A89; Mon, 13 Jul 2020 09:50:29 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4F9FCE2A9A for ; Mon, 13 Jul 2020 09:50:24 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3797918056AF for ; Mon, 13 Jul 2020 09:50:24 +0000 (UTC) Received: from mail-qv1-f68.google.com (mail-qv1-f68.google.com [209.85.219.68]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-221-0HLGewa3OEOHvc1MOiLadQ-1; Mon, 13 Jul 2020 05:50:22 -0400 Received: by mail-qv1-f68.google.com with SMTP id dm12so5483220qvb.9 for ; Mon, 13 Jul 2020 02:50:22 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:20 -0700 (PDT) X-MC-Unique: I2X6hb6sOvWtDEU5RckcIA-1 X-MC-Unique: 0HLGewa3OEOHvc1MOiLadQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dgEDJEXAEwG+MLInF3gwQELmrunVe/hTv5r8Vih5Gqc=; b=T2JE6lrF/EayEDH51z7nM7GKCHiZUaXlm9zQHw0KxTWK7yx3alsxcQZFvx3QhP/tKI fay6TTh7R+DAx8GflIFrjn6uFuvbE0vIEQo4JOv16DIBOulAnE7IVG6li0HB7KybdxnR Z30i5/2gKxGimyaRECnbISrMCKLfpCaOdMx9IUOX3rP3U9E8h93Nu0fT5s/Q8+m5I6CA BtAXl+mh+6fCwcWq/Y0orXrTa5Mse+ghCcOzkHHWRUb2cytt9P9ImGTQnmqTyWjBaOLj UnRshjwkoAuO6lOBGN2qwl11OPrlFgLk6rwLnVdmA6x8Z2bwpSiXRr1+a0vpTCX3iS5f TXsg== X-Gm-Message-State: AOAM531r0XBB8PL2K5UvIcybfDjak1ynuynwJI/uQkEiYJgYJSpU/0Ip bwo4xm9M99eJ3jjEFSXW0eQ+XJNZqhs= X-Google-Smtp-Source: ABdhPJzSPBZjE4qUdugDOIv3+seo3gL5/DrXbXvYfi/FJ/niuKTIv5GIKwKO1y6/J+WAEzivXqmAbw== X-Received: by 2002:a05:6214:a6b:: with SMTP id ef11mr56917021qvb.2.1594633821280; Mon, 13 Jul 2020 02:50:21 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 10/25] qemu_migration_params.c: modernize qemuMigrationParamsEnableTLS() Date: Mon, 13 Jul 2020 06:49:42 -0300 Message-Id: <20200713094957.1648405-11-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use g_autoptr() and remove both 'cleanup' and 'error' labels. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration_params.c | 34 +++++++++++--------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index 6273acd65a..b1518f82c0 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -953,23 +953,22 @@ qemuMigrationParamsEnableTLS(virQEMUDriverPtr driver, qemuMigrationParamsPtr migParams) { qemuDomainObjPrivatePtr priv =3D vm->privateData; - virJSONValuePtr tlsProps =3D NULL; - virJSONValuePtr secProps =3D NULL; - virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); + g_autoptr(virJSONValue) tlsProps =3D NULL; + g_autoptr(virJSONValue) secProps =3D NULL; + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); const char *secAlias =3D NULL; - int ret =3D -1; =20 if (!cfg->migrateTLSx509certdir) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("host migration TLS directory not configured")); - goto error; + return -1; } =20 if (!priv->job.migParams->params[QEMU_MIGRATION_PARAM_TLS_CREDS].set) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("TLS migration is not supported with this " "QEMU binary")); - goto error; + return -1; } =20 /* If there's a secret, then grab/store it now using the connection */ @@ -977,18 +976,18 @@ qemuMigrationParamsEnableTLS(virQEMUDriverPtr driver, if (!(priv->migSecinfo =3D qemuDomainSecretInfoTLSNew(priv, QEMU_MIGRATION_TLS_ALIAS_BA= SE, cfg->migrateTLSx509secretUUID))) - goto error; + return -1; secAlias =3D priv->migSecinfo->s.aes.alias; } =20 if (!(*tlsAlias =3D qemuAliasTLSObjFromSrcAlias(QEMU_MIGRATION_TLS_ALI= AS_BASE))) - goto error; + return -1; =20 if (qemuDomainGetTLSObjects(priv->qemuCaps, priv->migSecinfo, cfg->migrateTLSx509certdir, tlsListen, cfg->migrateTLSx509verify, *tlsAlias, &tlsProps, &secProps) < 0) - goto error; + return -1; =20 /* Ensure the domain doesn't already have the TLS objects defined... * This should prevent any issues just in case some cleanup wasn't @@ -997,29 +996,20 @@ qemuMigrationParamsEnableTLS(virQEMUDriverPtr driver, qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, *tlsAlias); =20 if (qemuDomainAddTLSObjects(driver, vm, asyncJob, &secProps, &tlsProps= ) < 0) - goto error; + return -1; =20 if (qemuMigrationParamsSetString(migParams, QEMU_MIGRATION_PARAM_TLS_CREDS, *tlsAlias) < 0) - goto error; + return -1; =20 if (!migParams->params[QEMU_MIGRATION_PARAM_TLS_HOSTNAME].set && qemuMigrationParamsSetString(migParams, QEMU_MIGRATION_PARAM_TLS_HOSTNAME, NULLSTR_EMPTY(hostname)) < 0) - goto error; - - ret =3D 0; - - cleanup: - virObjectUnref(cfg); - return ret; + return -1; =20 - error: - virJSONValueFree(tlsProps); - virJSONValueFree(secProps); - goto cleanup; + return 0; } =20 =20 --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633862; cv=none; d=zohomail.com; s=zohoarc; b=ZQjv47jt35ep2F+qFNkAtJiydoNIYOg5seAoMDn/a7Ftpo9ZmWP6SfXrZGuHjkQ3QglcYd+1Td6AWB924AIhodwS/vVmNq5otJvK7T86AGpCdNmie82Som+/AQENkcyBF7iBXu7TG+qas1vY1UQGz68u0/ZElBLxiA3dA2euZGI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633862; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=z2kpPrFb+P+I3LpJvTUNrFtHtIP0hj4atkZ9OjshUvM=; b=AZBbosIAuUk1Pt0e0K7geKYltEL0vH2v5XirpVj4OrTP8AFrfA146Xs+meiscBdW0+GUJsmS1nv8cmu0dQlqwA08syZLS1anHmxmNUOFXQHyWLTnZncY7M2EIN06lX222GgV5Z7SS9eABCppPdEqeMQTUt11TiVHIEmwzZSYFqM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1594633862404141.0333402273351; Mon, 13 Jul 2020 02:51:02 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-224-D464Hor9PKqtEVNZvtATww-1; Mon, 13 Jul 2020 05:50:59 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8DCD319200CC; Mon, 13 Jul 2020 09:50:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6B83D19D61; Mon, 13 Jul 2020 09:50:53 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 33F361806B0C; Mon, 13 Jul 2020 09:50:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oXV3005775 for ; Mon, 13 Jul 2020 05:50:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6A05B20A0535; Mon, 13 Jul 2020 09:50:33 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 454A52097D6C for ; Mon, 13 Jul 2020 09:50:27 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AB85C81B4CF for ; Mon, 13 Jul 2020 09:50:26 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-118-ZdXfvlJKNV2CoVlBpUczng-1; Mon, 13 Jul 2020 05:50:23 -0400 Received: by mail-qt1-f194.google.com with SMTP id j10so9406831qtq.11 for ; Mon, 13 Jul 2020 02:50:23 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:22 -0700 (PDT) X-MC-Unique: D464Hor9PKqtEVNZvtATww-1 X-MC-Unique: ZdXfvlJKNV2CoVlBpUczng-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z2kpPrFb+P+I3LpJvTUNrFtHtIP0hj4atkZ9OjshUvM=; b=W3iHxKMz186ToQpaqLaOPtIebJcbe+HpSWMDnr5D7Ln/2zpLTlBBw5PBM8i2hkiBVO /vulW27nMVYKw3lfnRewj1GcXoyZPvJcDNwsBMlJxBHZHXEa3EWkQleqlz8RyLdPfush kjoeVU0swG9MiHrhzi/S/14/luuCMm/R+MdpmYMxXtZTPIsIdU/c9o95keyCOAaV3ajC du7YGBIWfXYMgdwL1biW8i4yT8YOW8t2mKSk+egAM04nVFeJgEwMKdgs0Q2SfY9znQM6 PrjNaM8h3kD7XglF3CDW3gYGrqaNf4bgpeTTbn9xmxGJkcVWYmhxk0oEwNTx4MBpa1rz sopQ== X-Gm-Message-State: AOAM530/l3kCGjph9FpXYuG5/nf5P/g9qN2y9NSh0jaN0mb0OiAPTO1S hBiuF49vVdmcO9YmDZWA+h2mGdScyhA= X-Google-Smtp-Source: ABdhPJxzThEZl8H8oW39rjGUWjPVZdnINUY9dGPzBYA+ltBxOZdBYKhvKVrX4KnBPgorxlKrAVwIew== X-Received: by 2002:ac8:3893:: with SMTP id f19mr85676311qtc.184.1594633823044; Mon, 13 Jul 2020 02:50:23 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 11/25] qemu_migration_params.c: use g_autofree in qemuMigrationParamsApply() Date: Mon, 13 Jul 2020 06:49:43 -0300 Message-Id: <20200713094957.1648405-12-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration_params.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index b1518f82c0..aea17b1ac8 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -836,8 +836,8 @@ qemuMigrationParamsApply(virQEMUDriverPtr driver, { qemuDomainObjPrivatePtr priv =3D vm->privateData; bool xbzrleCacheSize_old =3D false; - virJSONValuePtr params =3D NULL; - virJSONValuePtr caps =3D NULL; + g_autoptr(virJSONValue) params =3D NULL; + g_autoptr(virJSONValue) caps =3D NULL; qemuMigrationParam xbzrle =3D QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE; int ret =3D -1; int rc; @@ -896,9 +896,6 @@ qemuMigrationParamsApply(virQEMUDriverPtr driver, if (xbzrleCacheSize_old) migParams->params[xbzrle].set =3D true; =20 - virJSONValueFree(params); - virJSONValueFree(caps); - return ret; } =20 --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633857; cv=none; d=zohomail.com; s=zohoarc; b=n1i17zrfj5plj+fWqjdu8I9Z40w8F8wr1ji5U+tn8tpJF2PiF9mOBL97QMGcAdJpYZkyeDo9yVKMUJuPJOdsSIzyS3Zoa4yFkD2BflNYyMPKq1/8ikXnJ3MvtWPzqDx2RQN9Ul6cIsXGFi5Ga9FvJryS+9/yJQEbxVHgGAlJPr8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633857; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xERxEq177CxvXpXWAshp8R1R67ACHn4AXDHq28tX6hs=; b=GqF/L5FpYt7z0eAyd2SNFASUSjXyxIJKUcWOJOMYIPMBkz5FQ5UmOXx/KUqPDxyMOhZ0OK6Ea7AdmFXkgaoc4l3Y0b5v2chm9h/vbas55kK8UwnvjTYM963MGqTpoUAypbfGydUqOAvCH5CAZ9IhCQjEqx5iWA0P9AHpLQ/tIZY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1594633857570834.2171789009935; Mon, 13 Jul 2020 02:50:57 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-207-aCdaMyuHO8GxR5y-Obx6zw-1; Mon, 13 Jul 2020 05:50:54 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BCDD9106B243; Mon, 13 Jul 2020 09:50:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9DD4F19D61; Mon, 13 Jul 2020 09:50:48 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6E01794F08; Mon, 13 Jul 2020 09:50:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oWmW005750 for ; Mon, 13 Jul 2020 05:50:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0423A217B43F; Mon, 13 Jul 2020 09:50:32 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BDA5F2051BE0 for ; Mon, 13 Jul 2020 09:50:30 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 34A6010AFB1B for ; Mon, 13 Jul 2020 09:50:28 +0000 (UTC) Received: from mail-qv1-f66.google.com (mail-qv1-f66.google.com [209.85.219.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-12-deRbiiMIM66kXh-k9TYGFA-1; Mon, 13 Jul 2020 05:50:25 -0400 Received: by mail-qv1-f66.google.com with SMTP id h17so5510749qvr.0 for ; Mon, 13 Jul 2020 02:50:25 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:23 -0700 (PDT) X-MC-Unique: aCdaMyuHO8GxR5y-Obx6zw-1 X-MC-Unique: deRbiiMIM66kXh-k9TYGFA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xERxEq177CxvXpXWAshp8R1R67ACHn4AXDHq28tX6hs=; b=SGPCoF3mvNuLWZ/nFPVpwrLY850gwTXebpeVqloXiq5g5HhxirfyqbxRi8KYNEnh1T ltyg6sonMcKGKYYbFsn5QQ3Z2OFOyxt+7rCKBQKfhYgoMSBUl8/PHC/eCQoxG+Dd0WXX Jrk9JIhXp5hRfo4euTJU/KMeSQngLVoCpjh4SjNlidBEOxo3uXdKJnntwGiG/IGWx0bF jwtkYB8idFOmBkpHiOoqkHxF2fFhZ0l7nKBofuByl+G2sBimtWo615On8IGR2/gHRS8v N6f6lv6xJKt4j8QGEuGhojQf04VSTbmijXijR4r8IavGWQJHSp6VnCYOjc9nX0uQjnEh CRgQ== X-Gm-Message-State: AOAM533D8+sAMEvXT64W5SWdc7qODAaD9Dhd2JVS+gpjczv0y21iHHcS lP04z3CSpcQ1SraOZPwfomiAtyfUVJU= X-Google-Smtp-Source: ABdhPJzVMNn1X+10Hy/kPJtFn1yG93c3WUx2AasdpGZbTZS4ZxsBMPKn6BjG6FHkg9MiT5UxV5lSbA== X-Received: by 2002:a05:6214:a43:: with SMTP id ee3mr76998587qvb.51.1594633824536; Mon, 13 Jul 2020 02:50:24 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 12/25] qemu_monitor_json.c: modernize qemuMonitorJSONMigrateIncoming() Date: Mon, 13 Jul 2020 06:49:44 -0300 Message-Id: <20200713094957.1648405-13-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use g_autoptr() and remove the now obsolete 'cleanup' label. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_monitor_json.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 3070c1e6b3..d808c4b55b 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -8405,9 +8405,8 @@ int qemuMonitorJSONMigrateIncoming(qemuMonitorPtr mon, const char *uri) { - int ret =3D -1; - virJSONValuePtr cmd; - virJSONValuePtr reply =3D NULL; + g_autoptr(virJSONValue) cmd =3D NULL; + g_autoptr(virJSONValue) reply =3D NULL; =20 if (!(cmd =3D qemuMonitorJSONMakeCommand("migrate-incoming", "s:uri", uri, @@ -8415,14 +8414,9 @@ qemuMonitorJSONMigrateIncoming(qemuMonitorPtr mon, return -1; =20 if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) - goto cleanup; - - ret =3D qemuMonitorJSONCheckError(cmd, reply); + return -1; =20 - cleanup: - virJSONValueFree(cmd); - virJSONValueFree(reply); - return ret; + return qemuMonitorJSONCheckError(cmd, reply); } =20 =20 --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633858; cv=none; d=zohomail.com; s=zohoarc; b=DD8SvKIJnltqGzZeJYaG2K8GJXO0Dz2pSJ+pEN+f83oT8cqIBJHCCz2UEhXEoNanAvj6/aFa15GwYIyNdt2WJ4lXxdkOvjSNPHESApI1EJ1wDByY6JQWbGWiHUrnut78WqBFatumxWsCAFzUi8eW5HHZRRj3Rk/IlOBN0JpMldA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633858; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uwA05zRZjoNll374txY7HFpjiHKWj9jF7erYap4WXFs=; b=EQ49RsJqckyFUL+PKF5ECwkgqVCDPGbg/eyc3ntw1wq6cbwksiFSsacUse6zHO/bDMVZiyP8MU1LCVl8DWvvtvqoO1KtPQkXNwaNUKD2MLk15nsCiGa1ErUiNLQDZT492XrGUWubSDbDOkDh6+2Nn2K1GKVY9zZDe9QwX7ZC6b0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1594633858533677.4066804849226; Mon, 13 Jul 2020 02:50:58 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-486-M88vdYMjOqmnP1jGkaKRyA-1; Mon, 13 Jul 2020 05:50:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CD6E619200D1; Mon, 13 Jul 2020 09:50:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ADEA727DE8B; Mon, 13 Jul 2020 09:50:49 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7ED5E94F0C; Mon, 13 Jul 2020 09:50:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oXC5005776 for ; Mon, 13 Jul 2020 05:50:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8ED1520A053B; Mon, 13 Jul 2020 09:50:33 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5B7B62097D97 for ; Mon, 13 Jul 2020 09:50:29 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0AF47805B9A for ; Mon, 13 Jul 2020 09:50:29 +0000 (UTC) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-457-XOlnbwYUOEe5DFX_1FdM_g-1; Mon, 13 Jul 2020 05:50:26 -0400 Received: by mail-qt1-f195.google.com with SMTP id i3so9403186qtq.13 for ; Mon, 13 Jul 2020 02:50:26 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:25 -0700 (PDT) X-MC-Unique: M88vdYMjOqmnP1jGkaKRyA-1 X-MC-Unique: XOlnbwYUOEe5DFX_1FdM_g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uwA05zRZjoNll374txY7HFpjiHKWj9jF7erYap4WXFs=; b=q2yMAXxYQMXTb9c7Zqath5sQvOywGEqge0lkdCAuzIIz6mUeVzZhEoRquQIUrEMQlD VG0mDHierP0vXQRtO6bFxhrwEOBaO1abLueH18jkQYG9viRfj7jBrmSBZVNSL6voAEgP Gy9dEkFUhaOnEymUKaSpVUPixPsl1v4Sa9nMqir/pADLgMWuQf8rCqJp0yYktbx6VQJ2 D+l/kU95p3E2VyqrmKD+UNBW8tF/EEP/weGqhODtknQkZnikIA5LKLxSFcDfO7px5kVD qFmQ9mXMX3uQMiUorc6Do7bj4aryBKl5R66tOJLBb7gG9b6JgvlN8f7F0XPsnWKZRqdC baMQ== X-Gm-Message-State: AOAM532W3Wjoozb41If/e2JEHaBUjW16CpxjVld3A90dZBnikOl5y4hr Nwuj+tn3atQhC9GyM6X28MuU9lTRiME= X-Google-Smtp-Source: ABdhPJyT6o5MWTP62X869mT2ZilLw/Lr3nD9AwCmq+RLUeah9GogVsOZKEVi8xL/x35Gvw7nmfgg2A== X-Received: by 2002:ac8:7959:: with SMTP id r25mr33439861qtt.85.1594633826058; Mon, 13 Jul 2020 02:50:26 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 13/25] qemu_migration.c: use g_auto* in qemuMigrationDstPrepareDirect() Date: Mon, 13 Jul 2020 06:49:45 -0300 Message-Id: <20200713094957.1648405-14-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 83a25e7a8f..28081c1b4f 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2810,10 +2810,10 @@ qemuMigrationDstPrepareDirect(virQEMUDriverPtr driv= er, { unsigned short port =3D 0; bool autoPort =3D true; - char *hostname =3D NULL; + g_autofree char *hostname =3D NULL; int ret =3D -1; - virURIPtr uri =3D NULL; - virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); + g_autoptr(virURI) uri =3D NULL; + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); const char *migrateHost =3D cfg->migrateHost; =20 VIR_DEBUG("driver=3D%p, dconn=3D%p, cookiein=3D%s, cookieinlen=3D%d, " @@ -2928,9 +2928,6 @@ qemuMigrationDstPrepareDirect(virQEMUDriverPtr driver, nmigrate_disks, migrate_disks, nbdPor= t, migParams, flags); cleanup: - virURIFree(uri); - VIR_FREE(hostname); - virObjectUnref(cfg); if (ret !=3D 0) { VIR_FREE(*uri_out); if (autoPort) --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633860; cv=none; d=zohomail.com; s=zohoarc; b=VS6IMbolhRFVybx3yKD6xSSMv50pxIr9c4nOsTKRe7hoLPkR2LvN7mlj1TRfjNRQbSzoI7nBZUun05u4QFmlsF3A8w6BTvWPoiZzvyvz+EQoa5vU4EdIAwDJuSXP4B1OsexWtfA3g2hXB1Zzc8Ntk5Hb3PI5PSVNcOHSTHy0pkI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633860; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CHVXJ7zWTAtJLfax9KEX3LKz30R4YWFWC8HUlCZ4OPo=; b=W5i6/OKwnGbFLA+ZpGH/0QY2FhtZifwlgIjCxcBI7jUrEC0u3fRihrOidAFiZA/RmEZKXnmtXrF/jImiTFXeR1ZO5N4/TW1CVVJxtEuInuUZsXnEpNBz/iQ9vLtexkTcaGSso7e0kL0yzJ/DMrMPYFV9zDdiYaOcxMLNoRkCGLQ= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1594633860077802.9664207679235; Mon, 13 Jul 2020 02:51:00 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-123-h--PT2RGNxGDpiXF9pvmJg-1; Mon, 13 Jul 2020 05:50:56 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0E990107BEF5; Mon, 13 Jul 2020 09:50:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E33A35FC2F; Mon, 13 Jul 2020 09:50:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B16C81809557; Mon, 13 Jul 2020 09:50:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oWde005751 for ; Mon, 13 Jul 2020 05:50:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 20059218ADC2; Mon, 13 Jul 2020 09:50:32 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0843E218ADEB for ; Mon, 13 Jul 2020 09:50:30 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ACEAF80CC27 for ; Mon, 13 Jul 2020 09:50:30 +0000 (UTC) Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-306-MK801sudPpazSiauTQPF7Q-1; Mon, 13 Jul 2020 05:50:28 -0400 Received: by mail-qt1-f174.google.com with SMTP id k18so9413862qtm.10 for ; Mon, 13 Jul 2020 02:50:28 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:27 -0700 (PDT) X-MC-Unique: h--PT2RGNxGDpiXF9pvmJg-1 X-MC-Unique: MK801sudPpazSiauTQPF7Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CHVXJ7zWTAtJLfax9KEX3LKz30R4YWFWC8HUlCZ4OPo=; b=EDlKCY7kfkKOOp74hUP8cDd/IwTpv1arYYSTeWG6VE2Q7RyZpYXwAcOMjRU4tvmJVI uUWuGBM1NYkNV9Ywh3EuFHId2DBCU+nqGG4Uq5Nh4Po5CPMs06WnkkJO/Pe8hcWa0CXs DHT3061N6eRFqNThcYcv/SAQ7Zk2lIzLuObR0mVPFoA6TtMXgeYm0rsBX/zGLZowBGIj DmpfATye/fF6xjF3ZZwqQeaQ5dFw5SlRKRSx6sE+OdhHX10ukibU/FbkCe6+sI4cQdMX wC0tLbEzRuXAxvhI4tpIT7QptJ08Ql9+8RdLhhCYZClvToofcbEGLakK9qB0GiwO778N H+RA== X-Gm-Message-State: AOAM531hl3edcgAyl2ClBqJF227u27Y57yPf4OVMFP1O+16Qj6fBsRSp TVy1tY7DABBnZvsyOt8nORv4SyKYeeI= X-Google-Smtp-Source: ABdhPJxAwgID9tW2s0gF+xqmalFkwLt6G30U2Tlw5ONTJlxW4wU6tfFbIo7lPZPO5XVpa+GGdnDu0A== X-Received: by 2002:ac8:3637:: with SMTP id m52mr85230906qtb.53.1594633827752; Mon, 13 Jul 2020 02:50:27 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 14/25] qemu_migration_cookie.h: register AUTOPTR_CLEANUP_FUNC for qemuMigrationCookiePtr Date: Mon, 13 Jul 2020 06:49:46 -0300 Message-Id: <20200713094957.1648405-15-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Next patch will use g_autoptr() in a qemuMigrationCookiePtr pointer to modernize qemuMigrationSrcBeginPhase(). Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration_cookie.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qemu/qemu_migration_cookie.h b/src/qemu/qemu_migration_coo= kie.h index 1e88684589..95e7edb899 100644 --- a/src/qemu/qemu_migration_cookie.h +++ b/src/qemu/qemu_migration_cookie.h @@ -171,6 +171,7 @@ qemuMigrationEatCookie(virQEMUDriverPtr driver, =20 void qemuMigrationCookieFree(qemuMigrationCookiePtr mig); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuMigrationCookie, qemuMigrationCookieFree= ); =20 int qemuMigrationCookieAddPersistent(qemuMigrationCookiePtr mig, --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633856; cv=none; d=zohomail.com; s=zohoarc; b=WkOilUoMgo+6qLzNA5FLL/cOFtF0ccA82j9gEDM4dgc9Ab7brsQWJjvkGT9CN6nEflRjUfRLJ8Cvtg8SzDavK8tDGoiYrn4H191RAEyLBW4gZ9D3qHfZZGWcXKa91PIVAjicPtzwtEHeD9bvJ4pQsQsRi3LB0DweADeIg0L4ci4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633856; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=N0Da4YwrJtkmgKHNQe+NI4aXVLdZTBkFywOlAJUTelA=; b=i7w77S7bI9bTrtYVS4qVr8Y4zALe4u7wgSfnnTmTw+jvneq+LEJ1ZmA3QJSKxRl+35wjbXKoNDfaB7IyyWFwGvvfRpQmg2FTBqd5Ta06xLfnpS5n3CkIITtjyznjSpAGvuHk1aD9ea5q7vupcwCAic0bMy5/H/XQeODtZgNnU9g= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1594633856802862.8765200881107; Mon, 13 Jul 2020 02:50:56 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-335-I-PwAjmaPXy7AoSUOjII7Q-1; Mon, 13 Jul 2020 05:50:52 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 81DDD107BEFA; Mon, 13 Jul 2020 09:50:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5D07061983; Mon, 13 Jul 2020 09:50:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2B97294F05; Mon, 13 Jul 2020 09:50:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oW2D005760 for ; Mon, 13 Jul 2020 05:50:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6C1762157F24; Mon, 13 Jul 2020 09:50:32 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 565AE217B435 for ; Mon, 13 Jul 2020 09:50:32 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3CE3480CC35 for ; Mon, 13 Jul 2020 09:50:32 +0000 (UTC) Received: from mail-qt1-f196.google.com (mail-qt1-f196.google.com [209.85.160.196]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-472-yeV92k06M3moe106ky8wTg-1; Mon, 13 Jul 2020 05:50:29 -0400 Received: by mail-qt1-f196.google.com with SMTP id o38so9440825qtf.6 for ; Mon, 13 Jul 2020 02:50:29 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:28 -0700 (PDT) X-MC-Unique: I-PwAjmaPXy7AoSUOjII7Q-1 X-MC-Unique: yeV92k06M3moe106ky8wTg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=N0Da4YwrJtkmgKHNQe+NI4aXVLdZTBkFywOlAJUTelA=; b=giUkMuewEvfgFBalcdiXNTpLsE9h7gGaP9AZHUEeU9mPB43hfBUuD2U0YC4+w1LkeL m6YfMZDckkr53grJ1q21XmR9i1w1ZI2QHXWRJKfcIg21dLOo5O5op8m0cZQb8go3Kph0 cTBIGfNWn8s4Fb5yce1SLBeRf43G6xfy9Y1fSuwFFG+8snCGoMgM0GeUhb54rpc7IE9r JPsKefR8MMNy6yWfvLHkqgJwgDu/lUHacGTXNDhcg4mNXlRnPjqxFQ+TGGBkNGWMMFfs TCXfIlTqSsKwSL74vMrAnCp6d0De6tiCdq4qkVyU9eNN3KJUQTnaGRsTz7fotNBWQHaA orPg== X-Gm-Message-State: AOAM532Pt7TPep6uKCDeO24aoa/um/6N5mZA9j+OTWdnF2lyJc+fWAD/ JzR262+g1cNus7H9/iXtXqT/wkN+VPs= X-Google-Smtp-Source: ABdhPJyKFIzu+fswLivOuS1Yyhc2dGUvBXkWYjmbOASk20tI2GmzT5o6XXYPp7gMHe6ZbKE+epUNLw== X-Received: by 2002:ac8:7956:: with SMTP id r22mr64102691qtt.359.1594633829179; Mon, 13 Jul 2020 02:50:29 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 15/25] qemu_migration.c: modernize qemuMigrationSrcBeginPhase() Date: Mon, 13 Jul 2020 06:49:47 -0300 Message-Id: <20200713094957.1648405-16-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use g_autoptr() and remove the 'cleanup' label. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration.c | 42 +++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 28081c1b4f..58c80533d8 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2054,9 +2054,8 @@ qemuMigrationSrcBeginPhase(virQEMUDriverPtr driver, const char **migrate_disks, unsigned long flags) { - char *rv =3D NULL; - qemuMigrationCookiePtr mig =3D NULL; - virDomainDefPtr def =3D NULL; + g_autoptr(qemuMigrationCookie) mig =3D NULL; + g_autoptr(virDomainDef) def =3D NULL; qemuDomainObjPrivatePtr priv =3D vm->privateData; unsigned int cookieFlags =3D QEMU_MIGRATION_COOKIE_LOCKSTATE; =20 @@ -2075,12 +2074,12 @@ qemuMigrationSrcBeginPhase(virQEMUDriverPtr driver, qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_BEGIN3); =20 if (!qemuMigrationSrcIsAllowed(driver, vm, true, flags)) - goto cleanup; + return NULL; =20 if (!(flags & (VIR_MIGRATE_UNSAFE | VIR_MIGRATE_OFFLINE)) && !qemuMigrationSrcIsSafe(vm->def, priv->qemuCaps, nmigrate_disks, migrate_disks, flags)) - goto cleanup; + return NULL; =20 if (flags & VIR_MIGRATE_POSTCOPY && (!(flags & VIR_MIGRATE_LIVE) || @@ -2088,13 +2087,13 @@ qemuMigrationSrcBeginPhase(virQEMUDriverPtr driver, virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", _("post-copy migration is not supported with non-li= ve " "or paused migration")); - goto cleanup; + return NULL; } =20 if (flags & VIR_MIGRATE_POSTCOPY && flags & VIR_MIGRATE_TUNNELLED) { virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", _("post-copy is not supported with tunnelled migrat= ion")); - goto cleanup; + return NULL; } =20 if (flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_INC)= ) { @@ -2111,7 +2110,7 @@ qemuMigrationSrcBeginPhase(virQEMUDriverPtr driver, virReportError(VIR_ERR_INVALID_ARG, _("disk target %s not found"), migrate_disks[i]); - goto cleanup; + return NULL; } } =20 @@ -2119,7 +2118,7 @@ qemuMigrationSrcBeginPhase(virQEMUDriverPtr driver, virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("Selecting disks to migrate is not " "implemented for tunnelled migration")); - goto cleanup; + return NULL; } } =20 @@ -2152,13 +2151,13 @@ qemuMigrationSrcBeginPhase(virQEMUDriverPtr driver, =20 if (!(mig =3D qemuMigrationEatCookie(driver, vm->def, priv->origname, priv, NULL, 0, 0))) - goto cleanup; + return NULL; =20 if (qemuMigrationBakeCookie(mig, driver, vm, QEMU_MIGRATION_SOURCE, cookieout, cookieoutlen, cookieFlags) < 0) - goto cleanup; + return NULL; =20 if (flags & VIR_MIGRATE_OFFLINE) { if (flags & (VIR_MIGRATE_NON_SHARED_DISK | @@ -2166,19 +2165,19 @@ qemuMigrationSrcBeginPhase(virQEMUDriverPtr driver, virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("offline migration cannot handle " "non-shared storage")); - goto cleanup; + return NULL; } if (!(flags & VIR_MIGRATE_PERSIST_DEST)) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("offline migration must be specified with " "the persistent flag set")); - goto cleanup; + return NULL; } if (flags & VIR_MIGRATE_TUNNELLED) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("tunnelled offline migration does not " "make sense")); - goto cleanup; + return NULL; } } =20 @@ -2186,21 +2185,16 @@ qemuMigrationSrcBeginPhase(virQEMUDriverPtr driver, if (!(def =3D virDomainDefParseString(xmlin, driver->xmlopt, priv-= >qemuCaps, VIR_DOMAIN_DEF_PARSE_INACTIVE | VIR_DOMAIN_DEF_PARSE_SKIP_VALI= DATE))) - goto cleanup; + return NULL; =20 if (!qemuDomainCheckABIStability(driver, vm, def)) - goto cleanup; + return NULL; =20 - rv =3D qemuDomainDefFormatLive(driver, priv->qemuCaps, def, NULL, = false, true); + return qemuDomainDefFormatLive(driver, priv->qemuCaps, def, NULL, = false, true); } else { - rv =3D qemuDomainDefFormatLive(driver, priv->qemuCaps, vm->def, pr= iv->origCPU, - false, true); + return qemuDomainDefFormatLive(driver, priv->qemuCaps, vm->def, pr= iv->origCPU, + false, true); } - - cleanup: - qemuMigrationCookieFree(mig); - virDomainDefFree(def); - return rv; } =20 char * --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633864; cv=none; d=zohomail.com; s=zohoarc; b=TiQ9vsdYbtVJBTPF1nrZrW3qKdpizzeqMgmIBt8lriX4V4IS7E0h3GeYHSVc7Fs74yQbiYgUwIw6ZKbYm5+ZMPukIv7sL5qIKoIRoCXpCj1OBW5tq2ZMShyM9U1GTWFYo0OcjdZpgn80l2OwkdM8hebH80DN8dxnv4qwh9otcDQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633864; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JWKSoeRpjLQhUPJBc/ctKnsiQ+LQ4u7IIQeUvJhWUMQ=; b=OYglU16FB8+9DQAgtJnidyDKwBwLM+O3Y38254qzsS3hxBMeYebt/xmLr1u7Kw/pCgn0Y9rMqjDy63DQZc25WjBfMAktWL7L+ahvSbbylDR3CeLRDfzO9+F/9Tnvxo4YzDT0trznP6MF8RF8AGOkQfwLCQJ0TLPrEsYMWi+qmqs= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1594633864748794.0494537391974; Mon, 13 Jul 2020 02:51:04 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-310-bmZ-gR5BMpO2Ps8cE_Nsew-1; Mon, 13 Jul 2020 05:51:00 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6C8EB19200D0; Mon, 13 Jul 2020 09:50:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EE7BB27DE8E; Mon, 13 Jul 2020 09:50:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BEAE018005C5; Mon, 13 Jul 2020 09:50:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oXbA005777 for ; Mon, 13 Jul 2020 05:50:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id A19E9217B43C; Mon, 13 Jul 2020 09:50:33 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 876E4217B436 for ; Mon, 13 Jul 2020 09:50:33 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 69C8F83B822 for ; Mon, 13 Jul 2020 09:50:33 +0000 (UTC) Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-20-asCYLYaxOGeVehP1oB-oCw-1; Mon, 13 Jul 2020 05:50:31 -0400 Received: by mail-qk1-f194.google.com with SMTP id r22so11518769qke.13 for ; Mon, 13 Jul 2020 02:50:31 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:30 -0700 (PDT) X-MC-Unique: bmZ-gR5BMpO2Ps8cE_Nsew-1 X-MC-Unique: asCYLYaxOGeVehP1oB-oCw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JWKSoeRpjLQhUPJBc/ctKnsiQ+LQ4u7IIQeUvJhWUMQ=; b=r2ptAtDdAXOA/bZ8LJFR/uqBLunFh8PtF0+A/BBKPdfRnPFy/1McHl+hFUkGE/9Sr+ lLTw9o0vuy/65y5t2pCUAOzoJru6Mlb53wlOI13do9Nzt0/RnCMRXDXP+HQtIk++kPXm A7KaeJuMhEq+JGNkGSsB9JLcTcashC51hVFUyI9SeIhCltY0k1Ypd+H10kdHS6ll6C0l w239To/4y+JpRfoFRSLbvNOxJgrIb6MKIVNl0XSjoOzOYgzmZNFCe61X1OyxXRjLJaxQ nEzl8OZ+bA2sr216e1+kPMQjS7/AD41NBmVJx1EZOu7F7f9RoqNHSaBde6dABnBPRMcR YgYw== X-Gm-Message-State: AOAM530SIq9HRonR7lS44a8NK6xG56AZ9EO4xWcvmd8L8qOc1IG/JTBp 9HxBCL9RHwnrx69CEvzkfVR3yFOx5A4= X-Google-Smtp-Source: ABdhPJyESnv/+ad1PNye0EbAcEsY+Ap/Ly+lZwF+B9R50oKpcrpRQ6nIclxn2DtG8bBg81DZKGRkLA== X-Received: by 2002:a37:45c4:: with SMTP id s187mr81225498qka.246.1594633830618; Mon, 13 Jul 2020 02:50:30 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 16/25] qemu_migration_cookie.c: modernize qemuMigrationEatCookie() Date: Mon, 13 Jul 2020 06:49:48 -0300 Message-Id: <20200713094957.1648405-17-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use g_autoptr() and remove the obsolete 'error' label. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration_cookie.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_coo= kie.c index 2e48d1b524..81b557e0a8 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -1464,14 +1464,14 @@ qemuMigrationEatCookie(virQEMUDriverPtr driver, int cookieinlen, unsigned int flags) { - qemuMigrationCookiePtr mig =3D NULL; + g_autoptr(qemuMigrationCookie) mig =3D NULL; =20 /* Parse & validate incoming cookie (if any) */ if (cookiein && cookieinlen && cookiein[cookieinlen-1] !=3D '\0') { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Migration cookie was not NULL terminated")); - goto error; + return NULL; } =20 VIR_DEBUG("cookielen=3D%d cookie=3D'%s'", cookieinlen, NULLSTR(cookiei= n)); @@ -1485,7 +1485,7 @@ qemuMigrationEatCookie(virQEMUDriverPtr driver, priv ? priv->qemuCaps : NULL, cookiein, flags) < 0) - goto error; + return NULL; =20 if (flags & QEMU_MIGRATION_COOKIE_PERSISTENT && mig->persistent && @@ -1500,7 +1500,7 @@ qemuMigrationEatCookie(virQEMUDriverPtr driver, virReportError(VIR_ERR_INTERNAL_ERROR, _("Missing %s lock state for migration cook= ie"), virLockManagerPluginGetName(driver->lockMan= ager)); - goto error; + return NULL; } } else if (STRNEQ(mig->lockDriver, virLockManagerPluginGetName(driver->lockManager)= )) { @@ -1508,16 +1508,12 @@ qemuMigrationEatCookie(virQEMUDriverPtr driver, _("Source host lock driver %s different from ta= rget %s"), mig->lockDriver, virLockManagerPluginGetName(driver->lockManager= )); - goto error; + return NULL; } } =20 if (flags & QEMU_MIGRATION_COOKIE_STATS && mig->jobInfo) mig->jobInfo->operation =3D priv->job.current->operation; =20 - return mig; - - error: - qemuMigrationCookieFree(mig); - return NULL; + return g_steal_pointer(&mig); } --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633866; cv=none; d=zohomail.com; s=zohoarc; b=be7rwwuPFODKYzkUbPi3EpxB79pjDqT2YrgQW/JuIzWA7q0FAcl13gM+69OmVnTE3+GS8JgOkkeK9EKNnwER6yPDrdcHMxlCm+7Y+ns7YXqanUwtjh7+NGTqJFOUxvUMaJrDILVOECIXL8vZxV1T99SOTHO3yp2ICg4FxIwypcI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633866; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0+yV3fkbIUy59QRFGilKqYYbcrHThdHWqlNsrZcX9t8=; b=BpudRRFNrlDDMFopyp6pkxN47/4rPfY09UMmEAYzsyHizk4DXmjY5mcFpuI3BUVpHRmRM9qCybkQ9PMqWKnM4KTKNEod8w4CX2V3tb3om2/YWuvAGDcrrz+mLteO+zQXjgfvWWK+U6eUpVPhKhclaONnBW32kfA/Rmge6kUS95E= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1594633866985716.2462772624515; Mon, 13 Jul 2020 02:51:06 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-197-WY8uvPozPc2MHLJsdEITBQ-1; Mon, 13 Jul 2020 05:51:03 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 491A218FF66E; Mon, 13 Jul 2020 09:50:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B3D078483; Mon, 13 Jul 2020 09:50:58 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id F045694F17; Mon, 13 Jul 2020 09:50:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oaTu005843 for ; Mon, 13 Jul 2020 05:50:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id CBBBD20A0534; Mon, 13 Jul 2020 09:50:35 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 676F320A053D for ; Mon, 13 Jul 2020 09:50:35 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3E31C8001E1 for ; Mon, 13 Jul 2020 09:50:35 +0000 (UTC) Received: from mail-qv1-f65.google.com (mail-qv1-f65.google.com [209.85.219.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-325-pkSvGQ9pPC2qZcli2_4qAw-1; Mon, 13 Jul 2020 05:50:32 -0400 Received: by mail-qv1-f65.google.com with SMTP id dm12so5483389qvb.9 for ; Mon, 13 Jul 2020 02:50:32 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:31 -0700 (PDT) X-MC-Unique: WY8uvPozPc2MHLJsdEITBQ-1 X-MC-Unique: pkSvGQ9pPC2qZcli2_4qAw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0+yV3fkbIUy59QRFGilKqYYbcrHThdHWqlNsrZcX9t8=; b=OQIQpv7YDVyonFTTfbA4seJYdXcPeznwOvC8NmuZk9ry59fI0wC+RuMnMDM4tXVwPc zDy7dRRaMfVTDJIcxyceshEgg/4m+gDta7wyBwCF5nq9rDz2NSX4e4wo/K14h/c1GZxG mrd8ZTg/E2EdN1L2CFrCtBhrkkWzNNn5PC0EL31jszfZt5w9uDDCnCafDFkBPBUKvvm2 Mao0HkC2X7zTkZxumZt+oz1byyJETv7wp4d/Qs1pgZWl9kACWysb/VHehb5Phazhiq3t mKWOmyxuENkUpOoo3dcC2Ye0DCGjON9538j/I+RxbkJxaM4yO70LjK364UI/4XlNPJG5 +01A== X-Gm-Message-State: AOAM533n7OrrocZmkLlBb2dHhV31516O0w29r1xI4E1rfQ6wkIM4lsCD RLd9Ybv5JyYvnQvPfvPRcMaxE0JRIHc= X-Google-Smtp-Source: ABdhPJwYidnxH7mVWsC37lwfXCEHvQxp3wqenunW9eH/07cHYGqP3nhqRGbDd4wXxCYe3Gfi4OXsWQ== X-Received: by 2002:a05:6214:b88:: with SMTP id fe8mr69547460qvb.244.1594633832040; Mon, 13 Jul 2020 02:50:32 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 17/25] qemu_driver.c: use g_auto* in qemuDomainMigratePerform3* functions Date: Mon, 13 Jul 2020 06:49:49 -0300 Message-Id: <20200713094957.1648405-18-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d133793ee1..d185666ed8 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12634,7 +12634,7 @@ qemuDomainMigratePerform3(virDomainPtr dom, { virQEMUDriverPtr driver =3D dom->conn->privateData; virDomainObjPtr vm =3D NULL; - qemuMigrationParamsPtr migParams =3D NULL; + g_autoptr(qemuMigrationParams) migParams =3D NULL; int ret =3D -1; =20 virCheckFlags(QEMU_MIGRATION_FLAGS, -1); @@ -12658,7 +12658,6 @@ qemuDomainMigratePerform3(virDomainPtr dom, =20 cleanup: virDomainObjEndAPI(&vm); - qemuMigrationParamsFree(migParams); return ret; } =20 @@ -12682,10 +12681,10 @@ qemuDomainMigratePerform3Params(virDomainPtr dom, const char *graphicsuri =3D NULL; const char *listenAddress =3D NULL; int nmigrate_disks; - const char **migrate_disks =3D NULL; + g_autofree const char **migrate_disks =3D NULL; unsigned long long bandwidth =3D 0; int nbdPort =3D 0; - qemuMigrationParamsPtr migParams =3D NULL; + g_autoptr(qemuMigrationParams) migParams =3D NULL; int ret =3D -1; =20 virCheckFlags(QEMU_MIGRATION_FLAGS, -1); @@ -12743,8 +12742,6 @@ qemuDomainMigratePerform3Params(virDomainPtr dom, flags, dname, bandwidth, true); cleanup: virDomainObjEndAPI(&vm); - qemuMigrationParamsFree(migParams); - VIR_FREE(migrate_disks); return ret; } =20 --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633870; cv=none; d=zohomail.com; s=zohoarc; b=lkLlWSGBML17HwndZ5xL55BN3TAN7lPvVbZiLSE5HM4EOnn3+A+S2xtE6XLnPD8xBNv1/hkN9Fk0Mrl+pI0+qnYwv4EVjhtoxFnuDtwnquONsJby5wQWYCS+lm8rYSnxRP0lda6fxyFPUN+notov9llkQqqdIhYm6nehyLcxbhc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633870; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HCxy+dn3nc4vT1HB1uzeheY9iFR3LsewyS1lOhJ5wJQ=; b=f5v9eUt/eZRkWq6Ylt6sHrQLTeGsrDnRMPfygj5OpJdicaoGO0OPe4hHQ1fGLp9Opk+mLiCQALdLcQEbA8XvvqiArDCSG0pqFlYCoUzFoGlVo3ypFjzN75T6qpgwmrC7dfQhQugEihRYh3KMtsDSLBH0v+4sHR1oboh04PMcIpE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1594633870876296.8427844362635; Mon, 13 Jul 2020 02:51:10 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-363-Z5E74n_ZNuuDcCJZT4O5kw-1; Mon, 13 Jul 2020 05:51:06 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8117E106B25A; Mon, 13 Jul 2020 09:50:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5F8D95FC3B; Mon, 13 Jul 2020 09:50:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2E4AF94F15; Mon, 13 Jul 2020 09:50:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9okXC005998 for ; Mon, 13 Jul 2020 05:50:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2A90BE38D3; Mon, 13 Jul 2020 09:50:46 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BAD9CE5B3C for ; Mon, 13 Jul 2020 09:50:36 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B2C4D100E7D3 for ; Mon, 13 Jul 2020 09:50:36 +0000 (UTC) Received: from mail-qv1-f68.google.com (mail-qv1-f68.google.com [209.85.219.68]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-189-TnEDTbTMOzeiuNsPtZR9Jg-1; Mon, 13 Jul 2020 05:50:34 -0400 Received: by mail-qv1-f68.google.com with SMTP id e3so5470844qvo.10 for ; Mon, 13 Jul 2020 02:50:34 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:33 -0700 (PDT) X-MC-Unique: Z5E74n_ZNuuDcCJZT4O5kw-1 X-MC-Unique: TnEDTbTMOzeiuNsPtZR9Jg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HCxy+dn3nc4vT1HB1uzeheY9iFR3LsewyS1lOhJ5wJQ=; b=HoHm/sSFDFEGmAKeJIqEO/ADkBP3V3bo3r0uvIQZxtjxd/CclFPTymoJQXHPrk/nFP sAO+ulUWI8eSY0LcG4uEXPWa8YMT4KUohQi7KGbqG2OkiS8UB/EZibBUa5YJwXd99DSQ PBSComxK6Yox0th2miMmIDq2fu2BAE6PnMXasjpYlob1bU6RXxCaLiHmsTE/EXM1ii6n MZV8dyC3uZtIpUZZ83i0wvlRXjwjCx2G4R0/03agWf9wqWwe9Kkyy6E6Wh0O1Lrm/mxX 81CqVbfmBOn8gKEIZXXFMeUrrCmbuGs6NNFrUBH68BcD6mfrziUKXREXjtm6ame1Tczd NUqA== X-Gm-Message-State: AOAM530leyVrlcVkeyoU7mbHROUiJLo7f8hRnnYKw4zJf+3ckD/9np+9 VmsCNkbwvcOIy4au2Zo/zH0tM6RcWgw= X-Google-Smtp-Source: ABdhPJw6DIeI+qjqWVUUbamPIjCN6pCXPrx/k455ECI9KQACAT5G/VjITKes3JBveXbxGhO4YSBpQA== X-Received: by 2002:ad4:452c:: with SMTP id l12mr59655668qvu.198.1594633833780; Mon, 13 Jul 2020 02:50:33 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 18/25] qemu_migration.c: modernize qemuMigrationSrcPerformNative() Date: Mon, 13 Jul 2020 06:49:50 -0300 Message-Id: <20200713094957.1648405-19-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use g_autoptr() and remove the unneeded 'cleanup' label. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 58c80533d8..884f1bc4a0 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3844,7 +3844,7 @@ qemuMigrationSrcPerformNative(virQEMUDriverPtr driver, qemuMigrationParamsPtr migParams) { qemuDomainObjPrivatePtr priv =3D vm->privateData; - virURIPtr uribits =3D NULL; + g_autoptr(virURI) uribits =3D NULL; int ret =3D -1; qemuMigrationSpec spec; =20 @@ -3862,7 +3862,7 @@ qemuMigrationSrcPerformNative(virQEMUDriverPtr driver, virReportError(VIR_ERR_INTERNAL_ERROR, _("missing scheme in migration URI: %s"), uri); - goto cleanup; + return -1; } =20 if (STREQ(uribits->scheme, "rdma")) { @@ -3870,13 +3870,13 @@ qemuMigrationSrcPerformNative(virQEMUDriverPtr driv= er, virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("outgoing RDMA migration is not supported " "with this QEMU binary")); - goto cleanup; + return -1; } if (!virMemoryLimitIsSet(vm->def->mem.hard_limit)) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot start RDMA migration with no memory h= ard " "limit set")); - goto cleanup; + return -1; } } =20 @@ -3900,9 +3900,6 @@ qemuMigrationSrcPerformNative(virQEMUDriverPtr driver, if (spec.destType =3D=3D MIGRATION_DEST_FD) VIR_FORCE_CLOSE(spec.dest.fd.qemu); =20 - cleanup: - virURIFree(uribits); - return ret; } =20 --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633871; cv=none; d=zohomail.com; s=zohoarc; b=VX3c4zZ+2WS5BiTpAJOJhJB+oVVi85Up8nRS/cYJxHPGcjQV8+yPIXoRBA7w7ZdqzrbvJM5pLzwElF5ePKIX19q4oGftRKSeprsg+sUMu/QBLulmAVmXiAxcIv+6BiAQPWjRt7lBEfjfbr5RdRQ+ItrmNH1BRgYpwRNwPSG+KfQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633871; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=V4Wt4qrMX/QedHiSLmpjUV/tWjTYSq3+NW99lFIlL2s=; b=JUA/aXFGPGWw6d0puH7HLe51GmXELpaWiDuCm4ZGTi+T+Xlp1IfqHyhe7VIHJ05B5cy88yEDInrMtH2yvYHZV91dKnu7aupBG27iJULBhJzWWbHM62BvNGjvON/g8AgCKmQUzwUB74ja1G0A2QR3B4WI/Ooz+LeQDj6e209j83A= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1594633871949757.6604813202072; Mon, 13 Jul 2020 02:51:11 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-429-VYwSjfS4Pxe2J3wpaV6_NQ-1; Mon, 13 Jul 2020 05:51:08 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8D67C1090; Mon, 13 Jul 2020 09:51:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 698D2619C4; Mon, 13 Jul 2020 09:51:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3BE35180CB39; Mon, 13 Jul 2020 09:51:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9odb9005879 for ; Mon, 13 Jul 2020 05:50:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id CFB3120A0530; Mon, 13 Jul 2020 09:50:38 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BECDF20A052F for ; Mon, 13 Jul 2020 09:50:38 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A5FC518056A6 for ; Mon, 13 Jul 2020 09:50:38 +0000 (UTC) Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com [209.85.219.45]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-382-XSqKGZjCO9aYw7G5x9SZeg-1; Mon, 13 Jul 2020 05:50:36 -0400 Received: by mail-qv1-f45.google.com with SMTP id u8so5477626qvj.12 for ; Mon, 13 Jul 2020 02:50:36 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:34 -0700 (PDT) X-MC-Unique: VYwSjfS4Pxe2J3wpaV6_NQ-1 X-MC-Unique: XSqKGZjCO9aYw7G5x9SZeg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V4Wt4qrMX/QedHiSLmpjUV/tWjTYSq3+NW99lFIlL2s=; b=oUfIhcxunDSkY0ZlZXNn1iN9xmrwV1WNrPePssF4mRfROkYh4SH3geJRDL6Z+uBYvS Eih1THgwyoZDKWFX6JSRCgqor1AAG0gqtMAmf0OVl4UM0igH23qvdyqnspN3e1JZwiT/ M6djUUSaWdgaspwcPSsoHHxXh4Odyr+q8N8Plk5cA81R/yvrRiHuaLYZUUniHnrZOtTJ kweCE2DqNRfwII/IcxlzmB4WX+La1Kg35qICp+Me6vxxTRiR/lpJnw2tbfBKj8Xu5utB 89/vOEbakK2VI++PUWWU06UIsJHqhEmRzBmMMMSZPN/iuFlofdrlJHg0P5OmXxst176u Qbmg== X-Gm-Message-State: AOAM533r/d2QDJgG1uB0xWD62nIJFQ1uqusDpwMurtwpqgmHjRGOcqcp w+AqMaIFLH9CxBMnUgX23HAZFIfu+zk= X-Google-Smtp-Source: ABdhPJyC49CG1MpaV7WZY6fZkQTedkizBdBP9rzQTYp8llVmY8f9SFNE2sQuEOra0FqlcO4Wwgak3w== X-Received: by 2002:ad4:4a6d:: with SMTP id cn13mr79821049qvb.165.1594633835312; Mon, 13 Jul 2020 02:50:35 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 19/25] qemu_migration.c: use auto* in qemuMigrationSrcRun() Date: Mon, 13 Jul 2020 06:49:51 -0300 Message-Id: <20200713094957.1648405-20-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 884f1bc4a0..9fa08617a2 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3467,10 +3467,10 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, int ret =3D -1; unsigned int migrate_flags =3D QEMU_MONITOR_MIGRATE_BACKGROUND; qemuDomainObjPrivatePtr priv =3D vm->privateData; - qemuMigrationCookiePtr mig =3D NULL; - char *tlsAlias =3D NULL; + g_autoptr(qemuMigrationCookie) mig =3D NULL; + g_autofree char *tlsAlias =3D NULL; qemuMigrationIOThreadPtr iothread =3D NULL; - int fd =3D -1; + VIR_AUTOCLOSE fd =3D -1; unsigned long migrate_speed =3D resource ? resource : priv->migMaxBand= width; virErrorPtr orig_err =3D NULL; unsigned int cookieFlags =3D 0; @@ -3479,8 +3479,8 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, bool bwParam =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_PA= RAM_BANDWIDTH); bool cancel =3D false; unsigned int waitFlags; - virDomainDefPtr persistDef =3D NULL; - char *timestamp; + g_autoptr(virDomainDef) persistDef =3D NULL; + g_autofree char *timestamp =3D NULL; int rc; =20 VIR_DEBUG("driver=3D%p, vm=3D%p, cookiein=3D%s, cookieinlen=3D%d, " @@ -3642,10 +3642,8 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, } =20 /* log start of migration */ - if ((timestamp =3D virTimeStringNow()) !=3D NULL) { + if ((timestamp =3D virTimeStringNow()) !=3D NULL) qemuDomainLogAppendMessage(driver, vm, "%s: initiating migration\n= ", timestamp); - VIR_FREE(timestamp); - } =20 rc =3D -1; switch (spec->destType) { @@ -3779,11 +3777,6 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, ret =3D 0; =20 cleanup: - VIR_FREE(tlsAlias); - VIR_FORCE_CLOSE(fd); - virDomainDefFree(persistDef); - qemuMigrationCookieFree(mig); - if (events) priv->signalIOError =3D false; =20 --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594634424; cv=none; d=zohomail.com; s=zohoarc; b=NODpsodq+AXZzNfXymkYByF0YF42eL6cGIVtBgPLmLAk2qKCl4uo3i5RKApAv0gXVSTrFqB19jNyIdE5uJaNfRfdp0Bbh9Dp0fhaNQk381/U1J1o0pc4MX1ry1mxDua8ggPzU8kIm9KVq0LG5FFEZonhtzKRGiNwen9JBJ9cD8o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594634424; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0JpBWn4NVUc8SYyA395TtmwbDV9nviy7iWl5eEaMRO4=; b=hXgB6ipIkf6bh+iB37fSox2+c+DCpeNW+Zjx2bz97yYwiZpA1Gvl4+2m/p1H1sCi+wD8JLOxMjC1xoep0BkhFE8rOX1CKM0jcUiBREeS1H4Hsc8D/E49dYbzCVXBErunnRtpb1zFTY2n+RsLEL1pf3Wsvo2yTHLThU9Uc7Sm9Ys= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1594634424091826.5935976871215; Mon, 13 Jul 2020 03:00:24 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-465-hx3iXl4GOxO3eoWZVUYJMA-1; Mon, 13 Jul 2020 06:00:20 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1711D107ACCA; Mon, 13 Jul 2020 10:00:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B67FE79CE3; Mon, 13 Jul 2020 10:00:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3389A94EF7; Mon, 13 Jul 2020 10:00:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06DA0Ave007275 for ; Mon, 13 Jul 2020 06:00:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1A583217B434; Mon, 13 Jul 2020 10:00:10 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 029482166BA2 for ; Mon, 13 Jul 2020 10:00:06 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EDE01100E7DC for ; Mon, 13 Jul 2020 09:50:39 +0000 (UTC) Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-250-Q-QObS6SOIqHEAD9uZGMfA-1; Mon, 13 Jul 2020 05:50:37 -0400 Received: by mail-qt1-f178.google.com with SMTP id j10so9407112qtq.11 for ; Mon, 13 Jul 2020 02:50:37 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:36 -0700 (PDT) X-MC-Unique: hx3iXl4GOxO3eoWZVUYJMA-1 X-MC-Unique: Q-QObS6SOIqHEAD9uZGMfA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0JpBWn4NVUc8SYyA395TtmwbDV9nviy7iWl5eEaMRO4=; b=MC9RVe4loVVGdMmJm0kRofJo0UPt5OF738xM52SeTqpRBS7c85ZEdQZDQi3QwVBuXS HWDbrqVY6Ikk+c3lXPWi7GMHyZIP/wyvzMgajd4GXgMG/QAFxzZaOQ749d2TjASrhXHa XLtDtqbXANa9oimlbbVDfYCBhuQccI3G8tXpwBMcHgJKmz5FBMXygFbroE6lQfczBoky +gmffcjawIXscssuVLvzjZVGEzkTErLXEOqvsR2pTwzyXZrpWHufcgzlZ9wFz8zqGJ53 kzt1vlfaATcuPM9l5EYtXxvtHGmqf4Um55Wgwqq1Liasy8ZaVASXG0sxQ9EGIEG27ooS 1tQQ== X-Gm-Message-State: AOAM5300E7rKYaJ4RwyV9oG8ahMxLFMTrS67lc9IQmt9pa8T86M//7bI 1PFFbBQPlLJUfEVGXiqOdmZ8ec8Vw58= X-Google-Smtp-Source: ABdhPJyIt2H45o4hiD3pyxUqDZGdbQJdaKR4z47UCB2coXZi4sshOkQUU9JDyCmmXs3DhA3ZIiM1OA== X-Received: by 2002:ac8:5249:: with SMTP id y9mr73673874qtn.99.1594633836862; Mon, 13 Jul 2020 02:50:36 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 20/25] qemu_migration.c: use g_auto* in qemuMigrationSrcPerformJob and Peer2Peer Date: Mon, 13 Jul 2020 06:49:52 -0300 Message-Id: <20200713094957.1648405-21-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 9fa08617a2..d8f2aeb9f0 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -4485,12 +4485,12 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriverPtr d= river, bool *v3proto) { int ret =3D -1; - virConnectPtr dconn =3D NULL; + g_autoptr(virConnect) dconn =3D NULL; bool p2p; virErrorPtr orig_err =3D NULL; bool offline =3D !!(flags & VIR_MIGRATE_OFFLINE); bool dstOffline =3D false; - virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); bool useParams; =20 VIR_DEBUG("driver=3D%p, sconn=3D%p, vm=3D%p, xmlin=3D%s, dconnuri=3D%s= , uri=3D%s, " @@ -4536,7 +4536,6 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriverPtr dri= ver, virReportError(VIR_ERR_OPERATION_FAILED, _("Failed to connect to remote libvirt URI %s: %s"), dconnuri, virGetLastErrorMessage()); - virObjectUnref(cfg); return -1; } =20 @@ -4611,10 +4610,8 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriverPtr dr= iver, virErrorPreserveLast(&orig_err); qemuDomainObjEnterRemote(vm); virConnectUnregisterCloseCallback(dconn, qemuMigrationSrcConnectionClo= sed); - virObjectUnref(dconn); ignore_value(qemuDomainObjExitRemote(vm, false)); virErrorRestore(&orig_err); - virObjectUnref(cfg); return ret; } =20 @@ -4650,7 +4647,7 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver, virObjectEventPtr event =3D NULL; int ret =3D -1; virErrorPtr orig_err =3D NULL; - virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); qemuDomainObjPrivatePtr priv =3D vm->privateData; =20 if (qemuMigrationJobStart(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, @@ -4726,7 +4723,6 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver, =20 cleanup: virObjectEventStateQueue(driver->domainEventState, event); - virObjectUnref(cfg); return ret; } =20 --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633865; cv=none; d=zohomail.com; s=zohoarc; b=Q/zfNlW70ogIYXwKCbyNIWCB6xcNNg7XGfub3vb5pu/AGidCkPezP8RwftRvRt1l9qAOEjxTJXrAeC3uWxc5vIJdWFqqgeJiMZijUKg1ffIfjcm0hdEHvnn8QCvZdr+BlNnsv2T47dqOB7wE+T9+R2VKxdK+R8wWXV0CnXMqBTY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633865; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+T+uggtH3/KKnMc1f2ixpv3I5WOOMvXCFdeEGesK2DE=; b=QQKxGknmra83iJvJseYddt2jTKvEsamXuPBDbhZCLniTJH6DUrpmZqzRr56p1e5xrB+xTcwXBK9yMmUM9cfuXcMP7+bANBy/2Gxsf9fBzEYAoc0vVqiyf4S/lNph+pDbTitfeQJRS7tYzBm2OIs6DSVBaUibNATmIATJn8OOI8I= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1594633865150984.7089631189235; Mon, 13 Jul 2020 02:51:05 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-225-ctJXnS_uN8qurNsUUG4OAw-1; Mon, 13 Jul 2020 05:51:00 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 469AA8027F6; Mon, 13 Jul 2020 09:50:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 23CB927DE98; Mon, 13 Jul 2020 09:50:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EB1FC94F12; Mon, 13 Jul 2020 09:50:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9ofmd005948 for ; Mon, 13 Jul 2020 05:50:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 533692026D5D; Mon, 13 Jul 2020 09:50:41 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3930A20A052E for ; Mon, 13 Jul 2020 09:50:41 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1ECDB80CC3A for ; Mon, 13 Jul 2020 09:50:41 +0000 (UTC) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-234-30dPULGTPKqesoWXdf9f_A-1; Mon, 13 Jul 2020 05:50:38 -0400 Received: by mail-qt1-f195.google.com with SMTP id e12so9422590qtr.9 for ; Mon, 13 Jul 2020 02:50:38 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:37 -0700 (PDT) X-MC-Unique: ctJXnS_uN8qurNsUUG4OAw-1 X-MC-Unique: 30dPULGTPKqesoWXdf9f_A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+T+uggtH3/KKnMc1f2ixpv3I5WOOMvXCFdeEGesK2DE=; b=QWM8KTxSLrpajOy5IlPmXDMRqlCturQEI2GbQxYsJob4HtdoaBf2tmBMRdpWMBupJK sE/5HymsGjZtT2O7CZ1Wiwo3gtBpWz7asuoWj9skhpay5pSGTR17oIw0866ucNKNhUXP xZn1ykvbZ9J0+Kosbkkc1TccHFh/T7JMZXsRlshaH8P4Vw695/58A3kMBFHP+i9J+xcF Ha2+G+Qy5j58WpTe2TGlcDRN966OZ0RYIqq8/vww9SMAIR1KgBniR3xfivV4FvmawiBt 762atoBxYd2ww4KAFi4iDpFxytwIwYNVp+vQzR4IQxrm7MD3zCMXZyXGkRqC4uhaYVzB 7VQQ== X-Gm-Message-State: AOAM530hPX1nZDlAUnTiFunk8Tvi5hr1gisqWBfAqTQzezAq3gE16TBS zkPpXmNKOT0F81fqmNhproMjABU2Xa8= X-Google-Smtp-Source: ABdhPJwMsAlkROJsopwg4qKXdB3KAv0N4YZTAB/bXDvxfXwRrpDIRWtpbSU2zysoT0dbc6y6NAb/Qw== X-Received: by 2002:ac8:2672:: with SMTP id v47mr78382370qtv.330.1594633838224; Mon, 13 Jul 2020 02:50:38 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 21/25] qemu_migration.c: modernize qemuMigrationDstPersist() Date: Mon, 13 Jul 2020 06:49:53 -0300 Message-Id: <20200713094957.1648405-22-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use g_autoptr() and remove the 'cleanup' label. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index d8f2aeb9f0..c8bb0a6060 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -4926,13 +4926,12 @@ qemuMigrationDstPersist(virQEMUDriverPtr driver, qemuMigrationCookiePtr mig, bool ignoreSaveError) { - virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); qemuDomainObjPrivatePtr priv =3D vm->privateData; virDomainDefPtr vmdef; - virDomainDefPtr oldDef =3D NULL; + g_autoptr(virDomainDef) oldDef =3D NULL; unsigned int oldPersist =3D vm->persistent; virObjectEventPtr event; - int ret =3D -1; =20 vm->persistent =3D 1; oldDef =3D vm->newDef; @@ -4953,19 +4952,14 @@ qemuMigrationDstPersist(virQEMUDriverPtr driver, VIR_DOMAIN_EVENT_DEFINED_ADD= ED); virObjectEventStateQueue(driver->domainEventState, event); =20 - ret =3D 0; - - cleanup: - virDomainDefFree(oldDef); - virObjectUnref(cfg); - return ret; + return 0; =20 error: virDomainDefFree(vm->newDef); vm->persistent =3D oldPersist; vm->newDef =3D oldDef; oldDef =3D NULL; - goto cleanup; + return -1; } =20 =20 --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633861; cv=none; d=zohomail.com; s=zohoarc; b=DvAd3DcOq2+Dbs3+yVPiWV0AohuR+pbSZHvYD0zFt84+thzI/BXczQEJiBVaU5W3400mbbmuz6rNkB4L5+MkvNZU0TXHi8X25oOLW3d2Pp/hdvN8ue2ia2n7hjxBse2OK/FRCcxe1//jr15CSRXOTURgkfvHsH1652TCTVuDsM4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633861; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=osQqE2FNeXiEVht7XEfkBxr1+OVrfEdkrzF81KxXz3A=; b=YIa9cje56OX9DQfTGNb1WLXOuJf5I+YJ8U86zBZj3M19mxAh4pZ4GpBIGVtejtRt178achXS5Fa1w7RIo3oDmRNtdJky3wJAWa6YmspbQnquO5PjX2eFJnrBAkZpCR3A/VmWXyFzIi4sGXSex3/IH2JHzDS6XcRKfLq3nfO5vwo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 159463386176137.96670556670176; Mon, 13 Jul 2020 02:51:01 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-496-3zdnIUVKOlyDfl0ipeD1rA-1; Mon, 13 Jul 2020 05:50:57 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0E95A8027EC; Mon, 13 Jul 2020 09:50:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E34B377894; Mon, 13 Jul 2020 09:50:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B52CC94F0F; Mon, 13 Jul 2020 09:50:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oiht005981 for ; Mon, 13 Jul 2020 05:50:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id A3A222157F26; Mon, 13 Jul 2020 09:50:44 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 88B4E2157F24 for ; Mon, 13 Jul 2020 09:50:42 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7FFA018056AD for ; Mon, 13 Jul 2020 09:50:42 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-426-rKDzuthBN9WDBkHAQS2iqg-1; Mon, 13 Jul 2020 05:50:40 -0400 Received: by mail-qt1-f194.google.com with SMTP id b25so9463160qto.2 for ; Mon, 13 Jul 2020 02:50:40 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:39 -0700 (PDT) X-MC-Unique: 3zdnIUVKOlyDfl0ipeD1rA-1 X-MC-Unique: rKDzuthBN9WDBkHAQS2iqg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=osQqE2FNeXiEVht7XEfkBxr1+OVrfEdkrzF81KxXz3A=; b=kfVIPLeIzfPKFosBzqj833bTSMoBsWKQuXqSoc0xcaSF1SeVlwgpjA9Dzw2QZKODiB uv8g8ywaIOSikjnWyMpxLI89Yd4EeqHOI5Xdx0+mVOvD4wDnxQda6xeMEEhIKi5XAHy7 Gc9qjXM20RX6YsymGGyUg6x16j7B+AA183rEF4dXB2s0C1/BukDAXpgFaUIVFzgKf3XO Kl9MyzM6l8O3WBlx29Ioo+o9hSdly8p3lskM+yRKrffx6mpU7Ckff4J3DqfIGMMn9Nr7 nc+5/XTo4rcZV/+RaYORBjWkOA3utPc3rvZH0EyUn0yr5lzXu8U9sBRGN96yAyJOJ8d7 3gjQ== X-Gm-Message-State: AOAM533G4g3QzKNY1CaLicH7O6PZJanwBA3x1dtPeku883cd64VvfMlS GDFNU0SE0Nrxc4i0xNnTXHdy3be+v0Q= X-Google-Smtp-Source: ABdhPJwvKqFv9CMjki2LR5M2Oq/Lsih0IwPH74uMP4SxMRVuzf1LUjZ94SY5MlzdOPYUbqapKkVJHw== X-Received: by 2002:ac8:6f7a:: with SMTP id u26mr82035822qtv.33.1594633839656; Mon, 13 Jul 2020 02:50:39 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 22/25] qemu_migration.c: use g_auto* in qemuMigrationDstFinish() Date: Mon, 13 Jul 2020 06:49:54 -0300 Message-Id: <20200713094957.1648405-23-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index c8bb0a6060..5d64e9df98 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -4976,11 +4976,11 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver, bool v3proto) { virDomainPtr dom =3D NULL; - qemuMigrationCookiePtr mig =3D NULL; + g_autoptr(qemuMigrationCookie) mig =3D NULL; virErrorPtr orig_err =3D NULL; int cookie_flags =3D 0; qemuDomainObjPrivatePtr priv =3D vm->privateData; - virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); unsigned short port; unsigned long long timeReceived =3D 0; virObjectEventPtr event; @@ -5246,9 +5246,7 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver, qemuMonitorSetDomainLog(priv->mon, NULL, NULL, NULL); VIR_FREE(priv->origname); virDomainObjEndAPI(&vm); - qemuMigrationCookieFree(mig); virErrorRestore(&orig_err); - virObjectUnref(cfg); =20 /* Set a special error if Finish is expected to return NULL as a resul= t of * successful call with retcode !=3D 0 --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633874; cv=none; d=zohomail.com; s=zohoarc; b=R7JHgaEIO5jxgJDNjPzrR9u/sl7/BRUX+TdZWT/2EJTDI2wH9/kmDZMuBCk5x6W5BybZ0WPWeSRmiQKs/yNJqfB2Wj35cPrk4sTWe964DiUuXHs4XyKhv+hYHVOMAcdtJ4bibfMaIEVcYrvXrSJ9pm190tRKvJ/NQ09jeGGHHII= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633874; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ldm+jEmt8OkqqVdBeB8J2UtZiEkbPlDY1Zfyg5Swxvg=; b=ei94SXWBMwn2oN1IEBMa4eZXl857cD5HASkQgddTrrDKRhKW+s3u1KZPXdb6jvzRJLsY26kBGOvowU1EG6Gz5z6ZJlqNTLtkoiTnSfMmb7ULQjEjTz1dy2fdsUa9o7OAM5KniQGFBNGqgcHZwEsF6TtTHH0UUcTVz4UGoc5mRP8= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1594633874616121.76514770148401; Mon, 13 Jul 2020 02:51:14 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-304-yY692DnJOLOEKdhxAklQyg-1; Mon, 13 Jul 2020 05:51:11 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0229F80BCA8; Mon, 13 Jul 2020 09:51:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CEACD1010404; Mon, 13 Jul 2020 09:51:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9D0E794F1C; Mon, 13 Jul 2020 09:51:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9oidR005982 for ; Mon, 13 Jul 2020 05:50:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id A86132026D5D; Mon, 13 Jul 2020 09:50:44 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8C32220A0520 for ; Mon, 13 Jul 2020 09:50:44 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 66AE68007CD for ; Mon, 13 Jul 2020 09:50:44 +0000 (UTC) Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-354-s_jmOpkiPfSLblw5KyIvdg-1; Mon, 13 Jul 2020 05:50:41 -0400 Received: by mail-qt1-f193.google.com with SMTP id i3so9403558qtq.13 for ; Mon, 13 Jul 2020 02:50:41 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:40 -0700 (PDT) X-MC-Unique: yY692DnJOLOEKdhxAklQyg-1 X-MC-Unique: s_jmOpkiPfSLblw5KyIvdg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ldm+jEmt8OkqqVdBeB8J2UtZiEkbPlDY1Zfyg5Swxvg=; b=WW3jtsedlJQVDUFfoQHorzPs7HbKA4+bXUB9x1+hYuGJFu7x48eaVKl+oFkyF+KHxS fJGJ4D0SDVytGWqvPyG0ooBZgYdsiY/pm1E4LdrYWkOOSb3jXFswiwH9Za6wj5Zivnwb VJUEOtwFEed9LgWqbY0b/9Rgpfx/7h9Ui9/P67HYMlxwfBqTB2CVbs4mjWKuEfQqBmIb oh6568YivXBNvWlDIaqoYwv0tsS86Y3Qgc9CDxL2MmD7plXsrJPFqABypO5Trd/Q46uD 01CE2XQzD5Gczi3sKPLJyr7oe+1siyypQWrvL9U30nbplAUYr1zjM7fZEzkzSu9X5QRR Aw0w== X-Gm-Message-State: AOAM531H3C8nA/5aXKemZjH7kcpTCDcG0Jz5N35GsPUx0T/AfG3w9e8m NL/pbMQWjPUgAGkJfpal6bEzXI4x16c= X-Google-Smtp-Source: ABdhPJyyQGHrqOOVuJOJJAg+77x0rf78GjI5XGklpMNPHg3YpLq/XfBl5NbaYOE3fsGXRCi1WZr+qg== X-Received: by 2002:aed:3883:: with SMTP id k3mr86218764qte.365.1594633841157; Mon, 13 Jul 2020 02:50:41 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 23/25] libvirt-domain.c: g_autofree in virDomainMigrate() and virDomainMigrate2() Date: Mon, 13 Jul 2020 06:49:55 -0300 Message-Id: <20200713094957.1648405-24-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/libvirt-domain.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index e379623ce4..5b76f1ab66 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -3553,7 +3553,7 @@ virDomainMigrate(virDomainPtr domain, if (flags & VIR_MIGRATE_PEER2PEER) { if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn, VIR_DRV_FEATURE_MIGRATION_P2P)) { - char *dstURI =3D NULL; + g_autofree char *dstURI =3D NULL; if (uri =3D=3D NULL) { dstURI =3D virConnectGetURI(dconn); if (!dstURI) @@ -3562,11 +3562,8 @@ virDomainMigrate(virDomainPtr domain, =20 VIR_DEBUG("Using peer2peer migration"); if (virDomainMigrateUnmanaged(domain, NULL, flags, dname, - uri ? uri : dstURI, NULL, bandwi= dth) < 0) { - VIR_FREE(dstURI); + uri ? uri : dstURI, NULL, bandwi= dth) < 0) goto error; - } - VIR_FREE(dstURI); =20 ddomain =3D virDomainLookupByName(dconn, dname ? dname : domai= n->name); } else { @@ -3712,17 +3709,14 @@ virDomainMigrate2(virDomainPtr domain, if (flags & VIR_MIGRATE_PEER2PEER) { if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn, VIR_DRV_FEATURE_MIGRATION_P2P)) { - char *dstURI =3D virConnectGetURI(dconn); + g_autofree char *dstURI =3D virConnectGetURI(dconn); if (!dstURI) return NULL; =20 VIR_DEBUG("Using peer2peer migration"); if (virDomainMigrateUnmanaged(domain, dxml, flags, dname, - dstURI, uri, bandwidth) < 0) { - VIR_FREE(dstURI); + dstURI, uri, bandwidth) < 0) goto error; - } - VIR_FREE(dstURI); =20 ddomain =3D virDomainLookupByName(dconn, dname ? dname : domai= n->name); } else { --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594634425; cv=none; d=zohomail.com; s=zohoarc; b=MjZ4nC2nf4221BmRLNWGCv3VTZ8L9/rcvLk2XrMoKKBDT0D+RA4SFWKCVSw0ke+iMyWeGgHp3LbS/AdDo00xOwdz0DT8Op8Tu7dZChItM7O7DMblcR+E6oz853yy52KJ2ieFy77WfU/dP9wQ0QU1w/syuzrbtP+LWyIUx5ELcM4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594634425; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xhTGTQwV23mEAZUFkpWOIGgnHdQd3KAcUGgaEZEuWIA=; b=X8wRzKvzcalXI/bITMkegzE5LS0kbqhuZ3IT7TtnOiGkB1XzCTxzuQoN9Eo2SidI7lwDmNEh3+d/zx07uKyqeG6aK4BTXH5cO2GbHC5S4TUk3uh+mcDaMRXMgq7mwGP5XRPGjquEnfgFZerB73lAFw3ti5MQyrGdqy4k9+UhpMo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1594634425605705.6963542003425; Mon, 13 Jul 2020 03:00:25 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-154-8LtSz6q9Mg6igbau8vW5XQ-1; Mon, 13 Jul 2020 06:00:22 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8A19D1902EA4; Mon, 13 Jul 2020 10:00:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3CA2560C84; Mon, 13 Jul 2020 10:00:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D243F1809554; Mon, 13 Jul 2020 10:00:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06DA0DSH007295 for ; Mon, 13 Jul 2020 06:00:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 12CC1E5964; Mon, 13 Jul 2020 10:00:13 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EE045E2A76 for ; Mon, 13 Jul 2020 10:00:06 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 330C3100E7EA for ; Mon, 13 Jul 2020 09:50:45 +0000 (UTC) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-123-itWGZ5fyOgCmgaocB_p5Hg-1; Mon, 13 Jul 2020 05:50:43 -0400 Received: by mail-qt1-f195.google.com with SMTP id b25so9463221qto.2 for ; Mon, 13 Jul 2020 02:50:43 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:42 -0700 (PDT) X-MC-Unique: 8LtSz6q9Mg6igbau8vW5XQ-1 X-MC-Unique: itWGZ5fyOgCmgaocB_p5Hg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xhTGTQwV23mEAZUFkpWOIGgnHdQd3KAcUGgaEZEuWIA=; b=sJYVSX1jWmlMJfHaqRO5tze/ZJpvCJXjCUM276eaV2Ss4CPb+qJTGrGrsrNIxLgixI 8TDm04GB1Ek6Mi6LQbh7BH+4mDkY74rxcO+SNn9E2tSguXSxAqZf2vBjndl6CmACKqBf PkWYwJPfwbDxPy87+diWEiykH95wqM+wbLXRo07fw1RsNQPx9lyi1Ej2Dytej4KNj6xm QjppISFWLQuYQM6VdyXQEXsrLAgn3bTVFXDaj2o/T75iv4/w9pZSvTtF1Uy0KfFXPJzu ZWurqUQK5dKAbvTzDTwUnTlxwtsWWsbFyDk9mhAJIgMeyoWt/dhyioM4aI3IjKnBWFD2 aIYg== X-Gm-Message-State: AOAM533JFuF3fl7X3nvQ/tXx6aEy9Y/8N1t9ANpOSJnjGpwWGFc8FB+J NJDNeXjk0vAIRJ8eS4Gcl+rCAhCPiD8= X-Google-Smtp-Source: ABdhPJzo/bnvrWm8wfxOjGnCiane8GYg5WjgJCj0owZZHMfd2il20ZqQE+/nm6oBgi/wAzUq+nTcSw== X-Received: by 2002:ac8:1a07:: with SMTP id v7mr81740497qtj.329.1594633842553; Mon, 13 Jul 2020 02:50:42 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 24/25] qemu_migration.c: modernize qemuMigrationSrcConfirmPhase() Date: Mon, 13 Jul 2020 06:49:56 -0300 Message-Id: <20200713094957.1648405-25-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use g_autoptr() and remove both 'error' and 'cleanup' labels. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 5d64e9df98..78e64344f6 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2975,10 +2975,9 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver, unsigned int flags, int retcode) { - qemuMigrationCookiePtr mig; + g_autoptr(qemuMigrationCookie) mig =3D NULL; virObjectEventPtr event; - int rv =3D -1; - virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); qemuDomainObjPrivatePtr priv =3D vm->privateData; qemuDomainJobInfoPtr jobInfo =3D NULL; =20 @@ -2997,7 +2996,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver, if (!(mig =3D qemuMigrationEatCookie(driver, vm->def, priv->origname, = priv, cookiein, cookieinlen, QEMU_MIGRATION_COOKIE_STATS))) - goto cleanup; + return -1; =20 if (retcode =3D=3D 0) jobInfo =3D priv->job.completed; @@ -3026,7 +3025,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver, } =20 if (flags & VIR_MIGRATE_OFFLINE) - goto done; + return 0; =20 /* Did the migration go as planned? If yes, kill off the domain objec= t. * If something failed, resume CPUs, but only if we didn't use post-co= py. @@ -3071,13 +3070,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver, VIR_WARN("Failed to save status on vm %s", vm->def->name); } =20 - done: - qemuMigrationCookieFree(mig); - rv =3D 0; - - cleanup: - virObjectUnref(cfg); - return rv; + return 0; } =20 int --=20 2.26.2 From nobody Sat Apr 27 13:43:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594633868; cv=none; d=zohomail.com; s=zohoarc; b=lm/KUxQ0Jl3Fv0xhmgh8bb158Cguv3rVLSYi0Ql3TvgfLOEA7naO3eG4x/wydZTv/KMHkQbZBNKtJQhrwvAwTIOT1IjRnqXKCnj8oOuQ7RCBKXptOz//D4UlHfHDYHnU5TnIN7+V/T3DTZ3zC573/VG/zpidst5cuFbJnk/I0/E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594633868; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yaqeE/vJOzpH5+PbOy1r/8r4DlzrZMOa2Jk0boraNog=; b=ao0rToxB6leJ1wyVH3uhOpwYqzyeeJSt/tsLCNVLVSLyloQfEvvVmkf43Qkx04H3lyiQdjR3snQlX+vu+SXhp296dYLqOGkZNsUq3stQ/iBVAbUaLI79uThEO1JIgeJPSIllXfhfEuWv7V+E9R/CqiZEM+kvT1lFQ4VSnB9eYGQ= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1594633868897294.85763042909673; Mon, 13 Jul 2020 02:51:08 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-278-u5Z1ZVkWMgygWQZA5VF2pA-1; Mon, 13 Jul 2020 05:51:05 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C04F018FF67F; Mon, 13 Jul 2020 09:50:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9FC3E7620F; Mon, 13 Jul 2020 09:50:59 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 71D1494F1B; Mon, 13 Jul 2020 09:50:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06D9omGa006029 for ; Mon, 13 Jul 2020 05:50:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7AD45E2A76; Mon, 13 Jul 2020 09:50:48 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 767C4E2A8B for ; Mon, 13 Jul 2020 09:50:48 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5A8B018056A4 for ; Mon, 13 Jul 2020 09:50:48 +0000 (UTC) Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-156-Mibj-fCBNMiAuLWRN1SyTA-1; Mon, 13 Jul 2020 05:50:45 -0400 Received: by mail-qt1-f173.google.com with SMTP id u12so9399510qth.12 for ; Mon, 13 Jul 2020 02:50:45 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:530c:1b8b:2d79:f76d:3f06]) by smtp.gmail.com with ESMTPSA id o15sm18335057qko.67.2020.07.13.02.50.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 02:50:43 -0700 (PDT) X-MC-Unique: u5Z1ZVkWMgygWQZA5VF2pA-1 X-MC-Unique: Mibj-fCBNMiAuLWRN1SyTA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yaqeE/vJOzpH5+PbOy1r/8r4DlzrZMOa2Jk0boraNog=; b=ufOOQPmRhz1vgScM2rOz1OVZFGizFv3FEDKMAhMT2zFUqkwFaGPD42N+XSSdURDfsh yiuNbdix73kc+1Rk1d/tpB9GEqeyq5B4A9LY7iJZE4ajQaBc8T1PIIddVHUHZ5z9P0lL 2AgY+XdcGWkegAovREkjqpJUKtmo2yC7xP5JNW2k/WF7xR1g1Uq/UOi873vzSnjP+xuV jXwn+XPkxCMr0HGNW01hm6J25AAEOoIL6UGcmKozH+88l/rfAzif3L1wMQlhHdYOUbWp RrFQSTiWAl2p4lAVdQ3lQSn1Rd86fDutCTu0E32TRnOu6HOkZL25SpJRXuXbwpQfCQ28 szmQ== X-Gm-Message-State: AOAM533B+7vEIBts6271lfpdGdiwT7aftKaTgTrRm4APhkEqkImG2Yq9 xTzz2EundCmWNaNU/AXgM0vcrNJdUGY= X-Google-Smtp-Source: ABdhPJxI36rIhM9X0+eZADKfGDq/Xs+gJEUisyFqReZ4jsoq+YzzpEzUy6dZ9jzDCEVQylw8dBdomA== X-Received: by 2002:ac8:46d6:: with SMTP id h22mr37617157qto.296.1594633844128; Mon, 13 Jul 2020 02:50:44 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 25/25] docs/kbase: introduce migrationinternals.rst Date: Mon, 13 Jul 2020 06:49:57 -0300 Message-Id: <20200713094957.1648405-26-danielhb413@gmail.com> In-Reply-To: <20200713094957.1648405-1-danielhb413@gmail.com> References: <20200713094957.1648405-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This document describes briefly how Libvirt migration internals works, complementing the info available in migration.html.in. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- docs/kbase/migrationinternals.rst | 174 ++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 docs/kbase/migrationinternals.rst diff --git a/docs/kbase/migrationinternals.rst b/docs/kbase/migrationintern= als.rst new file mode 100644 index 0000000000..869ee99bd7 --- /dev/null +++ b/docs/kbase/migrationinternals.rst @@ -0,0 +1,174 @@ +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D +Libvirt migration internals +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D + +.. contents:: + +Migration is a multi-step operation with at least two distinct actors, +the source and the destination libvirtd daemons, and a lot of failure +points. This document describes the basic migration workflow in the +code level, as a way to complement `the base migration docs `_ +and help developers to get up to speed quicker with the code. + +In this document, unless stated otherwise, these conventions are followed: + +* 'user' refers to any entity that initiates a migration, regardless of be= ing + an human using 'virsh' or a program consuming the Libvirt API; + +* 'source' refers to the source host of the migration, where the guest cur= rently + exists; + +* 'destination' refers to the destination host of the migration. As of + Libvirt 6.5.0 local migration isn't supported, thus source and destinati= on + refers to different hosts; + +* 'libvirt client' refers to the Libvirt client process that controls the + migration flow, e.g. virsh. Note that this client process can reside in + any host; + +* 'regular migration' refers to any migration operation where the libvirt + client co-ordinates the communication between the libvirtd instances in + the source and destination hosts. + +Migration protocol +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Libvirt works with three migrations protocols. Preference is given to +protocol version 3, falling back to older versions if source and destinati= on +can't handle version 3. Version 3 has been around since at least 2014, when +virDomainMigrate3 was moved to libvirt-domain.c by commit 67c08fccdcad, +meaning that it's safe to assume that users today are capable of always ru= nning +this protocol. + +Version 3 protocol sequence +--------------------------- + +The sequence of events in the migration protocol version 3, considering a +regular migration, is: + +1) in the source, generate the domain XML to pass to the destination. This +step is called "Begin"; + +2) in the destination, prepare the host to accept the incoming VM from the +source. This step is called "Prepare"; + +3) the source then starts the migration of the guest and waits for complet= ion. +This is called "Perform"; + +4) destination waits for the migration to be completed, checking if it was= successful +or not. The guest is killed in case of failure. This step is called "Finis= h"; + +5) the source checks the results of the migration process, killing the gue= st +if successful or resuming it if it failed. This is called "Confirm". + +In steps 1, 2, 3 and 4, an optional migration cookie can be generated and = passed +to source or destination. This cookie contains extra information that info= rms +about extra settings or configuration required during the process. + +The name of each step and the version of the protocol is used to name the = driver +interfaces that implements the logic. The steps above are implemented by t= he +following interfaces: + +1) Begin version 3: ``domainMigrateBegin3()`` and ``domainMigrateBegin3Pa= rams()`` +2) Prepare version 3: ``domainMigratePrepare3()`` and ``domainMigratePrepa= re3Params()`` +3) Perform version 3: ``domainMigratePerform3()`` and ``domainMigratePerfo= rm3Params()`` +4) Finish version 3: ``domainMigrateFinish3()`` and ``domainMigrateFinish3= Params()`` +5) Confirm version 3: ``domainMigrateConfirm3()`` and ``domainMigrateConfi= rm3Params()`` + + +"virsh migrate" entry point +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D + +When an user executes a "virsh migrate" command, virsh-domain.c calls ``cm= dMigrate()``. +A virThread is created with the ``doMigrate`` worker. After validation of = flags and +parameters, one of these functions will be executed: + +* if ``VIR_MIGRATE_PEER2PEER`` is set (i.e. --p2p was passed to virsh migr= ate), or + --direct was passed as parameter, ``virDomainMigrateToURI3()`` is called; + +* for all other cases, regular migration is assumed and execution goes + to ``virDomainMigrate3()``. + +virDomainMigrate3 function +-------------------------- + +``virDomainMigrate3()`` overall logic is: + +* if VIR_MIGRATE_PEER2PEER is set, error out and tell the user that this c= ase must + be handled via ``virDomainMigrateToURI3()`` + +* if VIR_MIGRATE_OFFLINE is set, check if both source and destination supp= orts it; + +* VIR_MIGRATE_CHANGE_PROTECTION is set, check if the source host supports = it; + +* check if the source and the destination driver supports VIR_DRV_FEATURE_= MIGRATION_PARAMS. + In this case, forward execution to ``virDomainMigrateVersion3Params()``; + +* proceed to check for a suitable migration protocol in both source and de= stination + drivers. The preference is to use migration protocol v3, via + ``virDomainMigrateVersion3()``, falling back to older versions if needed. + +Both ``virDomainMigrateVersion3()`` and ``virDomainMigrateVersion3Params()= `` +are wrappers of ``virDomainMigrateVersion3Full()``, where the logic of the +regular migration is executed from step 1 (Begin) to 5 (Confirm). + +virDomainMigrateToURI3 function +------------------------------- + +While ``virDomainMigrate3()`` handles regular migration cases, ``virDomain= MigrateToURI3()`` +takes care of peer-2-peer and direct migration scenarios. The function doe= s flags +validation and then calls ``virDomainMigrateUnmanagedParams()``. At this p= oint, +more checkings are made and then: + +* if VIR_MIGRATE_PEER2PEER is set and the source supports extensible param= eters + (tested via VIR_DRV_FEATURE_MIGRATION_PARAMS support), ``domainMigratePe= rform3Params()`` + API of the hypervisor driver is called; + +* for all other cases, ``virDomainMigrateUnmanagedProto3()`` is called. Th= is function does + additional checkings and then calls ``domainMigratePerform3()`` API of t= he hypervisor + driver. + +For both cases, the execution ends in the same API that handles the third = step (Perform) +of the regular migration sequence. It's up for each hypervisor driver impl= ementation to +differ when the API is being called from a regular or a peer-2-peer/direct= migration. + +QEMU driver specifics +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The QEMU driver supports migration protocol version 2 and 3. Here's a list= of +version 3 APIs that were discussed in this document that QEMU implements, +which can be found in src/qemu/qemu_driver.c: + +:: + + .domainMigrateBegin3 =3D qemuDomainMigrateBegin3, /* 0.9.2 */ + .domainMigratePrepare3 =3D qemuDomainMigratePrepare3, /* 0.9.2 */ + .domainMigratePerform3 =3D qemuDomainMigratePerform3, /* 0.9.2 */ + .domainMigrateFinish3 =3D qemuDomainMigrateFinish3, /* 0.9.2 */ + .domainMigrateConfirm3 =3D qemuDomainMigrateConfirm3, /* 0.9.2 */ + + .domainMigrateBegin3Params =3D qemuDomainMigrateBegin3Params, /* 1.1.0 */ + .domainMigratePrepare3Params =3D qemuDomainMigratePrepare3Params, /* 1.1= .0 */ + .domainMigratePerform3Params =3D qemuDomainMigratePerform3Params, /* 1.1= .0 */ + .domainMigrateFinish3Params =3D qemuDomainMigrateFinish3Params, /* 1.1.0= */ + .domainMigrateConfirm3Params =3D qemuDomainMigrateConfirm3Params, /* 1.1= .0 */ + +All implementations have a 'Params' variation that handles the case where = the +source and destationation can handle the extensible parameters API +(VIR_DRV_FEATURE_MIGRATION_PARAMS), but both versions calls out the same +inner function: + +* ``qemuDomainMigrateBegin3()`` and ``qemuDomainMigrateBegin3Params()`` use + ``qemuMigrationSrcBegin()``; + +* ``qemuDomainMigratePrepare3()`` and ``qemuDomainMigratePrepare3Params()`= ` use + ``qemuMigrationDstPrepareDirect()``; + +* ``qemuDomainMigratePerform3()`` and ``qemuDomainMigratePerform3Params()`= ` use + ``qemuMigrationSrcPerform()`` + +* ``qemuDomainMigrateFinish3()`` and ``qemuDomainMigrateFinish3Params()`` = use + ``qemuMigrationDstFinish()`` + +* ``qemuDomainMigrateConfirm3()`` and ``qemuDomainMigrateConfirm3Params()`= ` use + ``qemuMigrationSrcConfirm()`` --=20 2.26.2