Commit 4d578d13 authored by Jiatong Wang's avatar Jiatong Wang

Add error check and ignore unused variable (SA4006)

parent a74df596
...@@ -127,6 +127,10 @@ func (vmdisk vmDiskManager) Create(ctx context.Context, datastore *vclib.Datasto ...@@ -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) { ...@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment