| Libvirt-sandbox Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Properties | ||||
#include <libvirt-sandbox/libvirt-sandbox.h> struct GVirSandboxConfig; struct GVirSandboxConfigClass; GVirSandboxConfig * gvir_sandbox_config_load_from_path (const gchar *path,GError **error); GVirSandboxConfig * gvir_sandbox_config_load_from_data (const gchar *data,GError **error); gboolean gvir_sandbox_config_save_to_path (GVirSandboxConfig *config,const gchar *path,GError **error); gchar * gvir_sandbox_config_save_to_data (GVirSandboxConfig *config,GError **error); const gchar * gvir_sandbox_config_get_name (GVirSandboxConfig *config); void gvir_sandbox_config_set_uuid (GVirSandboxConfig *config,const gchar *uuid); const gchar * gvir_sandbox_config_get_uuid (GVirSandboxConfig *config); void gvir_sandbox_config_set_root (GVirSandboxConfig *config,const gchar *hostdir); const gchar * gvir_sandbox_config_get_root (GVirSandboxConfig *config); void gvir_sandbox_config_set_arch (GVirSandboxConfig *config,const gchar *arch); const gchar * gvir_sandbox_config_get_arch (GVirSandboxConfig *config); void gvir_sandbox_config_set_kernrelease (GVirSandboxConfig *config,const gchar *kernrelease); const gchar * gvir_sandbox_config_get_kernrelease (GVirSandboxConfig *config); void gvir_sandbox_config_set_kernpath (GVirSandboxConfig *config,const gchar *kernpath); const gchar * gvir_sandbox_config_get_kernpath (GVirSandboxConfig *config); void gvir_sandbox_config_set_kmodpath (GVirSandboxConfig *config,const gchar *kmodpath); const gchar * gvir_sandbox_config_get_kmodpath (GVirSandboxConfig *config); void gvir_sandbox_config_set_shell (GVirSandboxConfig *config,gboolean shell); gboolean gvir_sandbox_config_get_shell (GVirSandboxConfig *config); void gvir_sandbox_config_set_userid (GVirSandboxConfig *config,guint uid); guint gvir_sandbox_config_get_userid (GVirSandboxConfig *config); void gvir_sandbox_config_set_groupid (GVirSandboxConfig *config,guint gid); guint gvir_sandbox_config_get_groupid (GVirSandboxConfig *config); void gvir_sandbox_config_set_username (GVirSandboxConfig *config,const gchar *username); const gchar * gvir_sandbox_config_get_username (GVirSandboxConfig *config); void gvir_sandbox_config_set_homedir (GVirSandboxConfig *config,const gchar *homedir); const gchar * gvir_sandbox_config_get_homedir (GVirSandboxConfig *config); void gvir_sandbox_config_add_network (GVirSandboxConfig *config,GVirSandboxConfigNetwork *network); GList * gvir_sandbox_config_get_networks (GVirSandboxConfig *config); gboolean gvir_sandbox_config_add_network_opts (GVirSandboxConfig *config,const gchar *network,GError **error); gboolean gvir_sandbox_config_add_network_strv (GVirSandboxConfig *config,gchar **networks,GError **error); gboolean gvir_sandbox_config_has_networks (GVirSandboxConfig *config); void gvir_sandbox_config_add_mount (GVirSandboxConfig *config,GVirSandboxConfigMount *mnt); GList * gvir_sandbox_config_get_mounts (GVirSandboxConfig *config); GList * gvir_sandbox_config_get_mounts_with_type (GVirSandboxConfig *config,GType type); GVirSandboxConfigMount * gvir_sandbox_config_find_mount (GVirSandboxConfig *config,const gchar *target); gboolean gvir_sandbox_config_add_mount_opts (GVirSandboxConfig *config,const char *mount,GError **error); gboolean gvir_sandbox_config_add_mount_strv (GVirSandboxConfig *config,gchar **mounts,GError **error); gboolean gvir_sandbox_config_has_mounts (GVirSandboxConfig *config); gboolean gvir_sandbox_config_has_mounts_with_type (GVirSandboxConfig *config,GType type); gboolean gvir_sandbox_config_add_host_include_strv (GVirSandboxConfig *config,gchar **includes,GError **error); gboolean gvir_sandbox_config_add_host_include_file (GVirSandboxConfig *config,gchar *includefile,GError **error); void gvir_sandbox_config_set_security_label (GVirSandboxConfig *config,const gchar *label); const gchar * gvir_sandbox_config_get_security_label (GVirSandboxConfig *config); void gvir_sandbox_config_set_security_dynamic (GVirSandboxConfig *config,gboolean dynamic); gboolean gvir_sandbox_config_get_security_dynamic (GVirSandboxConfig *config); gboolean gvir_sandbox_config_set_security_opts (GVirSandboxConfig *config,const gchar *optstr,GError **error); gchar ** gvir_sandbox_config_get_command (GVirSandboxConfig *config);
GObject
+----GVirSandboxConfig
+----GVirSandboxConfigInteractive
+----GVirSandboxConfigService
"arch" gchar* : Read / Write "gid" guint : Read / Write "homedir" gchar* : Read / Write "kernpath" gchar* : Read / Write "kernrelease" gchar* : Read / Write "kmodpath" gchar* : Read / Write "name" gchar* : Read / Write / Construct Only "root" gchar* : Read / Write "security-dynamic" gboolean : Read / Write "security-label" gchar* : Read / Write "shell" gchar* : Read / Write "uid" guint : Read / Write "username" gchar* : Read / Write "uuid" gchar* : Read / Write / Construct Only
Provides a base object to store configurations for the application sandbox
The GVirSandboxConfig object stores the basic information required to create application sandboxes with a simple text based console.
struct GVirSandboxConfigClass {
GObjectClass parent_class;
gboolean (*load_config)(GVirSandboxConfig *config,
GKeyFile *file,
GError **error);
void (*save_config)(GVirSandboxConfig *config,
GKeyFile *file);
gchar **(*get_command)(GVirSandboxConfig *config);
gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING];
};
GVirSandboxConfig * gvir_sandbox_config_load_from_path (const gchar *path,GError **error);
|
the local path to load |
|
the loader error |
Returns : |
the new config or NULL. [transfer full] |
GVirSandboxConfig * gvir_sandbox_config_load_from_data (const gchar *data,GError **error);
|
the .ini data string to load |
|
the loader error |
Returns : |
the new config or NULL. [transfer full] |
gboolean gvir_sandbox_config_save_to_path (GVirSandboxConfig *config,const gchar *path,GError **error);
gchar * gvir_sandbox_config_save_to_data (GVirSandboxConfig *config,GError **error);
const gchar * gvir_sandbox_config_get_name (GVirSandboxConfig *config);
Retrieves the sandbox name
|
the sandbox config. [transfer none] |
Returns : |
the current name. [transfer none] |
void gvir_sandbox_config_set_uuid (GVirSandboxConfig *config,const gchar *uuid);
Set the UUID for the container, to overide the automatically generated value.
|
the sandbox config. [transfer none] |
|
the uuid in string format. [transfer none] |
const gchar * gvir_sandbox_config_get_uuid (GVirSandboxConfig *config);
Retrieves the sandbox UUID
|
the sandbox config. [transfer none] |
Returns : |
the current uuid. [transfer none] |
void gvir_sandbox_config_set_root (GVirSandboxConfig *config,const gchar *hostdir);
Set the host directory to use as the root for the sandbox. The defualt root is "/".
|
the sandbox config. [transfer none] |
|
the host directory. [transfer none] |
const gchar * gvir_sandbox_config_get_root (GVirSandboxConfig *config);
Retrieves the sandbox root directory
|
the sandbox config. [transfer none] |
Returns : |
the current root. [transfer none] |
void gvir_sandbox_config_set_arch (GVirSandboxConfig *config,const gchar *arch);
Set the architecture to use in the sandbox. If none is provided, it will default to matching the host architecture.
|
the sandbox config. [transfer none] |
|
the host directory. [transfer none] |
const gchar * gvir_sandbox_config_get_arch (GVirSandboxConfig *config);
Retrieves the sandbox binary architecture
|
the sandbox config. [transfer none] |
Returns : |
the current architecture. [transfer none] |
void gvir_sandbox_config_set_kernrelease (GVirSandboxConfig *config,const gchar *kernrelease);
Set the kernel release version to use in the sandbox. If none is provided, it will default to matching the current running kernel.
|
the sandbox config. [transfer none] |
|
the host directory. [transfer none] |
const gchar * gvir_sandbox_config_get_kernrelease (GVirSandboxConfig *config);
Retrieves the sandbox kernel release version
|
the sandbox config. [transfer none] |
Returns : |
the current kernel release version. [transfer none] |
void gvir_sandbox_config_set_kernpath (GVirSandboxConfig *config,const gchar *kernpath);
Set the kernel image path to use in the sandbox. If none is provided, it will default to matching /boot/vmlinuz-[kernel release].
|
the sandbox config. [transfer none] |
|
the host directory. [transfer none] |
const gchar * gvir_sandbox_config_get_kernpath (GVirSandboxConfig *config);
Retrieves the sandbox kernel image path
|
the sandbox config. [transfer none] |
Returns : |
the current kernel image path. [transfer none] |
void gvir_sandbox_config_set_kmodpath (GVirSandboxConfig *config,const gchar *kmodpath);
Sets the generic path to the kernel modules directory. It will default to "/lib/modules", modules being searched in /lib/modules/[kernel release]. If "/path" is given as argument modules will be searched in /path/[kernel release]
|
the sandbox config. [transfer none] |
|
the kernel modules path. [transfer none] |
const gchar * gvir_sandbox_config_get_kmodpath (GVirSandboxConfig *config);
Retrieves the sandbox kernel modules path
|
the sandbox config. [transfer none] |
Returns : |
the current kernel modules path. [transfer none] |
void gvir_sandbox_config_set_shell (GVirSandboxConfig *config,gboolean shell);
Set whether the container console should have a interactive shell.
|
the sandbox config. [transfer none] |
|
true if the container should have a shell. [transfer none] |
gboolean gvir_sandbox_config_get_shell (GVirSandboxConfig *config);
Retrieves the sandbox shell flag
|
the sandbox config. [transfer none] |
Returns : |
the shell flag. [transfer none] |
void gvir_sandbox_config_set_userid (GVirSandboxConfig *config,guint uid);
Set the user ID to invoke the sandbox application under. Defaults to the user ID of the current program.
|
the sandbox config. [transfer none] |
|
the sandbox user ID. [transfer none] |
guint gvir_sandbox_config_get_userid (GVirSandboxConfig *config);
Get the user ID to invoke the sandbox application under.
|
the sandbox config. [transfer none] |
Returns : |
the user ID. [transfer none] |
void gvir_sandbox_config_set_groupid (GVirSandboxConfig *config,guint gid);
Set the group ID to invoke the sandbox application under. Defaults to the group ID of the current program.
|
the sandbox config. [transfer none] |
|
the sandbox group ID. [transfer none] |
guint gvir_sandbox_config_get_groupid (GVirSandboxConfig *config);
Get the group ID to invoke the sandbox application under.
|
the sandbox config. [transfer none] |
Returns : |
the group ID. [transfer none] |
void gvir_sandbox_config_set_username (GVirSandboxConfig *config,const gchar *username);
Set the user name associated with the sandbox user ID. Defaults to the user name of the current program.
|
the sandbox config. [transfer none] |
|
the sandbox user name. [transfer none] |
const gchar * gvir_sandbox_config_get_username (GVirSandboxConfig *config);
Get the user name to invoke the sandbox application under.
|
the sandbox config. [transfer none] |
Returns : |
the user name. [transfer none] |
void gvir_sandbox_config_set_homedir (GVirSandboxConfig *config,const gchar *homedir);
Set the home directory associated with the sandbox user ID. Defaults to the home directory of the current program.
|
the sandbox config. [transfer none] |
|
the sandbox home directory. [transfer none] |
const gchar * gvir_sandbox_config_get_homedir (GVirSandboxConfig *config);
Get the home directory associated with the sandbox user ID
|
the sandbox config. [transfer none] |
Returns : |
the home directory. [transfer none] |
void gvir_sandbox_config_add_network (GVirSandboxConfig *config,GVirSandboxConfigNetwork *network);
Adds a new network connection to the sandbox
|
the sandbox config. [transfer none] |
|
the network configuration. [transfer none] |
GList * gvir_sandbox_config_get_networks (GVirSandboxConfig *config);
Retrieves the list of custom networks in the sandbox
|
the sandbox config. [transfer none] |
Returns : |
the list of networks. [transfer full][element-type GVirSandboxConfigNetwork] |
gboolean gvir_sandbox_config_add_network_opts (GVirSandboxConfig *config,const gchar *network,GError **error);
Parses network whose elements are in the format
KEY=VALUE, creating GVirSandboxConfigNetwork
instances for each element.
dhcp,source=default
source=private,address=192.168.122.1/24192.168.122.255,
address=192.168.122.1/24192.168.122.255,address=2001:212::204:2/64
route=192.168.122.255/24192.168.1.1
|
the sandbox config. [transfer none] |
|
the network config. [transfer none] |
gboolean gvir_sandbox_config_add_network_strv (GVirSandboxConfig *config,gchar **networks,GError **error);
Parses networks whose elements are in the format
KEY=VALUE, creating GVirSandboxConfigNetwork
instances for each element.
|
the sandbox config. [transfer none] |
|
the list of networks. [transfer none][array zero-terminated=1] |
gboolean gvir_sandbox_config_has_networks (GVirSandboxConfig *config);
void gvir_sandbox_config_add_mount (GVirSandboxConfig *config,GVirSandboxConfigMount *mnt);
Adds a new custom mount to the sandbox, to override part of the host filesystem
|
the sandbox config. [transfer none] |
|
the mount configuration. [transfer none] |
GList * gvir_sandbox_config_get_mounts (GVirSandboxConfig *config);
Retrieves the list of custom mounts in the sandbox
|
the sandbox config. [transfer none] |
Returns : |
the list of mounts. [transfer full][element-type GVirSandboxConfigMount] |
GList * gvir_sandbox_config_get_mounts_with_type (GVirSandboxConfig *config,GType type);
Retrieves the list of custom mounts in the sandbox
|
the sandbox config. [transfer none] |
Returns : |
the list of mounts. [transfer full][element-type GVirSandboxConfigMount] |
GVirSandboxConfigMount * gvir_sandbox_config_find_mount (GVirSandboxConfig *config,const gchar *target);
Finds the GVirSandboxConfigMount object corresponding to a guest
path of target.
|
the sandbox config. [transfer none] |
|
the guest target path |
Returns : |
a mount object or NULL. [transfer full][allow-none] |
gboolean gvir_sandbox_config_add_mount_opts (GVirSandboxConfig *config,const char *mount,GError **error);
Parses mount whose elements are in the format TYPE:TARGET=SOURCE
creating GVirSandboxConfigMount instances for each element. For
example
host-bind:/tmp=/var/lib/sandbox/demo/tmp
host-image:/=/var/lib/sandbox/demo.img
guest-bind:/home=/tmp/home
|
the sandbox config. [transfer none] |
|
the mount config. [transfer none] |
gboolean gvir_sandbox_config_add_mount_strv (GVirSandboxConfig *config,gchar **mounts,GError **error);
Parses mounts whose elements are in the format TYPE:TARGET=SOURCE
creating GVirSandboxConfigMount instances for each element. For
example
host-bind:/tmp=/var/lib/sandbox/demo/tmp
host-image:/=/var/lib/sandbox/demo.img
guest-bind:/home=/tmp/home
|
the sandbox config. [transfer none] |
|
the list of mounts. [transfer none][array zero-terminated=1] |
gboolean gvir_sandbox_config_has_mounts (GVirSandboxConfig *config);
gboolean gvir_sandbox_config_has_mounts_with_type (GVirSandboxConfig *config,GType type);
gboolean gvir_sandbox_config_add_host_include_strv (GVirSandboxConfig *config,gchar **includes,GError **error);
Parses includes whose elements are in the format
GUEST-TARGET=ROOT-PATH. If ROOT_PATH is omitted,
then it is assumed to be the same as GUEST-TARGET
|
the sandbox config. [transfer none] |
|
the list of includes. [transfer none][array zero-terminated=1] |
gboolean gvir_sandbox_config_add_host_include_file (GVirSandboxConfig *config,gchar *includefile,GError **error);
void gvir_sandbox_config_set_security_label (GVirSandboxConfig *config,const gchar *label);
Set the sandbox security label. By default a dynamic security label is chosen. A static security label must be specified if any custom mounts are added
|
the sandbox config. [transfer none] |
|
the host directory. [transfer none] |
const gchar * gvir_sandbox_config_get_security_label
(GVirSandboxConfig *config);
Retrieve the sandbox security label
|
the sandbox config. [transfer none] |
Returns : |
the security label. [transfer none] |
void gvir_sandbox_config_set_security_dynamic (GVirSandboxConfig *config,gboolean dynamic);
Set the SELinux security dynamic for the sandbox. The default dynamic is "svirt_sandbox_t"
|
the sandbox config. [transfer none] |
|
the security mode. [transfer none] |
gboolean gvir_sandbox_config_get_security_dynamic
(GVirSandboxConfig *config);
Retrieve the sandbox security mode
|
the sandbox config. [transfer none] |
Returns : |
the security mode. [transfer none] |
gboolean gvir_sandbox_config_set_security_opts (GVirSandboxConfig *config,const gchar *optstr,GError **error);
gchar ** gvir_sandbox_config_get_command (GVirSandboxConfig *config);
Retrieve the sandbox command and arguments
|
the sandbox config. [transfer none] |
Returns : |
the command path and arguments. [transfer full][array zero-terminated=1] |
"homedir" property "homedir" gchar* : Read / Write
The home directory.
Default value: "/home/berrange"
"kernrelease" property "kernrelease" gchar* : Read / Write
The kernel release version.
Default value: NULL
"name" property "name" gchar* : Read / Write / Construct Only
The sandbox name.
Default value: NULL
"security-dynamic" property "security-dynamic" gboolean : Read / Write
The security mode.
Default value: TRUE
"security-label" property "security-label" gchar* : Read / Write
The security label.
Default value: NULL