Skip to content

Commit

Permalink
Merge pull request #1118 from ioito/automated-cherry-pick-of-#1116-up…
Browse files Browse the repository at this point in the history
…stream-master

Automated cherry pick of #1116: fix(azure): azure nic delete
  • Loading branch information
ioito authored Nov 20, 2024
2 parents 3a90b6a + 6d8a8fb commit 1c33059
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/multicloud/azure/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@ func (self *SHost) CreateVM(desc *cloudprovider.SManagedVMCreateConfig) (cloudpr

instance, err := self.zone.region._createVM(desc, nic.ID)
if err != nil {
self.zone.region.DeleteNetworkInterface(nic.ID)
cloudprovider.Wait(time.Minute*2, time.Minute*6, func() (bool, error) {
e := self.zone.region.DeleteNetworkInterface(nic.ID)
if e == nil {
return true, nil
}
log.Errorf("delete nic %s error: %v", nic.ID, err)
return false, nil
})
return nil, err
}
instance.host = self
Expand Down Expand Up @@ -122,7 +129,8 @@ func (self *SRegion) _createVM(desc *cloudprovider.SManagedVMCreateConfig, nicId
"NetworkProfile": map[string]interface{}{
"NetworkInterfaces": []map[string]string{
map[string]string{
"Id": nicId,
"Id": nicId,
"deleteOption": "Delete",
},
},
},
Expand Down

0 comments on commit 1c33059

Please sign in to comment.