Remove procStart

It's never used and not needed. Our pipe is created with
syscall.SOCK_CLOEXEC, so pipe will be closed once container
process executed successfully, parent process will read EOF
and continue. If container process got error before executed,
we'll write procError to sync with parent.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
Qiang Huang
2016-01-30 13:41:21 +08:00
parent 86454a0447
commit 13e8f6e589
3 changed files with 10 additions and 17 deletions

View File

@@ -232,23 +232,19 @@ func (l *LinuxFactory) StartInitialization() (err error) {
os.Clearenv() os.Clearenv()
var i initer var i initer
defer func() { defer func() {
// if we have an error during the initialization of the container's init then send it back to the // We have an error during the initialization of the container's init,
// parent process in the form of an initError. // send it back to the parent process in the form of an initError.
if err != nil { // If container's init successed, syscall.Exec will not return, hence
if _, ok := i.(*linuxStandardInit); ok { // this defer function will never be called.
// Synchronisation only necessary for standard init. if _, ok := i.(*linuxStandardInit); ok {
if err := utils.WriteJSON(pipe, syncT{procError}); err != nil { // Synchronisation only necessary for standard init.
panic(err) if err := utils.WriteJSON(pipe, syncT{procError}); err != nil {
}
}
if err := utils.WriteJSON(pipe, newSystemError(err)); err != nil {
panic(err)
}
} else {
if err := utils.WriteJSON(pipe, syncT{procStart}); err != nil {
panic(err) panic(err)
} }
} }
if err := utils.WriteJSON(pipe, newSystemError(err)); err != nil {
panic(err)
}
// ensure that this pipe is always closed // ensure that this pipe is always closed
pipe.Close() pipe.Close()
}() }()

View File

@@ -14,7 +14,6 @@ type syncType uint8
const ( const (
procReady syncType = iota procReady syncType = iota
procError procError
procStart
procRun procRun
) )

View File

@@ -247,8 +247,6 @@ loop:
return newSystemError(err) return newSystemError(err)
} }
switch procSync.Type { switch procSync.Type {
case procStart:
break loop
case procReady: case procReady:
if err := p.manager.Set(p.config.Config); err != nil { if err := p.manager.Set(p.config.Config); err != nil {
return newSystemError(err) return newSystemError(err)