@@ -126,8 +126,9 @@ func (c *sioClient) init() error {
126
126
Username : c .username ,
127
127
Password : c .password },
128
128
); err != nil {
129
- klog .Error (log ("client authentication failed: %v" , err ))
130
- return err
129
+ // don't log error details from client calls in events
130
+ klog .V (4 ).Infof (log ("client authentication failed: %v" , err ))
131
+ return errors .New ("client authentication failed" )
131
132
}
132
133
133
134
// retrieve system
@@ -214,8 +215,9 @@ func (c *sioClient) CreateVolume(name string, sizeGB int64) (*siotypes.Volume, e
214
215
}
215
216
createResponse , err := c .client .CreateVolume (params , c .storagePool .Name )
216
217
if err != nil {
217
- klog .Error (log ("failed to create volume %s: %v" , name , err ))
218
- return nil , err
218
+ // don't log error details from client calls in events
219
+ klog .V (4 ).Infof (log ("failed to create volume %s: %v" , name , err ))
220
+ return nil , errors .New ("failed to create volume: see kubernetes logs for details" )
219
221
}
220
222
return c .Volume (sioVolumeID (createResponse .ID ))
221
223
}
@@ -243,8 +245,9 @@ func (c *sioClient) AttachVolume(id sioVolumeID, multipleMappings bool) error {
243
245
volClient .Volume = & siotypes.Volume {ID : string (id )}
244
246
245
247
if err := volClient .MapVolumeSdc (params ); err != nil {
246
- klog .Error (log ("failed to attach volume id %s: %v" , id , err ))
247
- return err
248
+ // don't log error details from client calls in events
249
+ klog .V (4 ).Infof (log ("failed to attach volume id %s: %v" , id , err ))
250
+ return errors .New ("failed to attach volume: see kubernetes logs for details" )
248
251
}
249
252
250
253
klog .V (4 ).Info (log ("volume %s attached successfully" , id ))
@@ -269,7 +272,9 @@ func (c *sioClient) DetachVolume(id sioVolumeID) error {
269
272
volClient := sio .NewVolume (c .client )
270
273
volClient .Volume = & siotypes.Volume {ID : string (id )}
271
274
if err := volClient .UnmapVolumeSdc (params ); err != nil {
272
- return err
275
+ // don't log error details from client calls in events
276
+ klog .V (4 ).Infof (log ("failed to detach volume id %s: %v" , id , err ))
277
+ return errors .New ("failed to detach volume: see kubernetes logs for details" )
273
278
}
274
279
return nil
275
280
}
@@ -287,7 +292,9 @@ func (c *sioClient) DeleteVolume(id sioVolumeID) error {
287
292
volClient := sio .NewVolume (c .client )
288
293
volClient .Volume = vol
289
294
if err := volClient .RemoveVolume ("ONLY_ME" ); err != nil {
290
- return err
295
+ // don't log error details from client calls in events
296
+ klog .V (4 ).Infof (log ("failed to remove volume id %s: %v" , id , err ))
297
+ return errors .New ("failed to remove volume: see kubernetes logs for details" )
291
298
}
292
299
return nil
293
300
}
@@ -306,8 +313,9 @@ func (c *sioClient) IID() (string, error) {
306
313
}
307
314
sdc , err := c .sysClient .FindSdc ("SdcGUID" , guid )
308
315
if err != nil {
309
- klog .Error (log ("failed to retrieve sdc info %s" , err ))
310
- return "" , err
316
+ // don't log error details from client calls in events
317
+ klog .V (4 ).Infof (log ("failed to retrieve sdc info %s" , err ))
318
+ return "" , errors .New ("failed to retrieve sdc info: see kubernetes logs for details" )
311
319
}
312
320
c .instanceID = sdc .Sdc .ID
313
321
klog .V (4 ).Info (log ("retrieved instanceID %s" , c .instanceID ))
@@ -472,12 +480,15 @@ func (c *sioClient) WaitForDetachedDevice(token string) error {
472
480
// ***********************************************************************
473
481
func (c * sioClient ) findSystem (sysname string ) (sys * siotypes.System , err error ) {
474
482
if c .sysClient , err = c .client .FindSystem ("" , sysname , "" ); err != nil {
475
- return nil , err
483
+ // don't log error details from clients in events
484
+ klog .V (4 ).Infof (log ("failed to find system %q: %v" , sysname , err ))
485
+ return nil , errors .New ("failed to find system: see kubernetes logs for details" )
476
486
}
477
487
systems , err := c .client .GetInstance ("" )
478
488
if err != nil {
479
- klog .Error (log ("failed to retrieve instances: %v" , err ))
480
- return nil , err
489
+ // don't log error details from clients in events
490
+ klog .V (4 ).Infof (log ("failed to retrieve instances: %v" , err ))
491
+ return nil , errors .New ("failed to retrieve instances: see kubernetes logs for details" )
481
492
}
482
493
for _ , sys = range systems {
483
494
if sys .Name == sysname {
@@ -493,8 +504,9 @@ func (c *sioClient) findProtectionDomain(pdname string) (*siotypes.ProtectionDom
493
504
if c .sysClient != nil {
494
505
protectionDomain , err := c .sysClient .FindProtectionDomain ("" , pdname , "" )
495
506
if err != nil {
496
- klog .Error (log ("failed to retrieve protection domains: %v" , err ))
497
- return nil , err
507
+ // don't log error details from clients in events
508
+ klog .V (4 ).Infof (log ("failed to retrieve protection domains: %v" , err ))
509
+ return nil , errors .New ("failed to retrieve protection domains: see kubernetes logs for details" )
498
510
}
499
511
c .pdClient .ProtectionDomain = protectionDomain
500
512
return protectionDomain , nil
@@ -508,8 +520,9 @@ func (c *sioClient) findStoragePool(spname string) (*siotypes.StoragePool, error
508
520
if c .pdClient != nil {
509
521
sp , err := c .pdClient .FindStoragePool ("" , spname , "" )
510
522
if err != nil {
511
- klog .Error (log ("failed to retrieve storage pool: %v" , err ))
512
- return nil , err
523
+ // don't log error details from clients in events
524
+ klog .V (4 ).Infof (log ("failed to retrieve storage pool: %v" , err ))
525
+ return nil , errors .New ("failed to retrieve storage pool: see kubernetes logs for details" )
513
526
}
514
527
c .spClient .StoragePool = sp
515
528
return sp , nil
@@ -519,14 +532,32 @@ func (c *sioClient) findStoragePool(spname string) (*siotypes.StoragePool, error
519
532
}
520
533
521
534
func (c * sioClient ) getVolumes () ([]* siotypes.Volume , error ) {
522
- return c .client .GetVolume ("" , "" , "" , "" , true )
535
+ volumes , err := c .client .GetVolume ("" , "" , "" , "" , true )
536
+ if err != nil {
537
+ // don't log error details from clients in events
538
+ klog .V (4 ).Infof (log ("failed to get volumes: %v" , err ))
539
+ return nil , errors .New ("failed to get volumes: see kubernetes logs for details" )
540
+ }
541
+ return volumes , nil
523
542
}
524
543
func (c * sioClient ) getVolumesByID (id sioVolumeID ) ([]* siotypes.Volume , error ) {
525
- return c .client .GetVolume ("" , string (id ), "" , "" , true )
544
+ volumes , err := c .client .GetVolume ("" , string (id ), "" , "" , true )
545
+ if err != nil {
546
+ // don't log error details from clients in events
547
+ klog .V (4 ).Infof (log ("failed to get volumes by id: %v" , err ))
548
+ return nil , errors .New ("failed to get volumes by id: see kubernetes logs for details" )
549
+ }
550
+ return volumes , nil
526
551
}
527
552
528
553
func (c * sioClient ) getVolumesByName (name string ) ([]* siotypes.Volume , error ) {
529
- return c .client .GetVolume ("" , "" , "" , name , true )
554
+ volumes , err := c .client .GetVolume ("" , "" , "" , name , true )
555
+ if err != nil {
556
+ // don't log error details from clients in events
557
+ klog .V (4 ).Infof (log ("failed to get volumes by name: %v" , err ))
558
+ return nil , errors .New ("failed to get volumes by name: see kubernetes logs for details" )
559
+ }
560
+ return volumes , nil
530
561
}
531
562
532
563
func (c * sioClient ) getSdcPath () string {
0 commit comments