 
 #---------------------------------------------------------------------
 
-detach = $coroutine ({id}) ->
-  try
-    host = @getObject id, 'host'
-  catch
-    @throw 'NO_SUCH_OBJECT'
-
+detach = $coroutine ({host}) ->
   xapi = @getXAPI host
 
   $wait xapi.call 'pool.eject', host.ref


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

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

  try
    host = @getObject id, 'host'
  catch
    @throw 'NO_SUCH_OBJECT'

  xapi = @getXAPI host

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


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

start = $coroutine ({host}) ->
  xapi = @getXAPI host

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