feat(xapi): host_restartAgent
This commit is contained in:
17
@xen-orchestra/xapi/src/host.js
Normal file
17
@xen-orchestra/xapi/src/host.js
Normal file
@@ -0,0 +1,17 @@
|
||||
module.exports = class Host {
|
||||
async restartAgent(ref) {
|
||||
const agentStartTime = +(await this.getField('host', ref, 'other_config')).agent_start_time
|
||||
|
||||
await this.call('host.restart_agent', ref)
|
||||
|
||||
await new Promise(resolve => {
|
||||
// even though the ref could change in case of pool master restart, tests show it stays the same
|
||||
const stopWatch = this.watchObject(ref, host => {
|
||||
if (+host.other_config.agent_start_time > agentStartTime) {
|
||||
stopWatch()
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -206,6 +206,7 @@ function mixin(mixins) {
|
||||
}
|
||||
mixin({
|
||||
task: require('./task.js'),
|
||||
host: require('./host.js'),
|
||||
VBD: require('./vbd.js'),
|
||||
VDI: require('./vdi.js'),
|
||||
VIF: require('./vif.js'),
|
||||
|
||||
@@ -134,7 +134,7 @@ restart.resolve = {
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
export function restartAgent({ host }) {
|
||||
return this.getXapi(host).restartHostAgent(host._xapiId)
|
||||
return this.getXapiObject(host).$restartAgent()
|
||||
}
|
||||
|
||||
restartAgent.description = 'restart the Xen agent on the host'
|
||||
|
||||
@@ -302,10 +302,6 @@ export default class Xapi extends XapiBase {
|
||||
await this.callAsync('host.reboot', host.$ref)
|
||||
}
|
||||
|
||||
async restartHostAgent(hostId) {
|
||||
await this.callAsync('host.restart_agent', this.getObject(hostId).$ref)
|
||||
}
|
||||
|
||||
async setRemoteSyslogHost(hostId, syslogDestination) {
|
||||
const host = this.getObject(hostId)
|
||||
await host.set_logging({
|
||||
|
||||
Reference in New Issue
Block a user