mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Merge pull request #66304 from jiatongw/gocheck
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Add error check and ignore unused variable (SA4006) **What this PR does / why we need it**: Fix some bugs in cloud provider vsphere, issue can be found here #66303 ```pkg/cloudprovider/providers/vsphere/nodemanager.go:176:5: defers in this range loop won't run unless the channel gets closed (SA9001) pkg/cloudprovider/providers/vsphere/vclib/diskmanagers/vmdm.go:129:8: this value of err is never used (SA4006) pkg/cloudprovider/providers/vsphere/vsphere.go:596:34: argument ctx is overwritten before first use (SA4009) pkg/cloudprovider/providers/vsphere/vsphere_test.go:360:2: this value of instanceID is never used (SA4006) pkg/cloudprovider/providers/vsphere/vsphere_util.go:301:3: defers in this infinite loop will never run (SA5003) ``` **Special notes for your reviewer**: I fixed ```SA4006``` report in that issue, but there are still other code needed to discuss and fix. **Release note**: ```release-note NONE ```
This commit is contained in:
commit
1a538daf44
@ -127,6 +127,10 @@ func (vmdisk vmDiskManager) Create(ctx context.Context, datastore *vclib.Datasto
|
|||||||
virtualMachineConfigSpec.DeviceChange = append(virtualMachineConfigSpec.DeviceChange, deviceConfigSpec)
|
virtualMachineConfigSpec.DeviceChange = append(virtualMachineConfigSpec.DeviceChange, deviceConfigSpec)
|
||||||
fileAlreadyExist := false
|
fileAlreadyExist := false
|
||||||
task, err := dummyVM.Reconfigure(ctx, virtualMachineConfigSpec)
|
task, err := dummyVM.Reconfigure(ctx, virtualMachineConfigSpec)
|
||||||
|
if err != nil {
|
||||||
|
glog.Errorf("Failed to reconfig. err: %v", err)
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
err = task.Wait(ctx)
|
err = task.Wait(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fileAlreadyExist = isAlreadyExists(vmdisk.diskPath, err)
|
fileAlreadyExist = isAlreadyExists(vmdisk.diskPath, err)
|
||||||
|
@ -357,7 +357,7 @@ func TestInstances(t *testing.T) {
|
|||||||
}
|
}
|
||||||
t.Logf("Found InstanceID(%s) = %s\n", nodeName, instanceID)
|
t.Logf("Found InstanceID(%s) = %s\n", nodeName, instanceID)
|
||||||
|
|
||||||
instanceID, err = i.InstanceID(context.TODO(), nonExistingVM)
|
_, err = i.InstanceID(context.TODO(), nonExistingVM)
|
||||||
if err == cloudprovider.InstanceNotFound {
|
if err == cloudprovider.InstanceNotFound {
|
||||||
t.Logf("VM %s was not found as expected\n", nonExistingVM)
|
t.Logf("VM %s was not found as expected\n", nonExistingVM)
|
||||||
} else if err == nil {
|
} else if err == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user