[lxc-devel] [lxd/master] Ignore missing WAL files when reproducing snapshots
freeekanayaka on Github
lxc-bot at linuxcontainers.org
Wed Jun 26 16:16:51 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190626/84e72ab9/attachment.bin>
-------------- next part --------------
From d080b846ba53ce0284e0eba12146f08b3b86f94e Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanayaka at canonical.com>
Date: Wed, 26 Jun 2019 18:12:59 +0200
Subject: [PATCH] Ignore missing WAL files when reproducing snapshots
---
lxd/cluster/migrate.go | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/lxd/cluster/migrate.go b/lxd/cluster/migrate.go
index 07caca85c8..47ecd931b8 100644
--- a/lxd/cluster/migrate.go
+++ b/lxd/cluster/migrate.go
@@ -205,9 +205,13 @@ func writeRaftSnapshot(dir string, index uint64) error {
return err
}
- wal, err := ioutil.ReadFile(filepath.Join(dir, "db.bin-wal"))
- if err != nil {
- return err
+ walPath := filepath.Join(dir, "db.bin-wal")
+ wal := []byte{}
+ if shared.PathExists(walPath) {
+ wal, err = ioutil.ReadFile(walPath)
+ if err != nil {
+ return err
+ }
}
buf := encodeRaftSnapshot(db, wal)
More information about the lxc-devel
mailing list