fix(vm.deltaCopy): correctly destroy VDIs (#589)

This commit is contained in:
Julien Fontanet 2017-07-31 18:30:31 +02:00 committed by GitHub
parent 76357fb918
commit e3d436a019
3 changed files with 15 additions and 12 deletions

View File

@ -110,7 +110,7 @@
"tmp": "^0.0.31",
"uuid": "^3.0.1",
"ws": "^3.0.0",
"xen-api": "^0.13.7",
"xen-api": "^0.14.0",
"xml2js": "~0.4.17",
"xo-acl-resolver": "^0.2.3",
"xo-collection": "^0.4.1",

View File

@ -653,6 +653,8 @@ export default class Xapi extends XapiBase {
await this.call('VM.hard_shutdown', vm.$ref)
}
await this.barrier('VM', vm.$ref)
if (deleteDisks) {
// Compute the VDIs list without duplicates.
const vdis = {}
@ -999,29 +1001,29 @@ export default class Xapi extends XapiBase {
await Promise.all([
// Create VBDs.
Promise.all(mapToArray(
asyncMap(
delta.vbds,
vbd => this._createVbd(vm, newVdis[vbd.VDI], vbd)
)),
),
// Import VDI contents.
Promise.all(mapToArray(
asyncMap(
newVdis,
async (vdi, id) => {
for (const stream of ensureArray(streams[`${id}.vhd`])) {
await this._importVdiContent(vdi, stream, VDI_FORMAT_VHD)
}
}
)),
),
// Wait for VDI export tasks (if any) termination.
Promise.all(mapToArray(
asyncMap(
streams,
stream => stream.task
)),
),
// Create VIFs.
Promise.all(mapToArray(delta.vifs, vif => {
asyncMap(delta.vifs, vif => {
const network =
(vif.$network$uuid && this.getObject(vif.$network$uuid, null)) ||
networksOnPoolMasterByDevice[vif.device] ||
@ -1034,7 +1036,7 @@ export default class Xapi extends XapiBase {
vif
)
}
}))
})
])
if (deleteBase && baseVm) {
@ -1867,6 +1869,7 @@ export default class Xapi extends XapiBase {
}
await Promise.all([
body.task,
body.checksumVerified,
this.putResource(body, '/import_raw_vdi/', {
host: pbd.host,

View File

@ -7093,9 +7093,9 @@ xdg-basedir@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4"
xen-api@^0.13.7:
version "0.13.7"
resolved "https://registry.yarnpkg.com/xen-api/-/xen-api-0.13.7.tgz#75da4d60e15820501186c816ed993182c4019627"
xen-api@^0.14.0:
version "0.14.0"
resolved "https://registry.yarnpkg.com/xen-api/-/xen-api-0.14.0.tgz#93bfb9f35daca1092237f1a0dfb211005a8e7916"
dependencies:
babel-polyfill "^6.23.0"
blocked "^1.2.1"