Work around Babel T7172 (second attempt).
This commit is contained in:
parent
ca8476d466
commit
baee4e185d
12
src/xapi.js
12
src/xapi.js
@ -1120,27 +1120,25 @@ export default class Xapi extends XapiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Modify existing (previous template) disks if necessary
|
// Modify existing (previous template) disks if necessary
|
||||||
existingVdis && await Promise.all(mapToArray(existingVdis, async (existingVdi, userdevice) => {
|
const this_ = this // Work around http://phabricator.babeljs.io/T7172
|
||||||
// Work around http://phabricator.babeljs.io/T7172
|
existingVdis && await Promise.all(mapToArray(existingVdis, async ({ size, $SR: srId, ...properties }, userdevice) => {
|
||||||
const { size, $SR: srId, ...properties } = existingVdi
|
|
||||||
|
|
||||||
const vbd = find(vm.$VBDs, { userdevice })
|
const vbd = find(vm.$VBDs, { userdevice })
|
||||||
if (!vbd) {
|
if (!vbd) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const vdi = vbd.$VDI
|
const vdi = vbd.$VDI
|
||||||
await this._setObjectProperties(vdi, properties)
|
await this_._setObjectProperties(vdi, properties)
|
||||||
|
|
||||||
// if the disk is bigger
|
// if the disk is bigger
|
||||||
if (
|
if (
|
||||||
size != null &&
|
size != null &&
|
||||||
size > vdi.virtual_size
|
size > vdi.virtual_size
|
||||||
) {
|
) {
|
||||||
await this.resizeVdi(vdi.$id, size)
|
await this_.resizeVdi(vdi.$id, size)
|
||||||
}
|
}
|
||||||
// if another SR is set, move it there
|
// if another SR is set, move it there
|
||||||
if (srId) {
|
if (srId) {
|
||||||
await this.moveVdi(vdi.$id, srId)
|
await this_.moveVdi(vdi.$id, srId)
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user