The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7923

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
If non-default network project in use, and network type not specified by user, default to `ovn` type. Otherwise default to `bridge` type.
From 8ca190120f9461048bb38537a7ba1f1883e11a41 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@canonical.com>
Date: Wed, 23 Sep 2020 09:20:04 +0100
Subject: [PATCH 1/2] lxd/network: Removes client side default network type
 when creating network

Let server decide the appropriate network type to use when not specified by 
user.

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
---
 lxc/network.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxc/network.go b/lxc/network.go
index 17980f40c2..41c2f6e549 100644
--- a/lxc/network.go
+++ b/lxc/network.go
@@ -255,7 +255,7 @@ func (c *cmdNetworkCreate) Command() *cobra.Command {
        cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G(`Create new 
networks`))
 
        cmd.Flags().StringVar(&c.network.flagTarget, "target", "", 
i18n.G("Cluster member name")+"``")
-       cmd.Flags().StringVarP(&c.network.flagType, "type", "t", "bridge", 
i18n.G("Network type"))
+       cmd.Flags().StringVarP(&c.network.flagType, "type", "t", "", 
i18n.G("Network type"))
 
        cmd.RunE = c.Run
 

From c896c22ae8c97cfb93ebf4112b6e6ecaa291bd48 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@canonical.com>
Date: Wed, 23 Sep 2020 09:20:43 +0100
Subject: [PATCH 2/2] lxd/networks: Default to ovn network type when creating
 non-default network project

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
---
 lxd/networks.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lxd/networks.go b/lxd/networks.go
index 32a58f7043..3e399350c0 100644
--- a/lxd/networks.go
+++ b/lxd/networks.go
@@ -144,7 +144,11 @@ func networksPost(d *Daemon, r *http.Request) 
response.Response {
        }
 
        if req.Type == "" {
-               req.Type = "bridge"
+               if projectName != project.Default {
+                       req.Type = "ovn" // Only OVN networks are allowed 
inside network enabled projects.
+               } else {
+                       req.Type = "bridge" // Default to bridge for 
non-network enabled projects.
+               }
        }
 
        if req.Config == nil {
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to