Commit 57eed7c2 authored by Daniel P. Berrange's avatar Daniel P. Berrange

Refactor classes to better support non-interactive services

Make the base config/context classes abstract and move stuff
related to interactive commands to a new subclass.
parent 7241af6e
......@@ -71,8 +71,7 @@ class Container:
if self.name:
config = self.CONFIG_PATH % self.name
try:
self.config = LibvirtSandbox.Config()
self.config.load_path(config)
self.config = LibvirtSandbox.Config.load_from_path(config)
mounts = self.config.get_host_image_mounts()
if len(mounts):
mount = self.config.get_host_image_mounts()[0]
......@@ -227,7 +226,7 @@ WantedBy=multi-user.target
config = self.CONFIG_PATH % self.name
if os.path.exists(config):
os.remove(config)
self.config.save_path(config)
self.config.save_to_path(config)
sys.stdout.write("Created sandbox config %s\n" % config)
def __get_image_path(self):
......@@ -263,7 +262,7 @@ WantedBy=multi-user.target
if os.path.exists(self.dest):
raise OSError("%s already exists" % self.dest)
self.config = LibvirtSandbox.Config.new(name)
self.config = LibvirtSandbox.ConfigService.new(name)
self.config.set_security_label("system_u:system_r:%s:%s" % (self.security_type, self.security_level))
self.config.set_security_dynamic(self.dynamic)
net = LibvirtSandbox.ConfigNetwork().new()
......@@ -271,8 +270,7 @@ WantedBy=multi-user.target
self.config.add_network(net)
self.name = name
self.executable = executable
self.config.set_command([ self.executable ])
self.config.set_tty(True)
self.config.set_executable(self.executable)
self.config.set_shell(True)
self.__extract_rpm()
......@@ -312,7 +310,7 @@ WantedBy=multi-user.target
self.loop.quit()
self.__connect()
context = LibvirtSandbox.Context.new(self.conn, self.config)
context = LibvirtSandbox.ContextService.new(self.conn, self.config)
context.start()
console = context.get_console()
console.connect("closed", closed)
......@@ -330,7 +328,7 @@ WantedBy=multi-user.target
def stop(self):
self.__connect()
context = LibvirtSandbox.Context.new(self.conn, self.config)
context = LibvirtSandbox.ContextService.new(self.conn, self.config)
context.attach()
context.stop()
......@@ -339,7 +337,7 @@ WantedBy=multi-user.target
self.loop.quit()
self.__connect()
context = LibvirtSandbox.Context.new(self.conn, self.config)
context = LibvirtSandbox.ContextService.new(self.conn, self.config)
context.attach()
print dir(context)
console = context.get_console()
......
......@@ -46,7 +46,9 @@ int main(int argc, char **argv) {
int ret = EXIT_FAILURE;
GVirConnection *hv = NULL;
GVirSandboxConfig *cfg = NULL;
GVirSandboxConfigInteractive *icfg = NULL;
GVirSandboxContext *ctx = NULL;
GVirSandboxContextInteractive *ictx = NULL;
GVirSandboxConsole *con = NULL;
GMainLoop *loop = NULL;
GError *error = NULL;
......@@ -139,8 +141,9 @@ int main(int argc, char **argv) {
goto cleanup;
}
cfg = gvir_sandbox_config_new(name ? name : "sandbox");
gvir_sandbox_config_set_command(cfg, cmdargs);
icfg = gvir_sandbox_config_interactive_new(name ? name : "sandbox");
cfg = GVIR_SANDBOX_CONFIG(icfg);
gvir_sandbox_config_interactive_set_command(icfg, cmdargs);
if (privileged) {
gvir_sandbox_config_set_userid(cfg, 0);
......@@ -195,9 +198,10 @@ int main(int argc, char **argv) {
gvir_sandbox_config_set_shell(cfg, TRUE);
if (isatty(STDIN_FILENO))
gvir_sandbox_config_set_tty(cfg, TRUE);
gvir_sandbox_config_interactive_set_tty(icfg, TRUE);
ctx = gvir_sandbox_context_new(hv, cfg);
ictx = gvir_sandbox_context_interactive_new(hv, icfg);
ctx = GVIR_SANDBOX_CONTEXT(ictx);
if (!gvir_sandbox_context_start(ctx, &error)) {
g_printerr(_("Unable to start sandbox: %s\n"),
......
......@@ -6,14 +6,14 @@ const Gtk = imports.gi.Gtk;
LibvirtGObject.init_object_check(null, null);
var cfg = LibvirtSandbox.Config.new("sandbox");
var cfg = LibvirtSandbox.ConfigInteractive.new("sandbox");
/* XXX how to set argv & check if stdin is a tty ? */
cfg.set_tty(true);
var conn = LibvirtGObject.Connection.new("qemu:///session");
conn.open(null)
var ctxt = LibvirtSandbox.Context.new(conn, cfg);
var ctxt = LibvirtSandbox.ContextInteractive.new(conn, cfg);
ctxt.start();
var con = ctxt.get_console()
......
......@@ -11,7 +11,7 @@ Glib::Object::Introspection->setup(basename => 'LibvirtSandbox', version => '1.0
LibvirtGObject::init_object_check(undef);
my $cfg = LibvirtSandbox::Config->new("sandbox");
my $cfg = LibvirtSandbox::ConfigInteractive->new("sandbox");
if (int(@ARGV) > 0) {
$cfg->set_command(@ARGV);
}
......@@ -22,7 +22,7 @@ if (-t STDIN) {
my $conn = LibvirtGObject::Connection->new("qemu:///session");
$conn->open(undef);
my $ctxt = LibvirtSandbox::Context->new($conn, $cfg);
my $ctxt = LibvirtSandbox::ContextInteractive->new($conn, $cfg);
$ctxt->start();
my $con = $ctxt->get_console();
......
......@@ -11,7 +11,7 @@ args = sys.argv[1:]
LibvirtGObject.init_object_check(None)
cfg = LibvirtSandbox.Config.new("sandbox")
cfg = LibvirtSandbox.ConfigInteractive.new("sandbox")
if len(args) > 0:
cfg.set_command(args)
if os.isatty(sys.stdin.fileno()):
......@@ -20,7 +20,7 @@ if os.isatty(sys.stdin.fileno()):
conn = LibvirtGObject.Connection.new("qemu:///session")
conn.open(None)
ctxt = LibvirtSandbox.Context.new(conn, cfg)
ctxt = LibvirtSandbox.ContextInteractive.new(conn, cfg)
ctxt.start()
con = ctxt.get_console()
......
......@@ -88,12 +88,14 @@ SANDBOX_HEADER_FILES = \
libvirt-sandbox.h \
libvirt-sandbox-main.h \
libvirt-sandbox-config.h \
libvirt-sandbox-config-graphical.h \
libvirt-sandbox-config-network.h \
libvirt-sandbox-config-network-address.h \
libvirt-sandbox-config-network-route.h \
libvirt-sandbox-config-mount.h \
libvirt-sandbox-config-initrd.h \
libvirt-sandbox-config-graphical.h \
libvirt-sandbox-config-interactive.h \
libvirt-sandbox-config-service.h \
libvirt-sandbox-cleaner.h \
libvirt-sandbox-builder.h \
libvirt-sandbox-builder-initrd.h \
......@@ -102,16 +104,20 @@ SANDBOX_HEADER_FILES = \
libvirt-sandbox-console.h \
libvirt-sandbox-context.h \
libvirt-sandbox-context-graphical.h \
libvirt-sandbox-context-interactive.h \
libvirt-sandbox-context-service.h \
$(NULL)
SANDBOX_SOURCE_FILES = \
libvirt-sandbox-main.c \
libvirt-sandbox-config.c \
libvirt-sandbox-config-graphical.c \
libvirt-sandbox-config-network.c \
libvirt-sandbox-config-network-address.c \
libvirt-sandbox-config-network-route.c \
libvirt-sandbox-config-mount.c \
libvirt-sandbox-config-initrd.c \
libvirt-sandbox-config-graphical.c \
libvirt-sandbox-config-interactive.c \
libvirt-sandbox-config-service.c \
libvirt-sandbox-cleaner.c \
libvirt-sandbox-builder.c \
libvirt-sandbox-builder-initrd.c \
......@@ -120,6 +126,8 @@ SANDBOX_SOURCE_FILES = \
libvirt-sandbox-console.c \
libvirt-sandbox-context.c \
libvirt-sandbox-context-graphical.c \
libvirt-sandbox-context-interactive.c \
libvirt-sandbox-context-service.c \
$(NULL)
libvirt_sandbox_1_0_ladir = $(includedir)/libvirt-sandbox-1.0/libvirt-sandbox
......
......@@ -34,7 +34,7 @@
* Provides an object to store configuration details for a graphical config
*
* The GVirSandboxConfigGraphical object extends #GVirSandboxConfig to store
* the extra information required to setup a graphical desktop application
* the extra information required to setup a _graphical desktop application
* sandbox.
*/
......@@ -198,14 +198,16 @@ static void gvir_sandbox_config_graphical_init(GVirSandboxConfigGraphical *confi
/**
* gvir_sandbox_config_graphical_new:
* @name: the sandbox name
*
* Create a new graphical application sandbox configuration
*
* Returns: (transfer full): a new graphical sandbox config object
*/
GVirSandboxConfigGraphical *gvir_sandbox_config_graphical_new(void)
GVirSandboxConfigGraphical *gvir_sandbox_config_graphical_new(const gchar *name)
{
return GVIR_SANDBOX_CONFIG_GRAPHICAL(g_object_new(GVIR_SANDBOX_TYPE_CONFIG_GRAPHICAL,
"name", name,
NULL));
}
......
......@@ -68,7 +68,7 @@ struct _GVirSandboxConfigGraphicalSize
GType gvir_sandbox_config_graphical_get_type(void);
GType gvir_sandbox_config_graphical_size_get_type(void);
GVirSandboxConfigGraphical *gvir_sandbox_config_graphical_new(void);
GVirSandboxConfigGraphical *gvir_sandbox_config_graphical_new(const gchar *name);
void gvir_sandbox_config_graphical_set_window_manager(GVirSandboxConfigGraphical *config, const gchar *hostpath);
const gchar *gvir_sandbox_config_graphical_get_window_manager(GVirSandboxConfigGraphical *config);
......
This diff is collapsed.
/*
* libvirt-sandbox-config-interactive.h: libvirt sandbox configuration
*
* Copyright (C) 2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author: Daniel P. Berrange <berrange@redhat.com>
*/
#if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD)
#error "Only <libvirt-sandbox/libvirt-sandbox.h> can be included directly."
#endif
#ifndef __LIBVIRT_SANDBOX_CONFIG_INTERACTIVE_H__
#define __LIBVIRT_SANDBOX_CONFIG_INTERACTIVE_H__
G_BEGIN_DECLS
#define GVIR_SANDBOX_TYPE_CONFIG_INTERACTIVE (gvir_sandbox_config_interactive_get_type ())
#define GVIR_SANDBOX_CONFIG_INTERACTIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONFIG_INTERACTIVE, GVirSandboxConfigInteractive))
#define GVIR_SANDBOX_CONFIG_INTERACTIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONFIG_INTERACTIVE, GVirSandboxConfigInteractiveClass))
#define GVIR_SANDBOX_IS_CONFIG_INTERACTIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONFIG_INTERACTIVE))
#define GVIR_SANDBOX_IS_CONFIG_INTERACTIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG_INTERACTIVE))
#define GVIR_SANDBOX_CONFIG_INTERACTIVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG_INTERACTIVE, GVirSandboxConfigInteractiveClass))
typedef struct _GVirSandboxConfigInteractive GVirSandboxConfigInteractive;
typedef struct _GVirSandboxConfigInteractivePrivate GVirSandboxConfigInteractivePrivate;
typedef struct _GVirSandboxConfigInteractiveClass GVirSandboxConfigInteractiveClass;
struct _GVirSandboxConfigInteractive
{
GVirSandboxConfig parent;
GVirSandboxConfigInteractivePrivate *priv;
/* Do not add fields to this struct */
};
struct _GVirSandboxConfigInteractiveClass
{
GVirSandboxConfigClass parent_class;
};
GType gvir_sandbox_config_interactive_get_type(void);
GVirSandboxConfigInteractive *gvir_sandbox_config_interactive_new(const gchar *name);
void gvir_sandbox_config_interactive_set_tty(GVirSandboxConfigInteractive *config, gboolean tty);
gboolean gvir_sandbox_config_interactive_get_tty(GVirSandboxConfigInteractive *config);
void gvir_sandbox_config_interactive_set_command(GVirSandboxConfigInteractive *config, gchar **argv);
gchar **gvir_sandbox_config_interactive_get_command(GVirSandboxConfigInteractive *config);
G_END_DECLS
#endif /* __LIBVIRT_SANDBOX_CONFIG_INTERACTIVE_H__ */
/*
* libvirt-sandbox-config-service.c: libvirt sandbox configuration
*
* Copyright (C) 2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author: Daniel P. Berrange <berrange@redhat.com>
*/
#include <config.h>
#include <string.h>
#include "libvirt-sandbox/libvirt-sandbox.h"
/**
* SECTION: libvirt-sandbox-config-service
* @short_description: Service sandbox configuration details
* @include: libvirt-sandbox/libvirt-sandbox.h
* @see_also: #GVirSandboxConfigService
*
* Provides an object to store configuration details for a service config
*
* The GVirSandboxConfigService object extends #GVirSandboxConfig to store
* the extra information required to setup a service sandbox
*/
#define GVIR_SANDBOX_CONFIG_SERVICE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_SANDBOX_TYPE_CONFIG_SERVICE, GVirSandboxConfigServicePrivate))
struct _GVirSandboxConfigServicePrivate
{
gchar *unit;
gchar *executable;
};
G_DEFINE_TYPE(GVirSandboxConfigService, gvir_sandbox_config_service, GVIR_SANDBOX_TYPE_CONFIG);
enum {
PROP_0,
PROP_UNIT,
PROP_EXECUTABLE,
};
enum {
LAST_SIGNAL
};
//static gint signals[LAST_SIGNAL];
static void gvir_sandbox_config_service_get_property(GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GVirSandboxConfigService *config = GVIR_SANDBOX_CONFIG_SERVICE(object);
GVirSandboxConfigServicePrivate *priv = config->priv;
switch (prop_id) {
case PROP_UNIT:
g_value_set_string(value, priv->unit);
break;
case PROP_EXECUTABLE:
g_value_set_string(value, priv->executable);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
}
}
static void gvir_sandbox_config_service_set_property(GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GVirSandboxConfigService *config = GVIR_SANDBOX_CONFIG_SERVICE(object);
GVirSandboxConfigServicePrivate *priv = config->priv;
switch (prop_id) {
case PROP_UNIT:
g_free(priv->unit);
priv->unit = g_value_dup_string(value);
break;
case PROP_EXECUTABLE:
g_free(priv->executable);
priv->executable = g_value_dup_string(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
}
}
static gboolean gvir_sandbox_config_service_load_config(GVirSandboxConfig *config,
GKeyFile *file,
GError **error)
{
GVirSandboxConfigServicePrivate *priv = GVIR_SANDBOX_CONFIG_SERVICE(config)->priv;
gboolean ret = FALSE;
gchar *str;
if (!GVIR_SANDBOX_CONFIG_CLASS(gvir_sandbox_config_service_parent_class)
->load_config(config, file, error))
goto cleanup;
if ((str = g_key_file_get_string(file, "service", "executable", NULL)) != NULL) {
g_free(priv->executable);
priv->executable = str;
}
if ((str = g_key_file_get_string(file, "service", "unit", NULL)) != NULL) {
g_free(priv->unit);
priv->unit = str;
}
ret = TRUE;
cleanup:
return ret;
}
static void gvir_sandbox_config_service_save_config(GVirSandboxConfig *config,
GKeyFile *file)
{
GVirSandboxConfigServicePrivate *priv = GVIR_SANDBOX_CONFIG_SERVICE(config)->priv;
GVIR_SANDBOX_CONFIG_CLASS(gvir_sandbox_config_service_parent_class)
->save_config(config, file);
if (priv->executable)
g_key_file_set_string(file, "service", "executable", priv->executable);
if (priv->unit)
g_key_file_set_string(file, "service", "unit", priv->unit);
}
static void gvir_sandbox_config_service_finalize(GObject *object)
{
GVirSandboxConfigService *config = GVIR_SANDBOX_CONFIG_SERVICE(object);
GVirSandboxConfigServicePrivate *priv = config->priv;
g_free(priv->unit);
g_free(priv->executable);
G_OBJECT_CLASS(gvir_sandbox_config_service_parent_class)->finalize(object);
}
static void gvir_sandbox_config_service_class_init(GVirSandboxConfigServiceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS(klass);
GVirSandboxConfigClass *config_class = GVIR_SANDBOX_CONFIG_CLASS(klass);
object_class->finalize = gvir_sandbox_config_service_finalize;
object_class->get_property = gvir_sandbox_config_service_get_property;
object_class->set_property = gvir_sandbox_config_service_set_property;
config_class->load_config = gvir_sandbox_config_service_load_config;
config_class->save_config = gvir_sandbox_config_service_save_config;
g_object_class_install_property(object_class,
PROP_UNIT,
g_param_spec_string("unit",
"Unit",
"The systemd unit name",
NULL,
G_PARAM_READABLE |
G_PARAM_WRITABLE |
G_PARAM_STATIC_NAME |
G_PARAM_STATIC_NICK |
G_PARAM_STATIC_BLURB));
g_object_class_install_property(object_class,
PROP_EXECUTABLE,
g_param_spec_string("executable",
"Executable",
"The executable name path",
NULL,
G_PARAM_READABLE |
G_PARAM_WRITABLE |
G_PARAM_STATIC_NAME |
G_PARAM_STATIC_NICK |
G_PARAM_STATIC_BLURB));
g_type_class_add_private(klass, sizeof(GVirSandboxConfigServicePrivate));
}
static void gvir_sandbox_config_service_init(GVirSandboxConfigService *config)
{
config->priv = GVIR_SANDBOX_CONFIG_SERVICE_GET_PRIVATE(config);
}
/**
* gvir_sandbox_config_service_new:
* @name: the sandbox name
*
* Create a new service application sandbox configuration
*
* Returns: (transfer full): a new service sandbox config object
*/
GVirSandboxConfigService *gvir_sandbox_config_service_new(const gchar *name)
{
return GVIR_SANDBOX_CONFIG_SERVICE(g_object_new(GVIR_SANDBOX_TYPE_CONFIG_SERVICE,
"name", name,
NULL));
}
const char *gvir_sandbox_config_service_get_unit(GVirSandboxConfigService *config)
{
GVirSandboxConfigServicePrivate *priv = config->priv;
return priv->unit;
}
void gvir_sandbox_config_service_set_unit(GVirSandboxConfigService *config,
const gchar *unit)
{
GVirSandboxConfigServicePrivate *priv = config->priv;
g_free(priv->unit);
priv->unit = g_strdup(unit);
}
const char *gvir_sandbox_config_service_get_executable(GVirSandboxConfigService *config)
{
GVirSandboxConfigServicePrivate *priv = config->priv;
return priv->executable;
}
void gvir_sandbox_config_service_set_executable(GVirSandboxConfigService *config,
const gchar *executable)
{
GVirSandboxConfigServicePrivate *priv = config->priv;
g_free(priv->executable);
priv->executable = g_strdup(executable);
}
/*
* libvirt-sandbox-config-service.h: libvirt sandbox configuration
*
* Copyright (C) 2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author: Daniel P. Berrange <berrange@redhat.com>
*/
#if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD)
#error "Only <libvirt-sandbox/libvirt-sandbox.h> can be included directly."
#endif
#ifndef __LIBVIRT_SANDBOX_CONFIG_SERVICE_H__
#define __LIBVIRT_SANDBOX_CONFIG_SERVICE_H__
G_BEGIN_DECLS
#define GVIR_SANDBOX_TYPE_CONFIG_SERVICE (gvir_sandbox_config_service_get_type ())
#define GVIR_SANDBOX_CONFIG_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONFIG_SERVICE, GVirSandboxConfigService))
#define GVIR_SANDBOX_CONFIG_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONFIG_SERVICE, GVirSandboxConfigServiceClass))
#define GVIR_SANDBOX_IS_CONFIG_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONFIG_SERVICE))
#define GVIR_SANDBOX_IS_CONFIG_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG_SERVICE))
#define GVIR_SANDBOX_CONFIG_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG_SERVICE, GVirSandboxConfigServiceClass))
typedef struct _GVirSandboxConfigService GVirSandboxConfigService;
typedef struct _GVirSandboxConfigServicePrivate GVirSandboxConfigServicePrivate;
typedef struct _GVirSandboxConfigServiceClass GVirSandboxConfigServiceClass;
struct _GVirSandboxConfigService
{
GVirSandboxConfig parent;
GVirSandboxConfigServicePrivate *priv;
/* Do not add fields to this struct */
};
struct _GVirSandboxConfigServiceClass
{
GVirSandboxConfigClass parent_class;
};
GType gvir_sandbox_config_service_get_type(void);
GVirSandboxConfigService *gvir_sandbox_config_service_new(const gchar *name);
const char *gvir_sandbox_config_service_get_unit(GVirSandboxConfigService *config);
void gvir_sandbox_config_service_set_unit(GVirSandboxConfigService *config,
const gchar *unit);
const char *gvir_sandbox_config_service_get_executable(GVirSandboxConfigService *config);
void gvir_sandbox_config_service_set_executable(GVirSandboxConfigService *config,
const gchar *exe);
G_END_DECLS
#endif /* __LIBVIRT_SANDBOX_CONFIG_SERVICE_H__ */
This diff is collapsed.
......@@ -36,8 +36,6 @@ G_BEGIN_DECLS
#define GVIR_SANDBOX_IS_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG))
#define GVIR_SANDBOX_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG, GVirSandboxConfigClass))
#define GVIR_SANDBOX_TYPE_CONFIG_HANDLE (gvir_sandbox_config_handle_get_type ())
typedef struct _GVirSandboxConfig GVirSandboxConfig;
typedef struct _GVirSandboxConfigPrivate GVirSandboxConfigPrivate;
typedef struct _GVirSandboxConfigClass GVirSandboxConfigClass;
......@@ -64,14 +62,11 @@ struct _GVirSandboxConfigClass
GType gvir_sandbox_config_get_type(void);
GVirSandboxConfig *gvir_sandbox_config_new(const gchar *name);
gboolean gvir_sandbox_config_load_path(GVirSandboxConfig *config,
const gchar *path,
GError **error);
gboolean gvir_sandbox_config_save_path(GVirSandboxConfig *config,
const gchar *path,
GError **error);
GVirSandboxConfig *gvir_sandbox_config_load_from_path(const gchar *path,
GError **error);
gboolean gvir_sandbox_config_save_to_path(GVirSandboxConfig *config,
const gchar *path,
GError **error);
const gchar *gvir_sandbox_config_get_name(GVirSandboxConfig *config);
......@@ -81,9 +76,6 @@ 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_tty(GVirSandboxConfig *config, gboolean tty);
gboolean gvir_sandbox_config_get_tty(GVirSandboxConfig *config);
void gvir_sandbox_config_set_shell(GVirSandboxConfig *config, gboolean shell);
gboolean gvir_sandbox_config_get_shell(GVirSandboxConfig *config);
......@@ -144,9 +136,6 @@ gboolean gvir_sandbox_config_add_host_include_file(GVirSandboxConfig *config,
gchar *includefile,
GError **error);
void gvir_sandbox_config_set_command(GVirSandboxConfig *config, gchar **argv);
gchar **gvir_sandbox_config_get_command(GVirSandboxConfig *config);
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);
......
/*
* libvirt-sandbox-context-graphical.c: libvirt sandbox contexturation
* libvirt-sandbox-context-graphical.c: libvirt sandbox graphical context
*
* Copyright (C) 2011 Red Hat, Inc.
*
......@@ -135,7 +135,7 @@ static void gvir_sandbox_context_graphical_init(GVirSandboxContextGraphical *con
* Returns: (transfer full): a new graphical sandbox context object
*/
GVirSandboxContextGraphical *gvir_sandbox_context_graphical_new(GVirConnection *connection,
GVirSandboxConfig *config)
GVirSandboxConfigGraphical *config)
{
return GVIR_SANDBOX_CONTEXT_GRAPHICAL(g_object_new(GVIR_SANDBOX_TYPE_CONTEXT_GRAPHICAL,
"connection", connection,
......
/*
* libvirt-sandbox-context-graphical.h: libvirt sandbox contexturation
* libvirt-sandbox-context-graphical.h: libvirt sandbox graphical context
*
* Copyright (C) 2011 Red Hat, Inc.
*
......@@ -58,7 +58,7 @@ struct _GVirSandboxContextGraphicalClass
GType gvir_sandbox_context_graphical_get_type(void);
GVirSandboxContextGraphical *gvir_sandbox_context_graphical_new(GVirConnection *connection,
GVirSandboxConfig *config);
GVirSandboxConfigGraphical *config);