File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,14 @@ func (self *SHost) CreateVM(desc *cloudprovider.SManagedVMCreateConfig) (cloudpr
72
72
73
73
instance , err := self .zone .region ._createVM (desc , nic .ID )
74
74
if err != nil {
75
- self .zone .region .DeleteNetworkInterface (nic .ID )
75
+ cloudprovider .Wait (time .Minute * 2 , time .Minute * 6 , func () (bool , error ) {
76
+ e := self .zone .region .DeleteNetworkInterface (nic .ID )
77
+ if e == nil {
78
+ return true , nil
79
+ }
80
+ log .Errorf ("delete nic %s error: %v" , nic .ID , err )
81
+ return false , nil
82
+ })
76
83
return nil , err
77
84
}
78
85
instance .host = self
@@ -122,7 +129,8 @@ func (self *SRegion) _createVM(desc *cloudprovider.SManagedVMCreateConfig, nicId
122
129
"NetworkProfile" : map [string ]interface {}{
123
130
"NetworkInterfaces" : []map [string ]string {
124
131
map [string ]string {
125
- "Id" : nicId ,
132
+ "Id" : nicId ,
133
+ "deleteOption" : "Delete" ,
126
134
},
127
135
},
128
136
},
You can’t perform that action at this time.
0 commit comments