From nobody Mon Feb 9 05:59:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1551743722053268.4394724632224; Mon, 4 Mar 2019 15:55:22 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 9B5E330821E0; Mon, 4 Mar 2019 23:55:19 +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 6A3905D9D3; Mon, 4 Mar 2019 23:55:19 +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 BA7EF181A12A; Mon, 4 Mar 2019 23:55:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x24NsHmd002657 for ; Mon, 4 Mar 2019 18:54:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9ECD0608C1; Mon, 4 Mar 2019 23:54:17 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 953796085B for ; Mon, 4 Mar 2019 23:54:17 +0000 (UTC) Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A6E91356C4 for ; Mon, 4 Mar 2019 23:54:16 +0000 (UTC) Received: by mail-qk1-f195.google.com with SMTP id a15so3856114qkc.1 for ; Mon, 04 Mar 2019 15:54:16 -0800 (PST) Received: from localhost.localdomain ([177.188.104.249]) by smtp.gmail.com with ESMTPSA id d32sm4670568qtc.88.2019.03.04.15.54.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Mar 2019 15:54:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ZixAmc5eO6ILt5fRk81bsuvXVBkBNluQAgRVdACcrug=; b=h8KCduyX5NZHIRvkAN31v9sylHExAMRvQwPxvM3jHVjcmaXKQ6cJDq+RZeKNSJX2fA FEjkm2dPjQ5wf33JrD9+GPz7WkWKEl1Nlxz7ZxkU7iXPgg0NEOoPLLhOkZPocnNKdYZe wqQyVnPv06FYbZJvUJ4cTLqoFpQ1Qtva2hQli74+EGoQLmGflydnQ3/WwLRhMhi149Nw snmr7iHNJ79ol3FcjpChrz7Nw5NSaunVzMn3WrLtTs7Oly00hLvmSwCZrn/P/4ZH8L52 u66Q+0u29y3s0MWwcmLCXgl0dEp34uFlX7NPGJcnvXdHlh3873r88Tqhr5jISNOGjgjC Go/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZixAmc5eO6ILt5fRk81bsuvXVBkBNluQAgRVdACcrug=; b=AGX85CLSgdoCQMU811tyi9gyLODSBr6tPubxREzlBCwbLzVACnxix66t+NFmaBdEWx OG+nsNFRPaiqIadXJpwRnw2Pyxi/z9Qq2l3v/ug2Oi3SOG7tGeWK/ZW1iWyy1FoUmKAI l3hWYPyCKaLGkRROcRHMVH9qfoZmdN2E/wQgDSuCg/FRodJJDERzInlkJ4ayWT1GJoft nXu7wFyGaAcxAoXyf9fTpQbKdqUCaE97D0Y8nNPdockwJmKR5FZEezQRnxV1fc7DChqh 3poBcnxiA85vCuc0SLvsc4Bqi35IIiCt04gHmhsaA7fgH3jTMI4lSu9n+4RxdxUAzdzn sWvg== X-Gm-Message-State: APjAAAV0gsy5nsFWQbFVDoYlIbOMewgF6BkGJEmV2gImbiDNaJViYhjy 9xMI69dHFZGmNuOHtHPKhQ1YWZAq X-Google-Smtp-Source: APXvYqzFmfMj8gqucaq760kZI1G2QqOrConUpHyIO9S3T4lGpYMFDbY7zfCkwvRIxpZm2UCph3pnnw== X-Received: by 2002:a05:620a:164a:: with SMTP id c10mr15652976qko.3.1551743655577; Mon, 04 Mar 2019 15:54:15 -0800 (PST) From: Julio Faracco To: libvir-list@redhat.com Date: Mon, 4 Mar 2019 20:54:01 -0300 Message-Id: <20190304235404.16320-4-jcfaracco@gmail.com> In-Reply-To: <20190304235404.16320-1-jcfaracco@gmail.com> References: <20190304235404.16320-1-jcfaracco@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 04 Mar 2019 23:54:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 04 Mar 2019 23:54:16 +0000 (UTC) for IP:'209.85.222.195' DOMAIN:'mail-qk1-f195.google.com' HELO:'mail-qk1-f195.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.111 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.222.195 mail-qk1-f195.google.com 209.85.222.195 mail-qk1-f195.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/6] lxc: Introduce lxcNetworkGetParseDataLegacy() method. 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 04 Mar 2019 23:55:20 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This function was introduced to fetch/alloc new data for legacy entries inside config file: 'lxc.network.foo'. Libvirt still need to support both versions. So, this function can be easy to remove in the future. Signed-off-by: Julio Faracco --- src/lxc/lxc_native.c | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index 7200743da7..4d26d1a20b 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -572,6 +572,37 @@ lxcAddNetworkDefinition(virDomainDefPtr def, lxcNetwor= kParseDataPtr data) return -1; } =20 +static lxcNetworkParseDataPtr +lxcNetworkGetParseDataLegacy(lxcNetworkParseArray *networks, + const char *name) +{ + const char *suffix =3D STRSKIP(name, "lxc.network."); + int elem =3D virLXCNetworkConfigEntryTypeFromString(suffix); + size_t index =3D networks->nnetworks; + + if (elem =3D=3D VIR_LXC_NETWORK_CONFIG_TYPE) { + if (!networks->data) { + if (VIR_ALLOC_N(networks->data, index + 1) < 0) + return NULL; + } else { + if (VIR_REALLOC_N(networks->data, index + 1) < 0) + return NULL; + } + + if (VIR_ALLOC(networks->data[index]) < 0) + return NULL; + + networks->data[index]->index =3D index; + networks->nnetworks++; + + /* Return a new network. */ + return networks->data[index]; + } + + /* Return the last network. */ + return networks->data[index-1]; +} + static int lxcNetworkParseDataIPs(const char *name, virConfValuePtr value, @@ -679,8 +710,12 @@ lxcNetworkWalkCallback(const char *name, virConfValueP= tr value, void *data) lxcNetworkParseArray *networks =3D data; lxcNetworkParseDataPtr parseData =3D NULL; =20 - if (STRPREFIX(name, "lxc.network.")) + if (STRPREFIX(name, "lxc.network.")) { + if (!(parseData =3D lxcNetworkGetParseDataLegacy(networks, name))) + return -1; + return lxcNetworkParseDataEntry(name, value, parseData); + } =20 return 0; } --=20 2.19.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list