зеркало из https://github.com/microsoft/docker.git
Vendor the latest swarmkit PR
Signed-off-by: cyli <cyli@twistedmatrix.com>
This commit is contained in:
Родитель
81f3e699c3
Коммит
b399d29a57
|
@ -100,7 +100,7 @@ github.com/docker/containerd 8517738ba4b82aff5662c97ca4627e7e4d03b531
|
|||
github.com/tonistiigi/fifo 1405643975692217d6720f8b54aeee1bf2cd5cf4
|
||||
|
||||
# cluster
|
||||
github.com/docker/swarmkit ce07d9f69c9b4a1b1eb508e777c44eeacca87065
|
||||
github.com/docker/swarmkit 0be0da2c1f88aec55dc0880f2057f76f77039430
|
||||
github.com/golang/mock bd3c8e81be01eef76d4b503f5e687d2d1354d2d9
|
||||
github.com/gogo/protobuf v0.3
|
||||
github.com/cloudflare/cfssl 7fb22c8cba7ecaf98e4082d22d65800cf45e042a
|
||||
|
|
11
vendor/github.com/docker/swarmkit/manager/state/raft/storage/storage.go
сгенерированный
поставляемый
11
vendor/github.com/docker/swarmkit/manager/state/raft/storage/storage.go
сгенерированный
поставляемый
|
@ -160,12 +160,13 @@ func (e *EncryptedRaftLogger) BootstrapNew(metadata []byte) error {
|
|||
encrypter, decrypter := encryption.Defaults(e.EncryptionKey)
|
||||
walFactory := NewWALFactory(encrypter, decrypter)
|
||||
|
||||
for _, dirpath := range []string{e.walDir(), e.snapDir()} {
|
||||
for _, dirpath := range []string{filepath.Dir(e.walDir()), e.snapDir()} {
|
||||
if err := os.MkdirAll(dirpath, 0700); err != nil {
|
||||
return errors.Wrapf(err, "failed to create %s", dirpath)
|
||||
}
|
||||
}
|
||||
var err error
|
||||
// the wal directory must not already exist upon creation
|
||||
e.wal, err = walFactory.Create(e.walDir(), metadata)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to create WAL")
|
||||
|
@ -373,8 +374,8 @@ func (e *EncryptedRaftLogger) Clear(ctx context.Context) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.Rename(e.walDir(), newWALDir)
|
||||
if err != nil {
|
||||
os.RemoveAll(newWALDir)
|
||||
if err = os.Rename(e.walDir(), newWALDir); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -382,8 +383,8 @@ func (e *EncryptedRaftLogger) Clear(ctx context.Context) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.Rename(e.snapDir(), newSnapDir)
|
||||
if err != nil {
|
||||
os.RemoveAll(newSnapDir)
|
||||
if err := os.Rename(e.snapDir(), newSnapDir); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
18
vendor/github.com/docker/swarmkit/manager/state/raft/storage/walwrap.go
сгенерированный
поставляемый
18
vendor/github.com/docker/swarmkit/manager/state/raft/storage/walwrap.go
сгенерированный
поставляемый
|
@ -9,7 +9,6 @@ import (
|
|||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/coreos/etcd/pkg/fileutil"
|
||||
"github.com/coreos/etcd/raft/raftpb"
|
||||
"github.com/coreos/etcd/wal"
|
||||
"github.com/coreos/etcd/wal/walpb"
|
||||
|
@ -204,16 +203,16 @@ func MigrateWALs(ctx context.Context, oldDir, newDir string, oldFactory, newFact
|
|||
}
|
||||
oldReader.Close()
|
||||
|
||||
if err := os.MkdirAll(filepath.Dir(newDir), 0700); err != nil {
|
||||
return errors.Wrap(err, "could not create parent directory")
|
||||
}
|
||||
|
||||
// keep temporary wal directory so WAL initialization appears atomic
|
||||
tmpdirpath := filepath.Clean(newDir) + ".tmp"
|
||||
if fileutil.Exist(tmpdirpath) {
|
||||
if err := os.RemoveAll(tmpdirpath); err != nil {
|
||||
return errors.Wrap(err, "could not remove temporary WAL directory")
|
||||
}
|
||||
}
|
||||
if err := fileutil.CreateDirAll(tmpdirpath); err != nil {
|
||||
return errors.Wrap(err, "could not create temporary WAL directory")
|
||||
if err := os.RemoveAll(tmpdirpath); err != nil {
|
||||
return errors.Wrap(err, "could not remove temporary WAL directory")
|
||||
}
|
||||
defer os.RemoveAll(tmpdirpath)
|
||||
|
||||
tmpWAL, err := newFactory.Create(tmpdirpath, waldata.Metadata)
|
||||
if err != nil {
|
||||
|
@ -228,6 +227,9 @@ func MigrateWALs(ctx context.Context, oldDir, newDir string, oldFactory, newFact
|
|||
if err := tmpWAL.Save(waldata.HardState, waldata.Entries); err != nil {
|
||||
return errors.Wrap(err, "could not migrate WALs to temporary directory")
|
||||
}
|
||||
if err := tmpWAL.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return os.Rename(tmpdirpath, newDir)
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче