Skip to content

Commit 9ae3fff

Browse files
remove unused code
1 parent bc3cad8 commit 9ae3fff

File tree

3 files changed

+7
-39
lines changed

3 files changed

+7
-39
lines changed

cns/restserver/internalapi.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,6 @@ var errNonExistentContainerStatus = errors.New("nonExistantContainerstatus")
195195
// all NCs and update the CNS state accordingly. This function returns the the total number of NCs on this VM that have been programmed to
196196
// some version, NOT the number of NCs that are up-to-date.
197197
func (service *HTTPRestService) syncHostNCVersion(ctx context.Context, channelMode string) (int, error) {
198-
// will remove it later
199-
// hasVNETBlockNC1 := service.isPrefixonNicSwiftV2()
200-
// logger.Printf("winDebug: syncHostNCVersion hasVNETBlockNC1 %v", hasVNETBlockNC1)
201-
// if runtime.GOOS == "windows" {
202-
// logger.Printf("winDebug: before setPrefixOnNICRegistry in syncHostNCVersion")
203-
// err := service.setPrefixOnNICRegistry(true, "aa:bb:cc:dd:ee:ff")
204-
// if err != nil {
205-
// logger.Debugf("failed to add PrefixOnNic keys to Windows registry: %w", err)
206-
// }
207-
// }
208198
outdatedNCs := map[string]struct{}{}
209199
programmedNCs := map[string]struct{}{}
210200
for idx := range service.state.ContainerStatus {
@@ -739,13 +729,12 @@ func (service *HTTPRestService) getIMDSNCs(ctx context.Context) (map[string]stri
739729
return ncs, nil
740730
}
741731

742-
// isPrefixonNicSwiftV2 checks if any NC in the container status should use SwiftV2 PrefixOnNic
743-
// Uses the SwiftV2PrefixOnNic field which captures the condition: isSwiftV2 && nc.Type == VNETBlock
732+
// Check whether NC is SwiftV2 NIC associated NC and prefix on nic is enabled
744733
func (service *HTTPRestService) isPrefixonNicSwiftV2() bool {
745734
for _, containerStatus := range service.state.ContainerStatus {
746735
req := containerStatus.CreateNetworkContainerRequest
747736

748-
// Check if this NC is SwiftV2 PrefixOnNic setting
737+
//
749738
if req.SwiftV2PrefixOnNic {
750739
return true
751740
}

cns/restserver/internalapi_linux.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,10 @@ func (service *HTTPRestService) setVFForAccelnetNICs() error {
183183
}
184184

185185
func (service *HTTPRestService) setPrefixOnNICRegistry(enabled bool, infraNicMacAddress string) error {
186+
// Assigning parameters to '_' to avoid unused parameter linting errors.
187+
// These parameters are only used in the Windows implementation.
188+
_ = enabled
189+
_ = infraNicMacAddress
186190
logger.Printf("[setPrefixOnNicEnabled winDebug] No-op on Linux platform")
187191
return nil
188-
}
189-
190-
func (service *HTTPRestService) getPrefixOnNicEnabled() (bool, error) {
191-
logger.Printf(" winDebug getPrefixOnNicEnabled is a no-op on non-Windows platforms")
192-
return false, nil // Add this missing return statement
193192
}

cns/restserver/internalapi_windows.go

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -147,25 +147,5 @@ func (service *HTTPRestService) setRegistryValue(registryPath, keyName string, v
147147
}
148148

149149
logger.Printf("[setRegistryValue] Set %s\\%s = %v", registryPath, keyName, value)
150-
// have to remove this log later
151-
// test, _ := service.getPrefixOnNicEnabled()
152-
// logger.Printf("winDebug: setRegistryValue getPrefixOnNicEnabled %v", test)
153150
return nil
154-
}
155-
156-
// for testing purpose, will remove it later
157-
158-
// func (service *HTTPRestService) getPrefixOnNicEnabled() (bool, error) {
159-
// key, err := registry.OpenKey(registry.LOCAL_MACHINE, prefixOnNicRegistryPath, registry.QUERY_VALUE)
160-
// if err != nil {
161-
// return false, nil // Key doesn't exist, default to false
162-
// }
163-
// defer key.Close()
164-
165-
// value, _, err := key.GetIntegerValue("enabled")
166-
// if err != nil {
167-
// return false, nil // Value doesn't exist, default to false
168-
// }
169-
170-
// return value == 1, nil
171-
// }
151+
}

0 commit comments

Comments
 (0)