parent
ede12b6732
commit
2ff25d1f61
@ -869,13 +869,8 @@ export default class Xapi extends XapiBase {
|
||||
...vdi,
|
||||
$SR$uuid: vdi.$SR.uuid,
|
||||
}
|
||||
const stream = (streams[`${vdiRef}.vhd`] = this._exportVdi(
|
||||
$cancelToken,
|
||||
vdi,
|
||||
baseVdi,
|
||||
VDI_FORMAT_VHD
|
||||
))
|
||||
$defer.onFailure(stream.cancel)
|
||||
streams[`${vdiRef}.vhd`] = () =>
|
||||
this._exportVdi($cancelToken, vdi, baseVdi, VDI_FORMAT_VHD)
|
||||
})
|
||||
|
||||
const vifs = {}
|
||||
@ -905,7 +900,7 @@ export default class Xapi extends XapiBase {
|
||||
},
|
||||
'streams',
|
||||
{
|
||||
value: await streams::pAll(),
|
||||
value: streams,
|
||||
}
|
||||
)
|
||||
}
|
||||
@ -1029,7 +1024,10 @@ export default class Xapi extends XapiBase {
|
||||
|
||||
// Import VDI contents.
|
||||
asyncMap(newVdis, async (vdi, id) => {
|
||||
for (const stream of ensureArray(streams[`${id}.vhd`])) {
|
||||
for (let stream of ensureArray(streams[`${id}.vhd`])) {
|
||||
if (typeof stream === 'function') {
|
||||
stream = await stream()
|
||||
}
|
||||
await this._importVdiContent(vdi, stream, VDI_FORMAT_VHD)
|
||||
}
|
||||
}),
|
||||
@ -1847,6 +1845,7 @@ export default class Xapi extends XapiBase {
|
||||
return snap
|
||||
}
|
||||
|
||||
@concurrency(12, stream => stream.then(stream => fromEvent(stream, 'end')))
|
||||
@cancellable
|
||||
_exportVdi ($cancelToken, vdi, base, format = VDI_FORMAT_VHD) {
|
||||
const host = vdi.$SR.$PBDs[0].$host
|
||||
|
@ -652,6 +652,10 @@ export default class {
|
||||
xapi,
|
||||
{ vdiParent, isFull, handler, stream, dir, retention }
|
||||
) {
|
||||
if (typeof stream === 'function') {
|
||||
stream = await stream()
|
||||
}
|
||||
|
||||
const backupDirectory = `vdi_${vdiParent.uuid}`
|
||||
dir = `${dir}/${backupDirectory}`
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user