From 81e46cb6da3ce4ec7bc35559bd33166bebc71702 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Mon, 10 Mar 2008 21:36:01 +0000 Subject: [PATCH] Fix daemon startup to avoid destroying networking --- .cvsignore | 31 ++++--------------- libvirt-0.4.1-daemon-startup.patch | 48 ++++++++++++++++++++++++++++++ libvirt.spec | 7 ++++- 3 files changed, 59 insertions(+), 27 deletions(-) create mode 100644 libvirt-0.4.1-daemon-startup.patch diff --git a/.cvsignore b/.cvsignore index 37eeee8..55e6af8 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,26 +1,5 @@ -libvirt-0.0.3.tar.gz -libvirt-0.0.4.tar.gz -libvirt-0.0.5.tar.gz -libvirt-0.0.6.tar.gz -libvirt-0.1.0.tar.gz -libvirt-0.1.2.tar.gz -libvirt-0.1.1.tar.gz -libvirt-0.1.3.tar.gz -libvirt-0.1.4.tar.gz -libvirt-0.1.5.tar.gz -libvirt-0.1.6.tar.gz -libvirt-0.1.7.tar.gz -libvirt-0.1.8.tar.gz -libvirt-0.1.9.tar.gz -libvirt-0.1.10.tar.gz -libvirt-0.1.11.tar.gz -libvirt-0.2.0.tar.gz -libvirt-0.2.1.tar.gz -libvirt-0.2.2.tar.gz -libvirt-0.2.3.tar.gz -libvirt-0.3.0.tar.gz -libvirt-0.3.1.tar.gz -libvirt-0.3.2.tar.gz -libvirt-0.3.3.tar.gz -libvirt-0.4.0.tar.gz -libvirt-0.4.1.tar.gz +.build*.log +*.rpm +i686 +x86_64 +libvirt-*.tar.gz diff --git a/libvirt-0.4.1-daemon-startup.patch b/libvirt-0.4.1-daemon-startup.patch new file mode 100644 index 0000000..ccf19bb --- /dev/null +++ b/libvirt-0.4.1-daemon-startup.patch @@ -0,0 +1,48 @@ +diff -rup libvirt-0.4.1.orig/qemud/qemud.c libvirt-0.4.1.new/qemud/qemud.c +--- libvirt-0.4.1.orig/qemud/qemud.c 2008-03-10 17:31:09.000000000 -0400 ++++ libvirt-0.4.1.new/qemud/qemud.c 2008-03-10 17:31:36.000000000 -0400 +@@ -393,7 +393,7 @@ static int qemudGoDaemon(void) { + case -1: + return -1; + default: +- return nextpid; ++ _exit(0); + } + + cleanup: +@@ -418,8 +418,7 @@ static int qemudGoDaemon(void) { + status != 0) { + return -1; + } +- +- return pid; ++ _exit(0); + } + } + } +@@ -2116,16 +2115,12 @@ int main(int argc, char **argv) { + goto error1; + + if (godaemon) { +- int pid; + openlog("libvirtd", 0, 0); +- pid = qemudGoDaemon(); +- if (pid < 0) { ++ if (qemudGoDaemon() < 0) { + qemudLog(QEMUD_ERR, _("Failed to fork as daemon: %s"), + strerror(errno)); + goto error1; + } +- if (pid > 0) +- goto out; + + /* Choose the name of the PID file. */ + if (!pid_file) { +@@ -2172,7 +2167,6 @@ int main(int argc, char **argv) { + if (godaemon) + closelog(); + +- out: + ret = 0; + + error2: diff --git a/libvirt.spec b/libvirt.spec index 83627d8..d844472 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -21,12 +21,13 @@ Summary: Library providing a simple API virtualization Name: libvirt Version: 0.4.1 -Release: 2%{?dist}%{?extra_release} +Release: 3%{?dist}%{?extra_release} License: LGPL Group: Development/Libraries Source: libvirt-%{version}.tar.gz Patch0: libvirt-0.4.1-qemud1.patch Patch1: libvirt-0.4.1-qemud2.patch +Patch2: %{name}-%{version}-daemon-startup.patch BuildRoot: %{_tmppath}/%{name}-%{version}-root URL: http://libvirt.org/ BuildRequires: python python-devel @@ -140,6 +141,7 @@ of recent versions of Linux (and other OSes). %setup -q %patch0 -p1 %patch1 -p1 +%patch2 -p1 %build # Xen is available only on i386 x86_64 ia64 @@ -280,6 +282,9 @@ fi %doc docs/examples/python %changelog +* Mon Mar 10 2008 Daniel P. Berrange - 0.4.1-3.fc9 +- Fixed daemon startup when run with --daemon flag + * Mon Mar 3 2008 Daniel Veillard - 0.4.1-2.fc9 - 2 patches found just after the release