[libvirt] Guest shutdown script

Ján ONDREJ (SAL) ondrejj at salstar.sk
Fri Jul 17 14:33:40 UTC 2009


Hello,

  when host server is shutting down, it's goot to shutdown also guests,
not only kill them. Host shutdown can be touched by an admin, but also can
be started by an UPS daemon or similar action. Then kill of guests is not a
best solution.

  I have my own script, which can shutdown guest automatically:
    http://www.salstar.sk/pub/salpack/etc/rc.d/init.d/virt-shutdown
You need to start this rc script after installation, otherwise it will not
do anything.

  Another init script with save/restore ability is here:
    http://marc.info/?l=kvm&m=124775655529836&w=4
I'm not using this so I don't know, if this will work well on Fedora.

  A good solution can also be, if libvirt init script can shutdown guests
autoamtically. It starts them, when system is booting, but does not stop
them. I know, that libvirt sometimes need to be restarted without touching
guests, but you also can avoid this, if you shutdown guest only if one of:
  - current runlevel is 0 (halt) or 6 (reboot). You can get current
    runlevel by running:
      runlevel | cut -d" " -f2
  - if "service libvirt shutdown" is called, which is not very systematic,
    but can work well

  Just please do not create a new package only for guest shutdowns. :-)

  I am not a member of this list, so please cc me.

			SAL




More information about the libvir-list mailing list