Struct lxc::Container [−][src]
Implementations
impl Container
[src]
pub fn new(name: &str, config_path: Option<&Path>) -> Result<Self, String>
[src]
Create a new container.
pub fn get(&self) -> Result<()>
[src]
Add a reference to the specified container.
pub fn error_string(&self) -> String
[src]
Human-readable string representing last error.
pub fn error_num(&self) -> i32
[src]
Last error number.
pub fn daemonize(&self) -> bool
[src]
Whether container wishes to be daemonized.
pub fn config_path(&self) -> String
[src]
Full path to configuration file.
pub fn is_defined(&self) -> bool
[src]
Determine if /var/lib/lxc/$name/config
exists.
pub fn state(&self) -> String
[src]
Wait for container to reach a particular state.
pub fn is_running(&self) -> bool
[src]
Determine if container is running.
pub fn freeze(&self) -> Result<()>
[src]
Freeze running container.
pub fn unfreeze(&self) -> Result<()>
[src]
Thaw a frozen container.
pub fn init_pid(&self) -> i32
[src]
Determine process ID of the containers init process.
pub fn load_config(&self, alt_file: &str) -> Result<()>
[src]
Load the specified configuration for the container.
pub fn start(&self, use_init: bool, argv: &[&str]) -> Result<()>
[src]
Start the container.
pub fn stop(&self) -> Result<()>
[src]
Stop the container.
pub fn want_daemonize(&self, state: bool) -> Result<()>
[src]
Change whether the container wants to run disconnected from the terminal.
pub fn want_close_all_fds(&self, state: bool) -> Result<()>
[src]
Change whether the container wishes all file descriptors to be closed on startup.
pub fn config_file_name(&self) -> String
[src]
Return current config file name.
pub fn wait(&self, state: &str, timeout: i32) -> Result<()>
[src]
Wait for container to reach a particular state.
pub fn set_config_item(&self, key: &str, value: &str) -> Result<()>
[src]
Set a key/value configuration option.
pub fn destroy(&self) -> Result<()>
[src]
Delete the container.
pub fn save_config(&self, alt_file: &str) -> Result<()>
[src]
Save configuaration to a file.
pub fn create(
&self,
template: &str,
bdevtype: Option<&str>,
specs: Option<&mut bdev_specs>,
flags: CreateFlags,
argv: &[&str]
) -> Result<()>
[src]
&self,
template: &str,
bdevtype: Option<&str>,
specs: Option<&mut bdev_specs>,
flags: CreateFlags,
argv: &[&str]
) -> Result<()>
Create a container.
pub fn rename(&self, newname: &str) -> Result<()>
[src]
Rename a container.
pub fn reboot(&self) -> Result<()>
[src]
Request the container reboot by sending it SIGINT
.
pub fn shutdown(&self, timeout: i32) -> Result<()>
[src]
Request the container shutdown by sending it SIGPWR
.
pub fn clear_config(&self)
[src]
Completely clear the containers in-memory configuration.
pub fn clear_config_item(&self, key: &str) -> Result<()>
[src]
Clear a configuration item.
pub fn get_config_item(&self, key: &str) -> Option<String>
[src]
Retrieve the value of a config item.
pub fn get_running_config_item(&self, key: &str) -> String
[src]
Retrieve the value of a config item from running container.
pub fn get_keys(&self, key: &str) -> String
[src]
Retrieve a list of config item keys given a key prefix.
pub fn get_interfaces(&self) -> Vec<String>
[src]
Obtain a list of network interfaces.
pub fn get_ips(&self, interfaces: &str, family: &str, scope: i32) -> Vec<String>
[src]
Determine the list of container IP addresses.
pub fn get_cgroup_item(&self, subsys: &str) -> String
[src]
Retrieve the specified cgroup subsystem value for the container.
pub fn set_cgroup_item(&self, subsys: &str, value: &str) -> Result<()>
[src]
Set the specified cgroup subsystem value for the container.
pub fn get_config_path(&self) -> String
[src]
Determine full path to the containers configuration file.
Each container can have a custom configuration path. However by default
it will be set to either the LXCPATH
configure variable, or the
lxcpath
value in the LXC_GLOBAL_CONF
configuration file
(i.e. /etc/lxc/lxc.conf
). The value for a specific container can be
changed using set_config_path
. There is no other way to specify this in
general at the moment.
pub fn set_config_path(&self, path: &str) -> Result<()>
[src]
Set the full path to the containers configuration file.
pub fn clone(
&self,
newname: &str,
lxcpath: &str,
flags: i32,
bdevtype: &str,
bdevdata: &str,
newsize: u64,
hookargs: &[String]
) -> Self
[src]
&self,
newname: &str,
lxcpath: &str,
flags: i32,
bdevtype: &str,
bdevdata: &str,
newsize: u64,
hookargs: &[String]
) -> Self
Copy a stopped container.
pub fn console_getfd(&self, ttynum: &mut i32, masterfd: &mut i32) -> Result<()>
[src]
Allocate a console tty for the container.
pub fn console(
&self,
ttynum: i32,
stdinfd: i32,
stdoutfd: i32,
stderrfd: i32,
escape: i32
) -> Result<()>
[src]
&self,
ttynum: i32,
stdinfd: i32,
stdoutfd: i32,
stderrfd: i32,
escape: i32
) -> Result<()>
Allocate and run a console tty.
pub fn attach(
&self,
exec_function: ExecFn,
exec_payload: &mut c_void,
options: &mut Options
) -> Result<i32>
[src]
&self,
exec_function: ExecFn,
exec_payload: &mut c_void,
options: &mut Options
) -> Result<i32>
Create a sub-process attached to a container and run a function inside it.
pub fn attach_run_wait(
&self,
options: &mut Options,
program: &str,
argv: &[&str]
) -> Result<i32>
[src]
&self,
options: &mut Options,
program: &str,
argv: &[&str]
) -> Result<i32>
Run a program inside a container and wait for it to exit.
pub fn snapshot(&self, commentfile: &str) -> Result<()>
[src]
Create a container snapshot.
Assuming default paths, snapshots will be created as
/var/lib/lxc/<c>/snaps/snap<n>
where <c>
represents the container
name and <n>
represents the zero-based snapshot number.
pub fn snapshot_list(&self) -> Vec<Snapshot>
[src]
Obtain a list of container snapshots.
pub fn snapshot_restore(&self, snapname: &str, newname: &str) -> Result<()>
[src]
Create a new container based on a snapshot.
The restored container will be a copy (not snapshot) of the snapshot,
and restored in the lxcpath
of the original container.
pub fn snapshot_destroy(&self, snapname: &str) -> Result<()>
[src]
Destroy the specified snapshot.
pub fn may_control(&self) -> bool
[src]
Determine if the caller may control the container.
pub fn add_device_node(
&self,
src_path: &str,
dest_path: Option<&str>
) -> Result<()>
[src]
&self,
src_path: &str,
dest_path: Option<&str>
) -> Result<()>
Add specified device to the container.
pub fn remove_device_node(
&self,
src_path: &str,
dest_path: Option<&str>
) -> Result<()>
[src]
&self,
src_path: &str,
dest_path: Option<&str>
) -> Result<()>
Remove specified device from the container.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Container
[src]
impl !Send for Container
[src]
impl !Sync for Container
[src]
impl Unpin for Container
[src]
impl UnwindSafe for Container
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,