Mailing List Archive

value of timestamp from API event.from() is always '0'
Hi all,

My xenserver version is 6.2
When I fetch logs from API function event.from(), the value of each
timestamp field is always '0.' .
Instead of event.next(), it is fine.
Could anyone give me some advices ?

--
-----------
Cao Tong



_______________________________________________
Xen-api mailing list
Xen-api@lists.xen.org
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api
Re: value of timestamp from API event.from() is always '0' [ In reply to ]
Hey Tony,

I've seen this too. I don't know what the events.from was designed for. I've seen XenCenter using it for a "fast"-sync with the pool, and features some kind of logging (see id=0, class=message). I think you can safely skip all events with id=0 and accept the ts=0 as given :)

I handle the pool syncing a little bit different, which is slower, bit a bit more straight forward:
1. event.register(*)
2. foreach($obj_types as $type) $type.get_all()
3. while($running) event.next()

Greetings
Uli Stärk

-----Ursprüngliche Nachricht-----
Von: xen-api-bounces@lists.xen.org [mailto:xen-api-bounces@lists.xen.org] Im Auftrag von tony_caotong@163.com
Gesendet: Mittwoch, 16. September 2015 04:39
An: xen-users@lists.xen.org; xen-api@lists.xen.org
Betreff: [Xen-API] value of timestamp from API event.from() is always '0'

Hi all,

My xenserver version is 6.2
When I fetch logs from API function event.from(), the value of each timestamp field is always '0.' .
Instead of event.next(), it is fine.
Could anyone give me some advices ?

--
-----------
Cao Tong



_______________________________________________
Xen-api mailing list
Xen-api@lists.xen.org
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api

_______________________________________________
Xen-api mailing list
Xen-api@lists.xen.org
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api
Re: value of timestamp from API event.from() is always '0' [ In reply to ]
> On 17 Sep 2015, at 13:39, Uli Stärk <Uli.Staerk@globalways.net> wrote:
>
> Hey Tony,
>
> I've seen this too. I don't know what the events.from was designed for. I've seen XenCenter using it for a "fast"-sync with the pool, and features some kind of logging (see id=0, class=message). I think you can safely skip all events with id=0 and accept the ts=0 as given :)

I’ve cc:d Jonathan Ludlam, who built the `event.from` mechanism — he can probably describe the fine-detail.

The main semantic difference between `event.next` and `event.from` from my point-of-view is that `event.next` reads from a fixed-space queue of object state snapshots which can easily overflow, while `event.from` fetches the *current* state of all objects which have changed since your last update. If you want to display the most up-to-date information — like XenCenter does — then `event.from` is the way to go. We also had a lot of problems with the `event.next` queue overflowing, especially under heavy load (e.g. while starting lots of VMs). This caused `event.next` to return a lot of exceptions, which means you have to re-register for events and poll the current state of the objects again, adding even more load to the overloaded system.

I recommend using `event.from` if you can :-)

Cheers,
Dave Scott


>
> I handle the pool syncing a little bit different, which is slower, bit a bit more straight forward:
> 1. event.register(*)
> 2. foreach($obj_types as $type) $type.get_all()
> 3. while($running) event.next()
>
> Greetings
> Uli Stärk
>
> -----Ursprüngliche Nachricht-----
> Von: xen-api-bounces@lists.xen.org [mailto:xen-api-bounces@lists.xen.org] Im Auftrag von tony_caotong@163.com
> Gesendet: Mittwoch, 16. September 2015 04:39
> An: xen-users@lists.xen.org; xen-api@lists.xen.org
> Betreff: [Xen-API] value of timestamp from API event.from() is always '0'
>
> Hi all,
>
> My xenserver version is 6.2
> When I fetch logs from API function event.from(), the value of each timestamp field is always '0.' .
> Instead of event.next(), it is fine.
> Could anyone give me some advices ?
>
> --
> -----------
> Cao Tong
>
>
>
> _______________________________________________
> Xen-api mailing list
> Xen-api@lists.xen.org
> http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api
>
> _______________________________________________
> Xen-api mailing list
> Xen-api@lists.xen.org
> http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api


_______________________________________________
Xen-api mailing list
Xen-api@lists.xen.org
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api
Re: value of timestamp from API event.from() is always '0' [ In reply to ]
Now my solution is that using two threads, one call event.next() and
return immediately, and another deal with the events returned.

So I can get messages with timestamps, but cannot get the events history.

Maybe there is a bug under XenServer 6.2 ?

-----------
Cao Tong

On 09/17/2015 09:42 PM, Dave Scott wrote:
>> On 17 Sep 2015, at 13:39, Uli Stärk <Uli.Staerk@globalways.net> wrote:
>>
>> Hey Tony,
>>
>> I've seen this too. I don't know what the events.from was designed for. I've seen XenCenter using it for a "fast"-sync with the pool, and features some kind of logging (see id=0, class=message). I think you can safely skip all events with id=0 and accept the ts=0 as given :)
> I’ve cc:d Jonathan Ludlam, who built the `event.from` mechanism — he can probably describe the fine-detail.
>
> The main semantic difference between `event.next` and `event.from` from my point-of-view is that `event.next` reads from a fixed-space queue of object state snapshots which can easily overflow, while `event.from` fetches the *current* state of all objects which have changed since your last update. If you want to display the most up-to-date information — like XenCenter does — then `event.from` is the way to go. We also had a lot of problems with the `event.next` queue overflowing, especially under heavy load (e.g. while starting lots of VMs). This caused `event.next` to return a lot of exceptions, which means you have to re-register for events and poll the current state of the objects again, adding even more load to the overloaded system.
>
> I recommend using `event.from` if you can :-)
>
> Cheers,
> Dave Scott
>
>
>> I handle the pool syncing a little bit different, which is slower, bit a bit more straight forward:
>> 1. event.register(*)
>> 2. foreach($obj_types as $type) $type.get_all()
>> 3. while($running) event.next()
>>
>> Greetings
>> Uli Stärk
>>
>> -----Ursprüngliche Nachricht-----
>> Von: xen-api-bounces@lists.xen.org [mailto:xen-api-bounces@lists.xen.org] Im Auftrag von tony_caotong@163.com
>> Gesendet: Mittwoch, 16. September 2015 04:39
>> An: xen-users@lists.xen.org; xen-api@lists.xen.org
>> Betreff: [Xen-API] value of timestamp from API event.from() is always '0'
>>
>> Hi all,
>>
>> My xenserver version is 6.2
>> When I fetch logs from API function event.from(), the value of each timestamp field is always '0.' .
>> Instead of event.next(), it is fine.
>> Could anyone give me some advices ?
>>
>> --
>> -----------
>> Cao Tong
>>
>>
>>
>> _______________________________________________
>> Xen-api mailing list
>> Xen-api@lists.xen.org
>> http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api
>>
>> _______________________________________________
>> Xen-api mailing list
>> Xen-api@lists.xen.org
>> http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api
>
> _______________________________________________
> Xen-api mailing list
> Xen-api@lists.xen.org
> http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api



_______________________________________________
Xen-api mailing list
Xen-api@lists.xen.org
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api