You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Nguyen Anh Tu <ng...@gmail.com> on 2013/05/10 12:57:57 UTC

About XAPI task queue

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

Re: About XAPI task queue

Posted by Nguyen Anh Tu <ng...@gmail.com>.
Sure. Thanks Seb :-)


2013/5/22 Sebastien Goasguen <ru...@gmail.com>

> You might also want to check out IRC
>
> xen-api on freenode
>
> On May 21, 2013, at 1:30 PM, Nguyen Anh Tu <ng...@gmail.com> wrote:
>
> > Perfect, Chiradeep. Exactly what i'm looking for. How about xapi queue?
> > Could u send me more information about it
> >
> > Thanks :-)
> >
> > Sent from my GT-N7000
> > On 22 May 2013 00:19, "Chiradeep Vittal" <Ch...@citrix.com>
> > wrote:
> >
> >> Also
> >> http://docs.vmd.citrix.com/XenServer/4.0.1/sdk/ch04.html#id2538486
> >>
> >>
> >> On 5/21/13 10:12 AM, "Chiradeep Vittal" <Ch...@citrix.com>
> >> wrote:
> >>
> >>> 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...@gmail.com> wrote:
> >>>
> >>>> no one can explain it for me?
> >>>>
> >>>>
> >>>> 2013/5/10 Nguyen Anh Tu <ng...@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
> >>>
> >>
> >>
>
>


-- 

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

Re: About XAPI task queue

Posted by Sebastien Goasguen <ru...@gmail.com>.
You might also want to check out IRC

xen-api on freenode

On May 21, 2013, at 1:30 PM, Nguyen Anh Tu <ng...@gmail.com> wrote:

> Perfect, Chiradeep. Exactly what i'm looking for. How about xapi queue?
> Could u send me more information about it
> 
> Thanks :-)
> 
> Sent from my GT-N7000
> On 22 May 2013 00:19, "Chiradeep Vittal" <Ch...@citrix.com>
> wrote:
> 
>> Also
>> http://docs.vmd.citrix.com/XenServer/4.0.1/sdk/ch04.html#id2538486
>> 
>> 
>> On 5/21/13 10:12 AM, "Chiradeep Vittal" <Ch...@citrix.com>
>> wrote:
>> 
>>> 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...@gmail.com> wrote:
>>> 
>>>> no one can explain it for me?
>>>> 
>>>> 
>>>> 2013/5/10 Nguyen Anh Tu <ng...@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
>>> 
>> 
>> 


Re: About XAPI task queue

Posted by Nguyen Anh Tu <ng...@gmail.com>.
Perfect, Chiradeep. Exactly what i'm looking for. How about xapi queue?
Could u send me more information about it

Thanks :-)

Sent from my GT-N7000
On 22 May 2013 00:19, "Chiradeep Vittal" <Ch...@citrix.com>
wrote:

> Also
> http://docs.vmd.citrix.com/XenServer/4.0.1/sdk/ch04.html#id2538486
>
>
> On 5/21/13 10:12 AM, "Chiradeep Vittal" <Ch...@citrix.com>
> wrote:
>
> >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...@gmail.com> wrote:
> >
> >>no one can explain it for me?
> >>
> >>
> >>2013/5/10 Nguyen Anh Tu <ng...@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
> >
>
>

Re: About XAPI task queue

Posted by Chiradeep Vittal <Ch...@citrix.com>.
Also
http://docs.vmd.citrix.com/XenServer/4.0.1/sdk/ch04.html#id2538486


On 5/21/13 10:12 AM, "Chiradeep Vittal" <Ch...@citrix.com>
wrote:

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


Re: About XAPI task queue

Posted by Chiradeep Vittal <Ch...@citrix.com>.
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...@gmail.com> wrote:

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


Re: About XAPI task queue

Posted by Nguyen Anh Tu <ng...@gmail.com>.
no one can explain it for me?


2013/5/10 Nguyen Anh Tu <ng...@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