Re: [libvirt] Raising events for testing
Yep that's what I've just seen. I've decided to try via mingwin which seems to implement a poll function...Callbacks implementation are really hard for a noob :) Regards, Arnaud De: "Eric Blake" Envoyé: lundi 31 janvier 2011 20:12 A: arnaud.champ...@si-vs1281.com Objet: Re: [libvirt] Raising events for testing On 01/31/2011 11:52 AM, arnaud.champ...@devatom.fr wrote: >> There is - it involves using gnulib. But that is only for C and C++ - I >> have no idea how this translates over to C# > So if I understand well, are you saying that if I use gnulib windows version > via C# (pinvoke, this kind of magic) I will have access to poll function ? > Intersting, I'll take a look. I hope gnulib if published via a dll under > windows, if so, I'm pretty sure I can use it with C# > regards Sorry; gnulib is a source only library that currently targets only C and C++; it does not target C#, and does not provide any dll, so I have no idea how that affects your porting efforts. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Raising events for testing
On 01/31/2011 11:52 AM, arnaud.champ...@devatom.fr wrote: >> There is - it involves using gnulib. But that is only for C and C++ - I >> have no idea how this translates over to C# > So if I understand well, are you saying that if I use gnulib windows version > via C# (pinvoke, this kind of magic) I will have access to poll function ? > Intersting, I'll take a look. I hope gnulib if published via a dll under > windows, if so, I'm pretty sure I can use it with C# > regards Sorry; gnulib is a source only library that currently targets only C and C++; it does not target C#, and does not provide any dll, so I have no idea how that affects your porting efforts. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Raising events for testing
>There is - it involves using gnulib. But that is only for C and C++ - I >have no idea how this translates over to C# So if I understand well, are you saying that if I use gnulib windows version via C# (pinvoke, this kind of magic) I will have access to poll function ? Intersting, I'll take a look. I hope gnulib if published via a dll under windows, if so, I'm pretty sure I can use it with C# regards Arnaud De: "Eric Blake" Envoyé: lundi 31 janvier 2011 19:37 A: arnaud.champ...@devatom.fr Objet: Re: [libvirt] Raising events for testing On 01/30/2011 05:21 AM, arnaud.champ...@devatom.fr wrote: > Hi, > > One thing I need to understand, in the callback python or c samples, the > fileDescriptor is on a socket or on a pipe ? Libvirt uses gnulib to guarantee that poll() works on file descriptors; all socket operations are magically mapped by gnulib to behave like file descriptors, so that you don't have to worry about the (less-useful) restrictions of windows poll() only working on sockets. >> Okay I have understand the use and mean of poll (pollfd... >> bla...bla...bla...) >> I have also discover that there is no Win32 equivalent which work with >> a file descriptor (unix way...). There is - it involves using gnulib. But that is only for C and C++ - I have no idea how this translates over to C#. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Raising events for testing
On Sun, Jan 30, 2011 at 01:21:37PM +0100, arnaud.champ...@devatom.fr wrote: > Hi, > > One thing I need to understand, in the callback python or c samples, > the fileDescriptor is on a socket or on a pipe ? Internally libvirt may have a opened pipe, file, socket, or something else. In all cases, the 'fd' parameter that is passed to callbacks is what Microsoft call "a C runtime file descriptor". In particular what you get in a callback is *not* a HANDLE or SOCKET object, even if the underlying object libvirt has internally is a SOCKET/HANDLE. Basically the libvirt code on Windows that creates sockets does SOCKET s = WSASocket(...) int fd = _open_osfhandle(s); The callback gets 'fd', and not 's'. Regard, Daniel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Raising events for testing
On 01/30/2011 05:21 AM, arnaud.champ...@devatom.fr wrote: > Hi, > > One thing I need to understand, in the callback python or c samples, the > fileDescriptor is on a socket or on a pipe ? Libvirt uses gnulib to guarantee that poll() works on file descriptors; all socket operations are magically mapped by gnulib to behave like file descriptors, so that you don't have to worry about the (less-useful) restrictions of windows poll() only working on sockets. >> Okay I have understand the use and mean of poll (pollfd... >> bla...bla...bla...) >> I have also discover that there is no Win32 equivalent which work with >> a file descriptor (unix way...). There is - it involves using gnulib. But that is only for C and C++ - I have no idea how this translates over to C#. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Raising events for testing
Hi, One thing I need to understand, in the callback python or c samples, the fileDescriptor is on a socket or on a pipe ? Regards, Arnaud -- From: Sent: Saturday, January 29, 2011 2:03 PM To: "Daniel P. Berrange" Cc: Subject: Re: [libvirt] Raising events for testing Okay I have understand the use and mean of poll (pollfd... bla...bla...bla...) I have also discover that there is no Win32 equivalent which work with a file descriptor (unix way...). Win32 has a select method that can be used to emulate the poll function, but the fd_set structure is base on socket and not on a file descriptor. Does anyone know a way to have a select or poll function that works with file descriptor under windows ? (maybe via mingw, I don't know) Regards, Arnaud -- From: Sent: Friday, January 28, 2011 7:06 PM To: "Daniel P. Berrange" Cc: Subject: Re: [libvirt] Raising events for testing Okay, I'm trying to understand the Python implentation (I'm not a python expert but it seems to be quite readable once you've understand why there is "self" everywhere :) ). The thing I'm not able to understand is the call to the "poll" function as this function doesn't exists in C# in any library at my knows... I'm not fluent with this. Anyone can expliain what poll do ? Regards Arnaud -- From: Sent: Friday, January 28, 2011 4:53 PM To: "Daniel P. Berrange" Cc: Subject: Re: [libvirt] Raising events for testing Woohoo it will burn my brain :) -- From: "Daniel P. Berrange" Sent: Friday, January 28, 2011 4:24 PM To: Cc: Subject: Re: [libvirt] Raising events for testing On Fri, Jan 28, 2011 at 04:17:21PM +0100, arnaud.champ...@devatom.fr wrote: I suffer with the new callback API :) Does the new callback API need the EventRegisterImpl call ? Yes, virEventRegisterImpl is required in order to be able to receive events. Can anyone explain me the steps to install these callbacks ? I have a lot of difficulties to understand the polling process in the sample, does this polling is mandatory ? Events can arrive at the client socket from libvirtd at any time. The poll() is used to watch for events arriving and ensure immediate dispatch. If we didn't do this no events would be seen until the next API call was made which is sub-optimal. The file daemon/events.c shows a complete C implementation of the event callbacks. The file examples/domain-events/events-python/domain-events.py shows a pure Python implementation The C example program is a very *bad* demo of poll() so ignore that and look at daemon/events.c instead. Daniel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Raising events for testing
Okay I have understand the use and mean of poll (pollfd... bla...bla...bla...) I have also discover that there is no Win32 equivalent which work with a file descriptor (unix way...). Win32 has a select method that can be used to emulate the poll function, but the fd_set structure is base on socket and not on a file descriptor. Does anyone know a way to have a select or poll function that works with file descriptor under windows ? (maybe via mingw, I don't know) Regards, Arnaud -- From: Sent: Friday, January 28, 2011 7:06 PM To: "Daniel P. Berrange" Cc: Subject: Re: [libvirt] Raising events for testing Okay, I'm trying to understand the Python implentation (I'm not a python expert but it seems to be quite readable once you've understand why there is "self" everywhere :) ). The thing I'm not able to understand is the call to the "poll" function as this function doesn't exists in C# in any library at my knows... I'm not fluent with this. Anyone can expliain what poll do ? Regards Arnaud -- From: Sent: Friday, January 28, 2011 4:53 PM To: "Daniel P. Berrange" Cc: Subject: Re: [libvirt] Raising events for testing Woohoo it will burn my brain :) -- From: "Daniel P. Berrange" Sent: Friday, January 28, 2011 4:24 PM To: Cc: Subject: Re: [libvirt] Raising events for testing On Fri, Jan 28, 2011 at 04:17:21PM +0100, arnaud.champ...@devatom.fr wrote: I suffer with the new callback API :) Does the new callback API need the EventRegisterImpl call ? Yes, virEventRegisterImpl is required in order to be able to receive events. Can anyone explain me the steps to install these callbacks ? I have a lot of difficulties to understand the polling process in the sample, does this polling is mandatory ? Events can arrive at the client socket from libvirtd at any time. The poll() is used to watch for events arriving and ensure immediate dispatch. If we didn't do this no events would be seen until the next API call was made which is sub-optimal. The file daemon/events.c shows a complete C implementation of the event callbacks. The file examples/domain-events/events-python/domain-events.py shows a pure Python implementation The C example program is a very *bad* demo of poll() so ignore that and look at daemon/events.c instead. Daniel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Raising events for testing
Okay, I'm trying to understand the Python implentation (I'm not a python expert but it seems to be quite readable once you've understand why there is "self" everywhere :) ). The thing I'm not able to understand is the call to the "poll" function as this function doesn't exists in C# in any library at my knows... I'm not fluent with this. Anyone can expliain what poll do ? Regards Arnaud -- From: Sent: Friday, January 28, 2011 4:53 PM To: "Daniel P. Berrange" Cc: Subject: Re: [libvirt] Raising events for testing Woohoo it will burn my brain :) -- From: "Daniel P. Berrange" Sent: Friday, January 28, 2011 4:24 PM To: Cc: Subject: Re: [libvirt] Raising events for testing On Fri, Jan 28, 2011 at 04:17:21PM +0100, arnaud.champ...@devatom.fr wrote: I suffer with the new callback API :) Does the new callback API need the EventRegisterImpl call ? Yes, virEventRegisterImpl is required in order to be able to receive events. Can anyone explain me the steps to install these callbacks ? I have a lot of difficulties to understand the polling process in the sample, does this polling is mandatory ? Events can arrive at the client socket from libvirtd at any time. The poll() is used to watch for events arriving and ensure immediate dispatch. If we didn't do this no events would be seen until the next API call was made which is sub-optimal. The file daemon/events.c shows a complete C implementation of the event callbacks. The file examples/domain-events/events-python/domain-events.py shows a pure Python implementation The C example program is a very *bad* demo of poll() so ignore that and look at daemon/events.c instead. Daniel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Raising events for testing
Woohoo it will burn my brain :) -- From: "Daniel P. Berrange" Sent: Friday, January 28, 2011 4:24 PM To: Cc: Subject: Re: [libvirt] Raising events for testing On Fri, Jan 28, 2011 at 04:17:21PM +0100, arnaud.champ...@devatom.fr wrote: I suffer with the new callback API :) Does the new callback API need the EventRegisterImpl call ? Yes, virEventRegisterImpl is required in order to be able to receive events. Can anyone explain me the steps to install these callbacks ? I have a lot of difficulties to understand the polling process in the sample, does this polling is mandatory ? Events can arrive at the client socket from libvirtd at any time. The poll() is used to watch for events arriving and ensure immediate dispatch. If we didn't do this no events would be seen until the next API call was made which is sub-optimal. The file daemon/events.c shows a complete C implementation of the event callbacks. The file examples/domain-events/events-python/domain-events.py shows a pure Python implementation The C example program is a very *bad* demo of poll() so ignore that and look at daemon/events.c instead. Daniel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Raising events for testing
On Fri, Jan 28, 2011 at 04:17:21PM +0100, arnaud.champ...@devatom.fr wrote: > I suffer with the new callback API :) > > Does the new callback API need the EventRegisterImpl call ? Yes, virEventRegisterImpl is required in order to be able to receive events. > Can anyone explain me the steps to install these callbacks ? I have > a lot of difficulties to understand the polling process in the > sample, does this polling is mandatory ? Events can arrive at the client socket from libvirtd at any time. The poll() is used to watch for events arriving and ensure immediate dispatch. If we didn't do this no events would be seen until the next API call was made which is sub-optimal. The file daemon/events.c shows a complete C implementation of the event callbacks. The file examples/domain-events/events-python/domain-events.py shows a pure Python implementation The C example program is a very *bad* demo of poll() so ignore that and look at daemon/events.c instead. Daniel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Raising events for testing
I suffer with the new callback API :) Does the new callback API need the EventRegisterImpl call ? Can anyone explain me the steps to install these callbacks ? I have a lot of difficulties to understand the polling process in the sample, does this polling is mandatory ? Help please Arnaud -- From: Sent: Friday, January 28, 2011 3:46 PM To: ; "Daniel P. Berrange" Cc: Subject: Re: [libvirt] Raising events for testing Weird, only domain lifecycle events works :( I do something wrong... -- From: Sent: Friday, January 28, 2011 2:23 PM To: "Daniel P. Berrange" Cc: Subject: Re: [libvirt] Raising events for testing Many thanks Daniel ! I'll test that -- From: "Daniel P. Berrange" Sent: Friday, January 28, 2011 12:00 PM To: Cc: Subject: Re: [libvirt] Raising events for testing On Thu, Jan 27, 2011 at 11:50:05PM +0100, arnaud.champ...@devatom.fr wrote: ?Hi, I have binded the new API for domain events and callbacks in C#. It seems to work (LifeCycle events works for sure, I have tested them). Now I want to test other event types and I don't know how to raise them for test (RTC change, WatchDog, Graphics and so on...). Anyone can point me on the right thing I have to do to raise these events ? RTC change -> In your guest OS change the hardware clock WatchDog - Add a device to XML and in Linux 'cat /dev/watchdog' and wait 60 seconds Graphics -> Connect to the guest VNC Reboot - Reboot the guest I/O error - Run a guest on NFS with the 'soft,intr' flags on the mount point. THen stop the NFS server and do I/O in the guest and wait a while Daniel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Raising events for testing
Weird, only domain lifecycle events works :( I do something wrong... -- From: Sent: Friday, January 28, 2011 2:23 PM To: "Daniel P. Berrange" Cc: Subject: Re: [libvirt] Raising events for testing Many thanks Daniel ! I'll test that -- From: "Daniel P. Berrange" Sent: Friday, January 28, 2011 12:00 PM To: Cc: Subject: Re: [libvirt] Raising events for testing On Thu, Jan 27, 2011 at 11:50:05PM +0100, arnaud.champ...@devatom.fr wrote: ?Hi, I have binded the new API for domain events and callbacks in C#. It seems to work (LifeCycle events works for sure, I have tested them). Now I want to test other event types and I don't know how to raise them for test (RTC change, WatchDog, Graphics and so on...). Anyone can point me on the right thing I have to do to raise these events ? RTC change -> In your guest OS change the hardware clock WatchDog - Add a device to XML and in Linux 'cat /dev/watchdog' and wait 60 seconds Graphics -> Connect to the guest VNC Reboot - Reboot the guest I/O error - Run a guest on NFS with the 'soft,intr' flags on the mount point. THen stop the NFS server and do I/O in the guest and wait a while Daniel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Raising events for testing
Many thanks Daniel ! I'll test that -- From: "Daniel P. Berrange" Sent: Friday, January 28, 2011 12:00 PM To: Cc: Subject: Re: [libvirt] Raising events for testing On Thu, Jan 27, 2011 at 11:50:05PM +0100, arnaud.champ...@devatom.fr wrote: ?Hi, I have binded the new API for domain events and callbacks in C#. It seems to work (LifeCycle events works for sure, I have tested them). Now I want to test other event types and I don't know how to raise them for test (RTC change, WatchDog, Graphics and so on...). Anyone can point me on the right thing I have to do to raise these events ? RTC change -> In your guest OS change the hardware clock WatchDog - Add a device to XML and in Linux 'cat /dev/watchdog' and wait 60 seconds Graphics -> Connect to the guest VNC Reboot - Reboot the guest I/O error - Run a guest on NFS with the 'soft,intr' flags on the mount point. THen stop the NFS server and do I/O in the guest and wait a while Daniel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Raising events for testing
On Thu, Jan 27, 2011 at 11:50:05PM +0100, arnaud.champ...@devatom.fr wrote: > ?Hi, > > I have binded the new API for domain events and callbacks in C#. It seems to > work (LifeCycle events works for sure, I have tested them). Now I want to > test other event types and I don't know how to raise them for test (RTC > change, WatchDog, Graphics and so on...). > > Anyone can point me on the right thing I have to do to raise these events ? RTC change -> In your guest OS change the hardware clock WatchDog - Add a device to XML and in Linux 'cat /dev/watchdog' and wait 60 seconds Graphics -> Connect to the guest VNC Reboot - Reboot the guest I/O error - Run a guest on NFS with the 'soft,intr' flags on the mount point. THen stop the NFS server and do I/O in the guest and wait a while Daniel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list