@@ -1077,9 +1077,14 @@ func InitializeOntapAPI(
1077
1077
var ontapAPI api.OntapAPI
1078
1078
var err error
1079
1079
1080
+ useRESTValue := "<nil>"
1081
+ if config .UseREST != nil {
1082
+ useRESTValue = strconv .FormatBool (* config .UseREST )
1083
+ }
1080
1084
fields := LogFields {
1081
- "Method" : "InitializeOntapAPI" , "Type" : "ontap_common" ,
1082
- "useREST" : config .UseREST ,
1085
+ "Method" : "InitializeOntapAPI" ,
1086
+ "Type" : "ontap_common" ,
1087
+ "useREST" : useRESTValue ,
1083
1088
}
1084
1089
Logd (ctx , config .StorageDriverName ,
1085
1090
config .DebugTraceFlags ["method" ]).WithFields (fields ).Trace (">>>> InitializeOntapAPI" )
@@ -1172,6 +1177,19 @@ func InitializeOntapAPI(
1172
1177
}
1173
1178
}
1174
1179
1180
+ fields = LogFields {
1181
+ "Backend" : config .BackendName ,
1182
+ }
1183
+ switch ontapAPI .(type ) {
1184
+ case api.OntapAPIREST :
1185
+ Logc (ctx ).WithFields (fields ).Info ("Using REST client" )
1186
+ case api.OntapAPIZAPI :
1187
+ Logc (ctx ).WithFields (fields ).Info ("Using ZAPI client" )
1188
+ default :
1189
+ // We should never reach this point, but putting this here just in case.
1190
+ Logc (ctx ).WithFields (fields ).Warn ("Unknown ONTAP API client type." )
1191
+ }
1192
+
1175
1193
Logc (ctx ).WithField ("SVM" , ontapAPI .SVMName ()).Debug ("Using SVM." )
1176
1194
return ontapAPI , nil
1177
1195
}
@@ -2770,6 +2788,14 @@ func getExternalConfig(ctx context.Context, config drivers.OntapStorageDriverCon
2770
2788
drivers .KeyName : utils .REDACTED ,
2771
2789
drivers .KeyType : utils .REDACTED ,
2772
2790
} // redact the credentials
2791
+
2792
+ // https://github.com/golang/go/issues/4609
2793
+ // It's how gob encoding-decoding works, it flattens the pointer while encoding,
2794
+ // and during the decoding phase, if the default value is encountered, it is assigned as nil.
2795
+ if config .UseREST != nil {
2796
+ cloneConfig .UseREST = utils .Ptr (* config .UseREST )
2797
+ }
2798
+
2773
2799
return cloneConfig
2774
2800
}
2775
2801
0 commit comments