From 2dd3f025a0fa8fbf537d04a4746654b2486e9fb9 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Wed, 20 Jul 2011 18:51:26 +0200 Subject: [PATCH] destroy: Implement internal API for lxc driver --- src/lxc/lxc_driver.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 80378d37e2..615d2c647b 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1934,20 +1934,25 @@ static void lxcDomainEventQueue(lxc_driver_t *driver, } /** - * lxcDomainDestroy: + * lxcDomainDestroyFlags: * @dom: pointer to domain to destroy + * @flags: an OR'ed set of virDomainDestroyFlags * * Sends SIGKILL to container root process to terminate the container * * Returns 0 on success or -1 in case of error */ -static int lxcDomainDestroy(virDomainPtr dom) +static int +lxcDomainDestroyFlags(virDomainPtr dom, + unsigned int flags) { lxc_driver_t *driver = dom->conn->privateData; virDomainObjPtr vm; virDomainEventPtr event = NULL; int ret = -1; + virCheckFlags(0, -1); + lxcDriverLock(driver); vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (!vm) { @@ -1983,6 +1988,20 @@ cleanup: return ret; } +/** + * lxcDomainDestroy: + * @dom: pointer to domain to destroy + * + * Sends SIGKILL to container root process to terminate the container + * + * Returns 0 on success or -1 in case of error + */ +static int +lxcDomainDestroy(virDomainPtr dom) +{ + return lxcDomainDestroyFlags(dom, 0); +} + static int lxcCheckNetNsSupport(void) { const char *argv[] = {"ip", "link", "set", "lo", "netns", "-1", NULL}; @@ -2928,6 +2947,7 @@ static virDriver lxcDriver = { .domainSuspend = lxcDomainSuspend, /* 0.7.2 */ .domainResume = lxcDomainResume, /* 0.7.2 */ .domainDestroy = lxcDomainDestroy, /* 0.4.4 */ + .domainDestroyFlags = lxcDomainDestroyFlags, /* 0.9.4 */ .domainGetOSType = lxcGetOSType, /* 0.4.2 */ .domainGetMaxMemory = lxcDomainGetMaxMemory, /* 0.7.2 */ .domainSetMaxMemory = lxcDomainSetMaxMemory, /* 0.7.2 */