From jyang at redhat.com Mon Apr 26 20:42:18 2010 Content-Type: multipart/mixed; boundary="===============2258615864415451066==" MIME-Version: 1.0 From: Jintao Yang To: devel at lists.libvirt.org Subject: Re: [libvirt] Documentation for synchronous hooks Date: Mon, 26 Apr 2010 20:42:12 -0400 Message-ID: <1520910258.2576921272328932737.JavaMail.root@zmail02.collab.prod.int.phx2.redhat.com> In-Reply-To: 2122833726.2576851272328815204.JavaMail.root@zmail02.collab.prod.int.phx2.redhat.com --===============2258615864415451066== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable hi DV, I saw the changelog of 0.7.8, which told the hooks scripts are suppo= rted. but is it took away in 0.8.0-4? [root(a)dhcp-66-70 libvirt]# rpm -ql libvirt | grep etc /etc/libvirt /etc/libvirt/libvirtd.conf /etc/libvirt/lxc.conf /etc/libvirt/nwfilter /etc/libvirt/nwfilter/allow-arp.xml /etc/libvirt/nwfilter/allow-dhcp-server.xml /etc/libvirt/nwfilter/allow-dhcp.xml /etc/libvirt/nwfilter/allow-incoming-ipv4.xml /etc/libvirt/nwfilter/allow-ipv4.xml /etc/libvirt/nwfilter/clean-traffic.xml /etc/libvirt/nwfilter/no-arp-spoofing.xml /etc/libvirt/nwfilter/no-ip-multicast.xml /etc/libvirt/nwfilter/no-ip-spoofing.xml /etc/libvirt/nwfilter/no-mac-broadcast.xml /etc/libvirt/nwfilter/no-mac-spoofing.xml /etc/libvirt/nwfilter/no-other-l2-traffic.xml /etc/libvirt/qemu /etc/libvirt/qemu.conf /etc/libvirt/qemu/networks /etc/libvirt/qemu/networks/autostart /etc/logrotate.d/libvirtd.lxc /etc/logrotate.d/libvirtd.qemu /etc/rc.d/init.d/libvirtd /etc/sysconfig/libvirtd [root(a)dhcp-66-70 libvirt]# rpm -q libvirt libvirt-0.8.0-4.el6.x86_64 Regards osier ----- Original Message ----- From: "Daniel Veillard" To: libvir-list(a)redhat.com Sent: Monday, April 12, 2010 11:16:27 PM GMT +08:00 Beijing / Chongqing / H= ong Kong / Urumqi Subject: [libvirt] Documentation for synchronous hooks Was still missing from main commits and would be needed for 0.8.0 Add documentation for synchronous hooks * docs/sitemap.html.in: add in navigation under Documentation/Deployment/Hooks * docs/hooks.html.in: new doc describing current support for 0.8.0 diff --git a/docs/hooks.html.in b/docs/hooks.html.in new file mode 100644 index 0000000..4ebeec3 --- /dev/null +++ b/docs/hooks.html.in @@ -0,0 +1,71 @@ + + + +

Hooks for specific system management

+

Libvirt includes synchronous hooks starting from version 0.8.0, + this is a way to tie specific tailored system actions at specific + time. This is based on scripts being called on the Host where the + hypervisor is running, if the script is present when the libvirtd + daemon is doing some significant actions.

+

The scripts are expected to execute quickly, return a zero exit + status if all conditions are set for the daemon to continue the + action (non zero will be considered a failure which may + be ignored but in general will stops the ongoing operation). + The script also should not call back into libvirt as the daemon + is waiting for the script exit and deadlock is likely to occur + otherwise.

+

The scripts are stored in the directory /etc/libvirt/hooks/ + when using a standard installation path + ($SYSCONF_DIR/libvirt/hook/ in general).

+

The scripts gets arguments as parameter on their command line:

+
    +
  • the first argument is the name of the object involved in the + operation or '-' if there is none. +
  • the second argument is the name of the operation. +
  • the third argument is a suboperation indication like 'start' + 'end' or '-' if there is none. +
  • the last argument is an extra argument string or '-' if there + is none. +
+

There is currently scripts for 3 domains of operation: +

    +
  • /etc/libvirt/hooks/daemon script if + present is called at 3 points in time:

    +

    at daemon startup, typically started with the following + arguments:

    +
    /etc/libvirt/hooks/daemon - start - start
    +

    at daemon shutdown when it is about to exit, with the follo= wing + arguments:

    +
    /etc/libvirt/hooks/daemon - shutdown - shutdown
    +

    When the daemon is asked to reload its driver state when + receiving the SIGHUP signal, arguments are:

    +
    /etc/libvirt/hooks/daemon - reload begin SIGHUP
    +
  • +
  • /etc/libvirt/hooks/qemu script and
    + /etc/libvirt/hooks/lxc to associate hooks for do= main + operation on the respective QEmu/KVM and LXC drivers.

    +

    The domain related hooks also receive the full XML descripti= on + for the concerned domain on their stdin, which allows to get + all the informations from the domain, including UUID or stor= age + if that is needed for the script operation.

    +

    Currently only domain startup and domain end operations + involve the hook, the first one just before the domain gets + created. + For example if starting a QEmu domain named test + the following script will get called:

    +
    /etc/libvirt/hooks/qemu test start begin -
    +

    note that a non-zero return value from the script will abort= the + domain startup operation, and if an error string is passed on + stderr by the hook script, it will be provided back to the u= ser + at the libvirt API level.

    +

    For domain shutdown, the script will be called just after the + domain has finished execution, and the script will get:

    +
    /etc/libvirt/hooks/qemu test stopped end -
    +

    It is expected that other operation will be associated to ho= oks + but at the time of 0.8.0 only those 2 are associated to doma= ins + lifecycle

    +
  • +
+

+ + diff --git a/docs/sitemap.html.in b/docs/sitemap.html.in index 0c3f0c3..0117c8d 100644 --- a/docs/sitemap.html.in +++ b/docs/sitemap.html.in @@ -50,6 +50,10 @@ Logging The library and the daemon logging support +
  • + Hooks + Hooks for system specific management +
  • -- = Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list(a)redhat.com https://www.redhat.com/mailman/listinfo/libvir-list --===============2258615864415451066==-- From veillard at redhat.com Tue Apr 27 02:50:08 2010 Content-Type: multipart/mixed; boundary="===============2340747373106409141==" MIME-Version: 1.0 From: Daniel Veillard To: devel at lists.libvirt.org Subject: Re: [libvirt] Documentation for synchronous hooks Date: Tue, 27 Apr 2010 08:49:57 +0200 Message-ID: <20100427064957.GG19644@redhat.com> In-Reply-To: 1520910258.2576921272328932737.JavaMail.root@zmail02.collab.prod.int.phx2.redhat.com --===============2340747373106409141== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Mon, Apr 26, 2010 at 08:42:12PM -0400, Jintao Yang wrote: > hi DV, I saw the changelog of 0.7.8, which told the hooks scripts are sup= ported. but is it took away in 0.8.0-4? > = > [root(a)dhcp-66-70 libvirt]# rpm -ql libvirt | grep etc > /etc/libvirt > /etc/libvirt/libvirtd.conf [...] > /etc/rc.d/init.d/libvirtd > /etc/sysconfig/libvirtd > [root(a)dhcp-66-70 libvirt]# rpm -q libvirt > libvirt-0.8.0-4.el6.x86_64 Hum, no, the support is there, but we don't create the /etc/directory nor provide any example file. I should do that before 0.8.1, good point. But the support is there, if you create the directory and add some scripts, then killall -HUP libvirtd it should rescan the directory and use the scripts if found. Daniel -- = Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ --===============2340747373106409141==-- From jyang at redhat.com Mon May 24 22:43:49 2010 Content-Type: multipart/mixed; boundary="===============4346861951248575260==" MIME-Version: 1.0 From: Osier Yang To: devel at lists.libvirt.org Subject: Re: [libvirt] Documentation for synchronous hooks Date: Tue, 25 May 2010 10:43:41 +0800 Message-ID: <4BFB395D.80608@redhat.com> In-Reply-To: 20100427064957.GG19644@redhat.com --===============4346861951248575260== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable still no /etc/libvirt/hooks and example hook scripts in 0.8.1-6. = anyone can provide some simple hook scripts? thanks - Osier Daniel Veillard wrote: > On Mon, Apr 26, 2010 at 08:42:12PM -0400, Jintao Yang wrote: > = >> hi DV, I saw the changelog of 0.7.8, which told the hooks scripts are su= pported. but is it took away in 0.8.0-4? >> >> [root(a)dhcp-66-70 libvirt]# rpm -ql libvirt | grep etc >> /etc/libvirt >> /etc/libvirt/libvirtd.conf >> = > [...] > = >> /etc/rc.d/init.d/libvirtd >> /etc/sysconfig/libvirtd >> [root(a)dhcp-66-70 libvirt]# rpm -q libvirt >> libvirt-0.8.0-4.el6.x86_64 >> = > > Hum, no, the support is there, but we don't create the /etc/directory > nor provide any example file. I should do that before 0.8.1, good point. > But the support is there, if you create the directory and add some > scripts, then killall -HUP libvirtd it should rescan the directory > and use the scripts if found. > > Daniel > > = --===============4346861951248575260==-- From hbrock at redhat.com Tue May 25 08:27:50 2010 Content-Type: multipart/mixed; boundary="===============4820186861041515357==" MIME-Version: 1.0 From: Hugh O. Brock To: devel at lists.libvirt.org Subject: Re: [libvirt] Documentation for synchronous hooks Date: Tue, 25 May 2010 08:27:41 -0400 Message-ID: <20100525122741.GW7053@redhat.com> In-Reply-To: 4BFB395D.80608@redhat.com --===============4820186861041515357== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Tue, May 25, 2010 at 10:43:41AM +0800, Osier Yang wrote: > still no /etc/libvirt/hooks and example hook scripts in 0.8.1-6. > anyone can provide some simple hook scripts? thanks > = > - Osier Osier, could you file a BZ for this to make sure we don't lose track of it? Thanks, --Hugh > Daniel Veillard wrote: > >On Mon, Apr 26, 2010 at 08:42:12PM -0400, Jintao Yang wrote: > >>hi DV, I saw the changelog of 0.7.8, which told the hooks scripts are s= upported. but is it took away in 0.8.0-4? > >> > >>[root(a)dhcp-66-70 libvirt]# rpm -ql libvirt | grep etc > >>/etc/libvirt > >>/etc/libvirt/libvirtd.conf > >[...] > >>/etc/rc.d/init.d/libvirtd > >>/etc/sysconfig/libvirtd > >>[root(a)dhcp-66-70 libvirt]# rpm -q libvirt > >>libvirt-0.8.0-4.el6.x86_64 > > > > Hum, no, the support is there, but we don't create the /etc/directory > >nor provide any example file. I should do that before 0.8.1, good point. > >But the support is there, if you create the directory and add some > >scripts, then killall -HUP libvirtd it should rescan the directory > >and use the scripts if found. > > > >Daniel > > > = > -- > libvir-list mailing list > libvir-list(a)redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list -- = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D Hugh Brock, hbrock(a)redhat.com, +1-215-564-3232 Deltacloud API + Portal http://deltacloud.org Libvirt virtualization library http://libvirt.org =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D --===============4820186861041515357==-- From jyang at redhat.com Thu Jul 1 02:17:17 2010 Content-Type: multipart/mixed; boundary="===============1553971363297236461==" MIME-Version: 1.0 From: Osier Yang To: devel at lists.libvirt.org Subject: Re: [libvirt] Documentation for synchronous hooks Date: Thu, 01 Jul 2010 14:17:10 +0800 Message-ID: <4C2C32E6.80506@redhat.com> In-Reply-To: 20100525122741.GW7053@redhat.com --===============1553971363297236461== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Hugh sorry, I just see this. Do we need a bug to track this problem any = more? Thanks Osier Hugh O. Brock wrote: > On Tue, May 25, 2010 at 10:43:41AM +0800, Osier Yang wrote: > = >> still no /etc/libvirt/hooks and example hook scripts in 0.8.1-6. >> anyone can provide some simple hook scripts? thanks >> >> - Osier >> = > > Osier, could you file a BZ for this to make sure we don't lose track > of it? > > Thanks, > --Hugh > > = >> Daniel Veillard wrote: >> = >>> On Mon, Apr 26, 2010 at 08:42:12PM -0400, Jintao Yang wrote: >>> = >>>> hi DV, I saw the changelog of 0.7.8, which told the hooks scripts are = supported. but is it took away in 0.8.0-4? >>>> >>>> [root(a)dhcp-66-70 libvirt]# rpm -ql libvirt | grep etc >>>> /etc/libvirt >>>> /etc/libvirt/libvirtd.conf >>>> = >>> [...] >>> = >>>> /etc/rc.d/init.d/libvirtd >>>> /etc/sysconfig/libvirtd >>>> [root(a)dhcp-66-70 libvirt]# rpm -q libvirt >>>> libvirt-0.8.0-4.el6.x86_64 >>>> = >>> Hum, no, the support is there, but we don't create the /etc/directory >>> nor provide any example file. I should do that before 0.8.1, good point. >>> But the support is there, if you create the directory and add some >>> scripts, then killall -HUP libvirtd it should rescan the directory >>> and use the scripts if found. >>> >>> Daniel >>> >>> = >> -- >> libvir-list mailing list >> libvir-list(a)redhat.com >> https://www.redhat.com/mailman/listinfo/libvir-list >> = > > = --===============1553971363297236461==-- From hbrock at redhat.com Thu Jul 1 06:34:28 2010 Content-Type: multipart/mixed; boundary="===============3531596600958846960==" MIME-Version: 1.0 From: Hugh O. Brock To: devel at lists.libvirt.org Subject: Re: [libvirt] Documentation for synchronous hooks Date: Thu, 01 Jul 2010 06:34:20 -0400 Message-ID: <20100701103419.GZ16567@redhat.com> In-Reply-To: 4C2C32E6.80506@redhat.com --===============3531596600958846960== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Thu, Jul 01, 2010 at 02:17:10PM +0800, Osier Yang wrote: > Hi Hugh > = > sorry, I just see this. Do we need a bug to track this problem > any more? > = > Thanks > Osier Hello Osier. If the condition still exists, yes, we definitely need a BZ. Thanks for checking! --Hugh > = > Hugh O. Brock wrote: > >On Tue, May 25, 2010 at 10:43:41AM +0800, Osier Yang wrote: > >>still no /etc/libvirt/hooks and example hook scripts in 0.8.1-6. > >>anyone can provide some simple hook scripts? thanks > >> > >>- Osier > > > >Osier, could you file a BZ for this to make sure we don't lose track > >of it? > > > >Thanks, > >--Hugh > > > >>Daniel Veillard wrote: > >>>On Mon, Apr 26, 2010 at 08:42:12PM -0400, Jintao Yang wrote: > >>>>hi DV, I saw the changelog of 0.7.8, which told the hooks scripts are= supported. but is it took away in 0.8.0-4? > >>>> > >>>>[root(a)dhcp-66-70 libvirt]# rpm -ql libvirt | grep etc > >>>>/etc/libvirt > >>>>/etc/libvirt/libvirtd.conf > >>>[...] > >>>>/etc/rc.d/init.d/libvirtd > >>>>/etc/sysconfig/libvirtd > >>>>[root(a)dhcp-66-70 libvirt]# rpm -q libvirt > >>>>libvirt-0.8.0-4.el6.x86_64 > >>> Hum, no, the support is there, but we don't create the /etc/directory > >>>nor provide any example file. I should do that before 0.8.1, good poin= t. > >>>But the support is there, if you create the directory and add some > >>>scripts, then killall -HUP libvirtd it should rescan the directory > >>>and use the scripts if found. > >>> > >>>Daniel > >>> > >>-- > >>libvir-list mailing list > >>libvir-list(a)redhat.com > >>https://www.redhat.com/mailman/listinfo/libvir-list > > > = > -- > libvir-list mailing list > libvir-list(a)redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list -- = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D Hugh Brock, hbrock(a)redhat.com, +1-215-564-3232 Deltacloud API + Portal http://deltacloud.org Libvirt virtualization library http://libvirt.org =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D --===============3531596600958846960==-- From jyang at redhat.com Fri Jul 2 05:10:11 2010 Content-Type: multipart/mixed; boundary="===============2416728903876394967==" MIME-Version: 1.0 From: Osier To: devel at lists.libvirt.org Subject: Re: [libvirt] Documentation for synchronous hooks Date: Fri, 02 Jul 2010 05:10:06 -0400 Message-ID: <260346955.591931278061806765.JavaMail.root@zmail02.collab.prod.int.phx2.redhat.com> In-Reply-To: 20100701103419.GZ16567@redhat.com --===============2416728903876394967== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Hugh It seems that not provide the sample scripts and directory "/etc/libvirt/ho= oks" is okay from the functional view, may be it's just not very kind for e= nd-user. and I communicated with DV, he said no need to file a bug agaist t= his. = Thanks - Osier ----- Original Message ----- From: "Hugh O. Brock" To: "Osier Yang" Cc: libvir-list(a)redhat.com Sent: Thursday, July 1, 2010 6:34:20 PM GMT +08:00 Beijing / Chongqing / Ho= ng Kong / Urumqi Subject: Re: [libvirt] Documentation for synchronous hooks On Thu, Jul 01, 2010 at 02:17:10PM +0800, Osier Yang wrote: > Hi Hugh > = > sorry, I just see this. Do we need a bug to track this problem > any more? > = > Thanks > Osier Hello Osier. If the condition still exists, yes, we definitely need a BZ. Thanks for checking! --Hugh > = > Hugh O. Brock wrote: > >On Tue, May 25, 2010 at 10:43:41AM +0800, Osier Yang wrote: > >>still no /etc/libvirt/hooks and example hook scripts in 0.8.1-6. > >>anyone can provide some simple hook scripts? thanks > >> > >>- Osier > > > >Osier, could you file a BZ for this to make sure we don't lose track > >of it? > > > >Thanks, > >--Hugh > > > >>Daniel Veillard wrote: > >>>On Mon, Apr 26, 2010 at 08:42:12PM -0400, Jintao Yang wrote: > >>>>hi DV, I saw the changelog of 0.7.8, which told the hooks scripts are= supported. but is it took away in 0.8.0-4? > >>>> > >>>>[root(a)dhcp-66-70 libvirt]# rpm -ql libvirt | grep etc > >>>>/etc/libvirt > >>>>/etc/libvirt/libvirtd.conf > >>>[...] > >>>>/etc/rc.d/init.d/libvirtd > >>>>/etc/sysconfig/libvirtd > >>>>[root(a)dhcp-66-70 libvirt]# rpm -q libvirt > >>>>libvirt-0.8.0-4.el6.x86_64 > >>> Hum, no, the support is there, but we don't create the /etc/directory > >>>nor provide any example file. I should do that before 0.8.1, good poin= t. > >>>But the support is there, if you create the directory and add some > >>>scripts, then killall -HUP libvirtd it should rescan the directory > >>>and use the scripts if found. > >>> > >>>Daniel > >>> > >>-- > >>libvir-list mailing list > >>libvir-list(a)redhat.com > >>https://www.redhat.com/mailman/listinfo/libvir-list > > > = > -- > libvir-list mailing list > libvir-list(a)redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list -- = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D Hugh Brock, hbrock(a)redhat.com, +1-215-564-3232 Deltacloud API + Portal http://deltacloud.org Libvirt virtualization library http://libvirt.org =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D --===============2416728903876394967==--