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

msivak at redhat.com msivak at redhat.com
Thu Sep 18 15:04:15 UTC 2014


Hello Nir Soffer, Dan Kenigsberg, Francesco Romani,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/33051

to review the following change.

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>
---
M vdsm.spec.in
M vdsm/Makefile.am
A vdsm/libvirt-hook.sh
3 files changed, 29 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/33051/1

diff --git a/vdsm.spec.in b/vdsm.spec.in
index 7af6d59..c126148 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -663,6 +663,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/libvirt-hook.sh \
+                 %{buildroot}%{_sysconfdir}/libvirt/hooks/qemu
+%endif
+
 %check
 make check PEP8=true PYFLAKES=true
 
@@ -950,6 +956,7 @@
 %{_sysconfdir}/sudoers.d/50_vdsm
 %{_sysconfdir}/cron.hourly/vdsm-logrotate
 %{_sysconfdir}/cron.d/vdsm-libvirt-logrotate
+%{_sysconfdir}/libvirt/hooks/qemu
 %{_datadir}/%{vdsm_name}/guestIF.py*
 %{_datadir}/%{vdsm_name}/logUtils.py*
 %{_datadir}/%{vdsm_name}/dsaversion.py*
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index c052a74..2966992 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -106,6 +106,7 @@
 EXTRA_DIST = \
 	dsaversion.py.in \
 	dumpStorageTable.py.in \
+	libvirt-hook.sh \
 	libvirt_password \
 	limits.conf \
 	logger.conf.in \
diff --git a/vdsm/libvirt-hook.sh b/vdsm/libvirt-hook.sh
new file mode 100644
index 0000000..963ba02
--- /dev/null
+++ b/vdsm/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/33051
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.4
Gerrit-Owner: Martin Sivák <msivak at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list