| ... | ... |
@@ -234,7 +234,7 @@ func (daemon *Daemon) register(container *Container, updateSuffixarray bool) err |
| 234 | 234 |
log.Debugf("killing old running container %s", container.ID)
|
| 235 | 235 |
|
| 236 | 236 |
existingPid := container.Pid |
| 237 |
- container.SetStopped(&execdriver.ExitStatus{0, false})
|
|
| 237 |
+ container.SetStopped(&execdriver.ExitStatus{ExitCode: 0})
|
|
| 238 | 238 |
|
| 239 | 239 |
// We only have to handle this for lxc because the other drivers will ensure that |
| 240 | 240 |
// no processes are left when docker dies |
| ... | ... |
@@ -266,7 +266,7 @@ func (daemon *Daemon) register(container *Container, updateSuffixarray bool) err |
| 266 | 266 |
|
| 267 | 267 |
log.Debugf("Marking as stopped")
|
| 268 | 268 |
|
| 269 |
- container.SetStopped(&execdriver.ExitStatus{-127, false})
|
|
| 269 |
+ container.SetStopped(&execdriver.ExitStatus{ExitCode: -127})
|
|
| 270 | 270 |
if err := container.ToDisk(); err != nil {
|
| 271 | 271 |
return err |
| 272 | 272 |
} |
| ... | ... |
@@ -76,11 +76,11 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba |
| 76 | 76 |
}) |
| 77 | 77 |
|
| 78 | 78 |
if err := d.generateEnvConfig(c); err != nil {
|
| 79 |
- return execdriver.ExitStatus{-1, false}, err
|
|
| 79 |
+ return execdriver.ExitStatus{ExitCode: -1}, err
|
|
| 80 | 80 |
} |
| 81 | 81 |
configPath, err := d.generateLXCConfig(c) |
| 82 | 82 |
if err != nil {
|
| 83 |
- return execdriver.ExitStatus{-1, false}, err
|
|
| 83 |
+ return execdriver.ExitStatus{ExitCode: -1}, err
|
|
| 84 | 84 |
} |
| 85 | 85 |
params := []string{
|
| 86 | 86 |
"lxc-start", |
| ... | ... |
@@ -154,11 +154,11 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba |
| 154 | 154 |
c.ProcessConfig.Args = append([]string{name}, arg...)
|
| 155 | 155 |
|
| 156 | 156 |
if err := nodes.CreateDeviceNodes(c.Rootfs, c.AutoCreatedDevices); err != nil {
|
| 157 |
- return execdriver.ExitStatus{-1, false}, err
|
|
| 157 |
+ return execdriver.ExitStatus{ExitCode: -1}, err
|
|
| 158 | 158 |
} |
| 159 | 159 |
|
| 160 | 160 |
if err := c.ProcessConfig.Start(); err != nil {
|
| 161 |
- return execdriver.ExitStatus{-1, false}, err
|
|
| 161 |
+ return execdriver.ExitStatus{ExitCode: -1}, err
|
|
| 162 | 162 |
} |
| 163 | 163 |
|
| 164 | 164 |
var ( |
| ... | ... |
@@ -182,7 +182,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba |
| 182 | 182 |
c.ProcessConfig.Process.Kill() |
| 183 | 183 |
c.ProcessConfig.Wait() |
| 184 | 184 |
} |
| 185 |
- return execdriver.ExitStatus{-1, false}, err
|
|
| 185 |
+ return execdriver.ExitStatus{ExitCode: -1}, err
|
|
| 186 | 186 |
} |
| 187 | 187 |
|
| 188 | 188 |
c.ContainerPid = pid |
| ... | ... |
@@ -193,7 +193,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba |
| 193 | 193 |
|
| 194 | 194 |
<-waitLock |
| 195 | 195 |
|
| 196 |
- return execdriver.ExitStatus{getExitCode(c), false}, waitErr
|
|
| 196 |
+ return execdriver.ExitStatus{ExitCode: getExitCode(c)}, waitErr
|
|
| 197 | 197 |
} |
| 198 | 198 |
|
| 199 | 199 |
/// Return the exit code of the process |
| ... | ... |
@@ -74,7 +74,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba |
| 74 | 74 |
// take the Command and populate the libcontainer.Config from it |
| 75 | 75 |
container, err := d.createContainer(c) |
| 76 | 76 |
if err != nil {
|
| 77 |
- return execdriver.ExitStatus{-1, false}, err
|
|
| 77 |
+ return execdriver.ExitStatus{ExitCode: -1}, err
|
|
| 78 | 78 |
} |
| 79 | 79 |
|
| 80 | 80 |
var term execdriver.Terminal |
| ... | ... |
@@ -85,7 +85,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba |
| 85 | 85 |
term, err = execdriver.NewStdConsole(&c.ProcessConfig, pipes) |
| 86 | 86 |
} |
| 87 | 87 |
if err != nil {
|
| 88 |
- return execdriver.ExitStatus{-1, false}, err
|
|
| 88 |
+ return execdriver.ExitStatus{ExitCode: -1}, err
|
|
| 89 | 89 |
} |
| 90 | 90 |
c.ProcessConfig.Terminal = term |
| 91 | 91 |
|
| ... | ... |
@@ -102,12 +102,12 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba |
| 102 | 102 |
) |
| 103 | 103 |
|
| 104 | 104 |
if err := d.createContainerRoot(c.ID); err != nil {
|
| 105 |
- return execdriver.ExitStatus{-1, false}, err
|
|
| 105 |
+ return execdriver.ExitStatus{ExitCode: -1}, err
|
|
| 106 | 106 |
} |
| 107 | 107 |
defer d.cleanContainer(c.ID) |
| 108 | 108 |
|
| 109 | 109 |
if err := d.writeContainerFile(container, c.ID); err != nil {
|
| 110 |
- return execdriver.ExitStatus{-1, false}, err
|
|
| 110 |
+ return execdriver.ExitStatus{ExitCode: -1}, err
|
|
| 111 | 111 |
} |
| 112 | 112 |
|
| 113 | 113 |
execOutputChan := make(chan execOutput, 1) |
| ... | ... |
@@ -146,7 +146,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba |
| 146 | 146 |
|
| 147 | 147 |
select {
|
| 148 | 148 |
case execOutput := <-execOutputChan: |
| 149 |
- return execdriver.ExitStatus{execOutput.exitCode, false}, execOutput.err
|
|
| 149 |
+ return execdriver.ExitStatus{ExitCode: execOutput.exitCode}, execOutput.err
|
|
| 150 | 150 |
case <-waitForStart: |
| 151 | 151 |
break |
| 152 | 152 |
} |
| ... | ... |
@@ -161,7 +161,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba |
| 161 | 161 |
// wait for the container to exit. |
| 162 | 162 |
execOutput := <-execOutputChan |
| 163 | 163 |
|
| 164 |
- return execdriver.ExitStatus{execOutput.exitCode, oomKill}, execOutput.err
|
|
| 164 |
+ return execdriver.ExitStatus{ExitCode: execOutput.exitCode, OOMKilled: oomKill}, execOutput.err
|
|
| 165 | 165 |
} |
| 166 | 166 |
|
| 167 | 167 |
func (d *driver) Kill(p *execdriver.Command, sig int) error {
|
| ... | ... |
@@ -134,15 +134,15 @@ func supportsAufs() error {
|
| 134 | 134 |
return ErrAufsNotSupported |
| 135 | 135 |
} |
| 136 | 136 |
|
| 137 |
-func (a Driver) rootPath() string {
|
|
| 137 |
+func (a *Driver) rootPath() string {
|
|
| 138 | 138 |
return a.root |
| 139 | 139 |
} |
| 140 | 140 |
|
| 141 |
-func (Driver) String() string {
|
|
| 141 |
+func (*Driver) String() string {
|
|
| 142 | 142 |
return "aufs" |
| 143 | 143 |
} |
| 144 | 144 |
|
| 145 |
-func (a Driver) Status() [][2]string {
|
|
| 145 |
+func (a *Driver) Status() [][2]string {
|
|
| 146 | 146 |
ids, _ := loadIds(path.Join(a.rootPath(), "layers")) |
| 147 | 147 |
return [][2]string{
|
| 148 | 148 |
{"Root Dir", a.rootPath()},
|
| ... | ... |
@@ -152,7 +152,7 @@ func (a Driver) Status() [][2]string {
|
| 152 | 152 |
|
| 153 | 153 |
// Exists returns true if the given id is registered with |
| 154 | 154 |
// this driver |
| 155 |
-func (a Driver) Exists(id string) bool {
|
|
| 155 |
+func (a *Driver) Exists(id string) bool {
|
|
| 156 | 156 |
if _, err := os.Lstat(path.Join(a.rootPath(), "layers", id)); err != nil {
|
| 157 | 157 |
return false |
| 158 | 158 |
} |
| ... | ... |
@@ -45,15 +45,15 @@ type Transaction struct {
|
| 45 | 45 |
} |
| 46 | 46 |
|
| 47 | 47 |
type DevInfo struct {
|
| 48 |
- Hash string `json:"-"` |
|
| 49 |
- DeviceId int `json:"device_id"` |
|
| 50 |
- Size uint64 `json:"size"` |
|
| 51 |
- TransactionId uint64 `json:"transaction_id"` |
|
| 52 |
- Initialized bool `json:"initialized"` |
|
| 53 |
- devices *DeviceSet `json:"-"` |
|
| 48 |
+ Hash string `json:"-"` |
|
| 49 |
+ DeviceId int `json:"device_id"` |
|
| 50 |
+ Size uint64 `json:"size"` |
|
| 51 |
+ TransactionId uint64 `json:"transaction_id"` |
|
| 52 |
+ Initialized bool `json:"initialized"` |
|
| 53 |
+ devices *DeviceSet |
|
| 54 | 54 |
|
| 55 |
- mountCount int `json:"-"` |
|
| 56 |
- mountPath string `json:"-"` |
|
| 55 |
+ mountCount int |
|
| 56 |
+ mountPath string |
|
| 57 | 57 |
|
| 58 | 58 |
// The global DeviceSet lock guarantees that we serialize all |
| 59 | 59 |
// the calls to libdevmapper (which is not threadsafe), but we |
| ... | ... |
@@ -65,12 +65,12 @@ type DevInfo struct {
|
| 65 | 65 |
// the global lock while holding the per-device locks all |
| 66 | 66 |
// device locks must be aquired *before* the device lock, and |
| 67 | 67 |
// multiple device locks should be aquired parent before child. |
| 68 |
- lock sync.Mutex `json:"-"` |
|
| 68 |
+ lock sync.Mutex |
|
| 69 | 69 |
} |
| 70 | 70 |
|
| 71 | 71 |
type MetaData struct {
|
| 72 | 72 |
Devices map[string]*DevInfo `json:"Devices"` |
| 73 |
- devicesLock sync.Mutex `json:"-"` // Protects all read/writes to Devices map |
|
| 73 |
+ devicesLock sync.Mutex // Protects all read/writes to Devices map |
|
| 74 | 74 |
} |
| 75 | 75 |
|
| 76 | 76 |
type DeviceSet struct {
|
| ... | ... |
@@ -49,7 +49,7 @@ func TestStateRunStop(t *testing.T) {
|
| 49 | 49 |
atomic.StoreInt64(&exit, int64(exitCode)) |
| 50 | 50 |
close(stopped) |
| 51 | 51 |
}() |
| 52 |
- s.SetStopped(&execdriver.ExitStatus{i, false})
|
|
| 52 |
+ s.SetStopped(&execdriver.ExitStatus{ExitCode: i})
|
|
| 53 | 53 |
if s.IsRunning() {
|
| 54 | 54 |
t.Fatal("State is running")
|
| 55 | 55 |
} |
| ... | ... |
@@ -122,7 +122,7 @@ func TestAttachTtyWithoutStdin(t *testing.T) {
|
| 122 | 122 |
if out, _, err := runCommandWithOutput(cmd); err == nil {
|
| 123 | 123 |
t.Fatal("attach should have failed")
|
| 124 | 124 |
} else if !strings.Contains(out, expected) {
|
| 125 |
- t.Fatal("attach failed with error %q: expected %q", out, expected)
|
|
| 125 |
+ t.Fatalf("attach failed with error %q: expected %q", out, expected)
|
|
| 126 | 126 |
} |
| 127 | 127 |
}() |
| 128 | 128 |
|
| ... | ... |
@@ -3903,7 +3903,7 @@ func TestBuildStderr(t *testing.T) {
|
| 3903 | 3903 |
t.Fatal(err) |
| 3904 | 3904 |
} |
| 3905 | 3905 |
if stderr != "" {
|
| 3906 |
- t.Fatal("Stderr should have been empty, instead its: %q", stderr)
|
|
| 3906 |
+ t.Fatalf("Stderr should have been empty, instead its: %q", stderr)
|
|
| 3907 | 3907 |
} |
| 3908 | 3908 |
logDone("build - testing stderr")
|
| 3909 | 3909 |
} |
| ... | ... |
@@ -339,7 +339,7 @@ func TestExecTtyWithoutStdin(t *testing.T) {
|
| 339 | 339 |
if out, _, err := runCommandWithOutput(cmd); err == nil {
|
| 340 | 340 |
t.Fatal("exec should have failed")
|
| 341 | 341 |
} else if !strings.Contains(out, expected) {
|
| 342 |
- t.Fatal("exec failed with error %q: expected %q", out, expected)
|
|
| 342 |
+ t.Fatalf("exec failed with error %q: expected %q", out, expected)
|
|
| 343 | 343 |
} |
| 344 | 344 |
}() |
| 345 | 345 |
|
| ... | ... |
@@ -2760,7 +2760,7 @@ func TestRunTtyWithPipe(t *testing.T) {
|
| 2760 | 2760 |
if out, _, err := runCommandWithOutput(cmd); err == nil {
|
| 2761 | 2761 |
t.Fatal("run should have failed")
|
| 2762 | 2762 |
} else if !strings.Contains(out, expected) {
|
| 2763 |
- t.Fatal("run failed with error %q: expected %q", out, expected)
|
|
| 2763 |
+ t.Fatalf("run failed with error %q: expected %q", out, expected)
|
|
| 2764 | 2764 |
} |
| 2765 | 2765 |
}() |
| 2766 | 2766 |
|
| ... | ... |
@@ -653,7 +653,7 @@ func TestRestore(t *testing.T) {
|
| 653 | 653 |
if err := container3.Run(); err != nil {
|
| 654 | 654 |
t.Fatal(err) |
| 655 | 655 |
} |
| 656 |
- container2.SetStopped(&execdriver.ExitStatus{0, false})
|
|
| 656 |
+ container2.SetStopped(&execdriver.ExitStatus{ExitCode: 0})
|
|
| 657 | 657 |
} |
| 658 | 658 |
|
| 659 | 659 |
func TestDefaultContainerName(t *testing.T) {
|