Skip to content

Commit

Permalink
Merge branch 'refactor/create-container' into 'master'
Browse files Browse the repository at this point in the history
preserve more CreateContainerMessage fields

See merge request !44
  • Loading branch information
timfeirg committed Jan 6, 2017
2 parents 910234b + c93657b commit 0e084ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
7 changes: 3 additions & 4 deletions README.md
Expand Up @@ -5,10 +5,9 @@ Core
We use v0.23.4 because v0.24 sucks

```shell
cp devtools/libgit2.rb.patch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
git apply libgit2.rb.patch && git add libgit2.rb && git commit -m "patch libgit2 version for eru-core" && rm libgit2.rb.patch
cd -
cp /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
git checkout b0b94c4ee5ddec3a33d1ecb406f73b19642ec519 libgit2.rb
git commit -m 'override libgit2 version'
```

## DEV
Expand Down
16 changes: 6 additions & 10 deletions cluster/calcium/create_container.go
Expand Up @@ -95,6 +95,10 @@ func (c *calcium) doCreateContainerWithCPUPeriod(nodename string, connum int, qu

for i := 0; i < connum; i++ {
config, hostConfig, networkConfig, containerName, err := c.makeContainerOptions(nil, specs, opts, "cpuperiod", node.GetIP())
ms[i].ContainerName = containerName
ms[i].Podname = opts.Podname
ms[i].Nodename = node.Name
ms[i].Memory = opts.Memory
if err != nil {
log.Errorf("Error when creating CreateContainerOptions, %v", err)
c.store.UpdateNodeMem(opts.Podname, nodename, opts.Memory, "+") // 创建容器失败就要把资源还回去对不对?
Expand Down Expand Up @@ -164,6 +168,7 @@ func (c *calcium) doCreateContainerWithCPUPeriod(nodename string, connum int, qu
c.store.UpdateNodeMem(opts.Podname, nodename, opts.Memory, "+")
continue
}
ms[i].ContainerID = info.ID

// after start
if err := runExec(node.Engine, info, AFTER_START); err != nil {
Expand All @@ -177,16 +182,7 @@ func (c *calcium) doCreateContainerWithCPUPeriod(nodename string, connum int, qu
continue
}

ms[i] = &types.CreateContainerMessage{
Podname: opts.Podname,
Nodename: node.Name,
ContainerID: info.ID,
ContainerName: containerName,
Error: "",
Success: true,
CPU: nil,
Memory: opts.Memory,
}
ms[i].Success = true

}
go func(podname string, nodename string) {
Expand Down

0 comments on commit 0e084ae

Please sign in to comment.