fix(xo-server/vm.create): work around a race condition (#2755)

Fixes #2747
This commit is contained in:
Julien Fontanet 2018-03-12 17:52:53 +01:00 committed by GitHub
parent 80c1e39b53
commit f5511449af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -160,12 +160,11 @@ export async function create (params) {
])
}
for (const vifId of vm.VIFs) {
const vif = this.getObject(vifId, 'VIF')
for (const vif of xapiVm.$VIFs) {
await this.allocIpAddresses(
vifId,
concat(vif.allowedIpv4Addresses, vif.allowedIpv6Addresses)
).catch(() => xapi.deleteVif(vif._xapiId))
vif.$id,
concat(vif.ipv4_allowed, vif.ipv6_allowed)
).catch(() => xapi.deleteVif(vif))
}
if (params.bootAfterCreate) {