Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
47a611a4
Commit
47a611a4
authored
Nov 27, 2013
by
Stéphane Graber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
python3: Add (add|remove)_device_node
Signed-off-by:
Stéphane Graber
<
stgraber@ubuntu.com
>
Acked-by:
Serge E. Hallyn
<
serge.hallyn@ubuntu.com
>
parent
de86840a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
lxc.c
src/python-lxc/lxc.c
+50
-0
No files found.
src/python-lxc/lxc.c
View file @
47a611a4
...
@@ -505,6 +505,25 @@ Container_state(Container *self, void *closure)
...
@@ -505,6 +505,25 @@ Container_state(Container *self, void *closure)
/* Container Functions */
/* Container Functions */
static
PyObject
*
static
PyObject
*
Container_add_device_node
(
Container
*
self
,
PyObject
*
args
,
PyObject
*
kwds
)
{
static
char
*
kwlist
[]
=
{
"src_path"
,
"dest_path"
,
NULL
};
char
*
src_path
=
NULL
;
char
*
dst_path
=
NULL
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"s|s"
,
kwlist
,
&
src_path
,
&
dst_path
))
return
NULL
;
if
(
self
->
container
->
add_device_node
(
self
->
container
,
src_path
,
dst_path
))
{
Py_RETURN_TRUE
;
}
Py_RETURN_FALSE
;
}
static
PyObject
*
Container_attach_and_possibly_wait
(
Container
*
self
,
PyObject
*
args
,
Container_attach_and_possibly_wait
(
Container
*
self
,
PyObject
*
args
,
PyObject
*
kwds
,
int
wait
)
PyObject
*
kwds
,
int
wait
)
{
{
...
@@ -930,6 +949,25 @@ Container_reboot(Container *self, PyObject *args, PyObject *kwds)
...
@@ -930,6 +949,25 @@ Container_reboot(Container *self, PyObject *args, PyObject *kwds)
}
}
static
PyObject
*
static
PyObject
*
Container_remove_device_node
(
Container
*
self
,
PyObject
*
args
,
PyObject
*
kwds
)
{
static
char
*
kwlist
[]
=
{
"src_path"
,
"dest_path"
,
NULL
};
char
*
src_path
=
NULL
;
char
*
dst_path
=
NULL
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"s|s"
,
kwlist
,
&
src_path
,
&
dst_path
))
return
NULL
;
if
(
self
->
container
->
remove_device_node
(
self
->
container
,
src_path
,
dst_path
))
{
Py_RETURN_TRUE
;
}
Py_RETURN_FALSE
;
}
static
PyObject
*
Container_save_config
(
Container
*
self
,
PyObject
*
args
,
PyObject
*
kwds
)
Container_save_config
(
Container
*
self
,
PyObject
*
args
,
PyObject
*
kwds
)
{
{
static
char
*
kwlist
[]
=
{
"path"
,
NULL
};
static
char
*
kwlist
[]
=
{
"path"
,
NULL
};
...
@@ -1139,6 +1177,12 @@ static PyGetSetDef Container_getseters[] = {
...
@@ -1139,6 +1177,12 @@ static PyGetSetDef Container_getseters[] = {
};
};
static
PyMethodDef
Container_methods
[]
=
{
static
PyMethodDef
Container_methods
[]
=
{
{
"add_device_node"
,
(
PyCFunction
)
Container_add_device_node
,
METH_VARARGS
|
METH_KEYWORDS
,
"add_device_node(src_path, dest_path) -> boolean
\n
"
"
\n
"
"Pass a new device to the container."
},
{
"attach"
,
(
PyCFunction
)
Container_attach
,
{
"attach"
,
(
PyCFunction
)
Container_attach
,
METH_VARARGS
|
METH_KEYWORDS
,
METH_VARARGS
|
METH_KEYWORDS
,
"attach(run, payload) -> int
\n
"
"attach(run, payload) -> int
\n
"
...
@@ -1244,6 +1288,12 @@ static PyMethodDef Container_methods[] = {
...
@@ -1244,6 +1288,12 @@ static PyMethodDef Container_methods[] = {
"
\n
"
"
\n
"
"Ask the container to reboot."
"Ask the container to reboot."
},
},
{
"remove_device_node"
,
(
PyCFunction
)
Container_remove_device_node
,
METH_VARARGS
|
METH_KEYWORDS
,
"remove_device_node(src_path, dest_path) -> boolean
\n
"
"
\n
"
"Remove a device from the container."
},
{
"save_config"
,
(
PyCFunction
)
Container_save_config
,
{
"save_config"
,
(
PyCFunction
)
Container_save_config
,
METH_VARARGS
|
METH_KEYWORDS
,
METH_VARARGS
|
METH_KEYWORDS
,
"save_config(path = DEFAULT) -> boolean
\n
"
"save_config(path = DEFAULT) -> boolean
\n
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment