diff --git a/src/api/pool.js b/src/api/pool.js index e00c7eee5..08e414946 100644 --- a/src/api/pool.js +++ b/src/api/pool.js @@ -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 = { diff --git a/src/xo.js b/src/xo.js index a3cfb79ea..c54a0c54d 100644 --- a/src/xo.js +++ b/src/xo.js @@ -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) }