[Bug 350936] Re: Should shut down domains on system shutdown

John Morrissey jwm at horde.net
Fri Oct 1 06:57:48 BST 2010


On Fri, Oct 01, 2010 at 03:47:07AM -0000, Nathan Crawford wrote:
> @John Morrissey - Nice work on getting this working! I hope you don't
> mind, I've taken the liberty of packaging all your changes and putting
> them in a PPA for easier testing.

Thanks, and packaging the changes is no problem at all.

FWIW, you might want to mark /etc/default/libvirt-bin as a conffile in the
libvirt packaging. Also, it might make more sense to package
omit-kvm-vm-pids as part of libvirt instead of a separate package; makes it
harder to forget to install it.

> One question on omit-kvm-vm-pids from #51, what does the '##*/' mean
> toward the end of line 26?

It's a shell construct that removes text at the beginning of a parameter. In
this case, the net effect is to remove the leading pathname, so all that's
left is the filename ('##' is longest match, and the pattern is '*/'). Since
it's a shell builtin, it's faster than calling basename(1), although speed
is arguably important here. :-)

Looking at it again, that for loop should probably have a guard so it
gracefully handles the case where no QEMU VMs are running:

for pidfile in /var/run/libvirt/qemu/*.pid; do
	if [ "$pidfile" = '/var/run/libvirt/qemu/*.pid' ]; then
		break
	fi
	if ! cp -f "$pidfile" "/lib/init/rw/sendsigs.omit.d/libvirt-bin-${pidfile##*/}"; then
		status=1
	fi
done

john
-- 
John Morrissey          _o            /\         ----  __o
jwm at horde.net        _-< \_          /  \       ----  <  \,
www.horde.net/    __(_)/_(_)________/    \_______(_) /_(_)__

-- 
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.



More information about the Ubuntu-server-bugs mailing list