diff -Nru libvirt-1.2.15/debian/changelog libvirt-1.2.15/debian/changelog --- libvirt-1.2.15/debian/changelog 2015-05-28 12:55:58.000000000 +0100 +++ libvirt-1.2.15/debian/changelog 2015-05-29 13:43:54.000000000 +0100 @@ -1,3 +1,11 @@ +libvirt (1.2.15-0ubuntu4.2) wily; urgency=medium + + * Add post-start to upstart (/etc/init/libvirt-bin.conf) and + systemd (/etc/init.d/libvirt-bin) to ensure libvirt-sock + created before up (LP: #1455608) + + -- Edward Hope-Morley Thu, 28 May 2015 16:06:44 +0100 + libvirt (1.2.15-0ubuntu3) wily; urgency=low * d/p/ubuntu-libxl-qemu-path.patch: Set correct path for qemu binary diff -Nru libvirt-1.2.15/debian/libvirt-bin.init libvirt-1.2.15/debian/libvirt-bin.init --- libvirt-1.2.15/debian/libvirt-bin.init 2012-12-05 22:37:34.000000000 +0000 +++ libvirt-1.2.15/debian/libvirt-bin.init 2015-05-29 13:41:18.000000000 +0100 @@ -87,6 +87,21 @@ return 0 } +wait_on_sockfile() { + sockfile=/var/run/libvirt/libvirt-sock + sockfile_check_retries=5 + while [ ! -S $sockfile ] ; do + echo "Waiting for $sockfile - recheck in 2 sec" + sleep 2; + if ! sockfile_check_retries=`expr $sockfile_check_retries - 1`; then + echo "Giving up waiting for $sockfile." + exit 1 + fi + done + echo "$sockfile ready." + return 0 +} + case "$1" in start) if check_start_libvirtd_option; then @@ -99,6 +114,7 @@ rm -f /var/run/libvirtd.pid start-stop-daemon --start --quiet --pidfile $PIDFILE \ --exec $DAEMON -- $libvirtd_opts + wait_on_sockfile if running; then log_end_msg 0 else diff -Nru libvirt-1.2.15/debian/libvirt-bin.upstart libvirt-1.2.15/debian/libvirt-bin.upstart --- libvirt-1.2.15/debian/libvirt-bin.upstart 2014-10-06 15:36:41.000000000 +0100 +++ libvirt-1.2.15/debian/libvirt-bin.upstart 2015-05-29 13:41:22.000000000 +0100 @@ -24,6 +24,20 @@ rm -f /var/run/libvirtd.pid end script +post-start script + sockfile=/var/run/libvirt/libvirt-sock + sockfile_check_retries=5 + while [ ! -S $sockfile ] ; do + echo "Waiting for $sockfile - recheck in 2 sec" + sleep 2; + if ! sockfile_check_retries=`expr $sockfile_check_retries - 1`; then + echo "Giving up waiting for $sockfile." + stop; exit 0 + fi + done + echo "$sockfile ready." +end script + pre-stop script [ -r /etc/default/libvirt-bin ] && . /etc/default/libvirt-bin