]> git.pld-linux.org Git - packages/libvirt.git/commitdiff
- hack lxc driver to send -INT to init when 'shutdown' command is issued from host
authorJan Rękorajski <baggins@pld-linux.org>
Tue, 24 Jan 2012 13:09:37 +0000 (13:09 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    libvirt-lxc.patch -> 1.1
    libvirt.spec -> 1.53

libvirt-lxc.patch [new file with mode: 0644]
libvirt.spec

diff --git a/libvirt-lxc.patch b/libvirt-lxc.patch
new file mode 100644 (file)
index 0000000..7b5b85a
--- /dev/null
@@ -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 */
index f4fbfa47f21069bb80ab412d287d490c6c0a4b1d..4aab47f32cca17b1fdb9e714a3cf9280d7369bdc 100644 (file)
@@ -36,6 +36,7 @@ Source0:      ftp://ftp.libvirt.org/libvirt/%{name}-%{version}.tar.gz
 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
@@ -243,6 +244,7 @@ Zarządca blokad sanlock dla biblioteki libvirt.
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 # weird translations
 %{__rm} po/{my,eu_ES}.{po,gmo}
This page took 0.147402 seconds and 4 git commands to generate.