Are you looking for information on how XAPI does async processing?
http://wiki.xen.org/wiki/VM_Startup

http://wiki.xen.org/wiki/XAPI_Dispatch


On 5/21/13 1:52 AM, "Nguyen Anh Tu" <ng.t...@gmail.com> wrote:

>no one can explain it for me?
>
>
>2013/5/10 Nguyen Anh Tu <ng.t...@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

Reply via email to