提交 5037cea5 编写于 作者: E Eric Blake

lxc: reject unknown flags

* src/lxc/lxc_driver.c (lxcOpen, lxcDomainSetMemoryParameters)
(lxcDomainGetMemoryParameters): Reject unknown flags.
* src/lxc/lxc_container.c (lxcContainerStart): Rename flags to
cflags to reflect that it is not tied to libvirt.
上级 9110941c
/*
* Copyright (C) 2008-2010 Red Hat, Inc.
* Copyright (C) 2008-2011 Red Hat, Inc.
* Copyright (C) 2008 IBM Corp.
*
* lxc_container.c: file description
......@@ -889,7 +889,7 @@ int lxcContainerStart(virDomainDefPtr def,
char *ttyPath)
{
pid_t pid;
int flags;
int cflags;
int stacksize = getpagesize() * 4;
char *stack, *stacktop;
lxc_child_argv_t args = { def, nveths, veths, control, ttyPath,
......@@ -902,19 +902,19 @@ int lxcContainerStart(virDomainDefPtr def,
}
stacktop = stack + stacksize;
flags = CLONE_NEWPID|CLONE_NEWNS|CLONE_NEWUTS|CLONE_NEWIPC|SIGCHLD;
cflags = CLONE_NEWPID|CLONE_NEWNS|CLONE_NEWUTS|CLONE_NEWIPC|SIGCHLD;
if (userns_supported()) {
VIR_DEBUG("Enable user namespaces");
flags |= CLONE_NEWUSER;
cflags |= CLONE_NEWUSER;
}
if (def->nets != NULL) {
VIR_DEBUG("Enable network namespaces");
flags |= CLONE_NEWNET;
cflags |= CLONE_NEWNET;
}
pid = clone(lxcContainerChild, stacktop, flags, &args);
pid = clone(lxcContainerChild, stacktop, cflags, &args);
VIR_FREE(stack);
VIR_DEBUG("clone() completed, new container PID is %d", pid);
......
......@@ -111,8 +111,10 @@ static void lxcDomainEventQueue(lxc_driver_t *driver,
static virDrvOpenStatus lxcOpen(virConnectPtr conn,
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
unsigned int flags ATTRIBUTE_UNUSED)
unsigned int flags)
{
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
/* Verify uri was specified */
if (conn->uri == NULL) {
if (lxc_driver == NULL)
......@@ -748,7 +750,7 @@ cleanup:
static int lxcDomainSetMemoryParameters(virDomainPtr dom,
virTypedParameterPtr params,
int nparams,
unsigned int flags ATTRIBUTE_UNUSED)
unsigned int flags)
{
lxc_driver_t *driver = dom->conn->privateData;
int i;
......@@ -756,6 +758,8 @@ static int lxcDomainSetMemoryParameters(virDomainPtr dom,
virDomainObjPtr vm = NULL;
int ret = -1;
virCheckFlags(0, -1);
lxcDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
......@@ -845,7 +849,7 @@ cleanup:
static int lxcDomainGetMemoryParameters(virDomainPtr dom,
virTypedParameterPtr params,
int *nparams,
unsigned int flags ATTRIBUTE_UNUSED)
unsigned int flags)
{
lxc_driver_t *driver = dom->conn->privateData;
int i;
......@@ -855,6 +859,8 @@ static int lxcDomainGetMemoryParameters(virDomainPtr dom,
int ret = -1;
int rc;
virCheckFlags(0, -1);
lxcDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册