Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
94759c16
Unverified
Commit
94759c16
authored
Nov 23, 2018
by
k8s-ci-robot
Committed by
GitHub
Nov 23, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #71377 from andyzhangx/return-error-attachdisk
fix azure disk attach/detach failed forever issue
parents
205eaee0
7b14a5a2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
azure_controller_standard.go
...loudprovider/providers/azure/azure_controller_standard.go
+5
-2
azure_controller_vmss.go
pkg/cloudprovider/providers/azure/azure_controller_vmss.go
+5
-2
No files found.
pkg/cloudprovider/providers/azure/azure_controller_standard.go
View file @
94759c16
...
@@ -76,7 +76,9 @@ func (as *availabilitySet) AttachDisk(isManagedDisk bool, diskName, diskURI stri
...
@@ -76,7 +76,9 @@ func (as *availabilitySet) AttachDisk(isManagedDisk bool, diskName, diskURI stri
klog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s): vm(%s) - attach disk(%s)"
,
nodeResourceGroup
,
vmName
,
diskName
)
klog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s): vm(%s) - attach disk(%s)"
,
nodeResourceGroup
,
vmName
,
diskName
)
ctx
,
cancel
:=
getContextWithCancel
()
ctx
,
cancel
:=
getContextWithCancel
()
defer
cancel
()
defer
cancel
()
if
_
,
err
:=
as
.
VirtualMachinesClient
.
CreateOrUpdate
(
ctx
,
nodeResourceGroup
,
vmName
,
newVM
);
err
!=
nil
{
_
,
err
=
as
.
VirtualMachinesClient
.
CreateOrUpdate
(
ctx
,
nodeResourceGroup
,
vmName
,
newVM
)
if
err
!=
nil
{
klog
.
Errorf
(
"azureDisk - attach disk(%s) failed, err: %v"
,
diskName
,
err
)
klog
.
Errorf
(
"azureDisk - attach disk(%s) failed, err: %v"
,
diskName
,
err
)
detail
:=
err
.
Error
()
detail
:=
err
.
Error
()
if
strings
.
Contains
(
detail
,
errLeaseFailed
)
||
strings
.
Contains
(
detail
,
errDiskBlobNotFound
)
{
if
strings
.
Contains
(
detail
,
errLeaseFailed
)
||
strings
.
Contains
(
detail
,
errDiskBlobNotFound
)
{
...
@@ -137,7 +139,8 @@ func (as *availabilitySet) DetachDiskByName(diskName, diskURI string, nodeName t
...
@@ -137,7 +139,8 @@ func (as *availabilitySet) DetachDiskByName(diskName, diskURI string, nodeName t
klog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s): vm(%s) - detach disk(%s)"
,
nodeResourceGroup
,
vmName
,
diskName
)
klog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s): vm(%s) - detach disk(%s)"
,
nodeResourceGroup
,
vmName
,
diskName
)
ctx
,
cancel
:=
getContextWithCancel
()
ctx
,
cancel
:=
getContextWithCancel
()
defer
cancel
()
defer
cancel
()
if
_
,
err
:=
as
.
VirtualMachinesClient
.
CreateOrUpdate
(
ctx
,
nodeResourceGroup
,
vmName
,
newVM
);
err
!=
nil
{
_
,
err
=
as
.
VirtualMachinesClient
.
CreateOrUpdate
(
ctx
,
nodeResourceGroup
,
vmName
,
newVM
)
if
err
!=
nil
{
klog
.
Errorf
(
"azureDisk - detach disk(%s) failed, err: %v"
,
diskName
,
err
)
klog
.
Errorf
(
"azureDisk - detach disk(%s) failed, err: %v"
,
diskName
,
err
)
}
else
{
}
else
{
klog
.
V
(
2
)
.
Infof
(
"azureDisk - detach disk(%s) succeeded"
,
diskName
)
klog
.
V
(
2
)
.
Infof
(
"azureDisk - detach disk(%s) succeeded"
,
diskName
)
...
...
pkg/cloudprovider/providers/azure/azure_controller_vmss.go
View file @
94759c16
...
@@ -72,7 +72,9 @@ func (ss *scaleSet) AttachDisk(isManagedDisk bool, diskName, diskURI string, nod
...
@@ -72,7 +72,9 @@ func (ss *scaleSet) AttachDisk(isManagedDisk bool, diskName, diskURI string, nod
ctx
,
cancel
:=
getContextWithCancel
()
ctx
,
cancel
:=
getContextWithCancel
()
defer
cancel
()
defer
cancel
()
klog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s): vm(%s) - attach disk(%s)"
,
nodeResourceGroup
,
nodeName
,
diskName
)
klog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s): vm(%s) - attach disk(%s)"
,
nodeResourceGroup
,
nodeName
,
diskName
)
if
_
,
err
:=
ss
.
VirtualMachineScaleSetVMsClient
.
Update
(
ctx
,
nodeResourceGroup
,
ssName
,
instanceID
,
vm
);
err
!=
nil
{
_
,
err
=
ss
.
VirtualMachineScaleSetVMsClient
.
Update
(
ctx
,
nodeResourceGroup
,
ssName
,
instanceID
,
vm
)
if
err
!=
nil
{
detail
:=
err
.
Error
()
detail
:=
err
.
Error
()
if
strings
.
Contains
(
detail
,
errLeaseFailed
)
||
strings
.
Contains
(
detail
,
errDiskBlobNotFound
)
{
if
strings
.
Contains
(
detail
,
errLeaseFailed
)
||
strings
.
Contains
(
detail
,
errDiskBlobNotFound
)
{
// if lease cannot be acquired or disk not found, immediately detach the disk and return the original error
// if lease cannot be acquired or disk not found, immediately detach the disk and return the original error
...
@@ -127,7 +129,8 @@ func (ss *scaleSet) DetachDiskByName(diskName, diskURI string, nodeName types.No
...
@@ -127,7 +129,8 @@ func (ss *scaleSet) DetachDiskByName(diskName, diskURI string, nodeName types.No
ctx
,
cancel
:=
getContextWithCancel
()
ctx
,
cancel
:=
getContextWithCancel
()
defer
cancel
()
defer
cancel
()
klog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s): vm(%s) - detach disk(%s)"
,
nodeResourceGroup
,
nodeName
,
diskName
)
klog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s): vm(%s) - detach disk(%s)"
,
nodeResourceGroup
,
nodeName
,
diskName
)
if
_
,
err
:=
ss
.
VirtualMachineScaleSetVMsClient
.
Update
(
ctx
,
nodeResourceGroup
,
ssName
,
instanceID
,
vm
);
err
!=
nil
{
_
,
err
=
ss
.
VirtualMachineScaleSetVMsClient
.
Update
(
ctx
,
nodeResourceGroup
,
ssName
,
instanceID
,
vm
)
if
err
!=
nil
{
klog
.
Errorf
(
"azureDisk - detach disk(%s) from %s failed, err: %v"
,
diskName
,
nodeName
,
err
)
klog
.
Errorf
(
"azureDisk - detach disk(%s) from %s failed, err: %v"
,
diskName
,
nodeName
,
err
)
}
else
{
}
else
{
klog
.
V
(
2
)
.
Infof
(
"azureDisk - detach disk(%s) succeeded"
,
diskName
)
klog
.
V
(
2
)
.
Infof
(
"azureDisk - detach disk(%s) succeeded"
,
diskName
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment