本文整理汇总了Golang中github.com/docker/libnetwork.SandboxContainerWalker函数的典型用法代码示例。如果您正苦于以下问题:Golang SandboxContainerWalker函数的具体用法?Golang SandboxContainerWalker怎么用?Golang SandboxContainerWalker使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SandboxContainerWalker函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: setNetworkNamespaceKey
// called from the libcontainer pre-start hook to set the network
// namespace configuration linkage to the libnetwork "sandbox" entity
func (daemon *Daemon) setNetworkNamespaceKey(containerID string, pid int) error {
path := fmt.Sprintf("/proc/%d/ns/net", pid)
var sandbox libnetwork.Sandbox
search := libnetwork.SandboxContainerWalker(&sandbox, containerID)
daemon.netController.WalkSandboxes(search)
if sandbox == nil {
return derr.ErrorCodeNoSandbox.WithArgs(containerID, "no sandbox found")
}
return sandbox.SetKey(path)
}
开发者ID:RockaLabs,项目名称:docker,代码行数:13,代码来源:container_unix.go
示例2: setNetworkNamespaceKey
// called from the libcontainer pre-start hook to set the network
// namespace configuration linkage to the libnetwork "sandbox" entity
func (daemon *Daemon) setNetworkNamespaceKey(containerID string, pid int) error {
path := fmt.Sprintf("/proc/%d/ns/net", pid)
var sandbox libnetwork.Sandbox
search := libnetwork.SandboxContainerWalker(&sandbox, containerID)
daemon.netController.WalkSandboxes(search)
if sandbox == nil {
return fmt.Errorf("error locating sandbox id %s: no sandbox found", containerID)
}
return sandbox.SetKey(path)
}
开发者ID:contiv,项目名称:docker,代码行数:13,代码来源:container_operations_unix.go
示例3: runParallelTests
func runParallelTests(t *testing.T, thrNumber int) {
var (
ep libnetwork.Endpoint
sb libnetwork.Sandbox
err error
)
t.Parallel()
pTest := flag.Lookup("test.parallel")
if pTest == nil {
t.Skip("Skipped because test.parallel flag not set;")
}
numParallel, err := strconv.Atoi(pTest.Value.String())
if err != nil {
t.Fatal(err)
}
if numParallel < numThreads {
t.Skip("Skipped because t.parallel was less than ", numThreads)
}
runtime.LockOSThread()
defer runtime.UnlockOSThread()
if thrNumber == first {
createGlobalInstance(t)
}
if thrNumber != first {
select {
case <-start:
}
thrdone := make(chan struct{})
done <- thrdone
defer close(thrdone)
if thrNumber == last {
defer close(done)
}
err = netns.Set(testns)
if err != nil {
t.Fatal(err)
}
}
defer netns.Set(origns)
net1, err := controller.NetworkByName("testhost")
if err != nil {
t.Fatal(err)
}
if net1 == nil {
t.Fatal("Could not find testhost")
}
net2, err := controller.NetworkByName("network2")
if err != nil {
t.Fatal(err)
}
if net2 == nil {
t.Fatal("Could not find network2")
}
epName := fmt.Sprintf("pep%d", thrNumber)
if thrNumber == first {
ep, err = net1.EndpointByName(epName)
} else {
ep, err = net2.EndpointByName(epName)
}
if err != nil {
t.Fatal(err)
}
if ep == nil {
t.Fatal("Got nil ep with no error")
}
cid := fmt.Sprintf("%drace", thrNumber)
controller.WalkSandboxes(libnetwork.SandboxContainerWalker(&sb, cid))
if sb == nil {
t.Fatalf("Got nil sandbox for container: %s", cid)
}
for i := 0; i < iterCnt; i++ {
parallelJoin(t, sb, ep, thrNumber)
parallelLeave(t, sb, ep, thrNumber)
}
debugf("\n")
err = ep.Delete()
if err != nil {
t.Fatal(err)
}
if thrNumber == first {
for thrdone := range done {
select {
//.........这里部分代码省略.........
开发者ID:hurrygeek,项目名称:libnetwork,代码行数:101,代码来源:libnetwork_test.go
注:本文中的github.com/docker/libnetwork.SandboxContainerWalker函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论