mirror of https://gitee.com/openkylin/libvirt.git
Move LXC process management code into separate file
Move all the code that manages stop/start of LXC processes into separate lxc_process.{c,h} file to make the lxc_driver.c file smaller Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
43e532d321
commit
fdf588a63d
|
@ -47,6 +47,7 @@ src/lxc/lxc_container.c
|
||||||
src/lxc/lxc_conf.c
|
src/lxc/lxc_conf.c
|
||||||
src/lxc/lxc_controller.c
|
src/lxc/lxc_controller.c
|
||||||
src/lxc/lxc_driver.c
|
src/lxc/lxc_driver.c
|
||||||
|
src/lxc/lxc_process.c
|
||||||
src/libxl/libxl_driver.c
|
src/libxl/libxl_driver.c
|
||||||
src/libxl/libxl_conf.c
|
src/libxl/libxl_conf.c
|
||||||
src/network/bridge_driver.c
|
src/network/bridge_driver.c
|
||||||
|
|
|
@ -352,6 +352,7 @@ LXC_DRIVER_SOURCES = \
|
||||||
lxc/lxc_container.c lxc/lxc_container.h \
|
lxc/lxc_container.c lxc/lxc_container.h \
|
||||||
lxc/lxc_cgroup.c lxc/lxc_cgroup.h \
|
lxc/lxc_cgroup.c lxc/lxc_cgroup.h \
|
||||||
lxc/lxc_domain.c lxc/lxc_domain.h \
|
lxc/lxc_domain.c lxc/lxc_domain.h \
|
||||||
|
lxc/lxc_process.c lxc/lxc_process.h \
|
||||||
lxc/lxc_driver.c lxc/lxc_driver.h
|
lxc/lxc_driver.c lxc/lxc_driver.h
|
||||||
|
|
||||||
LXC_CONTROLLER_SOURCES = \
|
LXC_CONTROLLER_SOURCES = \
|
||||||
|
|
|
@ -78,4 +78,14 @@ virCapsPtr lxcCapsInit(lxc_driver_t *driver);
|
||||||
virReportErrorHelper(VIR_FROM_LXC, code, __FILE__, \
|
virReportErrorHelper(VIR_FROM_LXC, code, __FILE__, \
|
||||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||||
|
|
||||||
|
static inline void lxcDriverLock(lxc_driver_t *driver)
|
||||||
|
{
|
||||||
|
virMutexLock(&driver->lock);
|
||||||
|
}
|
||||||
|
static inline void lxcDriverUnlock(lxc_driver_t *driver)
|
||||||
|
{
|
||||||
|
virMutexUnlock(&driver->lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* LXC_CONF_H */
|
#endif /* LXC_CONF_H */
|
||||||
|
|
1236
src/lxc/lxc_driver.c
1236
src/lxc/lxc_driver.c
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2010-2012 Red Hat, Inc.
|
||||||
|
* Copyright IBM Corp. 2008
|
||||||
|
*
|
||||||
|
* lxc_process.h: LXC process lifecycle management
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LXC_PROCESS_H__
|
||||||
|
# define __LXC_PROCESS_H__
|
||||||
|
|
||||||
|
# include "lxc_conf.h"
|
||||||
|
|
||||||
|
int lxcVmStart(virConnectPtr conn,
|
||||||
|
lxc_driver_t * driver,
|
||||||
|
virDomainObjPtr vm,
|
||||||
|
bool autoDestroy,
|
||||||
|
virDomainRunningReason reason);
|
||||||
|
int lxcVmTerminate(lxc_driver_t *driver,
|
||||||
|
virDomainObjPtr vm,
|
||||||
|
virDomainShutoffReason reason);
|
||||||
|
int lxcProcessAutoDestroyInit(lxc_driver_t *driver);
|
||||||
|
void lxcProcessAutoDestroyRun(lxc_driver_t *driver,
|
||||||
|
virConnectPtr conn);
|
||||||
|
void lxcProcessAutoDestroyShutdown(lxc_driver_t *driver);
|
||||||
|
int lxcProcessAutoDestroyAdd(lxc_driver_t *driver,
|
||||||
|
virDomainObjPtr vm,
|
||||||
|
virConnectPtr conn);
|
||||||
|
int lxcProcessAutoDestroyRemove(lxc_driver_t *driver,
|
||||||
|
virDomainObjPtr vm);
|
||||||
|
|
||||||
|
void lxcAutostartConfigs(lxc_driver_t *driver);
|
||||||
|
int lxcReconnectAll(lxc_driver_t *driver,
|
||||||
|
virDomainObjListPtr doms);
|
||||||
|
|
||||||
|
#endif /* __LXC_PROCESS_H__ */
|
Loading…
Reference in New Issue