feat(pool): ability to designate a new master

See vatesfr/xo-web#2213
This commit is contained in:
badrAZ 2017-08-03 11:21:53 +02:00
parent f263097008
commit 851182a92e
2 changed files with 25 additions and 0 deletions

View File

@ -54,6 +54,25 @@ setDefaultSr.params = {
setDefaultSr.resolve = {
sr: ['sr', 'SR']
}
// -------------------------------------------------------------------
export async function setPoolMaster ({ host }) {
await this.hasPermissions(this.user.id, [ [ host.$pool, 'administrate' ] ])
await this.getXapi(host).setPoolMaster(host._xapiId)
}
setPoolMaster.params = {
host: {
type: 'string'
}
}
setPoolMaster.resolve = {
host: ['host', 'host']
}
// -------------------------------------------------------------------
export async function installPatch ({pool, patch: patchUuid}) {

View File

@ -350,6 +350,12 @@ export default class Xapi extends XapiBase {
// =================================================================
async setPoolMaster (hostId) {
await this.call('pool.designate_new_master', this.getObject(hostId).$ref)
}
// =================================================================
async joinPool (masterAddress, masterUsername, masterPassword, force = false) {
await this.call(
force ? 'pool.join_force' : 'pool.join',