mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Compare commits
8 Commits
911d311adf
...
00166d05d9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00166d05d9 | ||
|
|
fbe29f0624 | ||
|
|
48f81c3782 | ||
|
|
7bdc7569f1 | ||
|
|
fadd8dc47c | ||
|
|
cb88c6ba10 | ||
|
|
f2f622ebf4 | ||
|
|
78c6b01902 |
1
api/doc.go
Normal file
1
api/doc.go
Normal file
@@ -0,0 +1 @@
|
||||
package api
|
||||
@@ -251,9 +251,14 @@ func deleteEpFromResolverImpl(
|
||||
}
|
||||
|
||||
func findHNSEp(ip4, ip6 *net.IPNet, hnsEndpoints []hcsshim.HNSEndpoint) *hcsshim.HNSEndpoint {
|
||||
if ip4 == nil && ip6 == nil {
|
||||
return nil
|
||||
}
|
||||
for _, hnsEp := range hnsEndpoints {
|
||||
if (hnsEp.IPAddress != nil && hnsEp.IPAddress.Equal(ip4.IP)) ||
|
||||
(hnsEp.IPv6Address != nil && hnsEp.IPv6Address.Equal(ip6.IP)) {
|
||||
if ip4 != nil && hnsEp.IPAddress != nil && hnsEp.IPAddress.Equal(ip4.IP) {
|
||||
return &hnsEp
|
||||
}
|
||||
if ip6 != nil && hnsEp.IPv6Address != nil && hnsEp.IPv6Address.Equal(ip6.IP) {
|
||||
return &hnsEp
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package daemon
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"maps"
|
||||
"os"
|
||||
@@ -258,10 +259,11 @@ func (daemon *Daemon) registerMountPoints(ctr *container.Container, defaultReadO
|
||||
StorageOpt: ctr.HostConfig.StorageOpt,
|
||||
}
|
||||
|
||||
// Include the destination in the layer name to make it unique for each mount point and container.
|
||||
// Hash the source and destination to create a safe, unique identifier for each mount point and container.
|
||||
// This makes sure that the same image can be mounted multiple times with different destinations.
|
||||
// Hex encode the destination to create a safe, unique identifier
|
||||
layerName := hex.EncodeToString([]byte(ctr.ID + ",src=" + mp.Source + ",dst=" + mp.Destination))
|
||||
// We hash it so that the snapshot name is friendly to the underlying filesystem and doesn't exceed path length limits.
|
||||
destHash := sha256.Sum256([]byte(ctr.ID + "-src=" + mp.Source + "-dst=" + mp.Destination))
|
||||
layerName := hex.EncodeToString(destHash[:])
|
||||
layer, err := daemon.imageService.CreateLayerFromImage(img, layerName, rwLayerOpts)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -297,7 +297,7 @@ func (d *Daemon) NewClientT(t testing.TB, extraOpts ...client.Opt) *client.Clien
|
||||
|
||||
c, err := d.NewClient(extraOpts...)
|
||||
assert.NilError(t, err, "[%s] could not create daemon client", d.id)
|
||||
t.Cleanup(func() { c.Close() })
|
||||
t.Cleanup(func() { _ = c.Close() })
|
||||
return c
|
||||
}
|
||||
|
||||
@@ -571,20 +571,20 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error {
|
||||
close(wait)
|
||||
}()
|
||||
|
||||
clientConfig, err := d.getClientConfig()
|
||||
clientCfg, err := d.getClientConfig()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
client := &http.Client{
|
||||
Transport: clientConfig.transport,
|
||||
httpClient := &http.Client{
|
||||
Transport: clientCfg.transport,
|
||||
}
|
||||
|
||||
req, err := http.NewRequest(http.MethodGet, "/_ping", http.NoBody)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "[%s] could not create new request", d.id)
|
||||
}
|
||||
req.URL.Host = clientConfig.addr
|
||||
req.URL.Scheme = clientConfig.scheme
|
||||
req.URL.Host = clientCfg.addr
|
||||
req.URL.Scheme = clientCfg.scheme
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
|
||||
defer cancel()
|
||||
@@ -602,7 +602,7 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error {
|
||||
rctx, rcancel := context.WithTimeout(context.TODO(), 2*time.Second)
|
||||
defer rcancel()
|
||||
|
||||
resp, err := client.Do(req.WithContext(rctx))
|
||||
resp, err := httpClient.Do(req.WithContext(rctx))
|
||||
if err != nil {
|
||||
if i > 2 { // don't log the first couple, this ends up just being noise
|
||||
d.log.Logf("[%s] error pinging daemon on start: %v", d.id, err)
|
||||
@@ -615,7 +615,7 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error {
|
||||
continue
|
||||
}
|
||||
|
||||
resp.Body.Close()
|
||||
_ = resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
d.log.Logf("[%s] received status != 200 OK: %s\n", d.id, resp.Status)
|
||||
}
|
||||
@@ -644,7 +644,7 @@ func (d *Daemon) Kill() error {
|
||||
}
|
||||
|
||||
defer func() {
|
||||
d.logFile.Close()
|
||||
_ = d.logFile.Close()
|
||||
d.cmd = nil
|
||||
}()
|
||||
|
||||
@@ -1062,7 +1062,7 @@ func cleanupRaftDir(t testing.TB, d *Daemon) {
|
||||
// artifacts.
|
||||
//
|
||||
// We currently do not include container logs in the bundles, so this also
|
||||
// removes the "containers" sub-directory.
|
||||
// removes the "containers" subdirectory.
|
||||
func cleanupDaemonStorage(t testing.TB, d *Daemon) {
|
||||
t.Helper()
|
||||
dirs := []string{
|
||||
|
||||
Reference in New Issue
Block a user