mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-05 12:35:20 +00:00
Rename all APIs in lxc_process.c to have a virLXCProcess prefix
For consistency all the APIs in the lxc_process.c file should have a virLXCProcess prefix in their name Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
b536e193a2
commit
eaf10b84ed
@ -126,7 +126,7 @@ static int lxcClose(virConnectPtr conn)
|
|||||||
lxc_driver_t *driver = conn->privateData;
|
lxc_driver_t *driver = conn->privateData;
|
||||||
|
|
||||||
lxcDriverLock(driver);
|
lxcDriverLock(driver);
|
||||||
lxcProcessAutoDestroyRun(driver, conn);
|
virLXCProcessAutoDestroyRun(driver, conn);
|
||||||
lxcDriverUnlock(driver);
|
lxcDriverUnlock(driver);
|
||||||
|
|
||||||
conn->privateData = NULL;
|
conn->privateData = NULL;
|
||||||
@ -978,7 +978,7 @@ static int lxcDomainStartWithFlags(virDomainPtr dom, unsigned int flags)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = lxcVmStart(dom->conn, driver, vm,
|
ret = virLXCProcessStart(dom->conn, driver, vm,
|
||||||
(flags & VIR_DOMAIN_START_AUTODESTROY),
|
(flags & VIR_DOMAIN_START_AUTODESTROY),
|
||||||
VIR_DOMAIN_RUNNING_BOOTED);
|
VIR_DOMAIN_RUNNING_BOOTED);
|
||||||
|
|
||||||
@ -1059,7 +1059,7 @@ lxcDomainCreateAndStart(virConnectPtr conn,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
def = NULL;
|
def = NULL;
|
||||||
|
|
||||||
if (lxcVmStart(conn, driver, vm,
|
if (virLXCProcessStart(conn, driver, vm,
|
||||||
(flags & VIR_DOMAIN_START_AUTODESTROY),
|
(flags & VIR_DOMAIN_START_AUTODESTROY),
|
||||||
VIR_DOMAIN_RUNNING_BOOTED) < 0) {
|
VIR_DOMAIN_RUNNING_BOOTED) < 0) {
|
||||||
virDomainAuditStart(vm, "booted", false);
|
virDomainAuditStart(vm, "booted", false);
|
||||||
@ -1296,7 +1296,7 @@ lxcDomainDestroyFlags(virDomainPtr dom,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = lxcVmTerminate(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED);
|
ret = virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED);
|
||||||
event = virDomainEventNewFromObj(vm,
|
event = virDomainEventNewFromObj(vm,
|
||||||
VIR_DOMAIN_EVENT_STOPPED,
|
VIR_DOMAIN_EVENT_STOPPED,
|
||||||
VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
|
VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
|
||||||
@ -1436,7 +1436,7 @@ static int lxcStartup(int privileged)
|
|||||||
|
|
||||||
lxcDomainSetPrivateDataHooks(lxc_driver->caps);
|
lxcDomainSetPrivateDataHooks(lxc_driver->caps);
|
||||||
|
|
||||||
if (lxcProcessAutoDestroyInit(lxc_driver) < 0)
|
if (virLXCProcessAutoDestroyInit(lxc_driver) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* Get all the running persistent or transient configs first */
|
/* Get all the running persistent or transient configs first */
|
||||||
@ -1448,7 +1448,7 @@ static int lxcStartup(int privileged)
|
|||||||
NULL, NULL) < 0)
|
NULL, NULL) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
lxcReconnectAll(lxc_driver, &lxc_driver->domains);
|
virLXCProcessReconnectAll(lxc_driver, &lxc_driver->domains);
|
||||||
|
|
||||||
/* Then inactive persistent configs */
|
/* Then inactive persistent configs */
|
||||||
if (virDomainLoadAllConfigs(lxc_driver->caps,
|
if (virDomainLoadAllConfigs(lxc_driver->caps,
|
||||||
@ -1461,7 +1461,7 @@ static int lxcStartup(int privileged)
|
|||||||
|
|
||||||
lxcDriverUnlock(lxc_driver);
|
lxcDriverUnlock(lxc_driver);
|
||||||
|
|
||||||
lxcAutostartConfigs(lxc_driver);
|
virLXCProcessAutostartAll(lxc_driver);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -1517,7 +1517,7 @@ static int lxcShutdown(void)
|
|||||||
virDomainObjListDeinit(&lxc_driver->domains);
|
virDomainObjListDeinit(&lxc_driver->domains);
|
||||||
virDomainEventStateFree(lxc_driver->domainEventState);
|
virDomainEventStateFree(lxc_driver->domainEventState);
|
||||||
|
|
||||||
lxcProcessAutoDestroyShutdown(lxc_driver);
|
virLXCProcessAutoDestroyShutdown(lxc_driver);
|
||||||
|
|
||||||
virCapabilitiesFree(lxc_driver->caps);
|
virCapabilitiesFree(lxc_driver->caps);
|
||||||
virSecurityManagerFree(lxc_driver->securityManager);
|
virSecurityManagerFree(lxc_driver->securityManager);
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
#define START_POSTFIX ": starting up\n"
|
#define START_POSTFIX ": starting up\n"
|
||||||
|
|
||||||
int lxcProcessAutoDestroyInit(lxc_driver_t *driver)
|
int virLXCProcessAutoDestroyInit(lxc_driver_t *driver)
|
||||||
{
|
{
|
||||||
if (!(driver->autodestroy = virHashCreate(5, NULL)))
|
if (!(driver->autodestroy = virHashCreate(5, NULL)))
|
||||||
return -1;
|
return -1;
|
||||||
@ -56,16 +56,16 @@ int lxcProcessAutoDestroyInit(lxc_driver_t *driver)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct lxcProcessAutoDestroyData {
|
struct virLXCProcessAutoDestroyData {
|
||||||
lxc_driver_t *driver;
|
lxc_driver_t *driver;
|
||||||
virConnectPtr conn;
|
virConnectPtr conn;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void lxcProcessAutoDestroyDom(void *payload,
|
static void virLXCProcessAutoDestroyDom(void *payload,
|
||||||
const void *name,
|
const void *name,
|
||||||
void *opaque)
|
void *opaque)
|
||||||
{
|
{
|
||||||
struct lxcProcessAutoDestroyData *data = opaque;
|
struct virLXCProcessAutoDestroyData *data = opaque;
|
||||||
virConnectPtr conn = payload;
|
virConnectPtr conn = payload;
|
||||||
const char *uuidstr = name;
|
const char *uuidstr = name;
|
||||||
unsigned char uuid[VIR_UUID_BUFLEN];
|
unsigned char uuid[VIR_UUID_BUFLEN];
|
||||||
@ -89,7 +89,7 @@ static void lxcProcessAutoDestroyDom(void *payload,
|
|||||||
}
|
}
|
||||||
|
|
||||||
VIR_DEBUG("Killing domain");
|
VIR_DEBUG("Killing domain");
|
||||||
lxcVmTerminate(data->driver, dom, VIR_DOMAIN_SHUTOFF_DESTROYED);
|
virLXCProcessStop(data->driver, dom, VIR_DOMAIN_SHUTOFF_DESTROYED);
|
||||||
virDomainAuditStop(dom, "destroyed");
|
virDomainAuditStop(dom, "destroyed");
|
||||||
event = virDomainEventNewFromObj(dom,
|
event = virDomainEventNewFromObj(dom,
|
||||||
VIR_DOMAIN_EVENT_STOPPED,
|
VIR_DOMAIN_EVENT_STOPPED,
|
||||||
@ -108,21 +108,21 @@ static void lxcProcessAutoDestroyDom(void *payload,
|
|||||||
/*
|
/*
|
||||||
* Precondition: driver is locked
|
* Precondition: driver is locked
|
||||||
*/
|
*/
|
||||||
void lxcProcessAutoDestroyRun(lxc_driver_t *driver, virConnectPtr conn)
|
void virLXCProcessAutoDestroyRun(lxc_driver_t *driver, virConnectPtr conn)
|
||||||
{
|
{
|
||||||
struct lxcProcessAutoDestroyData data = {
|
struct virLXCProcessAutoDestroyData data = {
|
||||||
driver, conn
|
driver, conn
|
||||||
};
|
};
|
||||||
VIR_DEBUG("conn=%p", conn);
|
VIR_DEBUG("conn=%p", conn);
|
||||||
virHashForEach(driver->autodestroy, lxcProcessAutoDestroyDom, &data);
|
virHashForEach(driver->autodestroy, virLXCProcessAutoDestroyDom, &data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lxcProcessAutoDestroyShutdown(lxc_driver_t *driver)
|
void virLXCProcessAutoDestroyShutdown(lxc_driver_t *driver)
|
||||||
{
|
{
|
||||||
virHashFree(driver->autodestroy);
|
virHashFree(driver->autodestroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
int lxcProcessAutoDestroyAdd(lxc_driver_t *driver,
|
int virLXCProcessAutoDestroyAdd(lxc_driver_t *driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
virConnectPtr conn)
|
virConnectPtr conn)
|
||||||
{
|
{
|
||||||
@ -134,7 +134,7 @@ int lxcProcessAutoDestroyAdd(lxc_driver_t *driver,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lxcProcessAutoDestroyRemove(lxc_driver_t *driver,
|
int virLXCProcessAutoDestroyRemove(lxc_driver_t *driver,
|
||||||
virDomainObjPtr vm)
|
virDomainObjPtr vm)
|
||||||
{
|
{
|
||||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
@ -147,7 +147,7 @@ int lxcProcessAutoDestroyRemove(lxc_driver_t *driver,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* lxcVmCleanup:
|
* virLXCProcessCleanup:
|
||||||
* @driver: pointer to driver structure
|
* @driver: pointer to driver structure
|
||||||
* @vm: pointer to VM to clean up
|
* @vm: pointer to VM to clean up
|
||||||
* @reason: reason for switching the VM to shutoff state
|
* @reason: reason for switching the VM to shutoff state
|
||||||
@ -155,7 +155,7 @@ int lxcProcessAutoDestroyRemove(lxc_driver_t *driver,
|
|||||||
* Cleanout resources associated with the now dead VM
|
* Cleanout resources associated with the now dead VM
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void lxcVmCleanup(lxc_driver_t *driver,
|
static void virLXCProcessCleanup(lxc_driver_t *driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
virDomainShutoffReason reason)
|
virDomainShutoffReason reason)
|
||||||
{
|
{
|
||||||
@ -176,7 +176,7 @@ static void lxcVmCleanup(lxc_driver_t *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Stop autodestroy in case guest is restarted */
|
/* Stop autodestroy in case guest is restarted */
|
||||||
lxcProcessAutoDestroyRemove(driver, vm);
|
virLXCProcessAutoDestroyRemove(driver, vm);
|
||||||
|
|
||||||
virEventRemoveHandle(priv->monitorWatch);
|
virEventRemoveHandle(priv->monitorWatch);
|
||||||
VIR_FORCE_CLOSE(priv->monitor);
|
VIR_FORCE_CLOSE(priv->monitor);
|
||||||
@ -230,7 +230,7 @@ static void lxcVmCleanup(lxc_driver_t *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int lxcSetupInterfaceBridged(virConnectPtr conn,
|
static int virLXCProcessSetupInterfaceBridged(virConnectPtr conn,
|
||||||
virDomainDefPtr vm,
|
virDomainDefPtr vm,
|
||||||
virDomainNetDefPtr net,
|
virDomainNetDefPtr net,
|
||||||
const char *brname,
|
const char *brname,
|
||||||
@ -292,7 +292,7 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int lxcSetupInterfaceDirect(virConnectPtr conn,
|
static int virLXCProcessSetupInterfaceDirect(virConnectPtr conn,
|
||||||
virDomainDefPtr def,
|
virDomainDefPtr def,
|
||||||
virDomainNetDefPtr net,
|
virDomainNetDefPtr net,
|
||||||
unsigned int *nveths,
|
unsigned int *nveths,
|
||||||
@ -359,7 +359,7 @@ cleanup:
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* lxcSetupInterfaces:
|
* virLXCProcessSetupInterfaces:
|
||||||
* @conn: pointer to connection
|
* @conn: pointer to connection
|
||||||
* @def: pointer to virtual machine structure
|
* @def: pointer to virtual machine structure
|
||||||
* @nveths: number of interfaces
|
* @nveths: number of interfaces
|
||||||
@ -371,7 +371,7 @@ cleanup:
|
|||||||
*
|
*
|
||||||
* Returns 0 on success or -1 in case of error
|
* Returns 0 on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int lxcSetupInterfaces(virConnectPtr conn,
|
static int virLXCProcessSetupInterfaces(virConnectPtr conn,
|
||||||
virDomainDefPtr def,
|
virDomainDefPtr def,
|
||||||
unsigned int *nveths,
|
unsigned int *nveths,
|
||||||
char ***veths)
|
char ***veths)
|
||||||
@ -401,7 +401,7 @@ static int lxcSetupInterfaces(virConnectPtr conn,
|
|||||||
if (!brname)
|
if (!brname)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (lxcSetupInterfaceBridged(conn,
|
if (virLXCProcessSetupInterfaceBridged(conn,
|
||||||
def,
|
def,
|
||||||
def->nets[i],
|
def->nets[i],
|
||||||
brname,
|
brname,
|
||||||
@ -420,7 +420,7 @@ static int lxcSetupInterfaces(virConnectPtr conn,
|
|||||||
_("No bridge name specified"));
|
_("No bridge name specified"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (lxcSetupInterfaceBridged(conn,
|
if (virLXCProcessSetupInterfaceBridged(conn,
|
||||||
def,
|
def,
|
||||||
def->nets[i],
|
def->nets[i],
|
||||||
brname,
|
brname,
|
||||||
@ -430,7 +430,7 @@ static int lxcSetupInterfaces(virConnectPtr conn,
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
case VIR_DOMAIN_NET_TYPE_DIRECT:
|
case VIR_DOMAIN_NET_TYPE_DIRECT:
|
||||||
if (lxcSetupInterfaceDirect(conn,
|
if (virLXCProcessSetupInterfaceDirect(conn,
|
||||||
def,
|
def,
|
||||||
def->nets[i],
|
def->nets[i],
|
||||||
nveths,
|
nveths,
|
||||||
@ -472,7 +472,7 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int lxcMonitorClient(lxc_driver_t * driver,
|
static int virLXCProcessMonitorClient(lxc_driver_t * driver,
|
||||||
virDomainObjPtr vm)
|
virDomainObjPtr vm)
|
||||||
{
|
{
|
||||||
char *sockpath = NULL;
|
char *sockpath = NULL;
|
||||||
@ -529,7 +529,7 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int lxcVmTerminate(lxc_driver_t *driver,
|
int virLXCProcessStop(lxc_driver_t *driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
virDomainShutoffReason reason)
|
virDomainShutoffReason reason)
|
||||||
{
|
{
|
||||||
@ -572,7 +572,7 @@ int lxcVmTerminate(lxc_driver_t *driver,
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
lxcVmCleanup(driver, vm, reason);
|
virLXCProcessCleanup(driver, vm, reason);
|
||||||
|
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
||||||
@ -582,7 +582,7 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern lxc_driver_t *lxc_driver;
|
extern lxc_driver_t *lxc_driver;
|
||||||
static void lxcMonitorEvent(int watch,
|
static void virLXCProcessMonitorEvent(int watch,
|
||||||
int fd,
|
int fd,
|
||||||
int events ATTRIBUTE_UNUSED,
|
int events ATTRIBUTE_UNUSED,
|
||||||
void *data)
|
void *data)
|
||||||
@ -603,7 +603,7 @@ static void lxcMonitorEvent(int watch,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lxcVmTerminate(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN) < 0) {
|
if (virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN) < 0) {
|
||||||
virEventRemoveHandle(watch);
|
virEventRemoveHandle(watch);
|
||||||
} else {
|
} else {
|
||||||
event = virDomainEventNewFromObj(vm,
|
event = virDomainEventNewFromObj(vm,
|
||||||
@ -628,7 +628,7 @@ cleanup:
|
|||||||
|
|
||||||
|
|
||||||
static virCommandPtr
|
static virCommandPtr
|
||||||
lxcBuildControllerCmd(lxc_driver_t *driver,
|
virLXCProcessBuildControllerCmd(lxc_driver_t *driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
int nveths,
|
int nveths,
|
||||||
char **veths,
|
char **veths,
|
||||||
@ -704,7 +704,7 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
lxcReadLogOutput(virDomainObjPtr vm,
|
virLXCProcessReadLogOutput(virDomainObjPtr vm,
|
||||||
char *logfile,
|
char *logfile,
|
||||||
off_t pos,
|
off_t pos,
|
||||||
char *buf,
|
char *buf,
|
||||||
@ -777,7 +777,7 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* lxcVmStart:
|
* virLXCProcessStart:
|
||||||
* @conn: pointer to connection
|
* @conn: pointer to connection
|
||||||
* @driver: pointer to driver structure
|
* @driver: pointer to driver structure
|
||||||
* @vm: pointer to virtual machine structure
|
* @vm: pointer to virtual machine structure
|
||||||
@ -788,7 +788,7 @@ cleanup:
|
|||||||
*
|
*
|
||||||
* Returns 0 on success or -1 in case of error
|
* Returns 0 on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
int lxcVmStart(virConnectPtr conn,
|
int virLXCProcessStart(virConnectPtr conn,
|
||||||
lxc_driver_t * driver,
|
lxc_driver_t * driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
bool autoDestroy,
|
bool autoDestroy,
|
||||||
@ -927,7 +927,7 @@ int lxcVmStart(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lxcSetupInterfaces(conn, vm->def, &nveths, &veths) != 0)
|
if (virLXCProcessSetupInterfaces(conn, vm->def, &nveths, &veths) != 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* Save the configuration for the controller */
|
/* Save the configuration for the controller */
|
||||||
@ -948,7 +948,7 @@ int lxcVmStart(virConnectPtr conn,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(cmd = lxcBuildControllerCmd(driver,
|
if (!(cmd = virLXCProcessBuildControllerCmd(driver,
|
||||||
vm,
|
vm,
|
||||||
nveths, veths,
|
nveths, veths,
|
||||||
ttyFDs, nttyFDs,
|
ttyFDs, nttyFDs,
|
||||||
@ -1003,7 +1003,7 @@ int lxcVmStart(virConnectPtr conn,
|
|||||||
/* Connect to the controller as a client *first* because
|
/* Connect to the controller as a client *first* because
|
||||||
* this will block until the child has written their
|
* this will block until the child has written their
|
||||||
* pid file out to disk */
|
* pid file out to disk */
|
||||||
if ((priv->monitor = lxcMonitorClient(driver, vm)) < 0)
|
if ((priv->monitor = virLXCProcessMonitorClient(driver, vm)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* And get its pid */
|
/* And get its pid */
|
||||||
@ -1020,7 +1020,7 @@ int lxcVmStart(virConnectPtr conn,
|
|||||||
if (lxcContainerWaitForContinue(handshakefds[0]) < 0) {
|
if (lxcContainerWaitForContinue(handshakefds[0]) < 0) {
|
||||||
char out[1024];
|
char out[1024];
|
||||||
|
|
||||||
if (!(lxcReadLogOutput(vm, logfile, pos, out, 1024) < 0)) {
|
if (!(virLXCProcessReadLogOutput(vm, logfile, pos, out, 1024) < 0)) {
|
||||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("guest failed to start: %s"), out);
|
_("guest failed to start: %s"), out);
|
||||||
}
|
}
|
||||||
@ -1031,13 +1031,13 @@ int lxcVmStart(virConnectPtr conn,
|
|||||||
if ((priv->monitorWatch = virEventAddHandle(
|
if ((priv->monitorWatch = virEventAddHandle(
|
||||||
priv->monitor,
|
priv->monitor,
|
||||||
VIR_EVENT_HANDLE_ERROR | VIR_EVENT_HANDLE_HANGUP,
|
VIR_EVENT_HANDLE_ERROR | VIR_EVENT_HANDLE_HANGUP,
|
||||||
lxcMonitorEvent,
|
virLXCProcessMonitorEvent,
|
||||||
vm, NULL)) < 0) {
|
vm, NULL)) < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autoDestroy &&
|
if (autoDestroy &&
|
||||||
lxcProcessAutoDestroyAdd(driver, vm, conn) < 0)
|
virLXCProcessAutoDestroyAdd(driver, vm, conn) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (virDomainObjSetDefTransient(driver->caps, vm, false) < 0)
|
if (virDomainObjSetDefTransient(driver->caps, vm, false) < 0)
|
||||||
@ -1114,25 +1114,25 @@ cleanup:
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
err = virSaveLastError();
|
err = virSaveLastError();
|
||||||
lxcVmTerminate(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED);
|
virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct lxcAutostartData {
|
struct virLXCProcessAutostartData {
|
||||||
lxc_driver_t *driver;
|
lxc_driver_t *driver;
|
||||||
virConnectPtr conn;
|
virConnectPtr conn;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
lxcAutostartDomain(void *payload, const void *name ATTRIBUTE_UNUSED, void *opaque)
|
virLXCProcessAutostartDomain(void *payload, const void *name ATTRIBUTE_UNUSED, void *opaque)
|
||||||
{
|
{
|
||||||
virDomainObjPtr vm = payload;
|
virDomainObjPtr vm = payload;
|
||||||
const struct lxcAutostartData *data = opaque;
|
const struct virLXCProcessAutostartData *data = opaque;
|
||||||
|
|
||||||
virDomainObjLock(vm);
|
virDomainObjLock(vm);
|
||||||
if (vm->autostart &&
|
if (vm->autostart &&
|
||||||
!virDomainObjIsActive(vm)) {
|
!virDomainObjIsActive(vm)) {
|
||||||
int ret = lxcVmStart(data->conn, data->driver, vm, false,
|
int ret = virLXCProcessStart(data->conn, data->driver, vm, false,
|
||||||
VIR_DOMAIN_RUNNING_BOOTED);
|
VIR_DOMAIN_RUNNING_BOOTED);
|
||||||
virDomainAuditStart(vm, "booted", ret >= 0);
|
virDomainAuditStart(vm, "booted", ret >= 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -1154,7 +1154,7 @@ lxcAutostartDomain(void *payload, const void *name ATTRIBUTE_UNUSED, void *opaqu
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
lxcAutostartConfigs(lxc_driver_t *driver) {
|
virLXCProcessAutostartAll(lxc_driver_t *driver) {
|
||||||
/* XXX: Figure out a better way todo this. The domain
|
/* XXX: Figure out a better way todo this. The domain
|
||||||
* startup code needs a connection handle in order
|
* startup code needs a connection handle in order
|
||||||
* to lookup the bridge associated with a virtual
|
* to lookup the bridge associated with a virtual
|
||||||
@ -1163,10 +1163,10 @@ lxcAutostartConfigs(lxc_driver_t *driver) {
|
|||||||
virConnectPtr conn = virConnectOpen("lxc:///");
|
virConnectPtr conn = virConnectOpen("lxc:///");
|
||||||
/* Ignoring NULL conn which is mostly harmless here */
|
/* Ignoring NULL conn which is mostly harmless here */
|
||||||
|
|
||||||
struct lxcAutostartData data = { driver, conn };
|
struct virLXCProcessAutostartData data = { driver, conn };
|
||||||
|
|
||||||
lxcDriverLock(driver);
|
lxcDriverLock(driver);
|
||||||
virHashForEach(driver->domains.objs, lxcAutostartDomain, &data);
|
virHashForEach(driver->domains.objs, virLXCProcessAutostartDomain, &data);
|
||||||
lxcDriverUnlock(driver);
|
lxcDriverUnlock(driver);
|
||||||
|
|
||||||
if (conn)
|
if (conn)
|
||||||
@ -1174,7 +1174,7 @@ lxcAutostartConfigs(lxc_driver_t *driver) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
lxcReconnectVM(void *payload, const void *name ATTRIBUTE_UNUSED, void *opaque)
|
virLXCProcessReconnectDomain(void *payload, const void *name ATTRIBUTE_UNUSED, void *opaque)
|
||||||
{
|
{
|
||||||
virDomainObjPtr vm = payload;
|
virDomainObjPtr vm = payload;
|
||||||
lxc_driver_t *driver = opaque;
|
lxc_driver_t *driver = opaque;
|
||||||
@ -1190,13 +1190,13 @@ lxcReconnectVM(void *payload, const void *name ATTRIBUTE_UNUSED, void *opaque)
|
|||||||
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
|
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
|
||||||
VIR_DOMAIN_RUNNING_UNKNOWN);
|
VIR_DOMAIN_RUNNING_UNKNOWN);
|
||||||
|
|
||||||
if ((priv->monitor = lxcMonitorClient(driver, vm)) < 0)
|
if ((priv->monitor = virLXCProcessMonitorClient(driver, vm)) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if ((priv->monitorWatch = virEventAddHandle(
|
if ((priv->monitorWatch = virEventAddHandle(
|
||||||
priv->monitor,
|
priv->monitor,
|
||||||
VIR_EVENT_HANDLE_ERROR | VIR_EVENT_HANDLE_HANGUP,
|
VIR_EVENT_HANDLE_ERROR | VIR_EVENT_HANDLE_HANGUP,
|
||||||
lxcMonitorEvent,
|
virLXCProcessMonitorEvent,
|
||||||
vm, NULL)) < 0)
|
vm, NULL)) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -1228,15 +1228,15 @@ cleanup:
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
lxcVmTerminate(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED);
|
virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED);
|
||||||
virDomainAuditStop(vm, "failed");
|
virDomainAuditStop(vm, "failed");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int lxcReconnectAll(lxc_driver_t *driver,
|
int virLXCProcessReconnectAll(lxc_driver_t *driver,
|
||||||
virDomainObjListPtr doms)
|
virDomainObjListPtr doms)
|
||||||
{
|
{
|
||||||
virHashForEach(doms->objs, lxcReconnectVM, driver);
|
virHashForEach(doms->objs, virLXCProcessReconnectDomain, driver);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -24,26 +24,27 @@
|
|||||||
|
|
||||||
# include "lxc_conf.h"
|
# include "lxc_conf.h"
|
||||||
|
|
||||||
int lxcVmStart(virConnectPtr conn,
|
int virLXCProcessStart(virConnectPtr conn,
|
||||||
lxc_driver_t * driver,
|
lxc_driver_t * driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
bool autoDestroy,
|
bool autoDestroy,
|
||||||
virDomainRunningReason reason);
|
virDomainRunningReason reason);
|
||||||
int lxcVmTerminate(lxc_driver_t *driver,
|
int virLXCProcessStop(lxc_driver_t *driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
virDomainShutoffReason reason);
|
virDomainShutoffReason reason);
|
||||||
int lxcProcessAutoDestroyInit(lxc_driver_t *driver);
|
|
||||||
void lxcProcessAutoDestroyRun(lxc_driver_t *driver,
|
int virLXCProcessAutoDestroyInit(lxc_driver_t *driver);
|
||||||
|
void virLXCProcessAutoDestroyRun(lxc_driver_t *driver,
|
||||||
virConnectPtr conn);
|
virConnectPtr conn);
|
||||||
void lxcProcessAutoDestroyShutdown(lxc_driver_t *driver);
|
void virLXCProcessAutoDestroyShutdown(lxc_driver_t *driver);
|
||||||
int lxcProcessAutoDestroyAdd(lxc_driver_t *driver,
|
int virLXCProcessAutoDestroyAdd(lxc_driver_t *driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
virConnectPtr conn);
|
virConnectPtr conn);
|
||||||
int lxcProcessAutoDestroyRemove(lxc_driver_t *driver,
|
int virLXCProcessAutoDestroyRemove(lxc_driver_t *driver,
|
||||||
virDomainObjPtr vm);
|
virDomainObjPtr vm);
|
||||||
|
|
||||||
void lxcAutostartConfigs(lxc_driver_t *driver);
|
void virLXCProcessAutostartAll(lxc_driver_t *driver);
|
||||||
int lxcReconnectAll(lxc_driver_t *driver,
|
int virLXCProcessReconnectAll(lxc_driver_t *driver,
|
||||||
virDomainObjListPtr doms);
|
virDomainObjListPtr doms);
|
||||||
|
|
||||||
#endif /* __LXC_PROCESS_H__ */
|
#endif /* __LXC_PROCESS_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user