> volOptions.GetConnection() can return nil, so it is not really safe. A new GetFSID() would prevent any incorrect usage, now, and possibly in the future.
when volOptions struct is created, we make sure we have the connection set. There is no way GetConnection() could return nil.
IMO, GetConnection() should be handling the nil check, or the GetConnection() caller should check for nil and proceed.
as we have similar usage at some places. for example -
|
|
|
ioctx, err := volOptions.GetConnection().GetIoctx(volOptions.MetadataPool) |
|
if err != nil { |
|
log.ErrorLog(ctx, "Failed to create ioctx: %s", err) |
|
|
|
return err |
|
} |
|
defer ioctx.Destroy() |
|
|
Originally posted by @iPraveenParihar in #5090 (comment)
when volOptions struct is created, we make sure we have the connection set. There is no way
GetConnection()could return nil.IMO,
GetConnection()should be handling the nil check, or theGetConnection()caller should check for nil and proceed.as we have similar usage at some places. for example -
ceph-csi/internal/cephfs/nodeserver.go
Lines 145 to 153 in 72b9d5a
Originally posted by @iPraveenParihar in #5090 (comment)