packages: libvirt/libvirt.spec, libvirt/libvirt-lxc.patch (NEW) - hack lxc ...

baggins baggins at pld-linux.org
Tue Jan 24 14:09:42 CET 2012


Author: baggins                      Date: Tue Jan 24 13:09:42 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- hack lxc driver to send -INT to init when 'shutdown' command is issued from host

---- Files affected:
packages/libvirt:
   libvirt.spec (1.52 -> 1.53) , libvirt-lxc.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/libvirt/libvirt.spec
diff -u packages/libvirt/libvirt.spec:1.52 packages/libvirt/libvirt.spec:1.53
--- packages/libvirt/libvirt.spec:1.52	Tue Jan 17 18:47:58 2012
+++ packages/libvirt/libvirt.spec	Tue Jan 24 14:09:37 2012
@@ -37,6 +37,7 @@
 Source1:	%{name}.init
 Patch0:		%{name}-sasl.patch
 Patch1:		%{name}-scsi-git.patch
+Patch2:		%{name}-lxc.patch
 URL:		http://www.libvirt.org/
 BuildRequires:	audit-libs-devel
 BuildRequires:	augeas-devel
@@ -244,6 +245,7 @@
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 # weird translations
 %{__rm} po/{my,eu_ES}.{po,gmo}
@@ -447,6 +449,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.53  2012/01/24 13:09:37  baggins
+- hack lxc driver to send -INT to init when 'shutdown' command is issued from host
+
 Revision 1.52  2012/01/17 17:47:58  baggins
 - rel 2
 

================================================================
Index: packages/libvirt/libvirt-lxc.patch
diff -u /dev/null packages/libvirt/libvirt-lxc.patch:1.1
--- /dev/null	Tue Jan 24 14:09:42 2012
+++ packages/libvirt/libvirt-lxc.patch	Tue Jan 24 14:09:37 2012
@@ -0,0 +1,84 @@
+diff -ur libvirt-0.9.9/src/lxc/lxc_controller.c libvirt-0.9.9-lxc/src/lxc/lxc_controller.c
+--- libvirt-0.9.9/src/lxc/lxc_controller.c	2011-12-29 08:26:45.000000000 +0100
++++ libvirt-0.9.9-lxc/src/lxc/lxc_controller.c	2012-01-24 00:37:37.856545745 +0100
+@@ -707,6 +707,14 @@
+ static bool quit = false;
+ static virMutex lock;
+ static int sigpipe[2];
++static pid_t initpid = -1;
++
++static void lxcSignalINTHandler(int signum ATTRIBUTE_UNUSED)
++{
++    if (initpid <= 0)
++	return;
++    kill(initpid, SIGINT);
++}
+ 
+ static void lxcSignalChildHandler(int signum ATTRIBUTE_UNUSED)
+ {
+@@ -1072,6 +1082,12 @@
+         goto cleanup;
+     }
+ 
++    if (signal(SIGINT, lxcSignalINTHandler) == SIG_ERR) {
++        virReportSystemError(errno, "%s",
++                             _("Cannot install signal handler"));
++        goto cleanup;
++    }
++
+     VIR_DEBUG("serverFd=%d clientFd=%d",
+               serverFd, clientFd);
+     virResetLastError();
+@@ -1430,6 +1446,7 @@
+         goto cleanup;
+     VIR_FORCE_CLOSE(control[1]);
+     VIR_FORCE_CLOSE(containerhandshake[1]);
++    initpid = container;
+ 
+     if (lxcControllerMoveInterfaces(nveths, veths, container) < 0)
+         goto cleanup;
+diff -ur libvirt-0.9.9/src/lxc/lxc_driver.c libvirt-0.9.9-lxc/src/lxc/lxc_driver.c
+--- libvirt-0.9.9/src/lxc/lxc_driver.c	2011-12-29 08:26:45.000000000 +0100
++++ libvirt-0.9.9-lxc/src/lxc/lxc_driver.c	2012-01-24 13:58:05.548702741 +0100
+@@ -3732,6 +3732,33 @@
+ }
+ 
+ static int
++lxcDomainShutdown (virDomainPtr dom)
++{
++    lxc_driver_t *driver = dom->conn->privateData;
++    virDomainObjPtr vm;
++    int ret = -1;
++
++    lxcDriverLock(driver);
++    vm = virDomainFindByUUID(&driver->domains, dom->uuid);
++
++    if (vm->pid <= 0) {
++        lxcError(VIR_ERR_INTERNAL_ERROR,
++                 _("Invalid PID %d for container"), vm->pid);
++        goto cleanup;
++    }
++
++    if (kill(vm->pid, SIGINT) < -1)
++	goto cleanup;
++    ret = 0;
++
++cleanup:
++    if (vm)
++        virDomainObjUnlock(vm);
++    lxcDriverUnlock(driver);
++    return ret;
++}
++
++static int
+ lxcDomainOpenConsole(virDomainPtr dom,
+                       const char *dev_name,
+                       virStreamPtr st,
+@@ -3847,6 +3874,7 @@
+     .domainLookupByName = lxcDomainLookupByName, /* 0.4.2 */
+     .domainSuspend = lxcDomainSuspend, /* 0.7.2 */
+     .domainResume = lxcDomainResume, /* 0.7.2 */
++    .domainShutdown = lxcDomainShutdown,
+     .domainDestroy = lxcDomainDestroy, /* 0.4.4 */
+     .domainDestroyFlags = lxcDomainDestroyFlags, /* 0.9.4 */
+     .domainGetOSType = lxcGetOSType, /* 0.4.2 */
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/libvirt/libvirt.spec?r1=1.52&r2=1.53&f=u



More information about the pld-cvs-commit mailing list