Rename StdFds into ExternalDescriptors
Signed-off-by: Andrey Vagin <avagin@openvz.org>
This commit is contained in:
parent
6ecf32c234
commit
655f1ce09c
|
@ -51,7 +51,7 @@ type State struct {
|
||||||
Config configs.Config `json:"config"`
|
Config configs.Config `json:"config"`
|
||||||
|
|
||||||
// Container's standard descriptors (std{in,out,err}), needed for checkpoint and restore
|
// Container's standard descriptors (std{in,out,err}), needed for checkpoint and restore
|
||||||
StdFds [3]string `json:"std_fds,omitempty"`
|
ExternalDescriptors [3]string `json:"external_descriptors,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// A libcontainer container object.
|
// A libcontainer container object.
|
||||||
|
|
|
@ -371,7 +371,7 @@ func (c *linuxContainer) Checkpoint(criuOpts *CriuOpts) error {
|
||||||
|
|
||||||
// Write the FD info to a file in the image directory
|
// Write the FD info to a file in the image directory
|
||||||
|
|
||||||
fdsJSON, err := json.Marshal(c.initProcess.stdFds())
|
fdsJSON, err := json.Marshal(c.initProcess.externalDescriptors())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -563,7 +563,7 @@ func (c *linuxContainer) criuSwrk(process *Process, req *criurpc.CriuReq, opts *
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
c.initProcess.setStdFds(fds)
|
c.initProcess.setExternalDescriptors(fds)
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := proto.Marshal(req)
|
data, err := proto.Marshal(req)
|
||||||
|
@ -700,7 +700,7 @@ func (c *linuxContainer) criuNotifications(resp *criurpc.CriuResp, process *Proc
|
||||||
|
|
||||||
case notify.GetScript() == "post-restore":
|
case notify.GetScript() == "post-restore":
|
||||||
pid := notify.GetPid()
|
pid := notify.GetPid()
|
||||||
r, err := newRestoredProcess(int(pid), c.initProcess.stdFds())
|
r, err := newRestoredProcess(int(pid), c.initProcess.externalDescriptors())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -771,7 +771,7 @@ func (c *linuxContainer) currentState() (*State, error) {
|
||||||
InitProcessStartTime: startTime,
|
InitProcessStartTime: startTime,
|
||||||
CgroupPaths: c.cgroupManager.GetPaths(),
|
CgroupPaths: c.cgroupManager.GetPaths(),
|
||||||
NamespacePaths: make(map[configs.NamespaceType]string),
|
NamespacePaths: make(map[configs.NamespaceType]string),
|
||||||
StdFds: c.initProcess.stdFds(),
|
ExternalDescriptors: c.initProcess.externalDescriptors(),
|
||||||
}
|
}
|
||||||
for _, ns := range c.config.Namespaces {
|
for _, ns := range c.config.Namespaces {
|
||||||
state.NamespacePaths[ns.Type] = ns.GetPath(c.initProcess.pid())
|
state.NamespacePaths[ns.Type] = ns.GetPath(c.initProcess.pid())
|
||||||
|
|
|
@ -182,7 +182,7 @@ func (l *LinuxFactory) Load(id string) (Container, error) {
|
||||||
r := &nonChildProcess{
|
r := &nonChildProcess{
|
||||||
processPid: state.InitProcessPid,
|
processPid: state.InitProcessPid,
|
||||||
processStartTime: state.InitProcessStartTime,
|
processStartTime: state.InitProcessStartTime,
|
||||||
fds: state.StdFds,
|
fds: state.ExternalDescriptors,
|
||||||
}
|
}
|
||||||
return &linuxContainer{
|
return &linuxContainer{
|
||||||
initProcess: r,
|
initProcess: r,
|
||||||
|
|
|
@ -34,9 +34,9 @@ type parentProcess interface {
|
||||||
|
|
||||||
signal(os.Signal) error
|
signal(os.Signal) error
|
||||||
|
|
||||||
stdFds() [3]string
|
externalDescriptors() [3]string
|
||||||
|
|
||||||
setStdFds(fds [3]string)
|
setExternalDescriptors(fds [3]string)
|
||||||
}
|
}
|
||||||
|
|
||||||
type setnsProcess struct {
|
type setnsProcess struct {
|
||||||
|
@ -149,11 +149,11 @@ func (p *setnsProcess) pid() int {
|
||||||
return p.cmd.Process.Pid
|
return p.cmd.Process.Pid
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *setnsProcess) stdFds() [3]string {
|
func (p *setnsProcess) externalDescriptors() [3]string {
|
||||||
return p.fds
|
return p.fds
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *setnsProcess) setStdFds(newFds [3]string) {
|
func (p *setnsProcess) setExternalDescriptors(newFds [3]string) {
|
||||||
p.fds = newFds
|
p.fds = newFds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ func (p *initProcess) pid() int {
|
||||||
return p.cmd.Process.Pid
|
return p.cmd.Process.Pid
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *initProcess) stdFds() [3]string {
|
func (p *initProcess) externalDescriptors() [3]string {
|
||||||
return p.fds
|
return p.fds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ func (p *initProcess) start() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return newSystemError(err)
|
return newSystemError(err)
|
||||||
}
|
}
|
||||||
p.setStdFds(fds);
|
p.setExternalDescriptors(fds);
|
||||||
|
|
||||||
// Do this before syncing with child so that no children
|
// Do this before syncing with child so that no children
|
||||||
// can escape the cgroup
|
// can escape the cgroup
|
||||||
|
@ -281,7 +281,7 @@ func (p *initProcess) signal(sig os.Signal) error {
|
||||||
return syscall.Kill(p.cmd.Process.Pid, s)
|
return syscall.Kill(p.cmd.Process.Pid, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *initProcess) setStdFds(newFds [3]string) {
|
func (p *initProcess) setExternalDescriptors(newFds [3]string) {
|
||||||
p.fds = newFds
|
p.fds = newFds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,11 +68,11 @@ func (p *restoredProcess) signal(s os.Signal) error {
|
||||||
return p.proc.Signal(s)
|
return p.proc.Signal(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *restoredProcess) stdFds() [3]string {
|
func (p *restoredProcess) externalDescriptors() [3]string {
|
||||||
return p.fds
|
return p.fds
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *restoredProcess) setStdFds(newFds [3]string) {
|
func (p *restoredProcess) setExternalDescriptors(newFds [3]string) {
|
||||||
p.fds = newFds
|
p.fds = newFds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,10 +109,10 @@ func (p *nonChildProcess) signal(s os.Signal) error {
|
||||||
return newGenericError(fmt.Errorf("restored process cannot be signaled"), SystemError)
|
return newGenericError(fmt.Errorf("restored process cannot be signaled"), SystemError)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *nonChildProcess) stdFds() [3]string {
|
func (p *nonChildProcess) externalDescriptors() [3]string {
|
||||||
return p.fds
|
return p.fds
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *nonChildProcess) setStdFds(newFds [3]string) {
|
func (p *nonChildProcess) setExternalDescriptors(newFds [3]string) {
|
||||||
p.fds = newFds
|
p.fds = newFds
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue