From nobody Mon Feb 9 01:19:57 2026 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 --- 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