Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated cherry pick of #3169: Fix agent initialization error by adjusting #3238

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/agent/util/net_windows.go
Expand Up @@ -157,7 +157,7 @@ func RemoveManagementInterface(networkName string) error {
var err error
var maxRetry = 3
var i = 0
cmd := fmt.Sprintf("Get-VMSwitch -Name %s | Set-VMSwitch -AllowManagementOS $false ", networkName)
cmd := fmt.Sprintf("Get-VMSwitch -ComputerName $(hostname) -Name %s | Set-VMSwitch -ComputerName $(hostname) -AllowManagementOS $false ", networkName)
// Retry the operation here because an error is returned at the first invocation.
for i < maxRetry {
_, err = ps.RunCommand(cmd)
Expand Down Expand Up @@ -379,7 +379,7 @@ func PrepareHNSNetwork(subnetCIDR *net.IPNet, nodeIPNet *net.IPNet, uplinkAdapte
// EnableRSCOnVSwitch enables RSC in the vSwitch to reduce host CPU utilization and increase throughput for virtual
// workloads by coalescing multiple TCP segments into fewer, but larger segments.
func EnableRSCOnVSwitch(vSwitch string) error {
cmd := fmt.Sprintf("Get-VMSwitch -Name %s | Select-Object -Property SoftwareRscEnabled | Format-Table -HideTableHeaders", vSwitch)
cmd := fmt.Sprintf("Get-VMSwitch -ComputerName $(hostname) -Name %s | Select-Object -Property SoftwareRscEnabled | Format-Table -HideTableHeaders", vSwitch)
stdout, err := ps.RunCommand(cmd)
if err != nil {
return err
Expand All @@ -397,7 +397,7 @@ func EnableRSCOnVSwitch(vSwitch string) error {
klog.Infof("Receive Segment Coalescing (RSC) for vSwitch %s is already enabled", vSwitch)
return nil
}
cmd = fmt.Sprintf("Set-VMSwitch -Name %s -EnableSoftwareRsc $True", vSwitch)
cmd = fmt.Sprintf("Set-VMSwitch -ComputerName $(hostname) -Name %s -EnableSoftwareRsc $True", vSwitch)
_, err = ps.RunCommand(cmd)
if err != nil {
return err
Expand Down