diff -Nru libvirt-1.2.16/debian/changelog libvirt-1.2.16/debian/changelog --- libvirt-1.2.16/debian/changelog 2015-07-27 19:43:02.000000000 +0000 +++ libvirt-1.2.16/debian/changelog 2015-08-14 13:46:35.000000000 +0000 @@ -1,3 +1,26 @@ +libvirt (1.2.16-2ubuntu8) wily; urgency=medium + + * Support OVMF images in virt-aa-helper. (LP: #1483071) + * Fix the libvirt-bin.preinst to not stop libvirt-bin on upgrade + from 1.2.16-2ubuntu7. + + -- Serge Hallyn Fri, 14 Aug 2015 07:34:30 -0500 + +libvirt (1.2.16-2ubuntu7) wily; urgency=medium + + * Stop libvirt-bin at pre-inst if upgrading from a non-systemd version, + restart at postinst. (This can be removed after 16.04 release) + * Commonize stopping of vms in upstart/systemd. + + -- Serge Hallyn Tue, 11 Aug 2015 17:40:36 -0500 + +libvirt (1.2.16-2ubuntu6) wily; urgency=medium + + * Add systemd units and libvirt-stop-guests script to stop VMs before + a host completes shutdown (LP: #1480440) + + -- Serge Hallyn Tue, 11 Aug 2015 15:42:29 -0500 + libvirt (1.2.16-2ubuntu5) wily; urgency=medium * debian/control changes: diff -Nru libvirt-1.2.16/debian/control libvirt-1.2.16/debian/control --- libvirt-1.2.16/debian/control 2015-07-27 19:43:51.000000000 +0000 +++ libvirt-1.2.16/debian/control 2015-08-11 22:45:48.000000000 +0000 @@ -7,6 +7,7 @@ Testsuite: autopkgtest Build-Depends: cdbs (>= 0.4.90~), debhelper (>= 7), + dh-systemd (>= 1.18~), dh-autoreconf, libxml2-dev, libcurl4-gnutls-dev, @@ -41,6 +42,7 @@ libnetcf-dev (>= 1:0.2.3-3~) [linux-any], libaudit-dev [linux-any], libapparmor-dev [linux-any], + libsystemd-daemon-dev [linux-any], nfs-common, librbd-dev [linux-any], # For "make check" diff -Nru libvirt-1.2.16/debian/libvirt-bin.install libvirt-1.2.16/debian/libvirt-bin.install --- libvirt-1.2.16/debian/libvirt-bin.install 2015-07-10 20:14:14.000000000 +0000 +++ libvirt-1.2.16/debian/libvirt-bin.install 2015-08-11 20:37:28.000000000 +0000 @@ -16,3 +16,4 @@ usr/share/apport/package-hooks/source_libvirt.py etc/dnsmasq.d-available/libvirt-bin etc/profile.d/libvirt-uri.sh +usr/lib/libvirt diff -Nru libvirt-1.2.16/debian/libvirt-bin.libvirt-bin.service libvirt-1.2.16/debian/libvirt-bin.libvirt-bin.service --- libvirt-1.2.16/debian/libvirt-bin.libvirt-bin.service 1970-01-01 00:00:00.000000000 +0000 +++ libvirt-1.2.16/debian/libvirt-bin.libvirt-bin.service 2015-08-11 20:37:28.000000000 +0000 @@ -0,0 +1,22 @@ +[Unit] +Description=Virtualization daemon +Before=libvirt-guests.service +After=network.target +After=dbus.service +After=iscsid.service +After=apparmor.service +Documentation=man:libvirtd(8) +Documentation=http://libvirt.org + +[Service] +Type=notify +Environment=LIBVIRTD_ARGS= KRB5_KTNAME=/etc/libvirt/libvirt.keytab +ExecStart=/usr/sbin/libvirtd $LIBVIRTD_ARGS +ExecReload=/bin/kill -HUP $MAINPID +KillMode=process +Restart=on-failure +# Override the maximum number of opened files +#LimitNOFILE=2048 + +[Install] +WantedBy=multi-user.target diff -Nru libvirt-1.2.16/debian/libvirt-bin.libvirt-guests.service libvirt-1.2.16/debian/libvirt-bin.libvirt-guests.service --- libvirt-1.2.16/debian/libvirt-bin.libvirt-guests.service 1970-01-01 00:00:00.000000000 +0000 +++ libvirt-1.2.16/debian/libvirt-bin.libvirt-guests.service 2015-08-11 20:37:28.000000000 +0000 @@ -0,0 +1,14 @@ +[Unit] +Description=Stop Active Libvirt Guests +After=network.target libvirtd.service time-sync.target systemd-machined.target + +[Service] +ExecStart=/bin/true +ExecStop=/usr/lib/libvirt/libvirt-stop-guests +TimeoutStopSec=60 +Type=oneshot +RemainAfterExit=yes +StandardOutput=journal+console + +[Install] +WantedBy=multi-user.target diff -Nru libvirt-1.2.16/debian/libvirt-bin.postinst libvirt-1.2.16/debian/libvirt-bin.postinst --- libvirt-1.2.16/debian/libvirt-bin.postinst 2015-07-10 20:14:15.000000000 +0000 +++ libvirt-1.2.16/debian/libvirt-bin.postinst 2015-08-12 04:55:44.000000000 +0000 @@ -216,12 +216,21 @@ # symlink wrongly, recreate it EXISTED="/etc/libvirt/qemu/networks/autostart/TMP_defaultexisted" if [ -z $2 ]; then - maybe_set_autostart + maybe_set_autostart elif [ -e "$EXISTED" ]; then # on upgrade, if default network was previously autostarted, - # continue to do so. - rm -f "$EXISTED" - set_autostart + # continue to do so. + rm -f "$EXISTED" + set_autostart + fi + + # restart libvirt-bin if we had to turn it off. + # remove this after 16.10 release + WASRUNNING="/run/libvirt/wasrunning" + if [ -e "$WASRUNNING" ]; then + service libvirt-bin start + service libvirt-guests start + rm -f "$WASRUNNING" fi ;; diff -Nru libvirt-1.2.16/debian/libvirt-bin.preinst libvirt-1.2.16/debian/libvirt-bin.preinst --- libvirt-1.2.16/debian/libvirt-bin.preinst 2015-07-10 20:14:14.000000000 +0000 +++ libvirt-1.2.16/debian/libvirt-bin.preinst 2015-08-14 13:38:47.000000000 +0000 @@ -10,7 +10,16 @@ if [ -e /etc/libvirt/qemu/networks/autostart/default.xml ]; then touch "$EXISTED" fi - ;; + # Stop libvirt if we are switching to systemd + # remove this after 16.10 release + WASRUNNING="/run/libvirt/wasrunning" + if [ -n "$2" ] && dpkg --compare-versions "$2" le 1.2.16-2ubuntu6; then + if service libvirt-bin status > /dev/null 2>&1; then + service libvirt-bin stop + touch "$WASRUNNING" + fi + fi + ;; install|abort-upgrade) diff -Nru libvirt-1.2.16/debian/libvirt-bin.upstart libvirt-1.2.16/debian/libvirt-bin.upstart --- libvirt-1.2.16/debian/libvirt-bin.upstart 2015-07-10 20:14:15.000000000 +0000 +++ libvirt-1.2.16/debian/libvirt-bin.upstart 2015-08-11 22:33:33.000000000 +0000 @@ -39,21 +39,6 @@ end script pre-stop script - [ -r /etc/default/libvirt-bin ] && . /etc/default/libvirt-bin - - log_msg() - { - logf="/var/log/libvirt/shutdownlog.log" - logger -p daemon.debug -s -t libvirt -- "$@" >> $logf 2>&1 - } - - run_virsh() - { - # We parse the output for things like domain state; - # make sure the output is in the language we expect. - LANG=C virsh "$@" 2>/dev/null - } - if [ -z "$RUNLEVEL" ]; then exit 0 fi @@ -61,36 +46,8 @@ if [ "$RUNLEVEL" -ne 0 ] && [ "$RUNLEVEL" -ne 1 ] && [ "$RUNLEVEL" -ne 6 ]; then exit 0 fi - log_msg "libvirt-bin: entering pre-stop at $(date)" - - for uri in $libvirt_uris; do - for domain in $(run_virsh -c "$uri" list | awk '$3 == "running" {print $2}'); do - log_msg "libvirt-bin: attempting clean shutdown of $domain at $(date)" - run_virsh -c "$uri" shutdown "$domain" >/dev/null - done - done - - delay=$libvirtd_shutdown_timeout - while [ $delay -gt 0 ]; do - for uri in $libvirt_uris; do - if ! run_virsh -c "$uri" list | awk '$3 == "running" {exit 1}'; then - # VMs at this URI are still running. Wait, then - # start at the beginning looking for running VMs. - sleep 1 - delay=$(($delay - 1)) - continue 2 - fi - done - break - done - for uri in $libvirt_uris; do - for domain in $(run_virsh -c "$uri" list | awk '$3 == "running" {print $2}'); do - log_msg "destroying $domain" - run_virsh -c "$uri" destroy "$domain" >/dev/null - done - done - log_msg "libvirt-bin: exiting pre-stop at $(date)" + /usr/lib/libvirt/libvirt-stop-guests end script # /etc/default/libvirt-bin will be deprecated soon. diff -Nru libvirt-1.2.16/debian/libvirt-stop-guests libvirt-1.2.16/debian/libvirt-stop-guests --- libvirt-1.2.16/debian/libvirt-stop-guests 1970-01-01 00:00:00.000000000 +0000 +++ libvirt-1.2.16/debian/libvirt-stop-guests 2015-08-11 22:32:15.000000000 +0000 @@ -0,0 +1,53 @@ +#!/bin/sh + +libvirt_uris='qemu:///system lxc:/// xen:///' +libvirtd_shutdown_timeout=30 + +[ -r /etc/default/libvirt-bin ] && . /etc/default/libvirt-bin + +run_virsh() +{ + # We parse the output for things like domain state; + # make sure the output is in the language we expect. + LANG=C virsh "$@" 2>/dev/null +} + +log_msg() +{ + logf="/var/log/libvirt/shutdownlog.log" + logger -p daemon.debug -s -t libvirt -- "$@" >> $logf 2>&1 +} + +wait_on_vms() { + log_msg "libvirt-bin: starting wait_on_vms at $(date)" + for uri in $libvirt_uris; do + for domain in $(run_virsh -c "$uri" list | awk '$3 == "running" {print $2}'); do + log_msg "libvirt-bin: attempting clean shutdown of $uri:$domain at $(date)" + run_virsh -c "$uri" shutdown "$domain" >/dev/null + done + done + + delay=$libvirtd_shutdown_timeout + while [ $delay -gt 0 ]; do + for uri in $libvirt_uris; do + if ! run_virsh -c "$uri" list | awk '$3 == "running" {exit 1}'; then + # VMs at this URI are still running. Wait, then + # start at the beginning looking for running VMs. + sleep 1 + delay=$(($delay - 1)) + continue 2 + fi + done + break + done + + for uri in $libvirt_uris; do + for domain in $(run_virsh -c "$uri" list | awk '$3 == "running" {print $2}'); do + log_msg "destroying $uri:$domain" + run_virsh -c "$uri" destroy "$domain" >/dev/null + done + done + log_msg "libvirt-bin: done with wait_on_vms at $(date)" +} + +wait_on_vms diff -Nru libvirt-1.2.16/debian/patches/series libvirt-1.2.16/debian/patches/series --- libvirt-1.2.16/debian/patches/series 2015-07-10 20:14:14.000000000 +0000 +++ libvirt-1.2.16/debian/patches/series 2015-08-14 12:40:06.000000000 +0000 @@ -27,3 +27,4 @@ 9040-virt-aa-helper-add-unix-channels.patch storage-allow-zero-capacity-with-non-backing-file-to.patch tests-add-vol-qcow2-zerocapacity-test-to-storagevolx.patch +virt-aa-helper-handle-ovmf diff -Nru libvirt-1.2.16/debian/patches/virt-aa-helper-handle-ovmf libvirt-1.2.16/debian/patches/virt-aa-helper-handle-ovmf --- libvirt-1.2.16/debian/patches/virt-aa-helper-handle-ovmf 1970-01-01 00:00:00.000000000 +0000 +++ libvirt-1.2.16/debian/patches/virt-aa-helper-handle-ovmf 2015-08-14 12:40:24.000000000 +0000 @@ -0,0 +1,14 @@ +Index: libvirt-1.2.16/src/security/virt-aa-helper.c +=================================================================== +--- libvirt-1.2.16.orig/src/security/virt-aa-helper.c ++++ libvirt-1.2.16/src/security/virt-aa-helper.c +@@ -572,7 +572,8 @@ valid_path(const char *path, const bool + /* override the above with these */ + const char * const override[] = { + "/sys/devices/pci", /* for hostdev pci devices */ +- "/etc/libvirt-sandbox/services/" /* for virt-sandbox service config */ ++ "/etc/libvirt-sandbox/services/", /* for virt-sandbox service config */ ++ "/usr/share/ovmf/" /* for OVMF images */ + }; + + if (path == NULL) { diff -Nru libvirt-1.2.16/debian/rules libvirt-1.2.16/debian/rules --- libvirt-1.2.16/debian/rules 2015-07-10 20:14:14.000000000 +0000 +++ libvirt-1.2.16/debian/rules 2015-08-12 13:40:33.000000000 +0000 @@ -45,6 +45,8 @@ else WITH_LXC = --with-lxc endif + WITH_INIT_SCRIPT = --with-init-script=systemd + WITH_SYSTEMD = --with-systemd-daemon else WITH_STORAGE_LVM = --without-storage-lvm WITH_STORAGE_ISCSI = --without-storage-iscsi @@ -60,6 +62,8 @@ WITH_NUMA = --without-numactl WITH_NETCF = --without-netcf WITH_AUDIT = --without-audit + WITH_INIT_SCRIPT = --with-init-script=none + WITH_SYSTEMD = --without-systemd-daemon endif DEB_BUILDDIR := $(CURDIR)/debian/build @@ -93,6 +97,7 @@ $(WITH_XEN) \ $(WITH_LXC) \ $(WITH_AUDIT) \ + $(WITH_INIT_SCRIPT) \ --with-apparmor \ --with-vbox \ --without-firewalld \ @@ -102,7 +107,6 @@ DEB_COMPRESS_EXCLUDE = .o event-test hellolibvirt info1 suspend DEB_PYTHON_SETUP_CMD = /dev/null DEB_DH_MAKESHLIBS_ARGS_libvirt0 += -V 'libvirt0 (>= 0.5.0)' -DEB_DH_INSTALLINIT_ARGS = --upstart-only --restart-after-upgrade LOGROTATE = $(basename $(basename $(notdir $(wildcard daemon/libvirtd*.logrotate.in)))) EXAMPLES_DIR = $(CURDIR)/debian/libvirt-doc/usr/share/doc/libvirt-doc/examples/ @@ -118,10 +122,18 @@ DEB_DH_GENCONTROL_ARGS_libvirt-bin = -- -V'dist:Conflicts=apparmor (<< 2.8.96~2652-0ubuntu1)' endif +install/libvirt-bin:: + # helper to stop vms at shutdown + mkdir -p debian/libvirt-bin/usr/lib/libvirt + cp debian/libvirt-stop-guests debian/libvirt-bin/usr/lib/libvirt + chmod ugo+x debian/libvirt-bin/usr/lib/libvirt/libvirt-stop-guests + dh_installinit -p libvirt-bin --name=libvirt-bin --restart-after-upgrade -- defaults 28 72 + dh_installinit -p libvirt-bin --name=libvirt-guests --no-restart-on-upgrade -- defaults 29 71 + dh_systemd_enable + dh_systemd_start -p libvirt-bin --restart-after-upgrade libvirt-bin.service + dh_systemd_start -p libvirt-bin --no-restart-on-upgrade libvirt-guests.service + binary-install/libvirt-bin:: - #cp $(CURDIR)/tools/libvirt-guests.init.sh $(CURDIR)/debian/libvirt-bin.libvirt-guests.init - #cp $(CURDIR)/tools/libvirt-guests.sysconf $(CURDIR)/debian/libvirt-bin.libvirt-guests.default - #dh_installinit --name=libvirt-guests --no-restart-on-upgrade -- defaults 29 71 rm debian/libvirt-bin/usr/lib/libvirt/connection-driver/*.la # Don't ship api files in the daemon package rm -r debian/libvirt-bin/usr/share/libvirt/api/