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

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) ===

From 64609830dd75ae776e0e01603692ed27591c19d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Fri, 21 Aug 2020 14:30:23 -0400
Subject: [PATCH 1/4] lxc/export: Use HostPathFollow
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This should better handle paths with intermediate symlinks.

Closes #7792

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxc/export.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxc/export.go b/lxc/export.go
index 0eddf0d4ed..33d71f7d84 100644
--- a/lxc/export.go
+++ b/lxc/export.go
@@ -125,7 +125,7 @@ func (c *cmdExport) Run(cmd *cobra.Command, args []string) 
error {
                targetName = "backup.tar.gz"
        }
 
-       target, err := os.Create(shared.HostPath(targetName))
+       target, err := os.Create(shared.HostPathFollow(targetName))
        if err != nil {
                return err
        }

From 04a913a0f89692f501d944525bb7157a9f9485e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Fri, 21 Aug 2020 14:49:12 -0400
Subject: [PATCH 2/4] lxd/cluster: Re-try listening for a minute
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #7782

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/endpoints/endpoints.go | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/lxd/endpoints/endpoints.go b/lxd/endpoints/endpoints.go
index feba2c178d..717649e0e6 100644
--- a/lxd/endpoints/endpoints.go
+++ b/lxd/endpoints/endpoints.go
@@ -5,6 +5,7 @@ import (
        "net"
        "net/http"
        "sync"
+       "time"
 
        "github.com/lxc/lxd/lxd/util"
        "github.com/lxc/lxd/shared"
@@ -194,23 +195,43 @@ func (e *Endpoints) up(config *Config) error {
                        e.inherited[network] = false
                }
 
-               // Errors here are not fatal and are just logged (unless we're
-               // clustered, see below).
+               // Errors here are not fatal and are just logged (unless we're 
clustered, see below).
                var networkAddressErr error
+               attempts := 0
+       againHttps:
                e.listeners[network], networkAddressErr = 
networkCreateListener(config.NetworkAddress, e.cert)
 
                isCovered := util.IsAddressCovered(config.ClusterAddress, 
config.NetworkAddress)
                if config.ClusterAddress != "" {
                        if isCovered {
-                               // In case of clustering we fail if we coun't
-                               // bind the network address.
+                               // In case of clustering we fail if we can't 
bind the network address.
                                if networkAddressErr != nil {
+                                       if attempts == 0 {
+                                               logger.Infof("Unable to bind 
https address %q, re-trying for a minute", config.NetworkAddress)
+                                       }
+
+                                       attempts++
+                                       if attempts < 60 {
+                                               time.Sleep(1 * time.Second)
+                                               goto againHttps
+                                       }
+
                                        return networkAddressErr
                                }
-
                        } else {
+                       againCluster:
                                e.listeners[cluster], err = 
networkCreateListener(config.ClusterAddress, e.cert)
                                if err != nil {
+                                       if attempts == 0 {
+                                               logger.Infof("Unable to bind 
cluster address %q, re-trying for a minute", config.ClusterAddress)
+                                       }
+
+                                       attempts++
+                                       if attempts < 60 {
+                                               time.Sleep(1 * time.Second)
+                                               goto againCluster
+                                       }
+
                                        return err
                                }
                        }

From 6f3bd86122b84ef64b5cc2c4c6662a8afe942aee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Fri, 21 Aug 2020 15:03:08 -0400
Subject: [PATCH 3/4] lxd/init: Don't fail on existing address
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/main_init_interactive.go | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/lxd/main_init_interactive.go b/lxd/main_init_interactive.go
index 493a3b62d9..ad3b42133f 100644
--- a/lxd/main_init_interactive.go
+++ b/lxd/main_init_interactive.go
@@ -119,14 +119,25 @@ func (c *cmdInit) askClustering(config *cmdInitData, d 
lxd.InstanceServer) error
                address := util.NetworkInterfaceAddress()
                validateServerAddress := func(value string) error {
                        address := util.CanonicalNetworkAddress(value)
+
                        host, _, _ := net.SplitHostPort(address)
                        if shared.StringInSlice(host, []string{"", "[::]", 
"0.0.0.0"}) {
                                return fmt.Errorf("Invalid IP address or DNS 
name")
                        }
+
+                       s, _, err := d.GetServer()
+                       if err == nil {
+                               if s.Config["cluster.https_address"] == value 
|| s.Config["core.https_address"] == value {
+                                       // We already own the address, just 
move on.
+                                       return nil
+                               }
+                       }
+
                        listener, err := net.Listen("tcp", address)
                        if err != nil {
                                return fmt.Errorf("Can't bind address %q: %v", 
address, err)
                        }
+
                        listener.Close()
                        return nil
                }
@@ -665,10 +676,20 @@ they otherwise would.
 
                netPort := cli.AskInt("Port to bind LXD to [default=8443]: ", 
1, 65535, "8443", func(netPort int64) error {
                        address := fmt.Sprintf("%s:%d", netAddr, netPort)
+
+                       s, _, err := d.GetServer()
+                       if err == nil {
+                               if s.Config["cluster.https_address"] == address 
|| s.Config["core.https_address"] == address {
+                                       // We already own the address, just 
move on.
+                                       return nil
+                               }
+                       }
+
                        listener, err := net.Listen("tcp", address)
                        if err != nil {
                                return fmt.Errorf("Can't bind address %q: %v", 
address, err)
                        }
+
                        listener.Close()
                        return nil
                })

From 92418b41fbef118bc05db413c2a985f7c5d3974b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Fri, 21 Aug 2020 16:40:15 -0400
Subject: [PATCH 4/4] lxd/storage/zfs: Fix bad transfer logic on block
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #7745

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/storage/drivers/driver_zfs_volumes.go | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lxd/storage/drivers/driver_zfs_volumes.go 
b/lxd/storage/drivers/driver_zfs_volumes.go
index 082ae886d2..3edbc96456 100644
--- a/lxd/storage/drivers/driver_zfs_volumes.go
+++ b/lxd/storage/drivers/driver_zfs_volumes.go
@@ -1264,11 +1264,17 @@ func (d *zfs) MigrateVolume(vol Volume, conn 
io.ReadWriteCloser, volSrcArgs *mig
 
                if volSrcArgs.MultiSync {
                        if volSrcArgs.FinalSync {
-                               finalParent = volSrcArgs.Data.(string)
+                               if volSrcArgs.Data != nil {
+                                       finalParent = 
volSrcArgs.Data.(map[ContentType]string)[vol.ContentType()]
+                               }
+
                                defer shared.RunCommand("zfs", "destroy", 
finalParent)
                                defer shared.RunCommand("zfs", "destroy", 
srcSnapshot)
                        } else {
-                               volSrcArgs.Data = srcSnapshot // Persist parent 
state for final sync.
+                               if volSrcArgs.Data == nil {
+                                       volSrcArgs.Data = 
map[ContentType]string{}
+                               }
+                               
volSrcArgs.Data.(map[ContentType]string)[vol.ContentType()] = srcSnapshot // 
Persist parent state for final sync.
                        }
                } else {
                        defer shared.RunCommand("zfs", "destroy", srcSnapshot)
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to