|
1 | 1 | package serverrpc
|
2 | 2 |
|
3 | 3 | import (
|
4 |
| - "github.com/golang/glog" |
5 | 4 | "github.com/hyperhq/hyperd/types"
|
6 | 5 | "golang.org/x/net/context"
|
7 | 6 | )
|
8 | 7 |
|
9 | 8 | // ContainerCreate creates a container by UserContainer spec
|
10 | 9 | func (s *ServerRPC) ContainerCreate(ctx context.Context, req *types.ContainerCreateRequest) (*types.ContainerCreateResponse, error) {
|
11 |
| - glog.V(3).Infof("ContainerCreate with request %s", req.String()) |
12 |
| - |
13 | 10 | containerID, err := s.daemon.CreateContainerInPod(req.PodID, req.ContainerSpec)
|
14 | 11 | if err != nil {
|
15 |
| - glog.Errorf("ContainerCreate failed %v with request %s: %v", err, req.String()) |
16 | 12 | return nil, err
|
17 | 13 | }
|
18 | 14 |
|
19 |
| - glog.V(3).Infof("ContainerCreate done with request %s", req.String()) |
20 |
| - |
21 | 15 | return &types.ContainerCreateResponse{
|
22 | 16 | ContainerID: containerID,
|
23 | 17 | }, nil
|
24 | 18 | }
|
25 | 19 |
|
26 | 20 | func (s *ServerRPC) ContainerStart(ctx context.Context, req *types.ContainerStartRequest) (*types.ContainerStartResponse, error) {
|
27 |
| - glog.V(3).Info("ContainerStart with request %s", req.String()) |
28 | 21 | err := s.daemon.StartContainer(req.ContainerId)
|
29 | 22 | if err != nil {
|
30 |
| - glog.Errorf("ContainerStart failed %v with request %s", err, req.String()) |
31 | 23 | return nil, err
|
32 | 24 | }
|
33 |
| - glog.V(3).Info("ContainerStart done with request %s", req.String()) |
| 25 | + |
34 | 26 | return &types.ContainerStartResponse{}, nil
|
35 | 27 | }
|
36 | 28 |
|
37 | 29 | // ContainerStop implements POST /container/stop
|
38 | 30 | func (s *ServerRPC) ContainerStop(c context.Context, req *types.ContainerStopRequest) (*types.ContainerStopResponse, error) {
|
39 |
| - glog.V(3).Infof("ContainerStop with request %v", req.String()) |
40 |
| - |
41 | 31 | err := s.daemon.StopContainer(req.ContainerID, int(req.Timeout))
|
42 | 32 | if err != nil {
|
43 |
| - glog.Errorf("ContainerStop failed %v with request %v", err, req.String()) |
44 | 33 | return nil, err
|
45 | 34 | }
|
46 | 35 |
|
47 |
| - glog.V(3).Infof("ContainerStop done with request %v", req.String()) |
48 |
| - |
49 | 36 | return &types.ContainerStopResponse{}, nil
|
50 | 37 | }
|
51 | 38 |
|
52 | 39 | // ContainerRename rename a container
|
53 | 40 | func (s *ServerRPC) ContainerRename(c context.Context, req *types.ContainerRenameRequest) (*types.ContainerRenameResponse, error) {
|
54 |
| - glog.V(3).Infof("ContainerRename with request %v", req.String()) |
55 |
| - |
56 | 41 | err := s.daemon.ContainerRename(req.OldContainerName, req.NewContainerName)
|
57 | 42 | if err != nil {
|
58 |
| - glog.Errorf("ContainerRename failed %v with request %v", err, req.String()) |
59 | 43 | return nil, err
|
60 | 44 | }
|
61 | 45 |
|
62 |
| - glog.V(3).Infof("ContainerRename done with request %v", req.String()) |
63 |
| - |
64 | 46 | return &types.ContainerRenameResponse{}, nil
|
65 | 47 | }
|
66 | 48 |
|
67 | 49 | func (s *ServerRPC) ContainerRemove(ctx context.Context, req *types.ContainerRemoveRequest) (*types.ContainerRemoveResponse, error) {
|
68 |
| - glog.V(3).Info("ContainerRemove with request %s", req.String()) |
69 | 50 | err := s.daemon.RemoveContainer(req.ContainerId)
|
70 | 51 | if err != nil {
|
71 |
| - glog.Errorf("ContainerRemove failed %v with request %s", err, req.String()) |
72 | 52 | return nil, err
|
73 | 53 | }
|
74 |
| - glog.V(3).Info("ContainerRemove done with request %s", req.String()) |
| 54 | + |
75 | 55 | return &types.ContainerRemoveResponse{}, nil
|
76 | 56 | }
|
77 | 57 |
|
78 | 58 | // ContainerSignal sends a singal to specified container of specified pod
|
79 | 59 | func (s *ServerRPC) ContainerSignal(ctx context.Context, req *types.ContainerSignalRequest) (*types.ContainerSignalResponse, error) {
|
80 |
| - glog.V(3).Infof("ContainerSignal with request %s", req.String()) |
81 |
| - |
82 | 60 | err := s.daemon.KillPodContainers(req.PodID, req.ContainerID, req.Signal)
|
83 | 61 | if err != nil {
|
84 |
| - glog.Errorf("ContainerSignal failed %v done with request %s", err, req.String()) |
85 | 62 | return nil, err
|
86 | 63 | }
|
87 | 64 |
|
88 |
| - glog.V(3).Infof("ContainerSignal done with request %s", req.String()) |
89 | 65 | return &types.ContainerSignalResponse{}, nil
|
90 | 66 | }
|
0 commit comments