From nobody Mon Feb 9 02:13:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1580263036550540.7681650022488; Tue, 28 Jan 2020 17:57:16 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-226-B1hk136_OvO5N5sbuxKE5w-1; Tue, 28 Jan 2020 20:57:05 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E4BEA1005513; Wed, 29 Jan 2020 01:56:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B8C018E9EA; Wed, 29 Jan 2020 01:56: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 6294285974; Wed, 29 Jan 2020 01:56:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00T1uexN012665 for ; Tue, 28 Jan 2020 20:56:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8E71E5C219; Wed, 29 Jan 2020 01:56:40 +0000 (UTC) Received: from mimecast-mx01.redhat.com (mimecast03.extmail.prod.ext.phx2.redhat.com [10.5.110.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 88D1F5C545 for ; Wed, 29 Jan 2020 01:56:37 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6E6771800D41 for ; Wed, 29 Jan 2020 01:56:37 +0000 (UTC) Received: from mail-qt1-f196.google.com (mail-qt1-f196.google.com [209.85.160.196]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-164-gHMUCXI7NIiUpfPgCqBjLQ-1; Tue, 28 Jan 2020 20:54:27 -0500 Received: by mail-qt1-f196.google.com with SMTP id c24so12052131qtp.5; Tue, 28 Jan 2020 17:54:27 -0800 (PST) Received: from localhost.localdomain ([2804:431:c7cb:c3b5:59b3:4b4:e00c:2a48]) by smtp.gmail.com with ESMTPSA id t15sm198798qkg.49.2020.01.28.17.54.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jan 2020 17:54:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580263035; 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=Gz1UkyWhUedHtKJdd5tIWBJ6f2oh2En1Shl94xHorBc=; b=NCRsjbkihtaGYv+JDcFquM66YOkYhY9gOz6dGPn5yAiPxFjbdOGyO5Ta8wiTm4sR76zAoa n+8w3G+5gNQUGyy7U2kOJ/vraosMbBWHhUDZjgjhAYcKR/en+E25ECR+SBW97pHfSrcd+M sdRHELJu6IHKhwhDtNnOlMj0Wu3waAI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QqFIS1uGX5BjNP73r+9FJTxtZbhDDXfobmFcj9N4C2k=; b=gJOYlLtU7xMilaH6KL23TrkaFa+1xlwqQLnOd8WJTLZVH/P3jcY4Jj2ZMUv1bJjIho dD6luDFUbwejtyN+5hpyNBeMl1EHrQc/f8qdRgSZlzgsmM17huCBmUySMfsBVihFP8tf XuO06nb5a+B+GL/N671NVk599ryJw5np5k4J+zXQ/T118dQuTVFKHR2fvJssHvc7Nhm/ Gnn3OEykYZkotf7azU1hSKFi6JNdrES7NvU8MFbll+8I6DgVZbZwDfudCh4lBRIK3x++ 26rEXNn4E09uDawQPBR5kex1d2hPKnU3ZwBGQbmo69bLJU/ZffE0njK43jfuW3kL/iNq PtPw== X-Gm-Message-State: APjAAAUeL5hQy/b1eR54/Ta8MPSQAoW5flyVfO3KA7at6VlviAs+EuHw OYL6RZtX7u2LZ5TjawwvpQATuxkX X-Google-Smtp-Source: APXvYqy1bvDySEP/2wxDcvxXrdcKlzYeWC9kxNUHXe5CaWZkfBez69gQce//h9fHP8WAnWG5GEl1Ig== X-Received: by 2002:ac8:1ac1:: with SMTP id h1mr24437694qtk.255.1580262866341; Tue, 28 Jan 2020 17:54:26 -0800 (PST) From: Julio Faracco To: libvir-list@redhat.com Subject: [PATCH v3 3/4] lxc: remove domain definition from lxc network struct Date: Tue, 28 Jan 2020 22:54:10 -0300 Message-Id: <20200129015411.11701-4-jcfaracco@gmail.com> In-Reply-To: <20200129015411.11701-1-jcfaracco@gmail.com> References: <20200129015411.11701-1-jcfaracco@gmail.com> MIME-Version: 1.0 X-MC-Unique: gHMUCXI7NIiUpfPgCqBjLQ-1 X-MC-Unique: B1hk136_OvO5N5sbuxKE5w-1 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 00T1uexN012665 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.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Domain definition is useless now inside network structure. This pointer was required because new network definition was being added each time that a new network type appeared. So, this should be processed into old function `lxcNetworkParseDataType()`. Now, as it was moved to an array, it can be handle together each interface pointer. Signed-off-by: Julio Faracco --- src/lxc/lxc_native.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index 35ac05f702..16dd0c1f5c 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -414,7 +414,6 @@ lxcCreateHostdevDef(int mode, int type, const char *dat= a) typedef struct _lxcNetworkParseData lxcNetworkParseData; typedef lxcNetworkParseData *lxcNetworkParseDataPtr; struct _lxcNetworkParseData { - virDomainDefPtr def; char *type; char *link; char *mac; @@ -470,13 +469,16 @@ lxcAddNetworkRouteDefinition(const char *address, } =20 static int -lxcAddNetworkDefinition(lxcNetworkParseData *data) +lxcAddNetworkDefinition(virDomainDefPtr def, lxcNetworkParseData *data) { virDomainNetDefPtr net =3D NULL; virDomainHostdevDefPtr hostdev =3D NULL; bool isPhys, isVlan =3D false; size_t i; =20 + if (!data) + return -1; + if ((data->type =3D=3D NULL) || STREQ(data->type, "empty") || STREQ(data->type, "") || STREQ(data->type, "none")) return 0; @@ -518,9 +520,9 @@ lxcAddNetworkDefinition(lxcNetworkParseData *data) &hostdev->source.caps.u.net.ip.nr= outes) < 0) goto error; =20 - if (VIR_EXPAND_N(data->def->hostdevs, data->def->nhostdevs, 1) < 0) + if (VIR_EXPAND_N(def->hostdevs, def->nhostdevs, 1) < 0) goto error; - data->def->hostdevs[data->def->nhostdevs - 1] =3D hostdev; + def->hostdevs[def->nhostdevs - 1] =3D hostdev; } else { if (!(net =3D lxcCreateNetDef(data->type, data->link, data->mac, data->flag, data->macvlanmode, @@ -542,9 +544,9 @@ lxcAddNetworkDefinition(lxcNetworkParseData *data) &net->guestIP.nroutes) < 0) goto error; =20 - if (VIR_EXPAND_N(data->def->nets, data->def->nnets, 1) < 0) + if (VIR_EXPAND_N(def->nets, def->nnets, 1) < 0) goto error; - data->def->nets[data->def->nnets - 1] =3D net; + def->nets[def->nnets - 1] =3D net; } =20 return 1; @@ -765,9 +767,8 @@ lxcConvertNetworkSettings(virDomainDefPtr def, virConfP= tr properties) =20 for (i =3D 0; i < networks.ndata; i++) { lxcNetworkParseDataPtr data =3D networks.parseData[i]; - data->def =3D def; =20 - status =3D lxcAddNetworkDefinition(data); + status =3D lxcAddNetworkDefinition(def, data); =20 if (status < 0) goto error; --=20 2.20.1