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) { for (const vif of xapiVm.$VIFs) {
const vif = this.getObject(vifId, 'VIF')
await this.allocIpAddresses( await this.allocIpAddresses(
vifId, vif.$id,
concat(vif.allowedIpv4Addresses, vif.allowedIpv6Addresses) concat(vif.ipv4_allowed, vif.ipv6_allowed)
).catch(() => xapi.deleteVif(vif._xapiId)) ).catch(() => xapi.deleteVif(vif))
} }
if (params.bootAfterCreate) { if (params.bootAfterCreate) {