Change in vdsm[ovirt-3.5]: Add a libvirt migration hook to filter out min_guarantee ele...

msivak at redhat.com msivak at redhat.com
Thu Sep 18 14:56:01 UTC 2014


Martin Sivák has uploaded a new change for review.

Change subject: Add a libvirt migration hook to filter out min_guarantee element
......................................................................

Add a libvirt migration hook to filter out min_guarantee element

libvirt removed the silent support for min_guarantee element.
That will break migrations of long running machines and
resume of machines that were paused with the element still
in their XML.

VDSM was updated and new machines won't contain the offending
element. This fix will remove it when a running machine is migrated
or resumed.

Change-Id: I5f5e79037b755b257f9cac419887606f66705504
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1138340
Signed-off-by: Martin Sivak <msivak at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/32928
Reviewed-by: Nir Soffer <nsoffer at redhat.com>
Reviewed-by: Francesco Romani <fromani at redhat.com>
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
Tested-by: Francesco Romani <fromani at redhat.com>
(cherry picked from commit ef7b9647cb6b9c3f46ba81f8238dd5ce0ffa5b87)
---
M vdsm.spec.in
M vdsm/virt/Makefile.am
A vdsm/virt/libvirt-hook.sh
3 files changed, 32 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/33050/1

diff --git a/vdsm.spec.in b/vdsm.spec.in
index 350811e..3809099 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -690,6 +690,12 @@
                  %{buildroot}%{_polkitdir}/10-vdsm-libvirt-access.pkla
 %endif
 
+# Install the libvirt hook for cleaning up the XML
+%if 0%{?fedora} || 0%{?rhel} >= 7
+install -Dm 0755 vdsm/virt/libvirt-hook.sh \
+                 %{buildroot}%{_sysconfdir}/libvirt/hooks/qemu
+%endif
+
 %check
 make check
 
@@ -970,6 +976,7 @@
 %{_sysconfdir}/sudoers.d/50_vdsm
 %{_sysconfdir}/cron.hourly/vdsm-logrotate
 %{_sysconfdir}/cron.d/vdsm-libvirt-logrotate
+%{_sysconfdir}/libvirt/hooks/qemu
 %{_datadir}/%{vdsm_name}/logUtils.py*
 %{_datadir}/%{vdsm_name}/dsaversion.py*
 %{_libexecdir}/%{vdsm_name}/curl-img-wrap
diff --git a/vdsm/virt/Makefile.am b/vdsm/virt/Makefile.am
index c3262a1..8965c77 100644
--- a/vdsm/virt/Makefile.am
+++ b/vdsm/virt/Makefile.am
@@ -32,3 +32,7 @@
 	vmpowerdown.py \
 	vmstatus.py \
 	$(NULL)
+
+EXTRA_DIST = \
+	libvirt-hook.sh \
+	$(NULL)
diff --git a/vdsm/virt/libvirt-hook.sh b/vdsm/virt/libvirt-hook.sh
new file mode 100644
index 0000000..963ba02
--- /dev/null
+++ b/vdsm/virt/libvirt-hook.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+DOMAIN=$1
+EVENT=$2
+PHASE=$3
+
+# This condition depends on a feature that will be included in
+# libvirt once https://bugzilla.redhat.com/show_bug.cgi?id=1142684
+# is resolved. It will work only for migrations before that.
+if [ "x$EVENT" != "xmigrate" -a "x$EVENT" != "xrestore" ]; then
+  # Return 0 and empty output for events that are not handled
+  # by this hook.
+  #
+  # libvirt will use input XML without change and consider
+  # it a success run according to the documentation.
+  exit 0
+fi
+
+# Fix VMs migrating to host with libvirt >= 1.2.8
+# See https://bugzilla.redhat.com/show_bug.cgi?id=1138340
+exec sed -e 's|<min_guarantee[^>]*>[0-9 ]*</min_guarantee>||g'
+


-- 
To view, visit http://gerrit.ovirt.org/33050
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f5e79037b755b257f9cac419887606f66705504
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Martin Sivák <msivak at redhat.com>


More information about the vdsm-patches mailing list