[Bug 350936] Re: Should shut down domains on system shutdown
Sorry for not writing that long, there was lot to do at work. My solution now for this problem is using a script that gets called by molly-guard, as testing other script-stuff was really annoying! As Molly-Guard installs it self as shutdown-command and executes each script inside /etc/molly-guard/run.d/ just before doing the real shutdown, it seems the perfect way for me on our server-system. I know it's just another workaround, but it's the least intrusive way and works very well because shutting down KVMs is done before all the other upstart/sysv-scripting stuff. Greets tomcrus -- Should shut down domains on system shutdown https://bugs.launchpad.net/bugs/350936 You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to libvirt in ubuntu. -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs
[Bug 350936] Re: Should shut down domains on system shutdown
As I'm currently setting up an intranet mail-server for my company (based on lucid / ebox) in some kvm-guests and there for have exactly the same problem. Reading all previous posts - and because I need kvm- guest shutdown as well - I will use something like this: Add following lines in /etc/init.d/sendsigs just before the sync line: # avoid every running kvm (started thru libvirt-bin) from being killed for pidfile in /var/run/libvirt/qemu/*.pid; do OMITPIDS=${OMITPIDS:+$OMITPIDS }-o $(cat $pidfile) done I think this should prevent kvm-guests from being killed on shutdown. Then in /etc/init/libvirt-bin.conf I would try to add following lines: kill timeout 360 pre-stop script # only shutdown all guests if stopping of task is because of # runlevels 0 (halt) or 6 (reboot) if [ $RUNLEVEL = 0 -o $RUNLEVEL = 6 ]; then TIMEOUT=300 VIRSH_CONNECT=qemu:///system function list_running_vms(){ virsh --connect $VIRSH_CONNECT list | grep running | awk '{ print $2 }' } # send shutdown to each running vm (they must handle acpi-power-button!) list_running_vms | while read vm; do virsh --connect $VIRSH_CONNECT shutdown $vm done # wait until timeout has reached or no running are vms left END_TIME=$(date -d $TIMEOUT seconds +%s) while [ $END_TIME -lt $(date +%s) ]; do test -z $(list_running_vms) break sleep 1 done # if any vms left running destroy them now if [ -n $(list_running_vms) ]; then list_running_vms | while read vm; do virsh --connect $VIRSH_CONNECT destroy $vm done fi sleep 3 fi end script I don't know yet if this works, but I will test as soon as possible. Maybe if somebody else is in the mood to do so please report if it succeeded... -- Should shut down domains on system shutdown https://bugs.launchpad.net/bugs/350936 You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to libvirt in ubuntu. -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs