Skip to content

Commit

Permalink
fix detach disk issue on deleting vmss node
Browse files Browse the repository at this point in the history
  • Loading branch information
andyzhangx committed Aug 26, 2021
1 parent 9869e9d commit c0c5b3b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions pkg/provider/azure_controller_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,5 +678,8 @@ func getValidCreationData(subscriptionID, resourceGroup, sourceResourceID, sourc

func isInstanceNotFoundError(err error) bool {
errMsg := strings.ToLower(err.Error())
if strings.Contains(errMsg, strings.ToLower(consts.VmssVMNotActiveErrorMessage)) {
return true
}
return strings.Contains(errMsg, errStatusCode400) && strings.Contains(errMsg, errInvalidParameter) && strings.Contains(errMsg, errTargetInstanceIds)
}
4 changes: 2 additions & 2 deletions pkg/provider/azure_controller_common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -903,8 +903,8 @@ func TestIsInstanceNotFoundError(t *testing.T) {
expectedResult: false,
},
{
errMsg: "not an active Virtual Machine scale set vm",
expectedResult: false,
errMsg: "The provided instanceId 857 is not an active Virtual Machine Scale Set VM instanceId.",
expectedResult: true,
},
{
errMsg: `compute.VirtualMachineScaleSetVMsClient#Update: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidParameter" Message="The provided instanceId 1181 is not an active Virtual Machine Scale Set VM instanceId." Target="instanceIds"`,
Expand Down

0 comments on commit c0c5b3b

Please sign in to comment.