-
Notifications
You must be signed in to change notification settings - Fork 128
Enable pod support #572
Enable pod support #572
Conversation
610282c to
4fc542b
Compare
6121774 to
fc950c4
Compare
cf04158 to
cee61ca
Compare
|
Please modify your commit message to describe more about this modifcations, also remove "cherry-pick from cfd4695 and 81d42e4", 81d42e4 isn't included in these codes and is outdated so you don't need to mention it. @ZhaoXuqiang |
cee61ca to
44ec27e
Compare
share a pod with existing container, with `--net container:xxx` get shared container by compare pid with exist running container's Pid which found from container's state file Signed-off-by: Zhang Wei <[email protected]> Signed-off-by: ZhaoXuqiang <[email protected]>
| if err != nil { | ||
| return fmt.Errorf("The container %q is not ready", sharedContainer) | ||
| if sharedContainer, err = findSharedContainer(context.GlobalString("root"), ns.Path); err != nil { | ||
| return fmt.Errorf("failed to find shared container: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you keep
- _, err = os.Stat(filepath.Join(root, sharedContainer, stateJSON))
- if err != nil {
- return fmt.Errorf("The container %q is not existing or not ready", sharedContainer)
- }
- _, err = os.Stat(filepath.Join(root, sharedContainer, "namespace"))
- if err != nil {
- return fmt.Errorf("The container %q is not ready", sharedContainer)
This piece of code is used for validation, I think it's still useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's not useful.
if sharedContainer != "" {
scState, err = loadStateFile(root, sharedContainer)
if err != nil {
return err
}
vm, lockFile, err = getSandbox(filepath.Join(context.GlobalString("root"), sharedContainer, "sandbox"))
if err != nil {
return err
}
}
func loadStateFile(root, container string) (*State, error) {
stateFile := filepath.Join(root, container, stateJSON)
file, err := os.Open(stateFile)
if err != nil {
return nil, err
}
defer file.Close()
var state State
if err = json.NewDecoder(file).Decode(&state); err != nil {
return nil, fmt.Errorf("Decode state file %s error: %s", stateFile, err.Error())
}
return &state, nil
}
loadStateFile will confirm the state file exist.
namespace file is not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it's OK then.
ping @laijs
|
LGTM |
Enable pod support
share a pod with existing container, with
--net container:xxxget shared container by compare pid with exist running container's Pid which found from container's state file
Signed-off-by: Zhang Wei [email protected]
Signed-off-by: ZhaoXuqiang [email protected]