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
2a934c4f
Unverified
Commit
2a934c4f
authored
Jan 05, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Jan 05, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #72263 from andyzhangx/automated-cherry-pick-of-#71992-upstream-release-1.13
Automated cherry pick of #71992: fix race condition when attach azure disk in vmss
parents
793fde6d
11527d69
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
+25
-4
azure_controller_vmss.go
pkg/cloudprovider/providers/azure/azure_controller_vmss.go
+25
-4
No files found.
pkg/cloudprovider/providers/azure/azure_controller_vmss.go
View file @
2a934c4f
...
...
@@ -67,7 +67,17 @@ func (ss *scaleSet) AttachDisk(isManagedDisk bool, diskName, diskURI string, nod
CreateOption
:
"attach"
,
})
}
vm
.
StorageProfile
.
DataDisks
=
&
disks
newVM
:=
compute
.
VirtualMachineScaleSetVM
{
Sku
:
vm
.
Sku
,
Location
:
vm
.
Location
,
VirtualMachineScaleSetVMProperties
:
&
compute
.
VirtualMachineScaleSetVMProperties
{
HardwareProfile
:
vm
.
HardwareProfile
,
StorageProfile
:
&
compute
.
StorageProfile
{
OsDisk
:
vm
.
StorageProfile
.
OsDisk
,
DataDisks
:
&
disks
,
},
},
}
ctx
,
cancel
:=
getContextWithCancel
()
defer
cancel
()
...
...
@@ -77,7 +87,7 @@ func (ss *scaleSet) AttachDisk(isManagedDisk bool, diskName, diskURI string, nod
defer
ss
.
vmssVMCache
.
Delete
(
key
)
klog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s): vm(%s) - attach disk(%s)"
,
nodeResourceGroup
,
nodeName
,
diskName
)
_
,
err
=
ss
.
VirtualMachineScaleSetVMsClient
.
Update
(
ctx
,
nodeResourceGroup
,
ssName
,
instanceID
,
vm
)
_
,
err
=
ss
.
VirtualMachineScaleSetVMsClient
.
Update
(
ctx
,
nodeResourceGroup
,
ssName
,
instanceID
,
newVM
)
if
err
!=
nil
{
detail
:=
err
.
Error
()
if
strings
.
Contains
(
detail
,
errLeaseFailed
)
||
strings
.
Contains
(
detail
,
errDiskBlobNotFound
)
{
...
...
@@ -126,7 +136,18 @@ func (ss *scaleSet) DetachDiskByName(diskName, diskURI string, nodeName types.No
return
fmt
.
Errorf
(
"detach azure disk failure, disk %s not found, diskURI: %s"
,
diskName
,
diskURI
)
}
vm
.
StorageProfile
.
DataDisks
=
&
disks
newVM
:=
compute
.
VirtualMachineScaleSetVM
{
Sku
:
vm
.
Sku
,
Location
:
vm
.
Location
,
VirtualMachineScaleSetVMProperties
:
&
compute
.
VirtualMachineScaleSetVMProperties
{
HardwareProfile
:
vm
.
HardwareProfile
,
StorageProfile
:
&
compute
.
StorageProfile
{
OsDisk
:
vm
.
StorageProfile
.
OsDisk
,
DataDisks
:
&
disks
,
},
},
}
ctx
,
cancel
:=
getContextWithCancel
()
defer
cancel
()
...
...
@@ -135,7 +156,7 @@ func (ss *scaleSet) DetachDiskByName(diskName, diskURI string, nodeName types.No
defer
ss
.
vmssVMCache
.
Delete
(
key
)
klog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s): vm(%s) - detach disk(%s)"
,
nodeResourceGroup
,
nodeName
,
diskName
)
_
,
err
=
ss
.
VirtualMachineScaleSetVMsClient
.
Update
(
ctx
,
nodeResourceGroup
,
ssName
,
instanceID
,
vm
)
_
,
err
=
ss
.
VirtualMachineScaleSetVMsClient
.
Update
(
ctx
,
nodeResourceGroup
,
ssName
,
instanceID
,
newVM
)
if
err
!=
nil
{
klog
.
Errorf
(
"azureDisk - detach disk(%s) from %s failed, err: %v"
,
diskName
,
nodeName
,
err
)
}
else
{
...
...
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