fix(xo-server/xapi): handle VM/VDI export stream close (#5538)
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
|
||||
> Users must be able to say: “I had this issue, happy to know it's fixed”
|
||||
|
||||
- [VM/Snapshot export] Fix `Error: no available place in queue` on canceling an export via browser then starting a new one when the concurrency threshold is reached [#5535](https://github.com/vatesfr/xen-orchestra/issues/5535) (PR [#5538](https://github.com/vatesfr/xen-orchestra/pull/5538))
|
||||
|
||||
### Packages to release
|
||||
|
||||
> Packages will be released in the order they are here, therefore, they should
|
||||
|
||||
@@ -10,7 +10,7 @@ import ms from 'ms'
|
||||
import synchronized from 'decorator-synchronized'
|
||||
import tarStream from 'tar-stream'
|
||||
import { vmdkToVhd } from 'xo-vmdk-to-vhd'
|
||||
import { cancelable, defer, fromEvent, ignoreErrors, pCatch, pRetry } from 'promise-toolbox'
|
||||
import { cancelable, defer, fromEvents, ignoreErrors, pCatch, pRetry } from 'promise-toolbox'
|
||||
import { parseDuration } from '@vates/parse-duration'
|
||||
import { PassThrough } from 'stream'
|
||||
import { forbiddenOperation } from 'xo-common/api-errors'
|
||||
@@ -105,7 +105,8 @@ export default class Xapi extends XapiBase {
|
||||
this._maxUncoalescedVdis = maxUncoalescedVdis
|
||||
this._restartHostTimeout = parseDuration(restartHostTimeout)
|
||||
|
||||
const waitStreamEnd = async stream => fromEvent(await stream, 'end')
|
||||
// close event is emitted when the export is canceled via browser. See https://github.com/vatesfr/xen-orchestra/issues/5535
|
||||
const waitStreamEnd = async stream => fromEvents(await stream, ['end', 'close'])
|
||||
this._exportVdi = concurrency(vdiExportConcurrency, waitStreamEnd)(this._exportVdi)
|
||||
this.exportVm = concurrency(vmExportConcurrency, waitStreamEnd)(this.exportVm)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user