Change in vdsm[master]: hooks: Add vdsm-hook-emulator
dougsland at redhat.com
dougsland at redhat.com
Tue Aug 25 22:52:35 UTC 2015
Douglas Schilling Landgraf has uploaded a new change for review.
Change subject: hooks: Add vdsm-hook-emulator
......................................................................
hooks: Add vdsm-hook-emulator
vdsm-hook-emulator has been created to help users change
the default emulator entry from oVirt Engine/VDSM/Libvirt,
in this case, qemu-kvm. After installing this hook the
virtual machines started by oVirt engine will look for
qemu-kvm-modified (script or binary) instead of qemu-kvm.
This approach is useful for cases where qemu-kvm requires
additional flags and needs a wrapper (qemu-kvm-modified)
or even cases where users require to change the emulator.
Change-Id: I6f0f5e5947850a3a7fa856ac9919b9155b783d24
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M configure.ac
A debian/vdsm-hook-emulator.docs
A debian/vdsm-hook-emulator.install
M vdsm.spec.in
M vdsm_hooks/Makefile.am
A vdsm_hooks/emulator/Makefile.am
A vdsm_hooks/emulator/before_vm_start.py
7 files changed, 88 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/34/45334/1
diff --git a/configure.ac b/configure.ac
index ae2b722..a4df66c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -366,6 +366,7 @@
vdsm_hooks/checkimages/Makefile
vdsm_hooks/directlun/Makefile
vdsm_hooks/diskunmap/Makefile
+ vdsm_hooks/emulator/Makefile
vdsm_hooks/ethtool_options/Makefile
vdsm_hooks/extnet/Makefile
vdsm_hooks/fakevmstats/Makefile
diff --git a/debian/vdsm-hook-emulator.docs b/debian/vdsm-hook-emulator.docs
new file mode 100644
index 0000000..5ecd9c6
--- /dev/null
+++ b/debian/vdsm-hook-emulator.docs
@@ -0,0 +1 @@
+COPYING
diff --git a/debian/vdsm-hook-emulator.install b/debian/vdsm-hook-emulator.install
new file mode 100644
index 0000000..c10344f
--- /dev/null
+++ b/debian/vdsm-hook-emulator.install
@@ -0,0 +1 @@
+usr/libexec/vdsm/hooks/before_vm_start/50_emulator
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 9c87915..e02c3b0 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -322,6 +322,15 @@
%description tests
A test suite for verifying the functionality of a running vdsm instance
+%package hook-emulator
+Summary: Replace qemu-kvm emulator entry to qemu-kvm-modified
+Requires: %{name}
+
+%description hook-emulator
+VDSM hook to replace emulator entry from qemu-kvm to qemu-kvm-modified.
+This is useful for act like a wrapper to qemu-kvm or even change in fact
+the emulator.
+
%package hook-allocate_net
Summary: random_network allocation hook for VDSM
Requires: %{name}
@@ -1184,6 +1193,11 @@
%exclude %{_libexecdir}/%{vdsm_name}/hooks/after_vm_destroy/50_vhostmd
%endif
+%files hook-emulator
+%defattr(-, root, root, -)
+%license COPYING
+%{_libexecdir}/%{vdsm_name}/hooks/before_vm_start/50_emulator
+
%files hook-qemucmdline
%defattr(-, root, root, -)
%license COPYING
diff --git a/vdsm_hooks/Makefile.am b/vdsm_hooks/Makefile.am
index 7dc9ff2..10cfd53 100644
--- a/vdsm_hooks/Makefile.am
+++ b/vdsm_hooks/Makefile.am
@@ -19,6 +19,7 @@
#
SUBDIRS = \
+ emulator \
ethtool_options \
faqemu \
ipv6 \
diff --git a/vdsm_hooks/emulator/Makefile.am b/vdsm_hooks/emulator/Makefile.am
new file mode 100644
index 0000000..9f9c173
--- /dev/null
+++ b/vdsm_hooks/emulator/Makefile.am
@@ -0,0 +1,33 @@
+#
+# Copyright 2015 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+# After installing this hook the virtual machines started by oVirt
+# engine will look for qemu-kvm-modified script/binary instead of
+# qemu-kvm. This is useful for act like a wrapper to qemu-kvm
+# or even change in fact the emulator.
+EXTRA_DIST = \
+ before_vm_start.py
+
+install-data-local:
+ $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start
+ $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \
+ $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_emulator
+
+uninstall-local:
+ $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_emulator
diff --git a/vdsm_hooks/emulator/before_vm_start.py b/vdsm_hooks/emulator/before_vm_start.py
new file mode 100755
index 0000000..ea5977b
--- /dev/null
+++ b/vdsm_hooks/emulator/before_vm_start.py
@@ -0,0 +1,37 @@
+#
+# Copyright 2015 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+# After installing this hook the virtual machines started by oVirt
+# engine will look for qemu-kvm-modified script/binary instead of
+# qemu-kvm. This is useful for act like a wrapper to qemu-kvm
+# or even change in fact the emulator.
+import hooking
+
+emulator_path = "/usr/libexec/qemu-kvm-modified"
+
+domxml = hooking.read_domxml()
+devices_element = domxml.getElementsByTagName('devices')[0]
+
+emulator_element = domxml.createElement('emulator')
+emulator_node = domxml.createTextNode(emulator_path)
+emulator_element.appendChild(emulator_node)
+
+devices_element.appendChild(emulator_element)
+
+hooking.write_domxml(domxml)
--
To view, visit https://gerrit.ovirt.org/45334
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f0f5e5947850a3a7fa856ac9919b9155b783d24
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland at redhat.com>
More information about the vdsm-patches
mailing list