Correctly handle patch upload error.
This commit is contained in:
parent
8592ead0e3
commit
53e94378ae
44
src/xapi.js
44
src/xapi.js
@ -183,29 +183,31 @@ export default class Xapi extends XapiBase {
|
|||||||
async _installHostPatch (host, stream, length) {
|
async _installHostPatch (host, stream, length) {
|
||||||
const taskRef = await this._createTask('Patch upload from XO')
|
const taskRef = await this._createTask('Patch upload from XO')
|
||||||
|
|
||||||
got.put('http://' + host.address + '/pool_patch_upload', {
|
await Promise.all([
|
||||||
body: stream,
|
gotPromise('http://' + host.address + '/pool_patch_upload', {
|
||||||
query: {
|
method: 'put',
|
||||||
session_id: this.sessionId,
|
body: stream,
|
||||||
task_id: taskRef
|
query: {
|
||||||
},
|
session_id: this.sessionId,
|
||||||
headers: {
|
task_id: taskRef
|
||||||
'content-length': length
|
},
|
||||||
}
|
headers: {
|
||||||
})
|
'content-length': length
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
this._watchTask(taskRef).then(
|
||||||
|
(patchRef) => {
|
||||||
|
debug('patch upload succeeded')
|
||||||
|
|
||||||
await this._watchTask(taskRef).then(
|
return this.call('pool_patch.apply', patchRef, host.ref)
|
||||||
(patchRef) => {
|
},
|
||||||
debug('patch upload succeeded')
|
(error) => {
|
||||||
|
debug('patch upload failed', error.stack || error)
|
||||||
|
|
||||||
return this.call('pool_patch.apply', patchRef, host.ref)
|
throw error
|
||||||
},
|
}
|
||||||
(error) => {
|
)
|
||||||
debug('patch upload failed', error.stack || error)
|
])
|
||||||
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async installHostPatchFromUrl (host, patchUrl) {
|
async installHostPatchFromUrl (host, patchUrl) {
|
||||||
|
Loading…
Reference in New Issue
Block a user