From nobody Sun Apr 28 10:02:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1580693352529390.85644297851513; Sun, 2 Feb 2020 17:29:12 -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-86-2VzJR4HSPOejxs86d1gR3g-1; Sun, 02 Feb 2020 20:29:05 -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 7BB51107ACC7; Mon, 3 Feb 2020 01:29: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 3677AF6F1; Mon, 3 Feb 2020 01:29:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 01EB118089CD; Mon, 3 Feb 2020 01:28:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0131StP9010794 for ; Sun, 2 Feb 2020 20:28:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2D7F36C343; Mon, 3 Feb 2020 01:28:55 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2926D6C336 for ; Mon, 3 Feb 2020 01:28:53 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 17BDD85A301 for ; Mon, 3 Feb 2020 01:28:53 +0000 (UTC) Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-270-15oBpjCBNNyvN2DGVxoZYA-1; Sun, 02 Feb 2020 20:28:51 -0500 Received: by mail-qt1-f193.google.com with SMTP id w8so10192964qts.11; Sun, 02 Feb 2020 17:28:50 -0800 (PST) Received: from localhost.localdomain ([2804:431:c7ca:48a6:483f:10c:9f6c:3cd0]) by smtp.gmail.com with ESMTPSA id l6sm9126115qti.10.2020.02.02.17.28.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 17:28:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580693351; 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=JMc4bdX2lzAI8WEYPl6lX+a2zlYqFEzOqIa6J93VjMM=; b=RRMwVKkuD+ye8uEZR094qmV/+jJqOH2HzPBT1KYuZTgvLlXW9wM+lxvdMl9zXz8bm6W298 b9naMl+vJ6hiqYw7555YIl14HP1LdseZkgffbjSJw3UUtiX+5OblzVU8dQ1sy3jXi0xD5L tZFd6JCi+Ea1bYxf36+AX5hl/lu7gys= 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=HfvmSddmK/CDEqDxd+L+4lhNfS3GDCN/kgwvN61SEU0=; b=KPaFonEuwFbv3elqTM6WR+OhNDlhV+Zc79RUegwLYToog/SZcy/3zod6X7TK6gjl1S upTDIe/Hewplrx9K1EzAPgS58QB413fHy3uBpD9Y8xymODP/zyf0Eowd0H/pY2CK8Uy+ ZW+znd9U33cBxbfoVW0K4WpzCI1u40zPJ7tXSQiXzNn5Z7XSS8lQhasG7Mgk/UWVYGxl TQw5H3p5FFw2gc/oxJpBi2qzN3+01Adjtbrd1+IuiuC3zVb3OXT6Fg6WjDtRCwhc0vNS KFXpM5AvlWM7+NfYC9k8oxPO8et1SOjDPjneu+Wodv3miYxt5MvvA24nAQ7/cGk/7bcZ rWXQ== X-Gm-Message-State: APjAAAXl8JCgOyr5sI7XUBAr3jYe6H4qfkPeOxNQA/8JVMz1I4IlAm21 c5ufEpcU5AWwzbSSacPwDptOmTrB X-Google-Smtp-Source: APXvYqx3TVsSB7IrhBIi7Aqlj2m37TzBTLyIKyUtP5qjpVSjJSe7M/mfeMZpfAw98OrQINrwsdGvFA== X-Received: by 2002:aed:256f:: with SMTP id w44mr20095949qtc.331.1580693329881; Sun, 02 Feb 2020 17:28:49 -0800 (PST) From: Julio Faracco To: libvir-list@redhat.com Subject: [PATCH v4 1/4] lxc: refactor lxcNetworkParseData pointers to use new structures Date: Sun, 2 Feb 2020 22:28:32 -0300 Message-Id: <20200203012835.20971-2-jcfaracco@gmail.com> In-Reply-To: <20200203012835.20971-1-jcfaracco@gmail.com> References: <20200203012835.20971-1-jcfaracco@gmail.com> MIME-Version: 1.0 X-MC-Unique: 15oBpjCBNNyvN2DGVxoZYA-1 X-MC-Unique: 2VzJR4HSPOejxs86d1gR3g-1 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 0131StP9010794 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 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" Struct lxcNetworkParseData is being used as a single pointer which iterates through LXC config lines. It means that it will be applied as a network each time that a new type appears. After, the same struct is used to populate a new network interface. This commit changes this logic to multiple lxcNetworkParseData to move this strcuture to an array. It makes more sense if we are using indexes to fill interface settings. This is better to improve code clarity. This commit still introduces *Legacy() functions to keep support of network old style definitions. Signed-off-by: Julio Faracco --- src/lxc/lxc_native.c | 140 ++++++++++++++++++++++++------------------- 1 file changed, 77 insertions(+), 63 deletions(-) diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index dd2345c324..31aa666e38 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -411,7 +411,9 @@ lxcCreateHostdevDef(int mode, int type, const char *dat= a) return hostdev; } =20 -typedef struct { +typedef struct _lxcNetworkParseData lxcNetworkParseData; +typedef lxcNetworkParseData *lxcNetworkParseDataPtr; +struct _lxcNetworkParseData { virDomainDefPtr def; char *type; char *link; @@ -424,9 +426,14 @@ typedef struct { size_t nips; char *gateway_ipv4; char *gateway_ipv6; - bool privnet; - size_t networks; -} lxcNetworkParseData; + size_t index; +}; + +typedef struct { + size_t ndata; + lxcNetworkParseDataPtr *parseData; +} lxcNetworkParseDataArray; + =20 static int lxcAddNetworkRouteDefinition(const char *address, @@ -552,39 +559,6 @@ lxcAddNetworkDefinition(lxcNetworkParseData *data) } =20 =20 -static int -lxcNetworkParseDataType(virConfValuePtr value, - lxcNetworkParseData *parseData) -{ - virDomainDefPtr def =3D parseData->def; - size_t networks =3D parseData->networks; - bool privnet =3D parseData->privnet; - int status; - - /* Store the previous NIC */ - status =3D lxcAddNetworkDefinition(parseData); - - if (status < 0) - return -1; - else if (status > 0) - networks++; - else if (parseData->type !=3D NULL && STREQ(parseData->type, "none")) - privnet =3D false; - - /* clean NIC to store a new one */ - memset(parseData, 0, sizeof(*parseData)); - - parseData->def =3D def; - parseData->networks =3D networks; - parseData->privnet =3D privnet; - - /* Keep the new value */ - parseData->type =3D value->str; - - return 0; -} - - static int lxcNetworkParseDataIPs(const char *name, virConfValuePtr value, @@ -633,8 +607,7 @@ lxcNetworkParseDataSuffix(const char *entry, =20 switch (elem) { case VIR_LXC_NETWORK_CONFIG_TYPE: - if (lxcNetworkParseDataType(value, parseData) < 0) - return -1; + parseData->type =3D value->str; break; case VIR_LXC_NETWORK_CONFIG_LINK: parseData->link =3D value->str; @@ -676,12 +649,40 @@ lxcNetworkParseDataSuffix(const char *entry, } =20 =20 +static lxcNetworkParseDataPtr +lxcNetworkGetParseDataByIndexLegacy(lxcNetworkParseDataArray *networks, + const char *entry) +{ + int elem =3D virLXCNetworkConfigEntryTypeFromString(entry); + size_t ndata =3D networks->ndata; + + if (elem =3D=3D VIR_LXC_NETWORK_CONFIG_TYPE) { + /* Index was not found. So, it is time to add new * + * interface and return this last position. */ + if (VIR_EXPAND_N(networks->parseData, networks->ndata, 1) < 0) + return NULL; + + networks->parseData[ndata] =3D g_new0(lxcNetworkParseData, 1); + networks->parseData[ndata]->index =3D networks->ndata; + + return networks->parseData[ndata]; + } + + /* Return last element added like a stack. */ + return networks->parseData[ndata - 1]; +} + + static int -lxcNetworkParseDataEntry(const char *name, - virConfValuePtr value, - lxcNetworkParseData *parseData) +lxcNetworkParseDataEntryLegacy(const char *name, + virConfValuePtr value, + lxcNetworkParseDataArray *networks) { const char *suffix =3D STRSKIP(name, "lxc.network."); + lxcNetworkParseData *parseData; + + if (!(parseData =3D lxcNetworkGetParseDataByIndexLegacy(networks, suff= ix))) + return -1; =20 return lxcNetworkParseDataSuffix(suffix, value, parseData); } @@ -690,10 +691,10 @@ lxcNetworkParseDataEntry(const char *name, static int lxcNetworkWalkCallback(const char *name, virConfValuePtr value, void *data) { - lxcNetworkParseData *parseData =3D data; + lxcNetworkParseDataArray *networks =3D data; =20 if (STRPREFIX(name, "lxc.network.")) - return lxcNetworkParseDataEntry(name, value, parseData); + return lxcNetworkParseDataEntryLegacy(name, value, networks); =20 return 0; } @@ -702,36 +703,49 @@ static int lxcConvertNetworkSettings(virDomainDefPtr def, virConfPtr properties) { int status; - size_t i; - lxcNetworkParseData data =3D {def, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, 0, - NULL, NULL, true, 0}; + bool privnet =3D true; + size_t i, j; + lxcNetworkParseDataArray networks =3D {0, NULL}; + int ret =3D -1; + + networks.parseData =3D g_new0(lxcNetworkParseDataPtr, 1); =20 - if (virConfWalk(properties, lxcNetworkWalkCallback, &data) < 0) + if (virConfWalk(properties, lxcNetworkWalkCallback, &networks) < 0) goto error; =20 + for (i =3D 0; i < networks.ndata; i++) { + lxcNetworkParseDataPtr data =3D networks.parseData[i]; + data->def =3D def; =20 - /* Add the last network definition found */ - status =3D lxcAddNetworkDefinition(&data); + status =3D lxcAddNetworkDefinition(data); =20 - if (status < 0) - goto error; - else if (status > 0) - data.networks++; - else if (data.type !=3D NULL && STREQ(data.type, "none")) - data.privnet =3D false; + if (status < 0) + goto error; + else if (data->type !=3D NULL && STREQ(data->type, "none")) + privnet =3D false; + } =20 - if (data.networks =3D=3D 0 && data.privnet) { + if (networks.ndata =3D=3D 0 && privnet) { /* When no network type is provided LXC only adds loopback */ def->features[VIR_DOMAIN_FEATURE_PRIVNET] =3D VIR_TRISTATE_SWITCH_= ON; } - return 0; + + ret =3D 0; + + cleanup: + for (i =3D 0; i < networks.ndata; i++) + VIR_FREE(networks.parseData[i]); + VIR_FREE(networks.parseData); + return ret; =20 error: - for (i =3D 0; i < data.nips; i++) - VIR_FREE(data.ips[i]); - VIR_FREE(data.ips); - return -1; + for (i =3D 0; i < networks.ndata; i++) { + lxcNetworkParseDataPtr data =3D networks.parseData[i]; + for (j =3D 0; j < data->nips; j++) + VIR_FREE(data->ips[j]); + VIR_FREE(data->ips); + } + goto cleanup; } =20 static int --=20 2.20.1 From nobody Sun Apr 28 10:02:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1580693349772147.79678568118516; Sun, 2 Feb 2020 17:29:09 -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-344-DCtj-uG0Ob6mGlhSZuyB2A-1; Sun, 02 Feb 2020 20:29:05 -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 E22081851FC9; Mon, 3 Feb 2020 01:29: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 95D4560BE1; Mon, 3 Feb 2020 01:29:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0E74318089CE; Mon, 3 Feb 2020 01:28:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0131SvKB010802 for ; Sun, 2 Feb 2020 20:28:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 042362166B28; Mon, 3 Feb 2020 01:28:57 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 002592166B27 for ; Mon, 3 Feb 2020 01:28:55 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E34CF85A304 for ; Mon, 3 Feb 2020 01:28:54 +0000 (UTC) Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-163-cAzajD32ObiLaxuRnUswtg-1; Sun, 02 Feb 2020 20:28:52 -0500 Received: by mail-qk1-f193.google.com with SMTP id h4so1811548qkm.0; Sun, 02 Feb 2020 17:28:52 -0800 (PST) Received: from localhost.localdomain ([2804:431:c7ca:48a6:483f:10c:9f6c:3cd0]) by smtp.gmail.com with ESMTPSA id l6sm9126115qti.10.2020.02.02.17.28.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 17:28:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580693348; 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=8WIxo4oWjcobtJ3NLHrEdwCII4kDKqvyAlopAbb8Lc8=; b=KcuYnEp4jeUX9iEb12o3+vIQ5BxzSm6er56KG0VHLdokRaICMux4nqtKGH8eSyK4SD31Ov awmsZiHWnT4B0vKd2zyWJlOIpt2w9CRAch9NtTmytAZ4qa+YKwS8m/HlgiV2D19f9ldTdT A/6X9x6jJO9qA5HoyHGgXeZjxF+roWw= 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=ZHcw3YcX7MJm9C0H9HnyIcT+vIQg1xEN37m+/esIpoI=; b=dkHp19c03Jq9hLaS5dup9sv2rPgA4yrwYqHPvb0QIRSCVAbYbU5NiqaAnRAiapjcDU XM34R9uSC/6O2dLUtuZWpi0GF5C1w0BPHM1f8iws6B8gDgYnWyxqML3eJr/ZQLDLPSML lWqUDUqaWvSsmFy3OYas5Z40ZlL4ny03tSynOO9qBu72OSqfj5wmyIw7iFEz9xols/W6 EQEY99o5eWn7rXW3fZ5az3ZmdXMGA9FJjeekGyICBeJkFuapPoepRxWTmfS6QFrZss5s LBzGCum1GUYcH8XgyDW45ampc1rrDDs/meqwJrsqmU622FaSN8Hv+zx0M57bW2RoZCE5 Ty0A== X-Gm-Message-State: APjAAAWxZPQI2SZA8BCqYRMJvHIq6fu7ohnyEyLM23wreN87wINHT5eH Hf6niVmPyukfHcvry2BsrSmwrLXi X-Google-Smtp-Source: APXvYqzrsz1yzrqjaBEWVP+zvhk5Q5gpc2d17AGe+rt92nsWv0HE+Y6V9Lo1KXkztRMwYzAQUHUjhw== X-Received: by 2002:a37:e211:: with SMTP id g17mr18471018qki.210.1580693331673; Sun, 02 Feb 2020 17:28:51 -0800 (PST) From: Julio Faracco To: libvir-list@redhat.com Subject: [PATCH v4 2/4] lxc: add LXC version 3 network parser Date: Sun, 2 Feb 2020 22:28:33 -0300 Message-Id: <20200203012835.20971-3-jcfaracco@gmail.com> In-Reply-To: <20200203012835.20971-1-jcfaracco@gmail.com> References: <20200203012835.20971-1-jcfaracco@gmail.com> MIME-Version: 1.0 X-MC-Unique: cAzajD32ObiLaxuRnUswtg-1 X-MC-Unique: DCtj-uG0Ob6mGlhSZuyB2A-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 0131SvKB010802 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 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" LXC version 3 or higher introduced indexes for network interfaces. Libvirt should be able to parse entries like `lxc.net.2.KEY`. This commit adds functions to parse this type of field. That's why array structures are so important this time. Signed-off-by: Julio Faracco --- src/lxc/lxc_native.c | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index 31aa666e38..8bbe205659 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -649,6 +649,55 @@ lxcNetworkParseDataSuffix(const char *entry, } =20 =20 +static lxcNetworkParseDataPtr +lxcNetworkGetParseDataByIndex(lxcNetworkParseDataArray *networks, + unsigned int index) +{ + size_t ndata =3D networks->ndata; + size_t i; + + for (i =3D 0; i < ndata; i++) { + if (networks->parseData[i]->index =3D=3D index) + return networks->parseData[i]; + } + + /* Index was not found. So, it is time to add new * + * interface and return this last position. */ + if (VIR_EXPAND_N(networks->parseData, networks->ndata, 1) < 0) + return NULL; + + networks->parseData[ndata] =3D g_new0(lxcNetworkParseData, 1); + networks->parseData[ndata]->index =3D index; + + return networks->parseData[ndata]; +} + + +static int +lxcNetworkParseDataEntry(const char *name, + virConfValuePtr value, + lxcNetworkParseDataArray *networks) +{ + lxcNetworkParseData *parseData; + const char *suffix_tmp =3D STRSKIP(name, "lxc.net."); + char *suffix =3D NULL; + unsigned long long index; + + if (virStrToLong_ull(suffix_tmp, &suffix, 10, &index) < 0) + return -1; + + if (suffix[0] !=3D '.') + return -1; + + suffix++; + + if (!(parseData =3D lxcNetworkGetParseDataByIndex(networks, index))) + return -1; + + return lxcNetworkParseDataSuffix(suffix, value, parseData); +} + + static lxcNetworkParseDataPtr lxcNetworkGetParseDataByIndexLegacy(lxcNetworkParseDataArray *networks, const char *entry) @@ -695,6 +744,8 @@ lxcNetworkWalkCallback(const char *name, virConfValuePt= r value, void *data) =20 if (STRPREFIX(name, "lxc.network.")) return lxcNetworkParseDataEntryLegacy(name, value, networks); + if (STRPREFIX(name, "lxc.net.")) + return lxcNetworkParseDataEntry(name, value, networks); =20 return 0; } --=20 2.20.1 From nobody Sun Apr 28 10:02:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1580693368096574.3105530483668; Sun, 2 Feb 2020 17:29:28 -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-86-VySKEGNmP9yT5mMACJxMpw-1; Sun, 02 Feb 2020 20:29:24 -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 A6601800D54; Mon, 3 Feb 2020 01:29:19 +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 799905C290; Mon, 3 Feb 2020 01:29: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 2D86081731; Mon, 3 Feb 2020 01:29:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0131SwEt010810 for ; Sun, 2 Feb 2020 20:28:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id ADBA06C341; Mon, 3 Feb 2020 01:28:58 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A94FB6C343 for ; Mon, 3 Feb 2020 01:28:57 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E4513802066 for ; Mon, 3 Feb 2020 01:28:56 +0000 (UTC) Received: from mail-qv1-f65.google.com (mail-qv1-f65.google.com [209.85.219.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-179-ZVqI6AqOPVenI6x2vpAMUw-1; Sun, 02 Feb 2020 20:28:54 -0500 Received: by mail-qv1-f65.google.com with SMTP id dc14so6071830qvb.9; Sun, 02 Feb 2020 17:28:54 -0800 (PST) Received: from localhost.localdomain ([2804:431:c7ca:48a6:483f:10c:9f6c:3cd0]) by smtp.gmail.com with ESMTPSA id l6sm9126115qti.10.2020.02.02.17.28.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 17:28:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580693367; 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=2EK7dgX+n9KBYnWW2wBROp0nkwt7277xt964nC/6c54=; b=WQKdiJtTj6kiQqTlJkxaKlmpKqyu8Lr2iT9i6a8rinZpSoOM2lMSM8xR7D4anS0IYirdFW GNPUsVcHzX2C18X6en+sAZr//YdSfEun9MpD3eR9d9IU1JuzyVbij/blWqEc15QARP1nHg jdZOQgws1gEJBfWVceb9/93SUpZHPiM= 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=HCHoJUze7LJI9oJ1xHZGElyLeHRPI1kQE3yC8C4WJEU=; b=A6zsy7m5b4yFhqU4z7SvLWodmCl14EotpByLqgpAANmLOOVsK7otVx5sJZhcXzFEv0 C/AHwaW+rV5OiHVg7owHugOaCgo+pK42v+S5REYhpuyQzwF0DxdAFx+e6k00ti0rXr03 Q4zyYV+WkZhzSyV8T/XBZXr20xu44Oxx8WZ/CzpDgAyaqFgj8s3jwXiRZREaLliihntf ABUDv+nZTaDOQ+nEAFwelXsLnzLrpLOWo9RrjD0u+5hXj3cQOo6ZSmN5XpEBqjMXaZU/ 5QyAEjZccw8sf4tMVBZcWYypWJeEeOsgmudXMx5v4np1X49w0LzqjmBryEX0o6+3N1I3 fA0w== X-Gm-Message-State: APjAAAVDHyQwQhgCyzujenMvppvFcZECZ/kSNt5vsoZHkrsAJxbQY9AF +5d7uAngB5jNCsBLJi3twJiRKSMH X-Google-Smtp-Source: APXvYqzPevUxoAfZ5oUqLUl2Opw96IAPJC3slFrStmym7g4w2BWrcBaxz6iwID9gRTrBvoZ892uJcg== X-Received: by 2002:a0c:e98e:: with SMTP id z14mr21339682qvn.158.1580693333418; Sun, 02 Feb 2020 17:28:53 -0800 (PST) From: Julio Faracco To: libvir-list@redhat.com Subject: [PATCH v4 3/4] lxc: remove domain definition from lxc network struct Date: Sun, 2 Feb 2020 22:28:34 -0300 Message-Id: <20200203012835.20971-4-jcfaracco@gmail.com> In-Reply-To: <20200203012835.20971-1-jcfaracco@gmail.com> References: <20200203012835.20971-1-jcfaracco@gmail.com> MIME-Version: 1.0 X-MC-Unique: ZVqI6AqOPVenI6x2vpAMUw-1 X-MC-Unique: VySKEGNmP9yT5mMACJxMpw-1 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 0131SwEt010810 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 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 Reviewed-by: Michal Privoznik --- 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 8bbe205659..99539a0205 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; @@ -766,9 +768,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 From nobody Sun Apr 28 10:02:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1580693381081410.5239486626888; Sun, 2 Feb 2020 17:29:41 -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-63-SymDnw-UOUyI9w0aDMjI7A-1; Sun, 02 Feb 2020 20:29:24 -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 6DEBB1851FD3; Mon, 3 Feb 2020 01:29:19 +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 411AA5DA82; Mon, 3 Feb 2020 01:29: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 EBE298172C; Mon, 3 Feb 2020 01:29:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0131T3TM010825 for ; Sun, 2 Feb 2020 20:29:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2B48F2016F34; Mon, 3 Feb 2020 01:29:03 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2541E2093CC1 for ; Mon, 3 Feb 2020 01:29:00 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 95819800897 for ; Mon, 3 Feb 2020 01:29:00 +0000 (UTC) Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-269-kE0p5cMJP42d37RrZ0B2xA-1; Sun, 02 Feb 2020 20:28:56 -0500 Received: by mail-qv1-f41.google.com with SMTP id p2so6060426qvo.10; Sun, 02 Feb 2020 17:28:56 -0800 (PST) Received: from localhost.localdomain ([2804:431:c7ca:48a6:483f:10c:9f6c:3cd0]) by smtp.gmail.com with ESMTPSA id l6sm9126115qti.10.2020.02.02.17.28.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 17:28:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580693379; 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=Ez0yHX/Pxb1B9JzJKsIENobsP1QRHRkiik9dwz9kd5g=; b=IJl1k2Wc6bt4O3o89hwW6qTzxyI4hKH+bX2Nv6APTswdja9KevzCTDaLJ87FbLDtLPVa+O Zy93F5ZLa9gYuZ8xL18y3tmQLCHRDtCyeDcU4TWMQtJw7M325uFe13E2+kXnzIbzU0KvC7 FRfRVKWtLJgaPSq/pl6rdMdu6JV8fEU= 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=R8/I8RpDN+OopVFCyQWL1/4WvVPgYBk4M/q/lSQ7ttI=; b=KTcuCM3sqFAlpLgmBOYpf7pTdmltx0qIIJFK9RjBTJpi5XowJ0hKa+EYevWL+Ihy7u rkgmcR/r93o0fKMpvQkzqoFR01jGaKQD7u4fchZfGj8yq3aIe6mpZP8olJEHSK1jNzUv vEAsIxEbArhR5MUtik6nZCowUZFKJfzY2Ws6IEXcLZId7LhA3AXBz2832J6oVH7B9zPV pBiyNliCLdf9+2b1GBAkbor1us9F/4XVCjqPrvv53GIKfv/C5rKnYrmbf8FDooAkzhlb mFpDd0oKOqJYf7wZEaTho51fAeXGQTyEMrALgm5PVNQdbsuKI1UyAH78a+8m0LVwKnvB sk6A== X-Gm-Message-State: APjAAAX01UxTjbypQglCV3p7RHolWbG37JhrHtB1+H6BQHqblaWdRXnA /N+xXZ3UlwwtBrjZXlG+EhnJf2hU X-Google-Smtp-Source: APXvYqxWRx7g8ZQLmQ0LfUwuUSeWG7+e+z7fKfn4mG9S5sOOJOEWm8P4fKFfdfS1iQiFqzlUT/saVQ== X-Received: by 2002:a0c:f513:: with SMTP id j19mr20848482qvm.206.1580693335198; Sun, 02 Feb 2020 17:28:55 -0800 (PST) From: Julio Faracco To: libvir-list@redhat.com Subject: [PATCH v4 4/4] tests: update LXC config dataset to support V3 indexes Date: Sun, 2 Feb 2020 22:28:35 -0300 Message-Id: <20200203012835.20971-5-jcfaracco@gmail.com> In-Reply-To: <20200203012835.20971-1-jcfaracco@gmail.com> References: <20200203012835.20971-1-jcfaracco@gmail.com> MIME-Version: 1.0 X-MC-Unique: kE0p5cMJP42d37RrZ0B2xA-1 X-MC-Unique: SymDnw-UOUyI9w0aDMjI7A-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 0131T3TM010825 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 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" LXC version 3 config files are still using network old style definition. So, as LXC supports it now, they can be converted to use this new definition. Signed-off-by: Julio Faracco --- .../lxcconf2xml-ethernet-v3.config | 16 ++++----- .../lxcconf2xml-fstab-v3.config | 10 +++--- .../lxcconf2xml-macvlannetwork-v3.config | 10 +++--- .../lxcconf2xml-miscnetwork-v3.config | 34 +++++++++---------- .../lxcconf2xml-nonenetwork-v3.config | 2 +- .../lxcconf2xml-physnetwork-v3.config | 14 ++++---- .../lxcconf2xml-simple-v3.config | 18 +++++----- .../lxcconf2xml-vlannetwork-v3.config | 10 +++--- 8 files changed, 57 insertions(+), 57 deletions(-) diff --git a/tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config b/tests/l= xcconf2xmldata/lxcconf2xml-ethernet-v3.config index 630cb2ebb6..0a641549f3 100644 --- a/tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config +++ b/tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config @@ -1,14 +1,14 @@ # Template used to create this container: opensuse # Template script checksum (SHA-1): 27307e0a95bd81b2c0bd82d6f87fdbe83be075= ef =20 -lxc.network.type =3D veth -lxc.network.flags =3D up -lxc.network.hwaddr =3D 02:00:15:8f:05:c1 -lxc.network.name =3D eth0 -lxc.network.ipv4 =3D 192.168.122.2/24 -lxc.network.ipv4.gateway =3D 192.168.122.1 -lxc.network.ipv6 =3D 2003:db8:1:0:214:1234:fe0b:3596/64 -lxc.network.ipv6.gateway =3D 2003:db8:1:0:214:1234:fe0b:3595 +lxc.net.0.type =3D veth +lxc.net.0.flags =3D up +lxc.net.0.hwaddr =3D 02:00:15:8f:05:c1 +lxc.net.0.name =3D eth0 +lxc.net.0.ipv4 =3D 192.168.122.2/24 +lxc.net.0.ipv4.gateway =3D 192.168.122.1 +lxc.net.0.ipv6 =3D 2003:db8:1:0:214:1234:fe0b:3596/64 +lxc.net.0.ipv6.gateway =3D 2003:db8:1:0:214:1234:fe0b:3595 =20 #remove next line if host DNS configuration should not be available to con= tainer lxc.mount.entry =3D proc proc proc nodev,noexec,nosuid 0 0 diff --git a/tests/lxcconf2xmldata/lxcconf2xml-fstab-v3.config b/tests/lxcc= onf2xmldata/lxcconf2xml-fstab-v3.config index 8b62818657..79bcfa1bd1 100644 --- a/tests/lxcconf2xmldata/lxcconf2xml-fstab-v3.config +++ b/tests/lxcconf2xmldata/lxcconf2xml-fstab-v3.config @@ -1,11 +1,11 @@ # Template used to create this container: opensuse # Template script checksum (SHA-1): 27307e0a95bd81b2c0bd82d6f87fdbe83be075= ef =20 -lxc.network.type =3D veth -lxc.network.flags =3D up -lxc.network.link =3D virbr0 -lxc.network.hwaddr =3D 02:00:15:8f:05:c1 -lxc.network.name =3D eth0 +lxc.net.0.type =3D veth +lxc.net.0.flags =3D up +lxc.net.0.link =3D virbr0 +lxc.net.0.hwaddr =3D 02:00:15:8f:05:c1 +lxc.net.0.name =3D eth0 =20 #remove next line if host DNS configuration should not be available to con= tainer lxc.mount.fstab =3D /var/lib/lxc/migrate_test/fstab diff --git a/tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork-v3.config b/t= ests/lxcconf2xmldata/lxcconf2xml-macvlannetwork-v3.config index 631f07ecca..ab8d85361f 100644 --- a/tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork-v3.config +++ b/tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork-v3.config @@ -1,11 +1,11 @@ # Template used to create this container: opensuse # Template script checksum (SHA-1): 27307e0a95bd81b2c0bd82d6f87fdbe83be075= ef =20 -lxc.network.type =3D macvlan -lxc.network.flags =3D up -lxc.network.link =3D eth0 -lxc.network.hwaddr =3D 02:00:15:8f:05:c1 -lxc.network.macvlan.mode =3D vepa +lxc.net.0.type =3D macvlan +lxc.net.0.flags =3D up +lxc.net.0.link =3D eth0 +lxc.net.0.hwaddr =3D 02:00:15:8f:05:c1 +lxc.net.0.macvlan.mode =3D vepa =20 #remove next line if host DNS configuration should not be available to con= tainer lxc.rootfs.path =3D /var/lib/lxc/migrate_test/rootfs diff --git a/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config b/test= s/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config index b46cb3ee7d..537da64592 100644 --- a/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config +++ b/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config @@ -1,22 +1,22 @@ -lxc.network.type =3D phys -lxc.network.link =3D eth0 -lxc.network.name =3D eth1 -lxc.network.ipv4 =3D 192.168.122.2/24 -lxc.network.ipv4.gateway =3D 192.168.122.1 -lxc.network.ipv6 =3D 2003:db8:1:0:214:1234:fe0b:3596/64 -lxc.network.ipv6.gateway =3D 2003:db8:1:0:214:1234:fe0b:3595 +lxc.net.0.type =3D phys +lxc.net.0.link =3D eth0 +lxc.net.0.name =3D eth1 +lxc.net.0.ipv4 =3D 192.168.122.2/24 +lxc.net.0.ipv4.gateway =3D 192.168.122.1 +lxc.net.0.ipv6 =3D 2003:db8:1:0:214:1234:fe0b:3596/64 +lxc.net.0.ipv6.gateway =3D 2003:db8:1:0:214:1234:fe0b:3595 =20 -lxc.network.type =3D vlan -lxc.network.flags =3D up -lxc.network.link =3D eth0 -lxc.network.hwaddr =3D 02:00:15:8f:05:c1 -lxc.network.vlan.id =3D 2 +lxc.net.1.type =3D vlan +lxc.net.1.flags =3D up +lxc.net.1.link =3D eth0 +lxc.net.1.hwaddr =3D 02:00:15:8f:05:c1 +lxc.net.1.vlan.id =3D 2 =20 -lxc.network.type =3D macvlan -lxc.network.flags =3D up -lxc.network.link =3D eth0 -lxc.network.hwaddr =3D 02:00:15:8f:05:c1 -lxc.network.macvlan.mode =3D vepa +lxc.net.2.type =3D macvlan +lxc.net.2.flags =3D up +lxc.net.2.link =3D eth0 +lxc.net.2.hwaddr =3D 02:00:15:8f:05:c1 +lxc.net.2.macvlan.mode =3D vepa =20 lxc.rootfs =3D /var/lib/lxc/migrate_test/rootfs lxc.utsname =3D migrate_test diff --git a/tests/lxcconf2xmldata/lxcconf2xml-nonenetwork-v3.config b/test= s/lxcconf2xmldata/lxcconf2xml-nonenetwork-v3.config index f81a786f1e..2402723d9e 100644 --- a/tests/lxcconf2xmldata/lxcconf2xml-nonenetwork-v3.config +++ b/tests/lxcconf2xmldata/lxcconf2xml-nonenetwork-v3.config @@ -1,4 +1,4 @@ lxc.rootfs.path =3D /var/lib/lxc/migrate_test/rootfs lxc.uts.name =3D migrate_test lxc.autodev=3D1 -lxc.network.type =3D none +lxc.net.0.type =3D none diff --git a/tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config b/test= s/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config index 92729841d7..9cf96163b3 100644 --- a/tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config +++ b/tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config @@ -1,10 +1,10 @@ -lxc.network.type =3D phys -lxc.network.link =3D eth0 -lxc.network.name =3D eth1 -lxc.network.ipv4 =3D 192.168.122.2/24 -lxc.network.ipv4.gateway =3D 192.168.122.1 -lxc.network.ipv6 =3D 2003:db8:1:0:214:1234:fe0b:3596/64 -lxc.network.ipv6.gateway =3D 2003:db8:1:0:214:1234:fe0b:3595 +lxc.net.0.type =3D phys +lxc.net.0.link =3D eth0 +lxc.net.0.name =3D eth1 +lxc.net.0.ipv4 =3D 192.168.122.2/24 +lxc.net.0.ipv4.gateway =3D 192.168.122.1 +lxc.net.0.ipv6 =3D 2003:db8:1:0:214:1234:fe0b:3596/64 +lxc.net.0.ipv6.gateway =3D 2003:db8:1:0:214:1234:fe0b:3595 =20 lxc.rootfs.path =3D /var/lib/lxc/migrate_test/rootfs lxc.uts.name =3D migrate_test diff --git a/tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config b/tests/lxc= conf2xmldata/lxcconf2xml-simple-v3.config index a0036a482e..b0656571b2 100644 --- a/tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config +++ b/tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config @@ -1,15 +1,15 @@ # Template used to create this container: opensuse # Template script checksum (SHA-1): 27307e0a95bd81b2c0bd82d6f87fdbe83be075= ef =20 -lxc.network.type =3D veth -lxc.network.flags =3D up -lxc.network.link =3D virbr0 -lxc.network.hwaddr =3D 02:00:15:8f:05:c1 -lxc.network.name =3D eth0 -lxc.network.ipv4 =3D 192.168.122.2/24 -lxc.network.ipv4.gateway =3D 192.168.122.1 -lxc.network.ipv6 =3D 2003:db8:1:0:214:1234:fe0b:3596/64 -lxc.network.ipv6.gateway =3D 2003:db8:1:0:214:1234:fe0b:3595 +lxc.net.0.type =3D veth +lxc.net.0.flags =3D up +lxc.net.0.link =3D virbr0 +lxc.net.0.hwaddr =3D 02:00:15:8f:05:c1 +lxc.net.0.name =3D eth0 +lxc.net.0.ipv4 =3D 192.168.122.2/24 +lxc.net.0.ipv4.gateway =3D 192.168.122.1 +lxc.net.0.ipv6 =3D 2003:db8:1:0:214:1234:fe0b:3596/64 +lxc.net.0.ipv6.gateway =3D 2003:db8:1:0:214:1234:fe0b:3595 =20 #remove next line if host DNS configuration should not be available to con= tainer lxc.mount.entry =3D proc proc proc nodev,noexec,nosuid 0 0 diff --git a/tests/lxcconf2xmldata/lxcconf2xml-vlannetwork-v3.config b/test= s/lxcconf2xmldata/lxcconf2xml-vlannetwork-v3.config index 31e26997dd..fb4539261f 100644 --- a/tests/lxcconf2xmldata/lxcconf2xml-vlannetwork-v3.config +++ b/tests/lxcconf2xmldata/lxcconf2xml-vlannetwork-v3.config @@ -1,11 +1,11 @@ # Template used to create this container: opensuse # Template script checksum (SHA-1): 27307e0a95bd81b2c0bd82d6f87fdbe83be075= ef =20 -lxc.network.type =3D vlan -lxc.network.flags =3D up -lxc.network.link =3D eth0 -lxc.network.hwaddr =3D 02:00:15:8f:05:c1 -lxc.network.vlan.id =3D 2 +lxc.net.1.type =3D vlan +lxc.net.1.flags =3D up +lxc.net.1.link =3D eth0 +lxc.net.1.hwaddr =3D 02:00:15:8f:05:c1 +lxc.net.1.vlan.id =3D 2 =20 lxc.rootfs.path =3D /var/lib/lxc/migrate_test/rootfs lxc.uts.name =3D migrate_test --=20 2.20.1