Michal Privoznik
2013-Nov-07 09:16 UTC
Re: [libvirt-users] Calling 'virsh' from within a hook script - avoid deadlock?
On 06.11.2013 16:17, Michal Privoznik wrote:> On 06.11.2013 11:23, TSADOK, Shlomi (Shlomi) wrote: >> [...] > > http://libvirt.org/hooks.html#recursive > > Do not do this. > > Michal >Maybe I should explain a bit why this is not supported. It's true that libvirt is multithreaded. However, not in terms of multiple write/modify accesses to a single domain. That is, when a domain is being started up it is a modify access. Meanwhile, at some point during the transaction the startup hook script is called. If the script decides to start another modify transaction an deadlock occurs. Michal
Daniel P. Berrange
2013-Nov-07 09:19 UTC
Re: [libvirt-users] Calling 'virsh' from within a hook script - avoid deadlock?
On Thu, Nov 07, 2013 at 10:16:29AM +0100, Michal Privoznik wrote:> On 06.11.2013 16:17, Michal Privoznik wrote: > > On 06.11.2013 11:23, TSADOK, Shlomi (Shlomi) wrote: > >> [...] > > > > http://libvirt.org/hooks.html#recursive > > > > Do not do this. > > > > Michal > > > > Maybe I should explain a bit why this is not supported. It's true that > libvirt is multithreaded. However, not in terms of multiple write/modify > accesses to a single domain. That is, when a domain is being started up > it is a modify access. Meanwhile, at some point during the transaction > the startup hook script is called. If the script decides to start > another modify transaction an deadlock occurs.There is also a limit to the number of threads which deal with jobs, so even if the threads are all busy, your hook will stall and potentially even deadlock if all creates are stuck in create calls with hooks running even across different VMs. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
TSADOK, Shlomi (Shlomi)
2013-Nov-07 11:11 UTC
Re: [libvirt-users] Calling 'virsh' from within a hook script - avoid deadlock?
Thanks for the explanation(and warnings). Very interesting and useful feature. Shlomi -----Original Message----- From: Daniel P. Berrange [mailto:berrange@redhat.com] Sent: Thursday, November 07, 2013 11:20 AM To: Michal Privoznik Cc: TSADOK, Shlomi (Shlomi); libvirt-users@redhat.com Subject: Re: [libvirt-users] Calling 'virsh' from within a hook script - avoid deadlock? On Thu, Nov 07, 2013 at 10:16:29AM +0100, Michal Privoznik wrote:> On 06.11.2013 16:17, Michal Privoznik wrote: > > On 06.11.2013 11:23, TSADOK, Shlomi (Shlomi) wrote: > >> [...] > > > > http://libvirt.org/hooks.html#recursive > > > > Do not do this. > > > > Michal > > > > Maybe I should explain a bit why this is not supported. It's true that > libvirt is multithreaded. However, not in terms of multiple > write/modify accesses to a single domain. That is, when a domain is > being started up it is a modify access. Meanwhile, at some point > during the transaction the startup hook script is called. If the > script decides to start another modify transaction an deadlock occurs.There is also a limit to the number of threads which deal with jobs, so even if the threads are all busy, your hook will stall and potentially even deadlock if all creates are stuck in create calls with hooks running even across different VMs. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Seemingly Similar Threads
- Re: Calling 'virsh' from within a hook script - avoid deadlock?
- Re: Calling 'virsh' from within a hook script - avoid deadlock?
- Re: Calling 'virsh' from within a hook script - avoid deadlock?
- Calling 'virsh' from within a hook script - avoid deadlock?
- Re: deadlock on connection loosing