From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421039; cv=none; d=zohomail.com; s=zohoarc; b=G7OOmcGOFgdmvdZ2Pob06N+gBmgM3a24v50PdYi992AbKQTLJJLC2jP0It/Mtn61dFS2L24It/DZqScOWZtMsq5nvDaSJWdB4zH6bpVvcYoD2mgn+Ua+GUwc6fTxz8466InTljM6OvLoglb37vGf4uj7XctdyT7Bf25iWtTc97k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421039; h=Content-Type:Content-Transfer-Encoding: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=y0/5yqnN+oZD3yY2UcbTemuqB+zh7v2M5V2onGtJXss=; b=I1RdwlkjrYArDbNBIUVsW7Wdpxu/b4g1rLIoXkgUbn+BOmKitmmiABWRYaD+l4bOyOTa6tcx/VTjCcTJyLxt4ddlqJy3fY/z4bUYIGRiB7LjnfQO885BC/BeZhVxQLRFD6eTm8c/2XMEiy/aU2V0aeQXkT1NseVhOulQlDoRFOY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639421039515423.2620076663193; Mon, 13 Dec 2021 10:43:59 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-399-E_VqUCp9MaCNXGihRN0WXw-1; Mon, 13 Dec 2021 13:43:54 -0500 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 8E5A01006ACD; Mon, 13 Dec 2021 18:43:45 +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 0B2ED78C2B; Mon, 13 Dec 2021 18:43: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 CB3594A70B; Mon, 13 Dec 2021 18:43:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhGcS003800 for ; Mon, 13 Dec 2021 13:43:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 014DD60C04; Mon, 13 Dec 2021 18:43:16 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7CB4F6107E for ; Mon, 13 Dec 2021 18:43:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421038; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=y0/5yqnN+oZD3yY2UcbTemuqB+zh7v2M5V2onGtJXss=; b=XWbk62rNErTp/CLBr7pHN/u1pjOrB7hOO1UfJXWd0iVIeUzSyyIv7pYUypPeb/PRYbBjVa fe1kBk4bFQ62quZpDXLi04pKNsNIXuqiSiz8plJcwQ3OePf3OBWlWT3ZyR4xZ6Mnl57Q+F RMnIcQYMHPc9Y6SyJR94bpDdsWW9zWQ= X-MC-Unique: E_VqUCp9MaCNXGihRN0WXw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 01/20] openvz: refactor openvzExtractVersionInfo Date: Mon, 13 Dec 2021 19:42:53 +0100 Message-Id: <4557ed7e621049144cc82a643f08bbef4ad83f42.1639420923.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421041142100004 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/openvz/openvz_conf.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index 4fb18c03ee..53170a720b 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -66,11 +66,10 @@ strtoI(const char *str) static int openvzExtractVersionInfo(const char *cmdstr, int *retversion) { - int ret =3D -1; unsigned long version; - char *help =3D NULL; + g_autofree char *help =3D NULL; char *tmp; - virCommand *cmd =3D virCommandNewArgList(cmdstr, "--help", NULL); + g_autoptr(virCommand) cmd =3D virCommandNewArgList(cmdstr, "--help", N= ULL); =20 if (retversion) *retversion =3D 0; @@ -79,27 +78,21 @@ openvzExtractVersionInfo(const char *cmdstr, int *retve= rsion) virCommandSetOutputBuffer(cmd, &help); =20 if (virCommandRun(cmd, NULL) < 0) - goto cleanup; + return -1; =20 tmp =3D help; =20 /* expected format: vzctl version .. */ if ((tmp =3D STRSKIP(tmp, "vzctl version ")) =3D=3D NULL) - goto cleanup; + return -1; =20 if (virParseVersionString(tmp, &version, true) < 0) - goto cleanup; + return -1; =20 if (retversion) *retversion =3D version; =20 - ret =3D 0; - - cleanup: - virCommandFree(cmd); - VIR_FREE(help); - - return ret; + return 0; } =20 int openvzExtractVersion(struct openvz_driver *driver) --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421014; cv=none; d=zohomail.com; s=zohoarc; b=bqDN9YfomdgXCe4rLEYtF8Wm8cYW/iQi8mw+N5fcmy4Po4QwddJtboUG8REC76hgB3yQPWnemZcF1HQliqQInUFVQKCzGlLMiu+iMOgv04vfQUXF8FiGMRKtOv9phRhisklnmy0rti71vOCc4xt+TbUmPyN9oBLK0h5o7srjlvM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421014; h=Content-Type:Content-Transfer-Encoding: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=JxMICRRESsXR/gI3ZtM+6M+YxFpY3OvvFTA64/6b3lg=; b=Lr4ySyULDciMSr3WfPGMn75F1FCLBhMVnU1DwE/0gAXaFUes9hxiBkzvLRvRm1PkGY/sb4AWQbyjtJjEjXQj/8LdQDjNxO85av+31xCzqJqHGXgaJGpzfvkjtDzuuI26LeMBWKp2LYVslLS50jqzoBRDNflHc2+hU+PbGxzciKE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639421014563535.9530476133478; Mon, 13 Dec 2021 10:43:34 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-527-3K26RxFeNmmN95UHt5W1NA-1; Mon, 13 Dec 2021 13:43:31 -0500 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 908505F9E4; Mon, 13 Dec 2021 18:43: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 DD0FD6107E; Mon, 13 Dec 2021 18:43: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 13C5F4CA9B; Mon, 13 Dec 2021 18:43:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhGuZ003805 for ; Mon, 13 Dec 2021 13:43:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id C7F5960C9F; Mon, 13 Dec 2021 18:43:16 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4FB1060C04 for ; Mon, 13 Dec 2021 18:43:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421013; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=JxMICRRESsXR/gI3ZtM+6M+YxFpY3OvvFTA64/6b3lg=; b=Uk4SksJpE9p7uX/2UtFgOt1fTYjIxqXihs+QH0gJHFHk9heVuFqiuHju3bvCgJDel9YQkj HqUjgOmhV/DymJp9SwCSlavIrWFeBiNDWcuvfzSw1gJ7EotjYXFy1rRzmdwVOkY1w7V98D KO2ENREwGOcNBqkRe/62FNby7q2kkaE= X-MC-Unique: 3K26RxFeNmmN95UHt5W1NA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 02/20] openvz: refactor openvzLoadDomains Date: Mon, 13 Dec 2021 19:42:54 +0100 Message-Id: <20a255f45e17384df3d700749bd01a80f435c48c.1639420923.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421015702100002 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/openvz/openvz_conf.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index 53170a720b..94c3baf87f 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -440,10 +440,10 @@ int openvzLoadDomains(struct openvz_driver *driver) char uuidstr[VIR_UUID_STRING_BUFLEN]; virDomainObj *dom =3D NULL; g_autoptr(virDomainDef) def =3D NULL; - char *temp =3D NULL; - char *outbuf =3D NULL; + g_autofree char *temp =3D NULL; + g_autofree char *outbuf =3D NULL; char *line; - virCommand *cmd =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; unsigned int vcpus =3D 0; =20 if (openvzAssignUUIDs() < 0) @@ -452,7 +452,7 @@ int openvzLoadDomains(struct openvz_driver *driver) cmd =3D virCommandNewArgList(VZLIST, "-a", "-ovpsid,status", "-H", NUL= L); virCommandSetOutputBuffer(cmd, &outbuf); if (virCommandRun(cmd, NULL) < 0) - goto cleanup; + return -1; =20 line =3D outbuf; while (line[0] !=3D '\0') { @@ -462,12 +462,12 @@ int openvzLoadDomains(struct openvz_driver *driver) (line =3D strchr(status, '\n')) =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to parse vzlist output")); - goto cleanup; + return -1; } *line++ =3D '\0'; =20 if (!(def =3D virDomainDefNew(driver->xmlopt))) - goto cleanup; + return -1; =20 def->virtType =3D VIR_DOMAIN_VIRT_OPENVZ; =20 @@ -483,7 +483,7 @@ int openvzLoadDomains(struct openvz_driver *driver) if (ret =3D=3D -1) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("UUID in config file malformed")); - goto cleanup; + return -1; } =20 def->os.type =3D VIR_DOMAIN_OSTYPE_EXE; @@ -494,7 +494,7 @@ int openvzLoadDomains(struct openvz_driver *driver) virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not read config for container %d"), veid); - goto cleanup; + return -1; } else if (ret > 0) { vcpus =3D strtoI(temp); } @@ -503,10 +503,10 @@ int openvzLoadDomains(struct openvz_driver *driver) vcpus =3D virHostCPUGetCount(); =20 if (virDomainDefSetVcpusMax(def, vcpus, driver->xmlopt) < 0) - goto cleanup; + return -1; =20 if (virDomainDefSetVcpus(def, vcpus) < 0) - goto cleanup; + return -1; =20 /* XXX load rest of VM config data .... */ =20 @@ -524,7 +524,7 @@ int openvzLoadDomains(struct openvz_driver *driver) driver->xmlopt, flags, NULL))) - goto cleanup; + return -1; =20 if (STREQ(status, "stopped")) { virDomainObjSetState(dom, VIR_DOMAIN_SHUTOFF, @@ -542,17 +542,7 @@ int openvzLoadDomains(struct openvz_driver *driver) dom =3D NULL; } =20 - virCommandFree(cmd); - VIR_FREE(temp); - VIR_FREE(outbuf); - return 0; - - cleanup: - virCommandFree(cmd); - VIR_FREE(temp); - VIR_FREE(outbuf); - return -1; } =20 static int --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421039; cv=none; d=zohomail.com; s=zohoarc; b=ZT2P3Jir3PuCKesngHFHOKgFHboRhYBl7OceZZ3WV0GVQ4G73Bv8IvQyzg0bwht0C/2v0SkeVOadAXqDx+P/gt8/7+P1ppOs/Uh5fTrwRoNRTt5+4tpD4BOOTuCs2YeG/lPqDjSKy1I34cYaUkJU8S7drjLBTTy9WOunQQJxExw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421039; h=Content-Type:Content-Transfer-Encoding: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=ZlRTAWh7gDBEcun9CblEVaZUJ57u4xsCWBBtGhQCajg=; b=gl2u0hbCY1LHfDe+aK9EYojP9XsiTTEKsOnZWhhbVeKrdhxsohxhLJCeu3DGnvsOEIjFTfzRav1TpIkRmzzjiDiHe6to5GVXvtDLw/p6G8+H8CoGy+CcKS9n5C4SZS4BvtmOB0/4P1748fxGmQypTD4gsCFEwBiaVSHReSvVvos= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639421039194179.6384176950936; Mon, 13 Dec 2021 10:43:59 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-481-RLlt9Hr8OUOF1vBW3fWLog-1; Mon, 13 Dec 2021 13:43:56 -0500 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 9EA9E802C98; Mon, 13 Dec 2021 18:43:48 +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 DCC0D6F129; Mon, 13 Dec 2021 18:43: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 AA104180B617; Mon, 13 Dec 2021 18:43:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhHM5003813 for ; Mon, 13 Dec 2021 13:43:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9A8C760C04; Mon, 13 Dec 2021 18:43:17 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 221DE60C9F for ; Mon, 13 Dec 2021 18:43:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421038; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ZlRTAWh7gDBEcun9CblEVaZUJ57u4xsCWBBtGhQCajg=; b=MOhPO4Xk6USj0U4QC5l29uld3fv5utgR3qbX9hny9gO6BA1tSRjjTMaB7Wy+9LWyrSZdaT 2lbwkauojtC27UA4E6Z/jB5AYIh2yiCZX8mAWQXZdDbTKhXF0tPmMBvLjXHN//OzpE8C3q bG6OPuBI1jPN79COhvH6hqJY82EgUEY= X-MC-Unique: RLlt9Hr8OUOF1vBW3fWLog-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 03/20] openvz: refactor openvzGetVEID Date: Mon, 13 Dec 2021 19:42:55 +0100 Message-Id: <16fd30600c3b2c4b4317e736f3526867bc2ac140.1639420923.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421041127100003 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/openvz/openvz_conf.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index 94c3baf87f..d2acbc2606 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -978,23 +978,18 @@ static int openvzAssignUUIDs(void) =20 int openvzGetVEID(const char *name) { - virCommand *cmd; - char *outbuf; + g_autoptr(virCommand) cmd =3D NULL; + g_autofree char *outbuf =3D NULL; char *temp; int veid; bool ok; =20 cmd =3D virCommandNewArgList(VZLIST, name, "-ovpsid", "-H", NULL); virCommandSetOutputBuffer(cmd, &outbuf); - if (virCommandRun(cmd, NULL) < 0) { - virCommandFree(cmd); - VIR_FREE(outbuf); + if (virCommandRun(cmd, NULL) < 0) return -1; - } =20 - virCommandFree(cmd); ok =3D virStrToLong_i(outbuf, &temp, 10, &veid) =3D=3D 0 && *temp =3D= =3D '\n'; - VIR_FREE(outbuf); =20 if (ok && veid >=3D 0) return veid; --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421014; cv=none; d=zohomail.com; s=zohoarc; b=O7fcPWzz0JA0as3dYCwpcz/7L8sFSDWFfqoaxYBJipQGXBi6gmShFn8CTLkW5HwkNkMluTVDpqrcFNqfmOiblIBTvWOuaZ5HG25TMTjzmBU9wFzRt8c+bK71Y9Cgngyr48k4Jjeod2ZOE+lnP+0mogvVyBnx53pJPmg9iVDMdtE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421014; h=Content-Type:Content-Transfer-Encoding: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=ZMHSkurioLQQXW7TjkvrdTHBB3mj/7OXwDQFhtWtGlg=; b=jZ8G/mjUHanjI7EyXZe5q9hMlSVMTcUDuYzDEUMl0Bu6nFzE9IfDKabbbpLUEu/531eaiYH0LGlRqAUE58+bVUiiKHX56oXiF3B6hv6O99NDZvtafoiEnFtBxcMs43K0bFIi+I0RA2GNPi3SkGaWh1ERFCXb2LBjwaJnFG5JspA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639421014324745.2902037392613; Mon, 13 Dec 2021 10:43:34 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-529-DIfURqPGMNmFi498RCMu2g-1; Mon, 13 Dec 2021 13:43:31 -0500 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 4F909102CB76; Mon, 13 Dec 2021 18:43:25 +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 CEBF76107F; Mon, 13 Dec 2021 18:43: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 13A334CA93; Mon, 13 Dec 2021 18:43:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhIt5003820 for ; Mon, 13 Dec 2021 13:43:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6D8AF60C17; Mon, 13 Dec 2021 18:43:18 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id E922D60C04 for ; Mon, 13 Dec 2021 18:43:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421013; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ZMHSkurioLQQXW7TjkvrdTHBB3mj/7OXwDQFhtWtGlg=; b=cc12NH1ya/ONm9XHzl+PAt5WhIJgfxsLk0D2EKh+sC1mzMFg4rsQeVC4KutH6J2vsIGB8g 6O5DTuWI17dcWu83JJwSBoDPke7+qt1o4GC4u65y6WOVoByFS5puOqzAocrRn89WX7nX9V +IdIh5eMvJpSogRvDsls1T8NhN3CSjs= X-MC-Unique: DIfURqPGMNmFi498RCMu2g-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 04/20] openvz: refactor openvzDomainDefineCmd Date: Mon, 13 Dec 2021 19:42:56 +0100 Message-Id: <4cbd4615a28a18509cec8b7debaeb77bed18165e.1639420923.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421015648100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/openvz/openvz_driver.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index ce3262c0e2..efd334a235 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -118,15 +118,14 @@ openvzDomObjFromDomain(struct openvz_driver *driver, static virCommand * openvzDomainDefineCmd(virDomainDef *vmdef) { - virCommand *cmd =3D virCommandNewArgList(VZCTL, - "--quiet", - "create", - NULL); + g_autoptr(virCommand) cmd =3D virCommandNewArgList(VZCTL, + "--quiet", + "create", + NULL); =20 if (vmdef =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Container is not defined")); - virCommandFree(cmd); return NULL; } =20 @@ -137,7 +136,7 @@ openvzDomainDefineCmd(virDomainDef *vmdef) virCommandAddArgList(cmd, "--ostemplate", vmdef->fss[0]->src, NULL= ); } =20 - return cmd; + return g_steal_pointer(&cmd); } =20 =20 --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421031; cv=none; d=zohomail.com; s=zohoarc; b=WvDRVIhalN0O5WKAFXw/VasWEFmoUV2+b1ZQl500zxQk4aaXNbACwvfk8vJplMF6b3PsDzwKb+mnUZp2O9ihXtrTeAAE56/xCn0iOZmoPTibwpL4PbyLa/77GEvc0KtoIwCn7cGsnLD9dGcrVQKtrnfGaJ0T9Ivwr3iiDk7pOlA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421031; h=Content-Type:Content-Transfer-Encoding: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=q13jB0dwuQCwIS4RburTbA4stMI7HlVJsp0LJaHUKlw=; b=KNNayTrTa2SEybjKlbOdDjc7yYpxNBelHv7I3qZaIXU3p9UwTVp9VgJrCmQsEAShUJfKXpVXyKBME5ieiDxXuCuR+eeOW7ZakshWNpZI/HIOgTRFEiYz17eikrYxWFwVEIUCGzZswsOHeWwGweBdV01eUsxmzxRrnujyh5MzSa8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1639421031264274.5642867023562; Mon, 13 Dec 2021 10:43:51 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-556-erDn42FcNTuKZ0naSRqCWg-1; Mon, 13 Dec 2021 13:43:46 -0500 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 3CEB16408E; Mon, 13 Dec 2021 18:43: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 1153B5E26C; Mon, 13 Dec 2021 18:43: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 D68944A700; Mon, 13 Dec 2021 18:43:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhJIP003828 for ; Mon, 13 Dec 2021 13:43:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3FC8260C9F; Mon, 13 Dec 2021 18:43:19 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB90360C04 for ; Mon, 13 Dec 2021 18:43:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421030; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=q13jB0dwuQCwIS4RburTbA4stMI7HlVJsp0LJaHUKlw=; b=Fi8dEtz+uTq4yEB1qVTmrGWwiQIkwqrQY/anPsH6Gk5r6zJZ+sLbCf1LimCMruenGlTPCk AHe7oa5WNtTiWzpMwm2P3w9bdfqf++3HnRmMfq2G/6Bp/pc0dTJt7uUy+1o2yG3bUQZXyT bEsDIW7bjH3Zr0zQyOS1TNLuz/BhvSg= X-MC-Unique: erDn42FcNTuKZ0naSRqCWg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 05/20] openvz: refactor openvzSetInitialConfig Date: Mon, 13 Dec 2021 19:42:57 +0100 Message-Id: <42b48736d6896050e8a3eee5069475aefbd3705f.1639420923.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421033126100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/openvz/openvz_driver.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index efd334a235..c4fa83f4c6 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -142,14 +142,12 @@ openvzDomainDefineCmd(virDomainDef *vmdef) =20 static int openvzSetInitialConfig(virDomainDef *vmdef) { - int ret =3D -1; int vpsid; - virCommand *cmd =3D NULL; =20 if (vmdef->nfss > 1) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("only one filesystem supported")); - goto cleanup; + return -1; } =20 if (vmdef->nfss =3D=3D 1 && @@ -158,7 +156,7 @@ static int openvzSetInitialConfig(virDomainDef *vmdef) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("filesystem is not of type 'template' or 'mount'"= )); - goto cleanup; + return -1; } =20 =20 @@ -169,32 +167,27 @@ static int openvzSetInitialConfig(virDomainDef *vmdef) if (virStrToLong_i(vmdef->name, NULL, 10, &vpsid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not convert domain name to VEID")); - goto cleanup; + return -1; } =20 if (openvzCopyDefaultConfig(vpsid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not copy default config")); - goto cleanup; + return -1; } =20 if (openvzWriteVPSConfigParam(vpsid, "VE_PRIVATE", vmdef->fss[0]->= src->path) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not set the source dir for the filesys= tem")); - goto cleanup; + return -1; } } else { - cmd =3D openvzDomainDefineCmd(vmdef); + g_autoptr(virCommand) cmd =3D openvzDomainDefineCmd(vmdef); if (virCommandRun(cmd, NULL) < 0) - goto cleanup; + return -1; } =20 - ret =3D 0; - - cleanup: - virCommandFree(cmd); - - return ret; + return 0; } =20 =20 --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421040; cv=none; d=zohomail.com; s=zohoarc; b=lIkXCC9OClInV3Ox7ARgtb7XRcgqwSFSGjmssNr/1zRsSTlrAD8LtXNsiIMVubVE+SH+bqa8sh6fOxCa9j8wvxg0zt+dQ1GmD0z1Qx9r/DuacNXSOT9xbduxpCcMjSl1Un2a9uwE+GI0TE7jTEoptLY6ypQLk75B4jFmdyVVMJk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421040; h=Content-Type:Content-Transfer-Encoding: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=KPwmiadrLF8AS7DloUp93BN6Goe/QA/QciDk2sJGiNE=; b=DSYksT5el1WUqlYTWxV6v9S0nwD/errUCE7x2JXdvPlkCsuoipmqoob3fWntm2R7LziUTWkNSVKbJHl58wtuLzZ3yFBXBMLD5EzFzR9J92X8/ILXA6S7jC8LOtGEpjbkEv5tnONoB1PT5an+LGYKyHVsRMWR/dGB8yK0ShYYae0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1639421040092874.5918862144586; Mon, 13 Dec 2021 10:44:00 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-226-n7dXcU3WPXaXOIV9mE_3AA-1; Mon, 13 Dec 2021 13:43:55 -0500 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 DEF21185303C; Mon, 13 Dec 2021 18:43:44 +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 C361B45D8F; Mon, 13 Dec 2021 18:43:44 +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 5D0DD1809CBA; Mon, 13 Dec 2021 18:43:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhKBb003835 for ; Mon, 13 Dec 2021 13:43:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1290E60C17; Mon, 13 Dec 2021 18:43:20 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E3C560C04 for ; Mon, 13 Dec 2021 18:43:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421039; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=KPwmiadrLF8AS7DloUp93BN6Goe/QA/QciDk2sJGiNE=; b=i3gAho1X3RO0NAhqQ1nCDT8MWaCTTI8HOlxbmqJgNNxro+0XNmrwIKp2jskDDc9odpEclc 8fuajesB4TPmAkU7pfimEnabe8DjNGljhBLND9PBNRii74iDV06l5ffkExLA1FLRFWJF2c seRHeV9Yc0qvjFWCSDYFyZf4hHlsxhg= X-MC-Unique: n7dXcU3WPXaXOIV9mE_3AA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 06/20] openvz: refactor openvzSetDiskQuota Date: Mon, 13 Dec 2021 19:42:58 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421041290100008 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/openvz/openvz_driver.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index c4fa83f4c6..073de66611 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -196,13 +196,12 @@ openvzSetDiskQuota(virDomainDef *vmdef, virDomainFSDef *fss, bool persist) { - int ret =3D -1; unsigned long long sl, hl; - virCommand *cmd =3D virCommandNewArgList(VZCTL, - "--quiet", - "set", - vmdef->name, - NULL); + g_autoptr(virCommand) cmd =3D virCommandNewArgList(VZCTL, + "--quiet", + "set", + vmdef->name, + NULL); if (persist) virCommandAddArg(cmd, "--save"); =20 @@ -220,18 +219,14 @@ openvzSetDiskQuota(virDomainDef *vmdef, } else if (fss->space_soft_limit) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("Can't set soft limit without hard limit")); - goto cleanup; + return -1; } =20 if (virCommandRun(cmd, NULL) < 0) - goto cleanup; + return -1; } =20 - ret =3D 0; - cleanup: - virCommandFree(cmd); - - return ret; + return 0; } =20 =20 --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421046; cv=none; d=zohomail.com; s=zohoarc; b=Jm5+8aqEwF1t5+CuOBV87UGoaX6ty8LLueWtLSo5zRgW0PGjkPYmPLL4LY2cc+lPtJJisz8kM4p2xRt/aawb1Co24sX0sNT2Ek90YcPJKrAjRiydtMVEIiZSwSETz/2QtGtJRD/nfNZnrC81dXwvuyIqB1SfcqEYj6N+RshSl1Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421046; h=Content-Type:Content-Transfer-Encoding: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=veudS6PPA76Fjh8Zv4TpuZ0lZvaJtEEX5c65vBTXzIE=; b=g7IrRgOrr9vMf3HR0PCKwmVOZzg+VzgIGD2NDnD+vV2vExqbxm/eMiSef0KiPnungW988lmov7qEs9p/lqWxOGtRPtXAHdzvGIN6XaKM6j6/2htvDH2jglUvYRMirv/FUB+wOSk1tooRgUyOEeF947jIKVpDgSLdv8/nkXoRags= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639421046298100.21051238012683; Mon, 13 Dec 2021 10:44:06 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-371-kZsNAZCIOAqCJUwPwpBjUw-1; Mon, 13 Dec 2021 13:44:00 -0500 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 E187E81EE79; Mon, 13 Dec 2021 18:43:50 +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 8266178C2E; Mon, 13 Dec 2021 18:43: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 421524A70B; Mon, 13 Dec 2021 18:43:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhK8Q003843 for ; Mon, 13 Dec 2021 13:43:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id D8CBD6107E; Mon, 13 Dec 2021 18:43:20 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 609FB60C04 for ; Mon, 13 Dec 2021 18:43:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421045; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=veudS6PPA76Fjh8Zv4TpuZ0lZvaJtEEX5c65vBTXzIE=; b=Rgw/iDuaeRVOsvXoVmJz5Q+OvWXoNxK/xAQfWtQjFc0slVXtGagOwYY8rCe6gK7d0V2YGW sJPPDlLK4OP7/sjY3srXu3l6KrDpf84TYOMfZ9SZnRGR/KXFFMsp41XFyaEN4soo9upzZr xv09kpthib/pAkk0jY+o9tSvrsQ7pvE= X-MC-Unique: kZsNAZCIOAqCJUwPwpBjUw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 07/20] openvz: refactor openvzDomainSetNetwork Date: Mon, 13 Dec 2021 19:42:59 +0100 Message-Id: <75d7f95c1fa02d5e9d0db35b7ffea783a7cbaf06.1639420923.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421046817100003 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/openvz/openvz_driver.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 073de66611..cffdb20898 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -661,13 +661,12 @@ openvzDomainSetNetwork(virConnectPtr conn, const char= *vpsid, virDomainNetDef *net, virBuffer *configBuf) { - int rc =3D -1; char macaddr[VIR_MAC_STRING_BUFLEN]; virMacAddr host_mac; char host_macaddr[VIR_MAC_STRING_BUFLEN]; struct openvz_driver *driver =3D conn->privateData; - virCommand *cmd =3D NULL; - char *guest_ifname =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; + g_autofree char *guest_ifname =3D NULL; =20 if (net =3D=3D NULL) return 0; @@ -703,7 +702,7 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *= vpsid, if (guest_ifname =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not generate eth name for containe= r")); - goto cleanup; + return -1; } } =20 @@ -714,7 +713,7 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *= vpsid, if (net->ifname =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not generate veth name")); - goto cleanup; + return -1; } } =20 @@ -744,23 +743,17 @@ openvzDomainSetNetwork(virConnectPtr conn, const char= *vpsid, =20 /* --ipadd ip */ for (i =3D 0; i < net->guestIP.nips; i++) { - char *ipStr =3D virSocketAddrFormat(&net->guestIP.ips[i]->addr= ess); + g_autofree char *ipStr =3D virSocketAddrFormat(&net->guestIP.i= ps[i]->address); if (!ipStr) - goto cleanup; + return -1; virCommandAddArgList(cmd, "--ipadd", ipStr, NULL); - VIR_FREE(ipStr); } } =20 /* TODO: processing NAT and physical device */ =20 virCommandAddArg(cmd, "--save"); - rc =3D virCommandRun(cmd, NULL); - - cleanup: - virCommandFree(cmd); - VIR_FREE(guest_ifname); - return rc; + return virCommandRun(cmd, NULL); } =20 =20 --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421046; cv=none; d=zohomail.com; s=zohoarc; b=NiuqKLoiPp94RRG9AYLcaCVoSAPLyGfPZGjfiEPfXZU9ryv0o3H9cjB1txleq6XDxkDjHbdkMOTcHFL1FCGjWQ+XDXf/lVQnq2BjMTN38tw+AjkMBgyf93hcVkv5nekM+qAKgs+dZVPAXlATGF3O8aZNwExs7T95USiLZJt7kS4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421046; h=Content-Type:Content-Transfer-Encoding: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=4hbIprY51apggaQB8h2x4y231i2i5KC0GnWxlhhdyC4=; b=iW7rpnnTzJDitnIOCZDHmzSP1uQ1i1JxwK3auyymT6GX0SzVDIjldqI5qoGaRdSYTEG8+kTpzIP1oBJRD88dhF1Yjk2sn3S3JMJ3Cy8PRdFA2sLQWv2Nqc1TKvilhN6mgF5LX8CXtVb47eGwEL1JWzetenEQkkOAPYGIkhvV2sk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1639421046358294.75395029424317; Mon, 13 Dec 2021 10:44:06 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-298-0LE1WWwtNACp6kAZousGAg-1; Mon, 13 Dec 2021 13:44:01 -0500 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 6443B10168FE; Mon, 13 Dec 2021 18:43: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 225C15BE24; Mon, 13 Dec 2021 18:43: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 DFCF01806D1C; Mon, 13 Dec 2021 18:43:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhL4U003862 for ; Mon, 13 Dec 2021 13:43:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id AB88E60C04; Mon, 13 Dec 2021 18:43:21 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 332986107F for ; Mon, 13 Dec 2021 18:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421045; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=4hbIprY51apggaQB8h2x4y231i2i5KC0GnWxlhhdyC4=; b=K9bBvWf1yHOFhXP2X1qzgf9Il/GuwZGMsGVEbszpT2gsA/acWaxF/lj77mn8My+4Na+pki TMICkGH1zYhzQaCQDE1NHiV4v4j6k2tYg1vaYQp7y698xACRQF1o4uLhXUqFICFTyPyDkZ 8DyZVqQ5nHb04hom439+s6YbncF8Yj0= X-MC-Unique: 0LE1WWwtNACp6kAZousGAg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 08/20] openvz: refactor openvzConnectListDomains Date: Mon, 13 Dec 2021 19:43:00 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421046832100004 Use g_auto where possible, reduce scope of some variables and remove pointless ret and rc variables. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/openvz/openvz_driver.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index cffdb20898..fa5ded54ec 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -1334,44 +1334,37 @@ static int openvzConnectListDomains(virConnectPtr c= onn G_GNUC_UNUSED, int *ids, int nids) { int got =3D 0; - int veid; - int outfd =3D -1; - int rc =3D -1; - int ret; - char buf[32]; - char *endptr; - virCommand *cmd =3D virCommandNewArgList(VZLIST, "-ovpsid", "-H", NULL= ); + VIR_AUTOCLOSE outfd =3D -1; + g_autoptr(virCommand) cmd =3D virCommandNewArgList(VZLIST, "-ovpsid", = "-H", NULL); =20 virCommandSetOutputFD(cmd, &outfd); if (virCommandRunAsync(cmd, NULL) < 0) - goto cleanup; + return -1; =20 while (got < nids) { - ret =3D openvz_readline(outfd, buf, 32); - if (!ret) + char *endptr; + char buf[32]; + int veid; + + if (openvz_readline(outfd, buf, 32) =3D=3D 0) break; if (virStrToLong_i(buf, &endptr, 10, &veid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not parse VPS ID %s"), buf); continue; } - ids[got] =3D veid; - got ++; + ids[got++] =3D veid; } =20 if (virCommandWait(cmd, NULL) < 0) - goto cleanup; + return -1; =20 if (VIR_CLOSE(outfd) < 0) { virReportSystemError(errno, "%s", _("failed to close file")); - goto cleanup; + return -1; } =20 - rc =3D got; - cleanup: - VIR_FORCE_CLOSE(outfd); - virCommandFree(cmd); - return rc; + return got; } =20 static int openvzConnectNumOfDomains(virConnectPtr conn) --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421033; cv=none; d=zohomail.com; s=zohoarc; b=CWIY1lLmeusbzFbzYy4MeESTkEydULfxMo2lu3OIZsehrK6eweSxKo1ckogTAEWHg3aR5YR3L/zmiBI6KMbU0+t+ii8t0BIkc5aUn70QT9dSxtPRlCtRX10ST9apuuWVxE9B5wYR0iUa3NOO2JKE7L+SlC03sFvhzFD4enGlU98= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421033; h=Content-Type:Content-Transfer-Encoding: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=6lA1ESJraWRYFgjoxt0EUGwsM+tC1T1/NRO+XL1L5co=; b=MNCWC8fQc+IoRUeD+8JCjYRnWJIwgKe0dWVenaSHT9pgnYD144oPN1dymezxxyXRT57qXcN+mdrew7ByQyXX5Y9eYjMjgGxiormxqkCzdHdEzIz9cK0b1+iaSPv8FC3kR+jv+pTqQQqxnVW91A0GavjEghCyzI/9hA6etSR/Bv4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639421033109160.97752029907087; Mon, 13 Dec 2021 10:43:53 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-527-ZjUfV5jvNE-cU4y49w-BXQ-1; Mon, 13 Dec 2021 13:43:48 -0500 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 30D2C1853028; Mon, 13 Dec 2021 18:43: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 1145F5F70B; Mon, 13 Dec 2021 18:43: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 D36224A7CD; Mon, 13 Dec 2021 18:43:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhMUg003872 for ; Mon, 13 Dec 2021 13:43:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7E3E860C04; Mon, 13 Dec 2021 18:43:22 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 05A5A60C9F for ; Mon, 13 Dec 2021 18:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421032; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=6lA1ESJraWRYFgjoxt0EUGwsM+tC1T1/NRO+XL1L5co=; b=C0UR/Lh4k5jpthqhalsKdEXGJndygs9LSKtXGv0QxZGNlG0xICyBJHuWoELHJ2pASDE3KP 22wegPTQvtZy645ZzreqnQh44kl0/QDkkZy8UmiqhBh1OmHachV5UiwY3bO4xXZ7FCHFcn 5U2U+zsvF1jeD73re8hNB7uu890sKxw= X-MC-Unique: ZjUfV5jvNE-cU4y49w-BXQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 09/20] openvz: refactor openvzConnectListDefinedDomains Date: Mon, 13 Dec 2021 19:43:01 +0100 Message-Id: <55c3f9701878cbdddf0616ad96d6cbaa53402aba.1639420923.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421033556100005 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/openvz/openvz_driver.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index fa5ded54ec..f1ee540a8b 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -1382,22 +1382,23 @@ static int openvzConnectNumOfDomains(virConnectPtr = conn) static int openvzConnectListDefinedDomains(virConnectPtr conn G_GNUC_UNUSE= D, char **const names, int nnames)= { int got =3D 0; - int veid, outfd =3D -1, ret; - int rc =3D -1; - char vpsname[32]; - char buf[32]; - char *endptr; - virCommand *cmd =3D virCommandNewArgList(VZLIST, - "-ovpsid", "-H", "-S", NULL); + VIR_AUTOCLOSE outfd =3D -1; + int ret =3D -1; + g_autoptr(virCommand) cmd =3D virCommandNewArgList(VZLIST, + "-ovpsid", "-H", "-S"= , NULL); =20 /* the -S options lists only stopped domains */ virCommandSetOutputFD(cmd, &outfd); if (virCommandRunAsync(cmd, NULL) < 0) - goto out; + goto cleanup; =20 while (got < nnames) { - ret =3D openvz_readline(outfd, buf, 32); - if (!ret) + char vpsname[32]; + char buf[32]; + char *endptr; + int veid; + + if (openvz_readline(outfd, buf, 32) =3D=3D 0) break; if (virStrToLong_i(buf, &endptr, 10, &veid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -1405,27 +1406,24 @@ static int openvzConnectListDefinedDomains(virConne= ctPtr conn G_GNUC_UNUSED, continue; } g_snprintf(vpsname, sizeof(vpsname), "%d", veid); - names[got] =3D g_strdup(vpsname); - got ++; + names[got++] =3D g_strdup(vpsname); } =20 if (virCommandWait(cmd, NULL) < 0) - goto out; + goto cleanup; =20 if (VIR_CLOSE(outfd) < 0) { virReportSystemError(errno, "%s", _("failed to close file")); - goto out; + goto cleanup; } =20 - rc =3D got; - out: - VIR_FORCE_CLOSE(outfd); - virCommandFree(cmd); - if (rc < 0) { + ret =3D got; + cleanup: + if (ret < 0) { for (; got >=3D 0; got--) VIR_FREE(names[got]); } - return rc; + return ret; } =20 static int openvzGetProcessInfo(unsigned long long *cpuTime, int vpsid) --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421039; cv=none; d=zohomail.com; s=zohoarc; b=hLeLaw2Z+/eN9HJjegqCLhAYhLPIzZvLR20/V24zS6S4qvQNoi/OMbs3WJnLOGoS86gCztZb+JwpYIuDTa+Q5GuWgUQRgJs3f5gYAe7dzW1HoyI1llgQLTso2d2YCPlgYqVjvzengtxKVCeyAhzyJCS6JjiWife3evDmApBpTL4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421039; h=Content-Type:Content-Transfer-Encoding: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=HDwVzT3rKVz5b2nCoT53xSbifv0DwsIDwQEjMubq2/A=; b=DktQQ1yi0KLX4UV0kceehxariSIiEgw6+Sj+DF6xlvGBNmAonGIYBTkBpDwDsx1/SdICv+P+LNwMFAkRluoxD/pS3I8/Gl6OA/4xwUK9Y2UAfoNlOneWMRtEeFSlO71ETYddaYxjAGwSmtRLHJmF7jEsZ2MCJn+AZWcogQ1dUtE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639421039569864.2751923399906; Mon, 13 Dec 2021 10:43:59 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-421-wV-XucRxPo668OcC27lTtA-1; Mon, 13 Dec 2021 13:43:56 -0500 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 C4CDE64A7C; Mon, 13 Dec 2021 18:43:48 +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 7C6C9610AE; Mon, 13 Dec 2021 18:43: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 4191B1806D2B; Mon, 13 Dec 2021 18:43:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhNTx003879 for ; Mon, 13 Dec 2021 13:43:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id 504976107F; Mon, 13 Dec 2021 18:43:23 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC8BE60C04 for ; Mon, 13 Dec 2021 18:43:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421038; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=HDwVzT3rKVz5b2nCoT53xSbifv0DwsIDwQEjMubq2/A=; b=UTFDK7OVoLXg7Ps/A9h8zmQ3oTdzupyjn3lh/0TIh95cZlrCo1oxceZgERyTIBrczx3yAO j/PBmB7pDRjQOo5UqoyTWSGRBQxkhIoWgUnwTLYCB7FLrC3kxmg3XLPxmUgfl0SpnfbeQL aa8P5g13E5TkyjQVm5PeZi9YBYs7qyQ= X-MC-Unique: wV-XucRxPo668OcC27lTtA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 10/20] openvz: refactor openvzDomainGetBarrierLimit Date: Mon, 13 Dec 2021 19:43:02 +0100 Message-Id: <6daa8f4dea3cc927022c84fe126cd3eb5763642d.1639420923.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421041181100005 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/openvz/openvz_driver.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index f1ee540a8b..345c31304a 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -1515,37 +1515,33 @@ openvzDomainGetBarrierLimit(virDomainPtr domain, unsigned long long *barrier, unsigned long long *limit) { - int ret =3D -1; - char *endp, *output =3D NULL; + char *endp; + g_autofree char *output =3D NULL; const char *tmp; - virCommand *cmd =3D virCommandNewArgList(VZLIST, "--no-header", NULL); + g_autoptr(virCommand) cmd =3D virCommandNewArgList(VZLIST, "--no-heade= r", NULL); =20 virCommandSetOutputBuffer(cmd, &output); virCommandAddArgFormat(cmd, "-o%s.b,%s.l", param, param); virCommandAddArg(cmd, domain->name); if (virCommandRun(cmd, NULL) < 0) - goto cleanup; + return -1; =20 tmp =3D output; virSkipSpaces(&tmp); if (virStrToLong_ull(tmp, &endp, 10, barrier) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Can't parse limit from vzlist output '%s'"), out= put); - goto cleanup; + return -1; } tmp =3D endp; virSkipSpaces(&tmp); if (virStrToLong_ull(tmp, &endp, 10, limit) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Can't parse barrier from vzlist output '%s'"), o= utput); - goto cleanup; + return -1; } =20 - ret =3D 0; - cleanup: - VIR_FREE(output); - virCommandFree(cmd); - return ret; + return 0; } =20 =20 --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421048; cv=none; d=zohomail.com; s=zohoarc; b=c5MrTr0/uVDdL5Ry6JM+XwXFz7HvdSt8yIIMvVcIQvyX+l8tDfl7UU1TZR6Rq3C3FGFo+3f5xBgdyvs/5Vs4LJXic0q+gRhojEZtlfABcuFsxiDMBJq5+llTz2fU63ra0E67z1xrYMd+btyvyGvjyU6nI2a7nzfSDH5ZhhjvuuM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421048; h=Content-Type:Content-Transfer-Encoding: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=GQjotDFD2O0ofryWqptIjGA5+FrRN8hCcYb/QRTn3yo=; b=c8f1rqf4xS6uq+FJDkwUqGqrz5QV/ViujJD1zHOipV/VOzxixw+wmB8fAcueO/yS+Gg6CNVSe16uNkZO5sLZoOUlCWvdO4x13myjor/YAVp/2KNBg6w6vYVUU2amwUqZ7UaTnexwRIN92MkUZ0QE0Psj+Y/eAsJvF35tw5xJl/I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1639421048149238.34511381142977; Mon, 13 Dec 2021 10:44:08 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-562-il80HhdJPaSKowVcXUUZiw-1; Mon, 13 Dec 2021 13:44:04 -0500 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 1607A80414B; Mon, 13 Dec 2021 18:43: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 56CCA5F4EA; Mon, 13 Dec 2021 18:43:56 +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 1EBE24A70F; Mon, 13 Dec 2021 18:43:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhODr003887 for ; Mon, 13 Dec 2021 13:43:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id 226186107F; Mon, 13 Dec 2021 18:43:24 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E68960C9F for ; Mon, 13 Dec 2021 18:43:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421047; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=GQjotDFD2O0ofryWqptIjGA5+FrRN8hCcYb/QRTn3yo=; b=AXRXqeQ2pqBW+aZRud30dynbrFpBX5OzwQQidXUMGG75Qd4EEaKprMJTaxXtrSTxHnTvfr YBca6sg+Va/OKIsIdHu72Kg+eRRQ+X/bpvx+K50V4gpi+VcmUyaRSzwjAwqBkMX+oM9MVB /cqSsIRTUcya/IKnwX97tQ0ZcydAN8U= X-MC-Unique: il80HhdJPaSKowVcXUUZiw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 11/20] openvz: refactor openvzDomainSetBarrierLimit Date: Mon, 13 Dec 2021 19:43:03 +0100 Message-Id: <5d2d7a71265f953f766d2aa45b202a7f8e3f5e79.1639420923.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421049165100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/openvz/openvz_driver.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 345c31304a..3cd655e5a7 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -1551,28 +1551,22 @@ openvzDomainSetBarrierLimit(virDomainPtr domain, unsigned long long barrier, unsigned long long limit) { - int ret =3D -1; - virCommand *cmd =3D virCommandNewArgList(VZCTL, "--quiet", "set", NULL= ); + g_autoptr(virCommand) cmd =3D virCommandNewArgList(VZCTL, "--quiet", "= set", NULL); =20 /* LONG_MAX indicates unlimited so reject larger values */ if (barrier > LONG_MAX || limit > LONG_MAX) { virReportError(VIR_ERR_OPERATION_FAILED, _("Failed to set %s for %s: value too large"), para= m, domain->name); - goto cleanup; + return -1; } =20 virCommandAddArg(cmd, domain->name); virCommandAddArgFormat(cmd, "--%s", param); virCommandAddArgFormat(cmd, "%llu:%llu", barrier, limit); virCommandAddArg(cmd, "--save"); - if (virCommandRun(cmd, NULL) < 0) - goto cleanup; =20 - ret =3D 0; - cleanup: - virCommandFree(cmd); - return ret; + return virCommandRun(cmd, NULL); } =20 =20 --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421034; cv=none; d=zohomail.com; s=zohoarc; b=X/cs/QWEWNvAwqIhtO57zGKWJOPsB9xWOMyktoKd8Dc3v52sagBYZswXKIoGNTnbkj0m375VTInwrqBO+ZP1u1hOFCtkkkzDHSljPbsQ6ZL5JI1W7f2ww739noznty9tfPopGsllx1lV/Oq2mZLP9YFUShHQdtIUBBP3/0XjB2U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421034; h=Content-Type:Content-Transfer-Encoding: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=IRYgfzqXoXroIfA19mwYYB8nGJdS8FgZ8ugJU7lHVA8=; b=TNarwcgF+R/2VgxVZ1Xu2N7ORZ3uqsqp+xtuMvAkjWqMFrIto+FWD/KCpZc8iCHQ6bSCOTWxL4THTdJQWaVIHnomSz4GQcRhradxjHXlFdcWzLrLH1qKCfaRbV0KD4QZbmYFnlr4+Jme3mfRokk7X2am428An2A5Z9ZKI1Hk1Ac= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1639421034215968.2859299319931; Mon, 13 Dec 2021 10:43:54 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-252-39K4zpnwNbOW9y4w-V8X0g-1; Mon, 13 Dec 2021 13:43:49 -0500 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 B32F01006AAF; Mon, 13 Dec 2021 18:43:44 +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 9074E6107F; Mon, 13 Dec 2021 18:43:44 +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 61E614A70B; Mon, 13 Dec 2021 18:43:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhOCp003903 for ; Mon, 13 Dec 2021 13:43:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id EA43461096; Mon, 13 Dec 2021 18:43:24 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 70DBE610A5 for ; Mon, 13 Dec 2021 18:43:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421033; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=IRYgfzqXoXroIfA19mwYYB8nGJdS8FgZ8ugJU7lHVA8=; b=Uk3VlKUwftSDet7BY2y2KSNjzfDUMuMPUFFjZmWIiq5JPCcjWhfAcMLqICwMReAqZoUIwr kgUq83IKu3YsWRQav7AGOR/ZB3QgrWXOmOEcdbpddhCq9i1JU4lIJNgzMrGQEbtxu07/Je yTsb11YYLKApkI4petTFNQSlWUCM8Ds= X-MC-Unique: 39K4zpnwNbOW9y4w-V8X0g-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 12/20] openvz: refactor openvzGetVEStatus Date: Mon, 13 Dec 2021 19:43:04 +0100 Message-Id: <9831d3f55e3455e47328a237f5c9c0247714bb17.1639420923.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421036002100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/openvz/openvz_driver.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 3cd655e5a7..d4c65dbc26 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -1697,21 +1697,20 @@ openvzDomainSetMemoryParameters(virDomainPtr domain, static int openvzGetVEStatus(virDomainObj *vm, int *status, int *reason) { - virCommand *cmd; - char *outbuf; + g_autoptr(virCommand) cmd =3D NULL; + g_autofree char *outbuf =3D NULL; char *line; int state; - int ret =3D -1; =20 cmd =3D virCommandNewArgList(VZLIST, vm->def->name, "-ostatus", "-H", = NULL); virCommandSetOutputBuffer(cmd, &outbuf); if (virCommandRun(cmd, NULL) < 0) - goto cleanup; + return -1; =20 if ((line =3D strchr(outbuf, '\n')) =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to parse vzlist output")); - goto cleanup; + return -1; } *line++ =3D '\0'; =20 @@ -1728,12 +1727,7 @@ openvzGetVEStatus(virDomainObj *vm, int *status, int= *reason) *status =3D VIR_DOMAIN_SHUTOFF; } =20 - ret =3D 0; - - cleanup: - virCommandFree(cmd); - VIR_FREE(outbuf); - return ret; + return 0; } =20 static int --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421166; cv=none; d=zohomail.com; s=zohoarc; b=gQJUy+d0JdRMzO7+sg69CqnP3GWjEs9xUkILgyE4DDvWREM+TWpWJvUQjiNzXdbarIGc9/IQZcpaPJCZukGFxb8LN6pG4NPJr6pV67Vr3gDh9DB+FLVqup0Lj9/2xQJQrIOAX0sf/N/za9a5/aCPjNIzbpiBDzMN6V/URb76+8o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421166; h=Content-Type:Content-Transfer-Encoding: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=/rJzM7x681Vc2JDjuaecAOvHYm5e2IJ3wChhSsKpwc8=; b=gAqje0RS1ec9448tvV7w8uIISTesdSx3hHzG+nrogL3H46LT2A7t6aunMsxanHbY3kp6Q1cXGxSXQY+qoCkMxRpXpJY3gFW0Q3gQsRIYwKclTOS2b48WKlL+UW8ZsF+qWdDIqutzleueHuhu23HisoOuab1i4Vt6xaDNJW9tJRE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639421166077767.6486036852846; Mon, 13 Dec 2021 10:46:06 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-358-HnXsOWF9PBu7J36SoJ78zA-1; Mon, 13 Dec 2021 13:44:06 -0500 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 3BB37100D84F; Mon, 13 Dec 2021 18:44: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 14DE95BE3F; Mon, 13 Dec 2021 18:43: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 D16331806D2D; Mon, 13 Dec 2021 18:43:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhPWS003916 for ; Mon, 13 Dec 2021 13:43:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id BCC0260C9F; Mon, 13 Dec 2021 18:43:25 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 447AD610A7 for ; Mon, 13 Dec 2021 18:43:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421165; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=/rJzM7x681Vc2JDjuaecAOvHYm5e2IJ3wChhSsKpwc8=; b=e3qWLBPQOXYdVKyM1w6mjmaLIo3i2t1iJqkLrn1YnssQqQOpi6VNCU+loaohydHCeEfTJr xprg2PGdBYtJ4XcG8TolhcPG788CuIGQU4Fh5rBDq+xphVihF+QQoRI7mITJojFX+ZVQHZ 5IvmaGc+yAUlS4OnXPdGhIhysKyxBCc= X-MC-Unique: HnXsOWF9PBu7J36SoJ78zA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 13/20] openvz: use g_auto in openvzDomainMigratePerform3Params Date: Mon, 13 Dec 2021 19:43:05 +0100 Message-Id: <96cdca23d408453a04ee7ccf7a3b92b3cf4f1edd.1639420923.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421167386100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/openvz/openvz_driver.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index d4c65dbc26..b2589059c8 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -2113,8 +2113,8 @@ openvzDomainMigratePerform3Params(virDomainPtr domain, struct openvz_driver *driver =3D domain->conn->privateData; virDomainObj *vm =3D NULL; const char *uri_str =3D NULL; - virURI *uri =3D NULL; - virCommand *cmd =3D NULL; + g_autoptr(virURI) uri =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; int ret =3D -1; =20 virCheckFlags(OPENVZ_MIGRATION_FLAGS, -1); @@ -2146,8 +2146,6 @@ openvzDomainMigratePerform3Params(virDomainPtr domain, ret =3D 0; =20 cleanup: - virCommandFree(cmd); - virURIFree(uri); virDomainObjEndAPI(&vm); return ret; } --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421108; cv=none; d=zohomail.com; s=zohoarc; b=dIriS/4CGmD6jK5tGiWE0TC+50a+zhzELHk+0IpJmvRZeSGFTX4Q75iupxISnaNNrwJzQZ6QYT5fSZOrGi9VH8fxsBMgZ8xfF2CTfbd1hXS86tdh24h9kobbUibzWagI/9wzH2GV74vJoZVfuK+Ax56GCEtRg/gJF74pAWZPODg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421108; h=Content-Type:Content-Transfer-Encoding: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=WjDolvf8JB8GcEbjpn8UhNEkHx/L/M4exeIKukdDJ4c=; b=gWAVs6bmcCigH3Jg5sKPhofeIpKLgZJgIMaLevolUiAUuYfsdocpQ14+sj8GzZp4/P40CBES8D07YzlzIK0TMBzviU1dzP39ZrnbcSGbCarmypisKEbBuqW0YYO6DdyP3oN5KetFEelitnbQlBXaFzEi9DOTIO/GhqRGAH0gh1w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 163942110897274.81639983908383; Mon, 13 Dec 2021 10:45:08 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-339-0SB7s6lvPvicfgJTSOgfYQ-1; Mon, 13 Dec 2021 13:44:10 -0500 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 C0C95101F002; Mon, 13 Dec 2021 18:44:03 +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 B472E708D5; Mon, 13 Dec 2021 18:44:01 +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 810501806D2F; Mon, 13 Dec 2021 18:44:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhQhB003925 for ; Mon, 13 Dec 2021 13:43:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8F63E4066; Mon, 13 Dec 2021 18:43:26 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1746060C9F for ; Mon, 13 Dec 2021 18:43:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421108; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=WjDolvf8JB8GcEbjpn8UhNEkHx/L/M4exeIKukdDJ4c=; b=eRfwvRkyNQ1OS34iUplc5Erw6B5Ri9BH3/nd1wcq85z8LfTsjxFDLjuOvs9EKftAwdCISB j+A3ez14tFgkFoEmy9Wcf/oE1uAmHoy8FG9sJiqLLXNFH0YpAaMik8LkWjj0yN9jyYZYVT E468yI6yNkiqfxjjcLJGhUDICqAfAQY= X-MC-Unique: 0SB7s6lvPvicfgJTSOgfYQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 14/20] openvz: refactor openvzVEGetStringParam Date: Mon, 13 Dec 2021 19:43:06 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421109587100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/openvz/openvz_util.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/openvz/openvz_util.c b/src/openvz/openvz_util.c index d14254c231..9419ce122c 100644 --- a/src/openvz/openvz_util.c +++ b/src/openvz/openvz_util.c @@ -58,27 +58,22 @@ char* openvzVEGetStringParam(virDomainPtr domain, const char* param) { int len; - char *output =3D NULL; + g_autofree char *output =3D NULL; =20 - virCommand *cmd =3D virCommandNewArgList(VZLIST, - "-o", - param, - domain->name, - "-H", NULL); + g_autoptr(virCommand) cmd =3D virCommandNewArgList(VZLIST, + "-o", + param, + domain->name, + "-H", NULL); =20 virCommandSetOutputBuffer(cmd, &output); - if (virCommandRun(cmd, NULL) < 0) { - VIR_FREE(output); - /* virCommandRun sets the virError */ - goto cleanup; - } + if (virCommandRun(cmd, NULL) < 0) + return NULL; =20 /* delete trailing newline */ len =3D strlen(output); if (len && output[len - 1] =3D=3D '\n') output[len - 1] =3D '\0'; =20 - cleanup: - virCommandFree(cmd); - return output; + return g_steal_pointer(&output); } --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421038; cv=none; d=zohomail.com; s=zohoarc; b=aDnikqxUpqcPIDiqNHxbwE6uiHnx6ag4XS+isCQV/GiIllN6WoVbHEqa83Z4y/Vr7CWR24LItFqRuWCFiRm8B5PRYjf6sCONHxnh8dv1y17Jx5vBQYXYO1e9BMmD15XRuf74zlSTXW4w1Q6c+a8uVjz5Wol77zmWSWf3eFf3P1A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421038; h=Content-Type:Content-Transfer-Encoding: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=KEqD9jaJonbtONiDQwFFQ1ph8unuz02xwixJlo7XjKY=; b=VM2KoiTRadgLF0vxIvq62QnASOcKRzfYMjnmWMX99vfPc62egrei3jroGseRO9vaj7GQPDAT1lKGS6rMtcmRReSqUJlog9+r+Qi6fcSKO78ZkZY/EwnOv7HLnlDkVIF1Erne2/5aBE8cJJzfXkd8vwWTixka/UbvPEJAJm3V1cU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1639421038529988.385568369754; Mon, 13 Dec 2021 10:43:58 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-224-ZjCSpGcpNaKlK0o8dEpS3w-1; Mon, 13 Dec 2021 13:43:53 -0500 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 22EB9802E6D; Mon, 13 Dec 2021 18:43: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 A4A17610AF; Mon, 13 Dec 2021 18:43: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 762324A70B; Mon, 13 Dec 2021 18:43:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhRcf003936 for ; Mon, 13 Dec 2021 13:43:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6196660C9F; Mon, 13 Dec 2021 18:43:27 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id DDD7E61082 for ; Mon, 13 Dec 2021 18:43:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421037; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=KEqD9jaJonbtONiDQwFFQ1ph8unuz02xwixJlo7XjKY=; b=SHqjVi4eFzoSYwcIJYoID0IJ99Oa1iaDj4d7wtFW1A7U3c6R9c1MMlWEBVeybDK/pqrGFV MqBxwBt3mJIXXvKJt4V8r30y+BeQCULtNVtt/Ahsl+NAF/XleooiTvyQ9DnyhxA8Mazhfc 9VYf3bI/f3JdvuhCOT5HXrI4klKCfJc= X-MC-Unique: ZjCSpGcpNaKlK0o8dEpS3w-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 15/20] vz: utils: use g_auto for virCommand Date: Mon, 13 Dec 2021 19:43:07 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421039004100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/vz/vz_utils.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/vz/vz_utils.c b/src/vz/vz_utils.c index 8fed875281..90e26091bb 100644 --- a/src/vz/vz_utils.c +++ b/src/vz/vz_utils.c @@ -92,7 +92,7 @@ vzDomObjFromDomain(virDomainPtr domain) static int vzDoCmdRun(char **outbuf, const char *binary, va_list list) { - virCommand *cmd =3D virCommandNewVAList(binary, list); + g_autoptr(virCommand) cmd =3D virCommandNewVAList(binary, list); int ret =3D -1; =20 if (outbuf) @@ -104,7 +104,6 @@ vzDoCmdRun(char **outbuf, const char *binary, va_list l= ist) ret =3D 0; =20 cleanup: - virCommandFree(cmd); if (ret && outbuf) VIR_FREE(*outbuf); return ret; --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421204; cv=none; d=zohomail.com; s=zohoarc; b=CM6ulC8E5L7QDmJYXIxmfiAeiIh09cpaVD/2KtjlFZDjj0Dlyt9R7NhK9TFr+7ST529vMUvI+nModTwuFROW+7Af5NANQI4fT5Bg8H0yN9XEGMTUkKle7vxPiRV3PywS3aIpFMhTS17rDedI3qER/lChwFZxDEIQ/A2yB4XH7Ag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421204; h=Content-Type:Content-Transfer-Encoding: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=Mho8JomLpm9MsIufWsxUIJrDZHlA3kKgaN6I+aezekM=; b=Uf6ck4OjrYoevryyr9frk+Cy7/1l96fw9EdkF6siPezwFMZYnattNfjOicApuqQrn0zwEhKRb3bzV/Gv11E29Rmu9Aha3REi4nlWReSz7jMrjHNK6eFw+ELUotyxbpeC0jZJIIz/4GLmaor9fUNojuBLGOnbGvrGDxyMNYrVPN8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639421204653357.0085392166476; Mon, 13 Dec 2021 10:46:44 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-551-m-MQs8OkP0KDK6zlnUlNRA-1; Mon, 13 Dec 2021 13:44:04 -0500 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 7DECE100C612; Mon, 13 Dec 2021 18:43: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 2BE765F4EF; Mon, 13 Dec 2021 18:43:52 +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 EB6054A70A; Mon, 13 Dec 2021 18:43:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhS1D003948 for ; Mon, 13 Dec 2021 13:43:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 33AF160C04; Mon, 13 Dec 2021 18:43:28 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFABD369A for ; Mon, 13 Dec 2021 18:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421203; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Mho8JomLpm9MsIufWsxUIJrDZHlA3kKgaN6I+aezekM=; b=S7m9QlgEc6CEpqFpgVkWMXuJuIbkbu7YHksyGxu0lqZaqxZSjPqSaLmHh2VKbl+BmWihIS Q0KytRezDhTIwzg3B6TzBqtx6qfQOdFAyzWQvOOom+hFe0wNxDC8//XIBmglVQCtz9gWz6 sGZNr1Hi3TWHmNBUdS55DaqNgvme5+o= X-MC-Unique: m-MQs8OkP0KDK6zlnUlNRA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 16/20] vmware: refactor vmwareUpdateVMStatus Date: Mon, 13 Dec 2021 19:43:08 +0100 Message-Id: <48c995e703b2ab80f44f9314682b85453aedff68.1639420923.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421205460100001 Use g_auto and get rid of the cleanup label, as well as the ret variable. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/vmware/vmware_driver.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c index 8f107dd529..998ecdb546 100644 --- a/src/vmware/vmware_driver.c +++ b/src/vmware/vmware_driver.c @@ -284,27 +284,26 @@ vmwareConnectGetVersion(virConnectPtr conn, unsigned = long *version) static int vmwareUpdateVMStatus(struct vmware_driver *driver, virDomainObj *vm) { - virCommand *cmd; - char *outbuf =3D NULL; - char *vmxAbsolutePath =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; + g_autofree char *outbuf =3D NULL; + g_autofree char *vmxAbsolutePath =3D NULL; char *parsedVmxPath =3D NULL; char *str; char *saveptr =3D NULL; bool found =3D false; int oldState =3D virDomainObjGetState(vm, NULL); int newState; - int ret =3D -1; =20 cmd =3D virCommandNewArgList(driver->vmrun, "-T", vmwareDriverTypeToString(driver->type), "list", NULL); virCommandSetOutputBuffer(cmd, &outbuf); if (virCommandRun(cmd, NULL) < 0) - goto cleanup; + return -1; =20 if (virFileResolveAllLinks(((vmwareDomainPtr) vm->privateData)->vmxPat= h, &vmxAbsolutePath) < 0) - goto cleanup; + return -1; =20 for (str =3D outbuf; (parsedVmxPath =3D strtok_r(str, "\n", &saveptr))= !=3D NULL; str =3D NULL) { @@ -331,13 +330,7 @@ vmwareUpdateVMStatus(struct vmware_driver *driver, vir= DomainObj *vm) =20 virDomainObjSetState(vm, newState, 0); =20 - ret =3D 0; - - cleanup: - virCommandFree(cmd); - VIR_FREE(outbuf); - VIR_FREE(vmxAbsolutePath); - return ret; + return 0; } =20 static int --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421106; cv=none; d=zohomail.com; s=zohoarc; b=lvdZoqDX08QdpYI+P/CITgPH143vfv+8oeAzblgSX4z+D6DHEwSUS5PymcI3q2POJds2iIAzV5MvjSooVz1pz2/HpSm3TmZST4bjg0Kl4N9IyPw9S8ao97grbF4sm1sWmI4g6iFQ8+H62IqaBeJvQTtz6vMAlXmOD3U/5cvm0vI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421106; h=Content-Type:Content-Transfer-Encoding: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=rzkBKfPajoiQKC1j1HWn1bWvek8yEc8DIAOgCAjOQLY=; b=PbPSuk2KnsN/kBSz5RbFONp4E9WjTyVE5gZWrS8zR3eQt8lG53CWanfDsFjdxxfWgCwvQgGtUhW+3MsXrFn/ynTDBBZpIThNX8f4L3YDy2862r4Yp07yAIu9liX7oY5SxfpTq9nePtEOrd3hl2uWRwegI6VrrngweSDfwg9+oAM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1639421106010830.2147046668532; Mon, 13 Dec 2021 10:45:06 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-3-rwch0lclNvmodXdUUi6kXw-1; Mon, 13 Dec 2021 13:44:10 -0500 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 6CAEF1F2E8; Mon, 13 Dec 2021 18:44:04 +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 4C3A622E1E; Mon, 13 Dec 2021 18:44:04 +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 15C374A70B; Mon, 13 Dec 2021 18:44:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhTxA003958 for ; Mon, 13 Dec 2021 13:43:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id 071C760C04; Mon, 13 Dec 2021 18:43:29 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 830066107F for ; Mon, 13 Dec 2021 18:43:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421104; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=rzkBKfPajoiQKC1j1HWn1bWvek8yEc8DIAOgCAjOQLY=; b=CEFzpdoA/Avc4Y7kkzNAnR/+Xbnn7GrP1g24WCoeXkkagi0tn+3WRwgKh5aqBMP7lTKOoz xvOb4u46s0FHspIShNynhVi+hXPX2lTiwnv4SH0Av8HnALyiopMHvbchGtvdkjNE2rVFWi lJgT8Irz0nPS1LmQlNLFtGZvkYNgLHA= X-MC-Unique: rwch0lclNvmodXdUUi6kXw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 17/20] vmware: use g_auto in vmwareLoadDomains Date: Mon, 13 Dec 2021 19:43:09 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421106948100002 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/vmware/vmware_conf.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c index 3f6b51ac44..17e67ea6d2 100644 --- a/src/vmware/vmware_conf.c +++ b/src/vmware/vmware_conf.c @@ -118,14 +118,14 @@ vmwareLoadDomains(struct vmware_driver *driver) { virDomainObj *vm =3D NULL; char *vmxPath =3D NULL; - char *vmx =3D NULL; + g_autofree char *vmx =3D NULL; vmwareDomainPtr pDomain; int ret =3D -1; virVMXContext ctx; - char *outbuf =3D NULL; + g_autofree char *outbuf =3D NULL; char *str; char *saveptr =3D NULL; - virCommand *cmd; + g_autoptr(virCommand) cmd =3D NULL; =20 ctx.parseFileName =3D vmwareParseVMXFileName; ctx.formatFileName =3D NULL; @@ -178,9 +178,6 @@ vmwareLoadDomains(struct vmware_driver *driver) ret =3D 0; =20 cleanup: - virCommandFree(cmd); - VIR_FREE(outbuf); - VIR_FREE(vmx); virObjectUnref(vm); return ret; } --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421054; cv=none; d=zohomail.com; s=zohoarc; b=g1OVXbj+yIfrkbBFDsHdt6KF6T1QdvZVlirZaYqe4U013RYgYlCRz9Hu69bZHPMkKqabZZeLGICCBPGMTjehULv9F64kjg5Qfx0bGuw8Y+xg/PYzhRQzaRj/J4lHjWMdoNwTieqbthByL3t4fkAHhexYiJIWc6V0yP7IQDt72fw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421054; h=Content-Type:Content-Transfer-Encoding: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=vmgUxuW1SY0VF+/LD+OBo93DUesVF8FC5RE2E9BQwMI=; b=KgqfIJDjJk+RT30c8ydXzt5ufPcBJrtCvDmnQ7a/V4UkuuOwaCqnIZzy+vo+VkViayGU0AEGNC0RFNzXRaq3VrnYUDXr/C1QMRYp2ns+qXGuONRGlWCTAZc/fN48PSyM/+WAyQT0zbXPtzTN8RgfuqlvIAN6vzDxAfSeLi8Jbf4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1639421054813248.14263217845848; Mon, 13 Dec 2021 10:44:14 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-140-CQvII0QeP6mnjAelXilkHg-1; Mon, 13 Dec 2021 13:44:12 -0500 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 969F3102CB3F; Mon, 13 Dec 2021 18:44:07 +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 7C36845D9A; Mon, 13 Dec 2021 18:44:07 +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 040024A713; Mon, 13 Dec 2021 18:44:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhTDQ003968 for ; Mon, 13 Dec 2021 13:43:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id CEA064066; Mon, 13 Dec 2021 18:43:29 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5596E60C9F for ; Mon, 13 Dec 2021 18:43:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421053; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=vmgUxuW1SY0VF+/LD+OBo93DUesVF8FC5RE2E9BQwMI=; b=Osy9y/qDoKeR1DxoQeRNSjlKdCiiQz5eWa16oslSZRm586j3bFz0N3DmVjqKzNMZ6BhY3q T55x7neEWQjtlriHS0Y3GdOSYVM8qOZv+6/5WGU4eYYD2JzihrcSexxybmY1Ui8QLFKMbV EnZkZReY8Do0PuG4XUzRt6pZzldawsc= X-MC-Unique: CQvII0QeP6mnjAelXilkHg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 18/20] vmware: refactor vmwareExtractVersion Date: Mon, 13 Dec 2021 19:43:10 +0100 Message-Id: <00a83de8d55ca7ae2ca3c359943c92a4de6e7ca2.1639420923.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421056332100001 Use g_auto for cleanup and remove the cleanup label. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/vmware/vmware_conf.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c index 17e67ea6d2..c88f11fcab 100644 --- a/src/vmware/vmware_conf.c +++ b/src/vmware/vmware_conf.c @@ -242,11 +242,10 @@ vmwareParseVersionStr(int type, const char *verbuf, u= nsigned long *version) int vmwareExtractVersion(struct vmware_driver *driver) { - int ret =3D -1; - virCommand *cmd =3D NULL; - char * outbuf =3D NULL; - char *bin =3D NULL; - char *vmwarePath =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; + g_autofree char *outbuf =3D NULL; + g_autofree char *bin =3D NULL; + g_autofree char *vmwarePath =3D NULL; =20 vmwarePath =3D g_path_get_dirname(driver->vmrun); =20 @@ -266,7 +265,7 @@ vmwareExtractVersion(struct vmware_driver *driver) default: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("invalid driver type for version detection")); - goto cleanup; + return -1; } =20 cmd =3D virCommandNewArgList(bin, "-v", NULL); @@ -274,19 +273,12 @@ vmwareExtractVersion(struct vmware_driver *driver) virCommandSetErrorBuffer(cmd, &outbuf); =20 if (virCommandRun(cmd, NULL) < 0) - goto cleanup; + return -1; =20 if (vmwareParseVersionStr(driver->type, outbuf, &driver->version) < 0) - goto cleanup; + return -1; =20 - ret =3D 0; - - cleanup: - virCommandFree(cmd); - VIR_FREE(outbuf); - VIR_FREE(bin); - VIR_FREE(vmwarePath); - return ret; + return 0; } =20 int --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421231; cv=none; d=zohomail.com; s=zohoarc; b=QwmK46n7cMbkxY0pwgQgYEoAj/uKJ4d38LjCv4c/jSD+ZUmZY91XUlM69qaXoyVSvvebm58EaGTlO7adsC4fTSWS0bzK6UL+CzGa6WtqPZQo919IVRkadOR7kzeiDlUMDHa33fKQoDAi+aBFKB3QD4pZW4B6cqR6mxjeJAVWq/o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421231; h=Content-Type:Content-Transfer-Encoding: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=B81kf4HNiMcIH/yv8I8yn+ul+P1rZEc2Qm8ce6UNsX8=; b=DY+IUUlhFuyM1icpDxtnzEV3Mf6bF0GBvsIbpCA5Us0LU/M7Lii7Gfhu8B6QXiYoxrZl7LXzpsYSg6VUKMxhgpKpIHqYUOx4WWerlXK6sBAz1kog6dUIojtPgcisZn8i3CmSftz+epYNVjyIfUPuP7YwgWWOOP1eHZMj5h4GzrM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639421231681915.6111549874914; Mon, 13 Dec 2021 10:47:11 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-587-dd-nefmINv6WgnfISTM_NA-1; Mon, 13 Dec 2021 13:44:17 -0500 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 6B60A101AFB9; Mon, 13 Dec 2021 18:44:12 +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 2B5EF77450; Mon, 13 Dec 2021 18:44:10 +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 A2B594A716; Mon, 13 Dec 2021 18:44:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhUGV003979 for ; Mon, 13 Dec 2021 13:43:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id A178F60C04; Mon, 13 Dec 2021 18:43:30 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 28D7E60C9F for ; Mon, 13 Dec 2021 18:43:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421230; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=B81kf4HNiMcIH/yv8I8yn+ul+P1rZEc2Qm8ce6UNsX8=; b=WBMIeFDMD6ij6Mj9VH+8me7a0a8SsuNG3bLvTN0IsAkxCZYhERuV9nnk1q+GqNXp+3f+oO kU31/AK30spznAsKzH7vt6fS2oUEw/MedMMlv+zIxEBrj7tkhrndIzP3Y6uNB1Ohnbf3J7 3vDeSoko5qz9+dW/fyJ/H/4lJ9EeUg4= X-MC-Unique: dd-nefmINv6WgnfISTM_NA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 19/20] tests: use g_auto in testCompareXMLToConfFiles Date: Mon, 13 Dec 2021 19:43:11 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421233141100001 Use g_auto for dnsmasq context and remove the cmd variable. It was unused since its introduction in: commit 8b32c80df089a3612a0448c1a92abc2071d6b6a9 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- tests/networkxml2conftest.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c index b76d72793a..7177505918 100644 --- a/tests/networkxml2conftest.c +++ b/tests/networkxml2conftest.c @@ -24,9 +24,8 @@ testCompareXMLToConfFiles(const char *inxml, const char *= outconf, int ret =3D -1; virNetworkDef *def =3D NULL; virNetworkObj *obj =3D NULL; - virCommand *cmd =3D NULL; g_autofree char *pidfile =3D NULL; - dnsmasqContext *dctx =3D NULL; + g_autoptr(dnsmasqContext) dctx =3D NULL; g_autoptr(virNetworkXMLOption) xmlopt =3D NULL; =20 if (!(xmlopt =3D networkDnsmasqCreateXMLConf())) @@ -82,9 +81,7 @@ testCompareXMLToConfFiles(const char *inxml, const char *= outconf, =20 fail: VIR_FREE(confactual); - virCommandFree(cmd); virNetworkObjEndAPI(&obj); - dnsmasqContextFree(dctx); return ret; } =20 --=20 2.31.1 From nobody Sun Apr 28 17:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421045; cv=none; d=zohomail.com; s=zohoarc; b=nOCvc4imj6txXPntjmQvRbW2uJZVLgal5CeNi8ERhsxHbU5R/cG+XfHpoWcCpWqynnVKfzzcQytf6diafOMcDOfKzijSaGBVVyCd+9Jfp/lAzLfTCB0/FH8jsgtuY4XA5M3iTX8buzeiJtALijJjsjRPimuBJe0dBJkXMgzlNeo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421045; h=Content-Type:Content-Transfer-Encoding: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=pjo1Jqvm1IughhzKXgzN1adFBcjy9wa1meibv7FUtw0=; b=Eask26bUTs29XR4G4yYQgX84V/fBH62vut8eV22tRnJd2Fnva4l8fKvAXVYTrLlcqUlM4Hw5cus+2KCyP0tFYBaLh0K9hTyqY9z/OzdyOaMwU0cB9NCBkB2glzNzJwU9FYPpePiyRztTHqKKpGkOA5O/q2Drjtte+OH8bsjMXNE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639421045835928.8672198900126; Mon, 13 Dec 2021 10:44:05 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-437-XOYxymE1PkiiVoX3ha5ErA-1; Mon, 13 Dec 2021 13:43:59 -0500 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 9071A1006ADE; Mon, 13 Dec 2021 18:43:51 +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 73FC67AB48; Mon, 13 Dec 2021 18:43: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 4713C4A710; Mon, 13 Dec 2021 18:43:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIhV7J003999 for ; Mon, 13 Dec 2021 13:43:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7427160C04; Mon, 13 Dec 2021 18:43:31 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id EFEBA61082 for ; Mon, 13 Dec 2021 18:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421044; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=pjo1Jqvm1IughhzKXgzN1adFBcjy9wa1meibv7FUtw0=; b=b4Or0bOo8koglUvhKgYqqgsRr5jzvZyZ/hu/uAbSdNyzxzEd2rQeyu7Dvi9/M55ju28drG 5YO1kXfq9E19MYY/zPZ5GBgmQl3OIfpdJXh4aM2YP/luk9rnQJ5oub9uJJIW6lZM4UIRlL oeFD3Ig8Qn3swajxmatsiWjRvQrw/8g= X-MC-Unique: XOYxymE1PkiiVoX3ha5ErA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 20/20] tests: storagevolxml2argvtest: do not reuse cmd Date: Mon, 13 Dec 2021 19:43:12 +0100 Message-Id: <1bba69ac0e7356dccdc06a80db439ca3b44018cd.1639420923.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421046677100001 Reduce the scope of the variable to avoid mixing automatic and manual cleanup. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- tests/storagevolxml2argvtest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/storagevolxml2argvtest.c b/tests/storagevolxml2argvtest.c index 9597509f00..94e2de1730 100644 --- a/tests/storagevolxml2argvtest.c +++ b/tests/storagevolxml2argvtest.c @@ -50,7 +50,6 @@ testCompareXMLToArgvFiles(bool shouldFail, g_autoptr(virStorageVolDef) vol =3D NULL; g_autoptr(virStorageVolDef) inputvol =3D NULL; g_autoptr(virStoragePoolDef) inputpool =3D NULL; - g_autoptr(virCommand) cmd =3D NULL; =20 if (!(def =3D virStoragePoolDefParseFile(poolxml))) goto cleanup; @@ -88,7 +87,8 @@ testCompareXMLToArgvFiles(bool shouldFail, convertStep =3D VIR_STORAGE_VOL_ENCRYPT_CREATE; =20 do { - virCommandFree(cmd); + g_autoptr(virCommand) cmd =3D NULL; + cmd =3D virStorageBackendCreateQemuImgCmdFromVol(obj, vol, inputvol, flags, create_tool, --=20 2.31.1