Change in vdsm[master]: faqemu: remove the fake /dev/kvm after vdsmd stops

zhshzhou at linux.vnet.ibm.com zhshzhou at linux.vnet.ibm.com
Mon Sep 10 06:18:16 UTC 2012


Zhou Zheng Sheng has uploaded a new change for review.

Change subject: faqemu: remove the fake /dev/kvm after vdsmd stops
......................................................................

faqemu: remove the fake /dev/kvm after vdsmd stops

/usr/libexec/vdsm/vdsm-faqemu, the fake emulator, will create a fake
/dev/kvm before it starts a real emulator. This fake device is for
cheating libvirtd. This fake /dev/kvm is not deleted automatically after
vdsmd stops. If we want to switch to real KVM support then, the fake
device will prevent the system creating the real device, thus makes the
user very confused about the error. This patch detects and deletes the
fake /dev/kvm after vdsmd stops whenever faqemu is enabled or not in the
vdsmd.conf.

Change-Id: I1c1183acf90cd32444b1c26fa20aa843e4a0556d
Signed-off-by: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
---
M vdsm.spec.in
M vdsm_hooks/faqemu/Makefile.am
A vdsm_hooks/faqemu/after_vdsm_stop.py
3 files changed, 32 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/7885/1

diff --git a/vdsm.spec.in b/vdsm.spec.in
index bb6730e..e758382 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -903,6 +903,7 @@
 %defattr(-, root, root, -)
 %doc COPYING
 %{_libexecdir}/%{vdsm_name}/vdsm-faqemu
+%{_libexecdir}/%{vdsm_name}/hooks/after_vdsm_stop/10_faqemu
 %{_libexecdir}/%{vdsm_name}/hooks/before_vm_start/10_faqemu
 
 %files gluster
diff --git a/vdsm_hooks/faqemu/Makefile.am b/vdsm_hooks/faqemu/Makefile.am
index 02ca13f..32882fd 100644
--- a/vdsm_hooks/faqemu/Makefile.am
+++ b/vdsm_hooks/faqemu/Makefile.am
@@ -28,12 +28,17 @@
 	$(nodist_vdsmexec_SCRIPTS)
 
 EXTRA_DIST = \
+	after_vdsm_stop.py \
 	before_vm_start.py
 
 install-data-local:
+	$(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_vdsm_stop
+	$(INSTALL_SCRIPT) $(srcdir)/after_vdsm_stop.py \
+		$(DESTDIR)$(vdsmhooksdir)/after_vdsm_stop/10_faqemu
 	$(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start
 	$(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \
 		$(DESTDIR)$(vdsmhooksdir)/before_vm_start/10_faqemu
 
 uninstall-local:
+	$(RM) $(DESTDIR)$(vdsmhooksdir)/after_vdsm_stop/10_faqemu
 	$(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/10_faqemu
diff --git a/vdsm_hooks/faqemu/after_vdsm_stop.py b/vdsm_hooks/faqemu/after_vdsm_stop.py
new file mode 100755
index 0000000..581ca0a
--- /dev/null
+++ b/vdsm_hooks/faqemu/after_vdsm_stop.py
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+#
+# Copyright 2012 IBM, 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
+#
+
+import os
+import os.path
+
+if os.path.isfile('/dev/kvm'):
+    os.unlink('/dev/kvm')


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c1183acf90cd32444b1c26fa20aa843e4a0556d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>


More information about the vdsm-patches mailing list