forked from kata-containers/runtime
-
Notifications
You must be signed in to change notification settings - Fork 1
/
noop_agent.go
248 lines (197 loc) · 7.87 KB
/
noop_agent.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
// Copyright (c) 2016 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
package virtcontainers
import (
"syscall"
"time"
"github.com/kata-containers/agent/protocols/grpc"
persistapi "github.com/kata-containers/runtime/virtcontainers/persist/api"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
"github.com/kata-containers/runtime/virtcontainers/types"
specs "github.com/opencontainers/runtime-spec/specs-go"
"golang.org/x/net/context"
)
// noopAgent a.k.a. NO-OP Agent is an empty Agent implementation, for testing and
// mocking purposes.
type noopAgent struct {
}
//start the proxy to watch the vm console. It does nothing.
func (n *noopAgent) startProxy(sandbox *Sandbox) error {
return nil
}
// init initializes the Noop agent, i.e. it does nothing.
func (n *noopAgent) init(ctx context.Context, sandbox *Sandbox, config interface{}) (bool, error) {
return false, nil
}
func (n *noopAgent) longLiveConn() bool {
return false
}
// createSandbox is the Noop agent sandbox creation implementation. It does nothing.
func (n *noopAgent) createSandbox(sandbox *Sandbox) error {
return nil
}
// capabilities returns empty capabilities, i.e no capabilties are supported.
func (n *noopAgent) capabilities() types.Capabilities {
return types.Capabilities{}
}
// disconnect is the Noop agent connection closer. It does nothing.
func (n *noopAgent) disconnect() error {
return nil
}
// exec is the Noop agent command execution implementation. It does nothing.
func (n *noopAgent) exec(sandbox *Sandbox, c Container, cmd types.Cmd) (*Process, error) {
return nil, nil
}
// startSandbox is the Noop agent Sandbox starting implementation. It does nothing.
func (n *noopAgent) startSandbox(sandbox *Sandbox) error {
return nil
}
// stopSandbox is the Noop agent Sandbox stopping implementation. It does nothing.
func (n *noopAgent) stopSandbox(sandbox *Sandbox) error {
return nil
}
// createContainer is the Noop agent Container creation implementation. It does nothing.
func (n *noopAgent) createContainer(sandbox *Sandbox, c *Container) (*Process, error) {
return &Process{}, nil
}
// startContainer is the Noop agent Container starting implementation. It does nothing.
func (n *noopAgent) startContainer(sandbox *Sandbox, c *Container) error {
return nil
}
// stopContainer is the Noop agent Container stopping implementation. It does nothing.
func (n *noopAgent) stopContainer(sandbox *Sandbox, c Container) error {
return nil
}
// signalProcess is the Noop agent Container signaling implementation. It does nothing.
func (n *noopAgent) signalProcess(c *Container, processID string, signal syscall.Signal, all bool) error {
return nil
}
// processListContainer is the Noop agent Container ps implementation. It does nothing.
func (n *noopAgent) processListContainer(sandbox *Sandbox, c Container, options ProcessListOptions) (ProcessList, error) {
return nil, nil
}
// updateContainer is the Noop agent Container update implementation. It does nothing.
func (n *noopAgent) updateContainer(sandbox *Sandbox, c Container, resources specs.LinuxResources) error {
return nil
}
// memHotplugByProbe is the Noop agent notify meomory hotplug event via probe interface implementation. It does nothing.
func (n *noopAgent) memHotplugByProbe(addr uint64, sizeMB uint32, memorySectionSizeMB uint32) error {
return nil
}
// onlineCPUMem is the Noop agent Container online CPU and Memory implementation. It does nothing.
func (n *noopAgent) onlineCPUMem(cpus uint32, cpuOnly bool) error {
return nil
}
// updateInterface is the Noop agent Interface update implementation. It does nothing.
func (n *noopAgent) updateInterface(inf *vcTypes.Interface) (*vcTypes.Interface, error) {
return nil, nil
}
// listInterfaces is the Noop agent Interfaces list implementation. It does nothing.
func (n *noopAgent) listInterfaces() ([]*vcTypes.Interface, error) {
return nil, nil
}
// updateRoutes is the Noop agent Routes update implementation. It does nothing.
func (n *noopAgent) updateRoutes(routes []*vcTypes.Route) ([]*vcTypes.Route, error) {
return nil, nil
}
// listRoutes is the Noop agent Routes list implementation. It does nothing.
func (n *noopAgent) listRoutes() ([]*vcTypes.Route, error) {
return nil, nil
}
// check is the Noop agent health checker. It does nothing.
func (n *noopAgent) check() error {
return nil
}
// statsContainer is the Noop agent Container stats implementation. It does nothing.
func (n *noopAgent) statsContainer(sandbox *Sandbox, c Container) (*ContainerStats, error) {
return &ContainerStats{}, nil
}
// waitProcess is the Noop agent process waiter. It does nothing.
func (n *noopAgent) waitProcess(c *Container, processID string) (int32, error) {
return 0, nil
}
// winsizeProcess is the Noop agent process tty resizer. It does nothing.
func (n *noopAgent) winsizeProcess(c *Container, processID string, height, width uint32) error {
return nil
}
// writeProcessStdin is the Noop agent process stdin writer. It does nothing.
func (n *noopAgent) writeProcessStdin(c *Container, ProcessID string, data []byte) (int, error) {
return 0, nil
}
// closeProcessStdin is the Noop agent process stdin closer. It does nothing.
func (n *noopAgent) closeProcessStdin(c *Container, ProcessID string) error {
return nil
}
// readProcessStdout is the Noop agent process stdout reader. It does nothing.
func (n *noopAgent) readProcessStdout(c *Container, processID string, data []byte) (int, error) {
return 0, nil
}
// readProcessStderr is the Noop agent process stderr reader. It does nothing.
func (n *noopAgent) readProcessStderr(c *Container, processID string, data []byte) (int, error) {
return 0, nil
}
// pauseContainer is the Noop agent Container pause implementation. It does nothing.
func (n *noopAgent) pauseContainer(sandbox *Sandbox, c Container) error {
return nil
}
// resumeContainer is the Noop agent Container resume implementation. It does nothing.
func (n *noopAgent) resumeContainer(sandbox *Sandbox, c Container) error {
return nil
}
// configHypervisor is the Noop agent hypervisor configuration implementation. It does nothing.
func (n *noopAgent) configure(h hypervisor, id, sharePath string, builtin bool, config interface{}) error {
return nil
}
func (n *noopAgent) configureFromGrpc(id string, builtin bool, config interface{}) error {
return nil
}
// getVMPath is the Noop agent vm path getter. It does nothing.
func (n *noopAgent) getVMPath(id string) string {
return ""
}
// getVMPath is the Noop agent share path getter. It does nothing.
func (n *noopAgent) getSharePath(id string) string {
return ""
}
// reseedRNG is the Noop agent RND reseeder. It does nothing.
func (n *noopAgent) reseedRNG(data []byte) error {
return nil
}
// reuseAgent is the Noop agent reuser. It does nothing.
func (n *noopAgent) reuseAgent(agent agent) error {
return nil
}
// getAgentURL is the Noop agent url getter. It returns nothing.
func (n *noopAgent) getAgentURL() (string, error) {
return "", nil
}
// setProxy is the Noop agent proxy setter. It does nothing.
func (n *noopAgent) setProxy(sandbox *Sandbox, proxy proxy, pid int, url string) error {
return nil
}
func (n *noopAgent) setProxyFromGrpc(proxy proxy, pid int, url string) {
}
// getGuestDetails is the Noop agent GuestDetails queryer. It does nothing.
func (n *noopAgent) getGuestDetails(*grpc.GuestDetailsRequest) (*grpc.GuestDetailsResponse, error) {
return nil, nil
}
// setGuestDateTime is the Noop agent guest time setter. It does nothing.
func (n *noopAgent) setGuestDateTime(time.Time) error {
return nil
}
// copyFile is the Noop agent copy file. It does nothing.
func (n *noopAgent) copyFile(src, dst string) error {
return nil
}
func (n *noopAgent) markDead() {
}
func (n *noopAgent) cleanup(s *Sandbox) {
}
// save is the Noop agent state saver. It does nothing.
func (n *noopAgent) save() (s persistapi.AgentState) {
return
}
// load is the Noop agent state loader. It does nothing.
func (n *noopAgent) load(s persistapi.AgentState) {}