cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nguyen Anh Tu <ng.t...@gmail.com>
Subject Re: About XAPI task queue
Date Tue, 21 May 2013 08:52:24 GMT
no one can explain it for me?


2013/5/10 Nguyen Anh Tu <ng.tuna@gmail.com>

> Hi forks,
>
> I'm working on CS + XCP. I have a question:
>
> When starting VM, Async job "startvm" is sent to XCP Host via xapi. Then
> we have to wait until xapi task responses.  This code here:
>
>     void startVM(Connection conn, Host host, VM vm, String vmName) throws
> XmlRpcException {
>         Task task = null;
>         try {
>            * task = vm.startOnAsync(conn, host, false, true);*
>             try {
>                 //poll every 1 seconds , timeout after 10 minutes
>                 *waitForTask(conn, task, 1000, 10 * 60 * 1000);*
>                 *checkForSuccess(conn, task);*
>             } catch (Types.HandleInvalid e) {
>                 if (vm.getPowerState(conn) == Types.VmPowerState.RUNNING) {
>                     task = null;
>                     return;
>                 }
>                 throw new CloudRuntimeException("Shutdown VM catch
> HandleInvalid and VM is not in RUNNING state");
>             }
>         } catch (XenAPIException e) {
>             String msg = "Unable to start VM(" + vmName + ") on host(" +
> _host.uuid +") due to " + e.toString();
>             s_logger.warn(msg, e);
>             throw new CloudRuntimeException(msg);
>         }finally {
>             if( task != null) {
>                 try {
>                     task.destroy(conn);
>                 } catch (Exception e1) {
>                     s_logger.debug("unable to destroy task(" +
> task.toString() + ") on host(" + _host.uuid +") due to " + e1.toString());
>                 }
>             }
>         }
>     }
>
> Can you explain how xapi task work? How xapi queue work? When its task
> responses?
>
> Thanks,
>
> --
>
> N.g.U.y.e.N.A.n.H.t.U
>



-- 

N.g.U.y.e.N.A.n.H.t.U

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message