Expose XAPI error messages in pool.mergeInto().
This commit is contained in:
parent
9ef0337807
commit
69751aa415
@ -1,3 +1,4 @@
|
||||
import {JsonRpcError} from '../api-errors'
|
||||
import {extractProperty} from '../utils'
|
||||
|
||||
// ===================================================================
|
||||
@ -80,7 +81,12 @@ export {uploadPatch as patch}
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
export async function mergeInto ({ source, target, force }) {
|
||||
await this.mergeXenPools(source.id, target.id, force)
|
||||
try {
|
||||
await this.mergeXenPools(source.id, target.id, force)
|
||||
} catch (e) {
|
||||
// FIXME: should we expose plain XAPI error messages?
|
||||
throw new JsonRpcError(e.message)
|
||||
}
|
||||
}
|
||||
|
||||
mergeInto.params = {
|
||||
|
@ -881,10 +881,10 @@ export default class Xo extends EventEmitter {
|
||||
return xapi
|
||||
}
|
||||
|
||||
async mergeXenPools (sourceId, targetId) {
|
||||
async mergeXenPools (sourceId, targetId, force = false) {
|
||||
const sourceXapi = this.getXAPI(sourceId)
|
||||
const {
|
||||
_auth: { username, password },
|
||||
_auth: { user, password },
|
||||
_url: { hostname }
|
||||
} = this.getXAPI(targetId)
|
||||
|
||||
@ -903,7 +903,7 @@ export default class Xo extends EventEmitter {
|
||||
}
|
||||
|
||||
try {
|
||||
await sourceXapi.joinPool(hostname, username, password)
|
||||
await sourceXapi.joinPool(hostname, user, password, force)
|
||||
} finally {
|
||||
await this.disconnectXenServer(sourceId)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user