   $wait xapi.call 'host.reboot', host.ref
 
   return true
-exports.restart.permission = 'admin'
-exports.restart.params = {
-  id: { type: 'string' }
-}
-
-exports.restart_agent = $coroutine ({id}) ->
+
+restart.params = {
+  id: { type: 'string' }
+}
+
+restart.resolve = {
+  host: ['id', 'host'],
+}
+
+exports.restart = restart
+
+#---------------------------------------------------------------------
+
+restartAgent = $coroutine ({id}) ->
   try
     host = @getObject id, 'host'
   catch

    type: 'boolean'
    optional: true

exports.restart = $coroutine ({id}) ->
  @checkPermission 'admin'

  try

  $wait xapi.call 'host.power_on', host.ref

  return true

start.params = {
  id: { type: 'string' }
}

start.resolve = {
  host: ['id', 'host'],
}

exports.start = start

#---------------------------------------------------------------------

stop = $coroutine ({id}) ->
  try
    host = @getObject id, 'host'
  catch
