@@ -20,7 +20,7 @@ import (
20
20
func (d * DriverClient ) Validate () error {
21
21
d .logger .Debug ("Validating driver for the given config" )
22
22
23
- ctx , cancel := context .WithTimeout (context .Background (), 5 * time .Second )
23
+ ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
24
24
defer cancel ()
25
25
26
26
_ , err := d .DriverSvc .Validate (ctx , & emptypb.Empty {})
@@ -36,9 +36,7 @@ func (d *DriverClient) Validate() error {
36
36
func (d * DriverClient ) Initialize (ctx context.Context ) error {
37
37
d .logger .Debug ("Initializing driver instance" )
38
38
39
- connCtx , cancel := context .WithTimeout (ctx , 5 * time .Second )
40
- defer cancel ()
41
- _ , err := d .DriverSvc .Initialize (connCtx , & emptypb.Empty {})
39
+ _ , err := d .DriverSvc .Initialize (ctx , & emptypb.Empty {})
42
40
if err != nil {
43
41
d .logger .Errorf ("Initialization failed: %v" , err )
44
42
return err
@@ -64,9 +62,7 @@ func (d *DriverClient) CreateDisk(ctx context.Context) error {
64
62
func (d * DriverClient ) Start (ctx context.Context ) (chan error , error ) {
65
63
d .logger .Debug ("Starting driver instance" )
66
64
67
- connCtx , cancel := context .WithTimeout (ctx , time .Minute )
68
- defer cancel ()
69
- stream , err := d .DriverSvc .Start (connCtx , & emptypb.Empty {})
65
+ stream , err := d .DriverSvc .Start (ctx , & emptypb.Empty {})
70
66
if err != nil {
71
67
d .logger .Errorf ("Failed to start driver instance: %v" , err )
72
68
return nil , err
@@ -97,7 +93,7 @@ func (d *DriverClient) Start(ctx context.Context) (chan error, error) {
97
93
func (d * DriverClient ) Stop (ctx context.Context ) error {
98
94
d .logger .Debug ("Stopping driver instance" )
99
95
100
- connCtx , cancel := context .WithTimeout (ctx , 5 * time .Second )
96
+ connCtx , cancel := context .WithTimeout (ctx , 10 * time .Second )
101
97
defer cancel ()
102
98
_ , err := d .DriverSvc .Stop (connCtx , & emptypb.Empty {})
103
99
if err != nil {
@@ -112,7 +108,7 @@ func (d *DriverClient) Stop(ctx context.Context) error {
112
108
func (d * DriverClient ) RunGUI () error {
113
109
d .logger .Debug ("Running GUI for the driver instance" )
114
110
115
- ctx , cancel := context .WithTimeout (context .Background (), 5 * time .Second )
111
+ ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
116
112
defer cancel ()
117
113
118
114
_ , err := d .DriverSvc .RunGUI (ctx , & emptypb.Empty {})
@@ -128,10 +124,7 @@ func (d *DriverClient) RunGUI() error {
128
124
func (d * DriverClient ) ChangeDisplayPassword (ctx context.Context , password string ) error {
129
125
d .logger .Debug ("Changing display password for the driver instance" )
130
126
131
- connCtx , cancel := context .WithTimeout (ctx , 5 * time .Second )
132
- defer cancel ()
133
-
134
- _ , err := d .DriverSvc .ChangeDisplayPassword (connCtx , & pb.ChangeDisplayPasswordRequest {
127
+ _ , err := d .DriverSvc .ChangeDisplayPassword (ctx , & pb.ChangeDisplayPasswordRequest {
135
128
Password : password ,
136
129
})
137
130
if err != nil {
@@ -146,10 +139,7 @@ func (d *DriverClient) ChangeDisplayPassword(ctx context.Context, password strin
146
139
func (d * DriverClient ) GetDisplayConnection (ctx context.Context ) (string , error ) {
147
140
d .logger .Debug ("Getting display connection for the driver instance" )
148
141
149
- connCtx , cancel := context .WithTimeout (ctx , 5 * time .Second )
150
- defer cancel ()
151
-
152
- resp , err := d .DriverSvc .GetDisplayConnection (connCtx , & emptypb.Empty {})
142
+ resp , err := d .DriverSvc .GetDisplayConnection (ctx , & emptypb.Empty {})
153
143
if err != nil {
154
144
d .logger .Errorf ("Failed to get display connection: %v" , err )
155
145
return "" , err
@@ -162,10 +152,7 @@ func (d *DriverClient) GetDisplayConnection(ctx context.Context) (string, error)
162
152
func (d * DriverClient ) CreateSnapshot (ctx context.Context , tag string ) error {
163
153
d .logger .Debugf ("Creating snapshot with tag: %s" , tag )
164
154
165
- connCtx , cancel := context .WithTimeout (ctx , 5 * time .Second )
166
- defer cancel ()
167
-
168
- _ , err := d .DriverSvc .CreateSnapshot (connCtx , & pb.CreateSnapshotRequest {
155
+ _ , err := d .DriverSvc .CreateSnapshot (ctx , & pb.CreateSnapshotRequest {
169
156
Tag : tag ,
170
157
})
171
158
if err != nil {
@@ -180,10 +167,7 @@ func (d *DriverClient) CreateSnapshot(ctx context.Context, tag string) error {
180
167
func (d * DriverClient ) ApplySnapshot (ctx context.Context , tag string ) error {
181
168
d .logger .Debugf ("Applying snapshot with tag: %s" , tag )
182
169
183
- connCtx , cancel := context .WithTimeout (ctx , 5 * time .Second )
184
- defer cancel ()
185
-
186
- _ , err := d .DriverSvc .ApplySnapshot (connCtx , & pb.ApplySnapshotRequest {
170
+ _ , err := d .DriverSvc .ApplySnapshot (ctx , & pb.ApplySnapshotRequest {
187
171
Tag : tag ,
188
172
})
189
173
if err != nil {
@@ -198,10 +182,7 @@ func (d *DriverClient) ApplySnapshot(ctx context.Context, tag string) error {
198
182
func (d * DriverClient ) DeleteSnapshot (ctx context.Context , tag string ) error {
199
183
d .logger .Debugf ("Deleting snapshot with tag: %s" , tag )
200
184
201
- connCtx , cancel := context .WithTimeout (ctx , 5 * time .Second )
202
- defer cancel ()
203
-
204
- _ , err := d .DriverSvc .DeleteSnapshot (connCtx , & pb.DeleteSnapshotRequest {
185
+ _ , err := d .DriverSvc .DeleteSnapshot (ctx , & pb.DeleteSnapshotRequest {
205
186
Tag : tag ,
206
187
})
207
188
if err != nil {
@@ -216,10 +197,7 @@ func (d *DriverClient) DeleteSnapshot(ctx context.Context, tag string) error {
216
197
func (d * DriverClient ) ListSnapshots (ctx context.Context ) (string , error ) {
217
198
d .logger .Debug ("Listing snapshots" )
218
199
219
- connCtx , cancel := context .WithTimeout (ctx , 5 * time .Second )
220
- defer cancel ()
221
-
222
- resp , err := d .DriverSvc .ListSnapshots (connCtx , & emptypb.Empty {})
200
+ resp , err := d .DriverSvc .ListSnapshots (ctx , & emptypb.Empty {})
223
201
if err != nil {
224
202
d .logger .Errorf ("Failed to list snapshots: %v" , err )
225
203
return "" , err
@@ -232,9 +210,7 @@ func (d *DriverClient) ListSnapshots(ctx context.Context) (string, error) {
232
210
func (d * DriverClient ) Register (ctx context.Context ) error {
233
211
d .logger .Debug ("Registering driver instance" )
234
212
235
- connCtx , cancel := context .WithTimeout (ctx , 5 * time .Second )
236
- defer cancel ()
237
- _ , err := d .DriverSvc .Register (connCtx , & emptypb.Empty {})
213
+ _ , err := d .DriverSvc .Register (ctx , & emptypb.Empty {})
238
214
if err != nil {
239
215
d .logger .Errorf ("Failed to register driver instance: %v" , err )
240
216
return err
@@ -247,10 +223,7 @@ func (d *DriverClient) Register(ctx context.Context) error {
247
223
func (d * DriverClient ) Unregister (ctx context.Context ) error {
248
224
d .logger .Debug ("Unregistering driver instance" )
249
225
250
- connCtx , cancel := context .WithTimeout (ctx , 5 * time .Second )
251
- defer cancel ()
252
-
253
- _ , err := d .DriverSvc .Unregister (connCtx , & emptypb.Empty {})
226
+ _ , err := d .DriverSvc .Unregister (ctx , & emptypb.Empty {})
254
227
if err != nil {
255
228
d .logger .Errorf ("Failed to unregister driver instance: %v" , err )
256
229
return err
@@ -263,7 +236,7 @@ func (d *DriverClient) Unregister(ctx context.Context) error {
263
236
func (d * DriverClient ) ForwardGuestAgent () bool {
264
237
d .logger .Debug ("Checking if guest agent needs to be forwarded" )
265
238
266
- ctx , cancel := context .WithTimeout (context .Background (), 5 * time .Second )
239
+ ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
267
240
defer cancel ()
268
241
269
242
resp , err := d .DriverSvc .ForwardGuestAgent (ctx , & emptypb.Empty {})
@@ -280,10 +253,7 @@ func (d *DriverClient) ForwardGuestAgent() bool {
280
253
func (d * DriverClient ) GuestAgentConn (ctx context.Context ) (net.Conn , error ) {
281
254
d .logger .Debug ("Getting guest agent connection" )
282
255
283
- connCtx , cancel := context .WithTimeout (ctx , 5 * time .Second )
284
- defer cancel ()
285
-
286
- connStream , err := d .DriverSvc .GuestAgentConn (connCtx , & emptypb.Empty {})
256
+ connStream , err := d .DriverSvc .GuestAgentConn (ctx , & emptypb.Empty {})
287
257
if err != nil {
288
258
d .logger .Errorf ("Failed to get guest agent connection: %v" , err )
289
259
return nil , err
@@ -295,7 +265,7 @@ func (d *DriverClient) GuestAgentConn(ctx context.Context) (net.Conn, error) {
295
265
func (d * DriverClient ) GetInfo () driver.Info {
296
266
d .logger .Debug ("Getting driver info" )
297
267
298
- ctx , cancel := context .WithTimeout (context .Background (), 5 * time .Second )
268
+ ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
299
269
defer cancel ()
300
270
301
271
resp , err := d .DriverSvc .GetInfo (ctx , & emptypb.Empty {})
@@ -317,13 +287,13 @@ func (d *DriverClient) GetInfo() driver.Info {
317
287
func (d * DriverClient ) SetConfig (inst * store.Instance , sshLocalPort int ) {
318
288
d .logger .Debugf ("Setting config for instance %s with SSH local port %d" , inst .Name , sshLocalPort )
319
289
320
- instJson , err := json . Marshal ( inst )
290
+ instJson , err := inst . MarshalJSON ( )
321
291
if err != nil {
322
292
d .logger .Errorf ("Failed to marshal instance config: %v" , err )
323
293
return
324
294
}
325
295
326
- ctx , cancel := context .WithTimeout (context .Background (), 5 * time .Second )
296
+ ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
327
297
defer cancel ()
328
298
329
299
_ , err = d .DriverSvc .SetConfig (ctx , & pb.SetConfigRequest {
0 commit comments