]> git.pld-linux.org Git - packages/libvirt.git/blame - libvirt-lxc.patch
- rel 5
[packages/libvirt.git] / libvirt-lxc.patch
CommitLineData
918baaba
JR
1diff -ur libvirt-0.9.9/src/lxc/lxc_controller.c libvirt-0.9.9-lxc/src/lxc/lxc_controller.c
2--- libvirt-0.9.9/src/lxc/lxc_controller.c 2011-12-29 08:26:45.000000000 +0100
3+++ libvirt-0.9.9-lxc/src/lxc/lxc_controller.c 2012-01-24 00:37:37.856545745 +0100
4@@ -707,6 +707,14 @@
5 static bool quit = false;
6 static virMutex lock;
7 static int sigpipe[2];
8+static pid_t initpid = -1;
9+
10+static void lxcSignalINTHandler(int signum ATTRIBUTE_UNUSED)
11+{
12+ if (initpid <= 0)
13+ return;
14+ kill(initpid, SIGINT);
15+}
16
17 static void lxcSignalChildHandler(int signum ATTRIBUTE_UNUSED)
18 {
19@@ -1072,6 +1082,12 @@
20 goto cleanup;
21 }
22
23+ if (signal(SIGINT, lxcSignalINTHandler) == SIG_ERR) {
24+ virReportSystemError(errno, "%s",
25+ _("Cannot install signal handler"));
26+ goto cleanup;
27+ }
28+
29 VIR_DEBUG("serverFd=%d clientFd=%d",
30 serverFd, clientFd);
31 virResetLastError();
32@@ -1430,6 +1446,7 @@
33 goto cleanup;
34 VIR_FORCE_CLOSE(control[1]);
35 VIR_FORCE_CLOSE(containerhandshake[1]);
36+ initpid = container;
37
38 if (lxcControllerMoveInterfaces(nveths, veths, container) < 0)
39 goto cleanup;
40diff -ur libvirt-0.9.9/src/lxc/lxc_driver.c libvirt-0.9.9-lxc/src/lxc/lxc_driver.c
41--- libvirt-0.9.9/src/lxc/lxc_driver.c 2011-12-29 08:26:45.000000000 +0100
42+++ libvirt-0.9.9-lxc/src/lxc/lxc_driver.c 2012-01-24 13:58:05.548702741 +0100
43@@ -3732,6 +3732,33 @@
44 }
45
46 static int
47+lxcDomainShutdown (virDomainPtr dom)
48+{
49+ lxc_driver_t *driver = dom->conn->privateData;
50+ virDomainObjPtr vm;
51+ int ret = -1;
52+
53+ lxcDriverLock(driver);
54+ vm = virDomainFindByUUID(&driver->domains, dom->uuid);
55+
56+ if (vm->pid <= 0) {
57+ lxcError(VIR_ERR_INTERNAL_ERROR,
58+ _("Invalid PID %d for container"), vm->pid);
59+ goto cleanup;
60+ }
61+
62+ if (kill(vm->pid, SIGINT) < -1)
63+ goto cleanup;
64+ ret = 0;
65+
66+cleanup:
67+ if (vm)
68+ virDomainObjUnlock(vm);
69+ lxcDriverUnlock(driver);
70+ return ret;
71+}
72+
73+static int
74 lxcDomainOpenConsole(virDomainPtr dom,
75 const char *dev_name,
76 virStreamPtr st,
77@@ -3847,6 +3874,7 @@
78 .domainLookupByName = lxcDomainLookupByName, /* 0.4.2 */
79 .domainSuspend = lxcDomainSuspend, /* 0.7.2 */
80 .domainResume = lxcDomainResume, /* 0.7.2 */
81+ .domainShutdown = lxcDomainShutdown,
82 .domainDestroy = lxcDomainDestroy, /* 0.4.4 */
83 .domainDestroyFlags = lxcDomainDestroyFlags, /* 0.9.4 */
84 .domainGetOSType = lxcGetOSType, /* 0.4.2 */
This page took 0.04763 seconds and 4 git commands to generate.