[libvirt] [PATCH libvirt-glib 0/5] More APIs in libvirt-gconfig

This adds support for - <filesystem> - <display/> type=vnc|sdl - <os> kernel, ramdisk, cmdline & init child elements - Top level virt type - Fixed a bug with NULL URIs in GVirConnection

From: "Daniel P. Berrange" <berrange@redhat.com> Create a new GVirConfigDomainFilesys object for dealing with the <filesystem> element. * libvirt-gconfig-domain-filesys.c, libvirt-gconfig-domain-filesys.h, Makefile.am, libvirt-gconfig.sym, libvirt-gconfig.h: New GVirConfigDomainFilesys object * libvirt-gconfig-object.c, libvirt-gconfig-object-private.h: Add gvir_config_object_delete_node for removing an XML node --- libvirt-gconfig/Makefile.am | 2 + libvirt-gconfig/libvirt-gconfig-domain-filesys.c | 181 ++++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-filesys.h | 98 ++++++++++++ libvirt-gconfig/libvirt-gconfig-object-private.h | 2 + libvirt-gconfig/libvirt-gconfig-object.c | 25 +++ libvirt-gconfig/libvirt-gconfig.h | 1 + libvirt-gconfig/libvirt-gconfig.sym | 13 ++ 7 files changed, 322 insertions(+), 0 deletions(-) create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-filesys.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-filesys.h diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am index 1879186..2c8c2a5 100644 --- a/libvirt-gconfig/Makefile.am +++ b/libvirt-gconfig/Makefile.am @@ -16,6 +16,7 @@ GCONFIG_HEADER_FILES = \ libvirt-gconfig-domain-clock.h \ libvirt-gconfig-domain-device.h \ libvirt-gconfig-domain-disk.h \ + libvirt-gconfig-domain-filesys.h \ libvirt-gconfig-domain-graphics.h \ libvirt-gconfig-domain-graphics-spice.h \ libvirt-gconfig-domain-input.h \ @@ -45,6 +46,7 @@ GCONFIG_SOURCE_FILES = \ libvirt-gconfig-domain-clock.c \ libvirt-gconfig-domain-device.c \ libvirt-gconfig-domain-disk.c \ + libvirt-gconfig-domain-filesys.c \ libvirt-gconfig-domain-graphics.c \ libvirt-gconfig-domain-graphics-spice.c \ libvirt-gconfig-domain-input.c \ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-filesys.c b/libvirt-gconfig/libvirt-gconfig-domain-filesys.c new file mode 100644 index 0000000..6aa7f02 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-filesys.c @@ -0,0 +1,181 @@ +/* + * libvirt-gobject-config-domain-filesys.c: libvirt glib integration + * + * Copyright (C) 2011 Red Hat + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@gmail.com> + */ + +#include <config.h> + +#include <string.h> + +#include <libxml/tree.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h" +#include "libvirt-gconfig/libvirt-gconfig-object-private.h" + +#define GVIR_CONFIG_DOMAIN_FILESYS_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_FILESYS, GVirConfigDomainFilesysPrivate)) + +struct _GVirConfigDomainFilesysPrivate +{ + GVirConfigDomainFilesysType type; +}; + +G_DEFINE_TYPE(GVirConfigDomainFilesys, gvir_config_domain_filesys, GVIR_TYPE_CONFIG_DOMAIN_DEVICE); + + +static void gvir_config_domain_filesys_class_init(GVirConfigDomainFilesysClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigDomainFilesysPrivate)); +} + + +static void gvir_config_domain_filesys_init(GVirConfigDomainFilesys *filesys) +{ + g_debug("Init GVirConfigDomainFilesys=%p", filesys); + + filesys->priv = GVIR_CONFIG_DOMAIN_FILESYS_GET_PRIVATE(filesys); +} + + +GVirConfigDomainFilesys *gvir_config_domain_filesys_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_FILESYS, + "filesystem", NULL); + return GVIR_CONFIG_DOMAIN_FILESYS(object); +} + +GVirConfigDomainFilesys *gvir_config_domain_filesys_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_FILESYS, + "filesystem", NULL, xml, error); + return GVIR_CONFIG_DOMAIN_FILESYS(object); +} + +void gvir_config_domain_filesys_set_type(GVirConfigDomainFilesys *filesys, + GVirConfigDomainFilesysType type) +{ + xmlNodePtr node; + const char *type_str; + + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_FILESYS(filesys)); + + node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(filesys)); + g_return_if_fail(node != NULL); + type_str = gvir_config_genum_get_nick(GVIR_TYPE_CONFIG_DOMAIN_FILESYS_TYPE, + type); + g_return_if_fail(type_str != NULL); + xmlNewProp(node, (xmlChar*)"type", (xmlChar*)type_str); + filesys->priv->type = type; +} + +void gvir_config_domain_filesys_set_access_type(GVirConfigDomainFilesys *filesys, + GVirConfigDomainFilesysAccessType type) +{ + xmlNodePtr node; + const char *type_str; + + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_FILESYS(filesys)); + + node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(filesys)); + g_return_if_fail(node != NULL); + type_str = gvir_config_genum_get_nick(GVIR_TYPE_CONFIG_DOMAIN_FILESYS_ACCESS_TYPE, + type); + g_return_if_fail(type_str != NULL); + xmlNewProp(node, (xmlChar*)"accesmode", (xmlChar*)type_str); +} + +void gvir_config_domain_filesys_set_driver_type(GVirConfigDomainFilesys *filesys, + GVirConfigDomainFilesysDriverType type) +{ + GVirConfigObject *node; + + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_FILESYS(filesys)); + node = gvir_config_object_add_child(GVIR_CONFIG_OBJECT(filesys), "driver"); + g_return_if_fail(GVIR_IS_CONFIG_OBJECT(node)); + if (type != GVIR_CONFIG_DOMAIN_FILESYS_DRIVER_DEFAULT) + gvir_config_object_set_attribute_with_type( + node, "type", + GVIR_TYPE_CONFIG_DOMAIN_FILESYS_DRIVER_TYPE, + type, NULL); + /* else XXX delete existing attribute ? */ + g_object_unref(G_OBJECT(node)); +} + +void gvir_config_domain_filesys_set_source(GVirConfigDomainFilesys *filesys, + const char *source) +{ + GVirConfigObject *source_node; + const char *attribute_name; + + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_FILESYS(filesys)); + source_node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(filesys), + "source"); + g_return_if_fail(source_node != NULL); + + switch (filesys->priv->type) { + case GVIR_CONFIG_DOMAIN_FILESYS_MOUNT: + attribute_name = "dir"; + break; + case GVIR_CONFIG_DOMAIN_FILESYS_FILE: + attribute_name = "file"; + break; + case GVIR_CONFIG_DOMAIN_FILESYS_BLOCK: + attribute_name = "dev"; + break; + case GVIR_CONFIG_DOMAIN_FILESYS_TEMPLATE: + attribute_name = "name"; + break; + default: + g_return_if_reached(); + } + + gvir_config_object_set_attribute(source_node, + attribute_name, source, + NULL); + g_object_unref(G_OBJECT(source_node)); +} + + +void gvir_config_domain_filesys_set_target(GVirConfigDomainFilesys *filesys, + const char *path) +{ + GVirConfigObject *node; + + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_FILESYS(filesys)); + node = gvir_config_object_add_child(GVIR_CONFIG_OBJECT(filesys), "target"); + g_return_if_fail(GVIR_IS_CONFIG_OBJECT(node)); + gvir_config_object_set_attribute(node, "dir", path, NULL); + g_object_unref(G_OBJECT(node)); +} + +void gvir_config_domain_filesys_set_readonly(GVirConfigDomainFilesys *filesys, + gboolean readonly) +{ + if (readonly) + gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(filesys), "readonly"); + else + gvir_config_object_delete_child(GVIR_CONFIG_OBJECT(filesys), "readonly"); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-filesys.h b/libvirt-gconfig/libvirt-gconfig-domain-filesys.h new file mode 100644 index 0000000..bfb98df --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-filesys.h @@ -0,0 +1,98 @@ +/* + * libvirt-gobject-domain-filesys.c: libvirt gobject integration + * + * Copyright (C) 2011 Red Hat + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@gmail.com> + */ + +#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD) +#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly." +#endif + +#ifndef __LIBVIRT_GCONFIG_DOMAIN_FILESYS_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_FILESYS_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_DOMAIN_FILESYS (gvir_config_domain_filesys_get_type ()) +#define GVIR_CONFIG_DOMAIN_FILESYS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_FILESYS, GVirConfigDomainFilesys)) +#define GVIR_CONFIG_DOMAIN_FILESYS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_FILESYS, GVirConfigDomainFilesysClass)) +#define GVIR_IS_CONFIG_DOMAIN_FILESYS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_FILESYS)) +#define GVIR_IS_CONFIG_DOMAIN_FILESYS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_FILESYS)) +#define GVIR_CONFIG_DOMAIN_FILESYS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_FILESYS, GVirConfigDomainFilesysClass)) + +typedef struct _GVirConfigDomainFilesys GVirConfigDomainFilesys; +typedef struct _GVirConfigDomainFilesysPrivate GVirConfigDomainFilesysPrivate; +typedef struct _GVirConfigDomainFilesysClass GVirConfigDomainFilesysClass; + +struct _GVirConfigDomainFilesys +{ + GVirConfigDomainDevice parent; + + GVirConfigDomainFilesysPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigDomainFilesysClass +{ + GVirConfigDomainDeviceClass parent_class; + + gpointer padding[20]; +}; + +typedef enum { + GVIR_CONFIG_DOMAIN_FILESYS_MOUNT, + GVIR_CONFIG_DOMAIN_FILESYS_BLOCK, + GVIR_CONFIG_DOMAIN_FILESYS_FILE, + GVIR_CONFIG_DOMAIN_FILESYS_TEMPLATE, +} GVirConfigDomainFilesysType; + +typedef enum { + GVIR_CONFIG_DOMAIN_FILESYS_ACCESS_PASSTHROUGH, + GVIR_CONFIG_DOMAIN_FILESYS_ACCESS_MAPPED, + GVIR_CONFIG_DOMAIN_FILESYS_ACCESS_SQUASHED, +} GVirConfigDomainFilesysAccessType; + +typedef enum { + GVIR_CONFIG_DOMAIN_FILESYS_DRIVER_DEFAULT, + GVIR_CONFIG_DOMAIN_FILESYS_DRIVER_PATH, + GVIR_CONFIG_DOMAIN_FILESYS_DRIVER_HANDLE, +} GVirConfigDomainFilesysDriverType; + +GType gvir_config_domain_filesys_get_type(void); + +GVirConfigDomainFilesys *gvir_config_domain_filesys_new(void); +GVirConfigDomainFilesys *gvir_config_domain_filesys_new_from_xml(const gchar *xml, + GError **error); + +void gvir_config_domain_filesys_set_type(GVirConfigDomainFilesys *filesys, + GVirConfigDomainFilesysType type); +void gvir_config_domain_filesys_set_access_type(GVirConfigDomainFilesys *filesys, + GVirConfigDomainFilesysAccessType type); +void gvir_config_domain_filesys_set_driver_type(GVirConfigDomainFilesys *filesys, + GVirConfigDomainFilesysDriverType type); +void gvir_config_domain_filesys_set_source(GVirConfigDomainFilesys *filesys, + const char *source); +void gvir_config_domain_filesys_set_target(GVirConfigDomainFilesys *filesys, + const char *target); +void gvir_config_domain_filesys_set_readonly(GVirConfigDomainFilesys *filesys, + gboolean readonly); +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_FILESYS_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig-object-private.h b/libvirt-gconfig/libvirt-gconfig-object-private.h index f196be6..c564ac5 100644 --- a/libvirt-gconfig/libvirt-gconfig-object-private.h +++ b/libvirt-gconfig/libvirt-gconfig-object-private.h @@ -39,6 +39,8 @@ GVirConfigObject *gvir_config_object_add_child(GVirConfigObject *object, const char *child_name); GVirConfigObject *gvir_config_object_replace_child(GVirConfigObject *object, const char *child_name); +void gvir_config_object_delete_child(GVirConfigObject *object, + const char *child_name); void gvir_config_object_set_child(GVirConfigObject *object, xmlNodePtr child); diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c index 902e014..7fb1d4f 100644 --- a/libvirt-gconfig/libvirt-gconfig-object.c +++ b/libvirt-gconfig/libvirt-gconfig-object.c @@ -380,6 +380,31 @@ gvir_config_object_replace_child(GVirConfigObject *object, NULL)); } + +G_GNUC_INTERNAL void +gvir_config_object_delete_child(GVirConfigObject *object, + const char *child_name) +{ + xmlNodePtr parent_node; + xmlNodePtr old_node; + + g_return_if_fail(GVIR_IS_CONFIG_OBJECT(object)); + g_return_if_fail(child_name != NULL); + + parent_node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(object)); + g_return_if_fail (parent_node != NULL); + + if (!(old_node = gvir_config_xml_get_element(parent_node, child_name, NULL))) + return; + + /* FIXME: should we make sure there are no multiple occurrences + * of this node? + */ + xmlUnlinkNode(old_node); + xmlFreeNode(old_node); +} + + G_GNUC_INTERNAL void gvir_config_object_set_node_content(GVirConfigObject *object, const char *node_name, diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h index ad9f59a..ed7623c 100644 --- a/libvirt-gconfig/libvirt-gconfig.h +++ b/libvirt-gconfig/libvirt-gconfig.h @@ -33,6 +33,7 @@ #include <libvirt-gconfig/libvirt-gconfig-domain-clock.h> #include <libvirt-gconfig/libvirt-gconfig-domain-device.h> #include <libvirt-gconfig/libvirt-gconfig-domain-disk.h> +#include <libvirt-gconfig/libvirt-gconfig-domain-filesys.h> #include <libvirt-gconfig/libvirt-gconfig-domain-graphics.h> #include <libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h> #include <libvirt-gconfig/libvirt-gconfig-domain-input.h> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 9da3933..3ad7b1f 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -47,6 +47,19 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_domain_disk_set_target_dev; gvir_config_domain_disk_set_type; + gvir_config_domain_filesys_get_type; + gvir_config_domain_filesys_type_get_type; + gvir_config_domain_filesys_access_type_get_type; + gvir_config_domain_filesys_driver_type_get_type; + gvir_config_domain_filesys_new; + gvir_config_domain_filesys_new_from_xml; + gvir_config_domain_filesys_set_access_type; + gvir_config_domain_filesys_set_driver_type; + gvir_config_domain_filesys_set_readonly; + gvir_config_domain_filesys_set_source; + gvir_config_domain_filesys_set_target; + gvir_config_domain_filesys_set_type; + gvir_config_domain_graphics_get_type; gvir_config_domain_graphics_spice_get_type; -- 1.7.6.4

Hi, There's a typo in the subject "su*p*port" On Wed, Nov 30, 2011 at 04:52:03PM +0000, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Create a new GVirConfigDomainFilesys object for dealing with the <filesystem> element.
* libvirt-gconfig-domain-filesys.c, libvirt-gconfig-domain-filesys.h, Makefile.am, libvirt-gconfig.sym, libvirt-gconfig.h: New GVirConfigDomainFilesys object * libvirt-gconfig-object.c, libvirt-gconfig-object-private.h: Add gvir_config_object_delete_node for removing an XML node --- libvirt-gconfig/Makefile.am | 2 + libvirt-gconfig/libvirt-gconfig-domain-filesys.c | 181 ++++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-filesys.h | 98 ++++++++++++ libvirt-gconfig/libvirt-gconfig-object-private.h | 2 + libvirt-gconfig/libvirt-gconfig-object.c | 25 +++ libvirt-gconfig/libvirt-gconfig.h | 1 + libvirt-gconfig/libvirt-gconfig.sym | 13 ++ 7 files changed, 322 insertions(+), 0 deletions(-) create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-filesys.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-filesys.h
diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am index 1879186..2c8c2a5 100644 --- a/libvirt-gconfig/Makefile.am +++ b/libvirt-gconfig/Makefile.am @@ -16,6 +16,7 @@ GCONFIG_HEADER_FILES = \ libvirt-gconfig-domain-clock.h \ libvirt-gconfig-domain-device.h \ libvirt-gconfig-domain-disk.h \ + libvirt-gconfig-domain-filesys.h \ libvirt-gconfig-domain-graphics.h \ libvirt-gconfig-domain-graphics-spice.h \ libvirt-gconfig-domain-input.h \ @@ -45,6 +46,7 @@ GCONFIG_SOURCE_FILES = \ libvirt-gconfig-domain-clock.c \ libvirt-gconfig-domain-device.c \ libvirt-gconfig-domain-disk.c \ + libvirt-gconfig-domain-filesys.c \ libvirt-gconfig-domain-graphics.c \ libvirt-gconfig-domain-graphics-spice.c \ libvirt-gconfig-domain-input.c \ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-filesys.c b/libvirt-gconfig/libvirt-gconfig-domain-filesys.c new file mode 100644 index 0000000..6aa7f02 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-filesys.c
I'd go with fs rather than filesys, but I'm fine with filesys if you feel it's a better name.
@@ -0,0 +1,181 @@ +/* + * libvirt-gobject-config-domain-filesys.c: libvirt glib integration + * + * Copyright (C) 2011 Red Hat + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@gmail.com>
Ah, I must have written this during my nap after lunch :)
+ */ + +#include <config.h> + +#include <string.h> + +#include <libxml/tree.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h" +#include "libvirt-gconfig/libvirt-gconfig-object-private.h" + +#define GVIR_CONFIG_DOMAIN_FILESYS_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_FILESYS, GVirConfigDomainFilesysPrivate)) + +struct _GVirConfigDomainFilesysPrivate +{ + GVirConfigDomainFilesysType type; +}; + +G_DEFINE_TYPE(GVirConfigDomainFilesys, gvir_config_domain_filesys, GVIR_TYPE_CONFIG_DOMAIN_DEVICE); + + +static void gvir_config_domain_filesys_class_init(GVirConfigDomainFilesysClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigDomainFilesysPrivate)); +} + + +static void gvir_config_domain_filesys_init(GVirConfigDomainFilesys *filesys) +{ + g_debug("Init GVirConfigDomainFilesys=%p", filesys); + + filesys->priv = GVIR_CONFIG_DOMAIN_FILESYS_GET_PRIVATE(filesys); +} + + +GVirConfigDomainFilesys *gvir_config_domain_filesys_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_FILESYS, + "filesystem", NULL); + return GVIR_CONFIG_DOMAIN_FILESYS(object); +} + +GVirConfigDomainFilesys *gvir_config_domain_filesys_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_FILESYS, + "filesystem", NULL, xml, error); + return GVIR_CONFIG_DOMAIN_FILESYS(object); +} + +void gvir_config_domain_filesys_set_type(GVirConfigDomainFilesys *filesys, + GVirConfigDomainFilesysType type) +{ + xmlNodePtr node; + const char *type_str; + + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_FILESYS(filesys)); + + node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(filesys)); + g_return_if_fail(node != NULL); + type_str = gvir_config_genum_get_nick(GVIR_TYPE_CONFIG_DOMAIN_FILESYS_TYPE, + type); + g_return_if_fail(type_str != NULL); + xmlNewProp(node, (xmlChar*)"type", (xmlChar*)type_str); + filesys->priv->type = type;
gvir_config_object_set_attribute_with_type should work here
+} + +void gvir_config_domain_filesys_set_access_type(GVirConfigDomainFilesys *filesys, + GVirConfigDomainFilesysAccessType type) +{ + xmlNodePtr node; + const char *type_str; + + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_FILESYS(filesys)); + + node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(filesys)); + g_return_if_fail(node != NULL); + type_str = gvir_config_genum_get_nick(GVIR_TYPE_CONFIG_DOMAIN_FILESYS_ACCESS_TYPE, + type); + g_return_if_fail(type_str != NULL); + xmlNewProp(node, (xmlChar*)"accesmode", (xmlChar*)type_str);
and here too
+} + +void gvir_config_domain_filesys_set_driver_type(GVirConfigDomainFilesys *filesys, + GVirConfigDomainFilesysDriverType type) +{ + GVirConfigObject *node; + + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_FILESYS(filesys)); + node = gvir_config_object_add_child(GVIR_CONFIG_OBJECT(filesys), "driver"); + g_return_if_fail(GVIR_IS_CONFIG_OBJECT(node)); + if (type != GVIR_CONFIG_DOMAIN_FILESYS_DRIVER_DEFAULT) + gvir_config_object_set_attribute_with_type( + node, "type", + GVIR_TYPE_CONFIG_DOMAIN_FILESYS_DRIVER_TYPE, + type, NULL); + /* else XXX delete existing attribute ? */ + g_object_unref(G_OBJECT(node)); +} + +void gvir_config_domain_filesys_set_source(GVirConfigDomainFilesys *filesys, + const char *source) +{ + GVirConfigObject *source_node; + const char *attribute_name; + + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_FILESYS(filesys)); + source_node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(filesys), + "source"); + g_return_if_fail(source_node != NULL); + + switch (filesys->priv->type) { + case GVIR_CONFIG_DOMAIN_FILESYS_MOUNT: + attribute_name = "dir"; + break; + case GVIR_CONFIG_DOMAIN_FILESYS_FILE: + attribute_name = "file"; + break; + case GVIR_CONFIG_DOMAIN_FILESYS_BLOCK: + attribute_name = "dev"; + break; + case GVIR_CONFIG_DOMAIN_FILESYS_TEMPLATE: + attribute_name = "name"; + break; + default: + g_return_if_reached(); + } + + gvir_config_object_set_attribute(source_node, + attribute_name, source, + NULL); + g_object_unref(G_OBJECT(source_node)); +} + + +void gvir_config_domain_filesys_set_target(GVirConfigDomainFilesys *filesys, + const char *path) +{ + GVirConfigObject *node; + + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_FILESYS(filesys)); + node = gvir_config_object_add_child(GVIR_CONFIG_OBJECT(filesys), "target"); + g_return_if_fail(GVIR_IS_CONFIG_OBJECT(node)); + gvir_config_object_set_attribute(node, "dir", path, NULL); + g_object_unref(G_OBJECT(node)); +} + +void gvir_config_domain_filesys_set_readonly(GVirConfigDomainFilesys *filesys, + gboolean readonly) +{ + if (readonly) + gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(filesys), "readonly");
You need to unref _replace_child return value
+ else + gvir_config_object_delete_child(GVIR_CONFIG_OBJECT(filesys), "readonly"); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-filesys.h b/libvirt-gconfig/libvirt-gconfig-domain-filesys.h new file mode 100644 index 0000000..bfb98df --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-filesys.h @@ -0,0 +1,98 @@ +/* + * libvirt-gobject-domain-filesys.c: libvirt gobject integration
Nit, filesys.h
+ * + * Copyright (C) 2011 Red Hat + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@gmail.com>
I'm pleading non-guilty once again :)
+ */ + +#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD) +#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly." +#endif + +#ifndef __LIBVIRT_GCONFIG_DOMAIN_FILESYS_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_FILESYS_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_DOMAIN_FILESYS (gvir_config_domain_filesys_get_type ()) +#define GVIR_CONFIG_DOMAIN_FILESYS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_FILESYS, GVirConfigDomainFilesys)) +#define GVIR_CONFIG_DOMAIN_FILESYS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_FILESYS, GVirConfigDomainFilesysClass)) +#define GVIR_IS_CONFIG_DOMAIN_FILESYS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_FILESYS)) +#define GVIR_IS_CONFIG_DOMAIN_FILESYS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_FILESYS)) +#define GVIR_CONFIG_DOMAIN_FILESYS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_FILESYS, GVirConfigDomainFilesysClass)) + +typedef struct _GVirConfigDomainFilesys GVirConfigDomainFilesys; +typedef struct _GVirConfigDomainFilesysPrivate GVirConfigDomainFilesysPrivate; +typedef struct _GVirConfigDomainFilesysClass GVirConfigDomainFilesysClass; + +struct _GVirConfigDomainFilesys +{ + GVirConfigDomainDevice parent; + + GVirConfigDomainFilesysPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigDomainFilesysClass +{ + GVirConfigDomainDeviceClass parent_class; + + gpointer padding[20]; +}; + +typedef enum { + GVIR_CONFIG_DOMAIN_FILESYS_MOUNT, + GVIR_CONFIG_DOMAIN_FILESYS_BLOCK, + GVIR_CONFIG_DOMAIN_FILESYS_FILE, + GVIR_CONFIG_DOMAIN_FILESYS_TEMPLATE, +} GVirConfigDomainFilesysType; + +typedef enum { + GVIR_CONFIG_DOMAIN_FILESYS_ACCESS_PASSTHROUGH, + GVIR_CONFIG_DOMAIN_FILESYS_ACCESS_MAPPED, + GVIR_CONFIG_DOMAIN_FILESYS_ACCESS_SQUASHED, +} GVirConfigDomainFilesysAccessType; + +typedef enum { + GVIR_CONFIG_DOMAIN_FILESYS_DRIVER_DEFAULT, + GVIR_CONFIG_DOMAIN_FILESYS_DRIVER_PATH, + GVIR_CONFIG_DOMAIN_FILESYS_DRIVER_HANDLE, +} GVirConfigDomainFilesysDriverType; + +GType gvir_config_domain_filesys_get_type(void); + +GVirConfigDomainFilesys *gvir_config_domain_filesys_new(void); +GVirConfigDomainFilesys *gvir_config_domain_filesys_new_from_xml(const gchar *xml, + GError **error); + +void gvir_config_domain_filesys_set_type(GVirConfigDomainFilesys *filesys, + GVirConfigDomainFilesysType type); +void gvir_config_domain_filesys_set_access_type(GVirConfigDomainFilesys *filesys, + GVirConfigDomainFilesysAccessType type); +void gvir_config_domain_filesys_set_driver_type(GVirConfigDomainFilesys *filesys, + GVirConfigDomainFilesysDriverType type); +void gvir_config_domain_filesys_set_source(GVirConfigDomainFilesys *filesys, + const char *source); +void gvir_config_domain_filesys_set_target(GVirConfigDomainFilesys *filesys, + const char *target); +void gvir_config_domain_filesys_set_readonly(GVirConfigDomainFilesys *filesys, + gboolean readonly); +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_FILESYS_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig-object-private.h b/libvirt-gconfig/libvirt-gconfig-object-private.h index f196be6..c564ac5 100644 --- a/libvirt-gconfig/libvirt-gconfig-object-private.h +++ b/libvirt-gconfig/libvirt-gconfig-object-private.h @@ -39,6 +39,8 @@ GVirConfigObject *gvir_config_object_add_child(GVirConfigObject *object, const char *child_name); GVirConfigObject *gvir_config_object_replace_child(GVirConfigObject *object, const char *child_name); +void gvir_config_object_delete_child(GVirConfigObject *object, + const char *child_name); void gvir_config_object_set_child(GVirConfigObject *object, xmlNodePtr child);
diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c index 902e014..7fb1d4f 100644 --- a/libvirt-gconfig/libvirt-gconfig-object.c +++ b/libvirt-gconfig/libvirt-gconfig-object.c @@ -380,6 +380,31 @@ gvir_config_object_replace_child(GVirConfigObject *object, NULL)); }
+ +G_GNUC_INTERNAL void +gvir_config_object_delete_child(GVirConfigObject *object, + const char *child_name) +{ + xmlNodePtr parent_node; + xmlNodePtr old_node; + + g_return_if_fail(GVIR_IS_CONFIG_OBJECT(object)); + g_return_if_fail(child_name != NULL); + + parent_node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(object)); + g_return_if_fail (parent_node != NULL);
This is nitpicking but there's a space before (
+ + if (!(old_node = gvir_config_xml_get_element(parent_node, child_name, NULL))) + return; + + /* FIXME: should we make sure there are no multiple occurrences + * of this node? + */ + xmlUnlinkNode(old_node); + xmlFreeNode(old_node); +}
I think we will get memory corruption if this API is combined with _attach_child: device_node = gvir_config_object_new("device"); fs_node = gvir_config_object_new("fs"); gvir_config_object_attach(device_node, fs_node); gvir_config_object_delete_child(device_node, "fs"); g_object_unref(G_OBJECT(fs_node)); The xmlNodePtr held by fs_node will be freed twice, once by _delete_child and when _finalize runs after the call to g_object_unref Having each GVirConfigObject keep a list of its GVirConfigObject children would make it possible to handle this case I think. I'm fine with getting this function in even if there are known issues with it.
+ + G_GNUC_INTERNAL void gvir_config_object_set_node_content(GVirConfigObject *object, const char *node_name, diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h index ad9f59a..ed7623c 100644 --- a/libvirt-gconfig/libvirt-gconfig.h +++ b/libvirt-gconfig/libvirt-gconfig.h @@ -33,6 +33,7 @@ #include <libvirt-gconfig/libvirt-gconfig-domain-clock.h> #include <libvirt-gconfig/libvirt-gconfig-domain-device.h> #include <libvirt-gconfig/libvirt-gconfig-domain-disk.h> +#include <libvirt-gconfig/libvirt-gconfig-domain-filesys.h> #include <libvirt-gconfig/libvirt-gconfig-domain-graphics.h> #include <libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h> #include <libvirt-gconfig/libvirt-gconfig-domain-input.h> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 9da3933..3ad7b1f 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -47,6 +47,19 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_domain_disk_set_target_dev; gvir_config_domain_disk_set_type;
+ gvir_config_domain_filesys_get_type; + gvir_config_domain_filesys_type_get_type; + gvir_config_domain_filesys_access_type_get_type; + gvir_config_domain_filesys_driver_type_get_type; + gvir_config_domain_filesys_new; + gvir_config_domain_filesys_new_from_xml; + gvir_config_domain_filesys_set_access_type; + gvir_config_domain_filesys_set_driver_type; + gvir_config_domain_filesys_set_readonly; + gvir_config_domain_filesys_set_source; + gvir_config_domain_filesys_set_target; + gvir_config_domain_filesys_set_type; + gvir_config_domain_graphics_get_type;
gvir_config_domain_graphics_spice_get_type; -- 1.7.6.4
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On Wed, Nov 30, 2011 at 06:26:18PM +0100, Christophe Fergeau wrote:
+ + if (!(old_node = gvir_config_xml_get_element(parent_node, child_name, NULL))) + return; + + /* FIXME: should we make sure there are no multiple occurrences + * of this node? + */ + xmlUnlinkNode(old_node); + xmlFreeNode(old_node); +}
I think we will get memory corruption if this API is combined with _attach_child:
And I'm wrong since the whole point of the introduction of GVirConfigXmlDoc is to avoid this kind of memory corruption. However, in the example below, fs_node will have a reference to a GVirConfigXmlDoc which has no relation with its GVirConfigObject::node pointer, and this pointer will be pointing to already freed memory which is suboptimal.
device_node = gvir_config_object_new("device"); fs_node = gvir_config_object_new("fs"); gvir_config_object_attach(device_node, fs_node); gvir_config_object_delete_child(device_node, "fs"); g_object_unref(G_OBJECT(fs_node));
The xmlNodePtr held by fs_node will be freed twice, once by _delete_child and when _finalize runs after the call to g_object_unref
Having each GVirConfigObject keep a list of its GVirConfigObject children would make it possible to handle this case I think.
I'm fine with getting this function in even if there are known issues with it.
Christophe

From: "Daniel P. Berrange" <berrange@redhat.com> Enable setting of the <kernel>, <ramdisk>, <cmdline> and <init> elements inside <os>...</os>. * libvirt-gconfig/libvirt-gconfig-domain-os.c, libvirt-gconfig/libvirt-gconfig-domain-os.h, libvirt-gconfig/libvirt-gconfig.sym: Add new setters --- libvirt-gconfig/libvirt-gconfig-domain-os.c | 28 +++++++++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-os.h | 4 +++ libvirt-gconfig/libvirt-gconfig.sym | 4 +++ 3 files changed, 36 insertions(+), 0 deletions(-) diff --git a/libvirt-gconfig/libvirt-gconfig-domain-os.c b/libvirt-gconfig/libvirt-gconfig-domain-os.c index a898111..f114494 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-os.c +++ b/libvirt-gconfig/libvirt-gconfig-domain-os.c @@ -86,6 +86,34 @@ void gvir_config_domain_os_set_os_type(GVirConfigDomainOs *os, "type", type_str); } +void gvir_config_domain_os_set_kernel(GVirConfigDomainOs *os, + const char * kernel) +{ + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(os), + "kernel", kernel); +} + +void gvir_config_domain_os_set_ramdisk(GVirConfigDomainOs *os, + const char * ramdisk) +{ + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(os), + "initrd", ramdisk); +} + +void gvir_config_domain_os_set_cmdline(GVirConfigDomainOs *os, + const char * cmdline) +{ + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(os), + "cmdline", cmdline); +} + +void gvir_config_domain_os_set_init(GVirConfigDomainOs *os, + const char * init) +{ + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(os), + "init", init); +} + void gvir_config_domain_os_set_loader(GVirConfigDomainOs *os, const char * loader) { diff --git a/libvirt-gconfig/libvirt-gconfig-domain-os.h b/libvirt-gconfig/libvirt-gconfig-domain-os.h index 1522744..b978dbc 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-os.h +++ b/libvirt-gconfig/libvirt-gconfig-domain-os.h @@ -82,6 +82,10 @@ GVirConfigDomainOs *gvir_config_domain_os_new_from_xml(const gchar *xml, GError void gvir_config_domain_os_set_os_type(GVirConfigDomainOs *os, GVirConfigDomainOsType type); void gvir_config_domain_os_set_arch(GVirConfigDomainOs *os, const char *arch); void gvir_config_domain_os_set_boot_devices(GVirConfigDomainOs *os, GList *boot_devices); +void gvir_config_domain_os_set_kernel(GVirConfigDomainOs *os, const char *kernel); +void gvir_config_domain_os_set_ramdisk(GVirConfigDomainOs *os, const char *ramdisk); +void gvir_config_domain_os_set_cmdline(GVirConfigDomainOs *os, const char *cmdline); +void gvir_config_domain_os_set_init(GVirConfigDomainOs *os, const char *init); void gvir_config_domain_os_set_loader(GVirConfigDomainOs *os, const char * loader); void gvir_config_domain_os_set_machine(GVirConfigDomainOs *os, const char *machine); void gvir_config_domain_os_set_smbios_mode(GVirConfigDomainOs *os, diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 3ad7b1f..e895cb0 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -89,7 +89,11 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_domain_os_new_from_xml; gvir_config_domain_os_set_os_type; gvir_config_domain_os_set_boot_devices; + gvir_config_domain_os_set_cmdline; + gvir_config_domain_os_set_init; + gvir_config_domain_os_set_kernel; gvir_config_domain_os_set_loader; + gvir_config_domain_os_set_ramdisk; gvir_config_domain_os_set_smbios_mode; gvir_config_domain_os_enable_boot_menu; gvir_config_domain_os_bios_enable_serial; -- 1.7.6.4

ACK On Wed, Nov 30, 2011 at 04:52:04PM +0000, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Enable setting of the <kernel>, <ramdisk>, <cmdline> and <init> elements inside <os>...</os>.
* libvirt-gconfig/libvirt-gconfig-domain-os.c, libvirt-gconfig/libvirt-gconfig-domain-os.h, libvirt-gconfig/libvirt-gconfig.sym: Add new setters --- libvirt-gconfig/libvirt-gconfig-domain-os.c | 28 +++++++++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-os.h | 4 +++ libvirt-gconfig/libvirt-gconfig.sym | 4 +++ 3 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-os.c b/libvirt-gconfig/libvirt-gconfig-domain-os.c index a898111..f114494 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-os.c +++ b/libvirt-gconfig/libvirt-gconfig-domain-os.c @@ -86,6 +86,34 @@ void gvir_config_domain_os_set_os_type(GVirConfigDomainOs *os, "type", type_str); }
+void gvir_config_domain_os_set_kernel(GVirConfigDomainOs *os, + const char * kernel) +{ + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(os), + "kernel", kernel); +} + +void gvir_config_domain_os_set_ramdisk(GVirConfigDomainOs *os, + const char * ramdisk) +{ + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(os), + "initrd", ramdisk); +} + +void gvir_config_domain_os_set_cmdline(GVirConfigDomainOs *os, + const char * cmdline) +{ + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(os), + "cmdline", cmdline); +} + +void gvir_config_domain_os_set_init(GVirConfigDomainOs *os, + const char * init) +{ + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(os), + "init", init); +} + void gvir_config_domain_os_set_loader(GVirConfigDomainOs *os, const char * loader) { diff --git a/libvirt-gconfig/libvirt-gconfig-domain-os.h b/libvirt-gconfig/libvirt-gconfig-domain-os.h index 1522744..b978dbc 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-os.h +++ b/libvirt-gconfig/libvirt-gconfig-domain-os.h @@ -82,6 +82,10 @@ GVirConfigDomainOs *gvir_config_domain_os_new_from_xml(const gchar *xml, GError void gvir_config_domain_os_set_os_type(GVirConfigDomainOs *os, GVirConfigDomainOsType type); void gvir_config_domain_os_set_arch(GVirConfigDomainOs *os, const char *arch); void gvir_config_domain_os_set_boot_devices(GVirConfigDomainOs *os, GList *boot_devices); +void gvir_config_domain_os_set_kernel(GVirConfigDomainOs *os, const char *kernel); +void gvir_config_domain_os_set_ramdisk(GVirConfigDomainOs *os, const char *ramdisk); +void gvir_config_domain_os_set_cmdline(GVirConfigDomainOs *os, const char *cmdline); +void gvir_config_domain_os_set_init(GVirConfigDomainOs *os, const char *init); void gvir_config_domain_os_set_loader(GVirConfigDomainOs *os, const char * loader); void gvir_config_domain_os_set_machine(GVirConfigDomainOs *os, const char *machine); void gvir_config_domain_os_set_smbios_mode(GVirConfigDomainOs *os, diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 3ad7b1f..e895cb0 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -89,7 +89,11 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_domain_os_new_from_xml; gvir_config_domain_os_set_os_type; gvir_config_domain_os_set_boot_devices; + gvir_config_domain_os_set_cmdline; + gvir_config_domain_os_set_init; + gvir_config_domain_os_set_kernel; gvir_config_domain_os_set_loader; + gvir_config_domain_os_set_ramdisk; gvir_config_domain_os_set_smbios_mode; gvir_config_domain_os_enable_boot_menu; gvir_config_domain_os_bios_enable_serial; -- 1.7.6.4
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

From: "Daniel P. Berrange" <berrange@redhat.com> It is permissible to pass in NULL for a URI to libvirt, which causes it to probe for a supported driver. In such a case we should populate priv->uri with the resulting probed URI after opening the connection * libvirt-gobject/libvirt-gobject-connection.c: Populate URI after opening connection, if NULL --- libvirt-gobject/libvirt-gobject-connection.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c index 59b828d..a1a6f5d 100644 --- a/libvirt-gobject/libvirt-gobject-connection.c +++ b/libvirt-gobject/libvirt-gobject-connection.c @@ -415,6 +415,18 @@ gboolean gvir_connection_open(GVirConnection *conn, return FALSE; } + if (!priv->uri && + !(priv->uri = virConnectGetURI(priv->conn))) { + if (err) + *err = gvir_error_new(GVIR_CONNECTION_ERROR, + 0, + "%s", "Unable to get connection URI"); + virConnectClose(priv->conn); + priv->conn = NULL; + g_mutex_unlock(priv->lock); + return FALSE; + } + if (virConnectDomainEventRegister(priv->conn, domain_event_cb, conn, NULL) != -1) priv->domain_event = TRUE; else -- 1.7.6.4

On Wed, Nov 30, 2011 at 04:52:05PM +0000, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
It is permissible to pass in NULL for a URI to libvirt, which causes it to probe for a supported driver. In such a case we should populate priv->uri with the resulting probed URI after opening the connection
* libvirt-gobject/libvirt-gobject-connection.c: Populate URI after opening connection, if NULL --- libvirt-gobject/libvirt-gobject-connection.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c index 59b828d..a1a6f5d 100644 --- a/libvirt-gobject/libvirt-gobject-connection.c +++ b/libvirt-gobject/libvirt-gobject-connection.c @@ -415,6 +415,18 @@ gboolean gvir_connection_open(GVirConnection *conn, return FALSE; }
+ if (!priv->uri && + !(priv->uri = virConnectGetURI(priv->conn))) {
priv->uri will be freed with g_free(), virConnectGetURI must be freed with free(), I'm afraid we'll have to g_strdup + free() here.
+ if (err) + *err = gvir_error_new(GVIR_CONNECTION_ERROR, + 0, + "%s", "Unable to get connection URI"); + virConnectClose(priv->conn); + priv->conn = NULL; + g_mutex_unlock(priv->lock); + return FALSE; + } + if (virConnectDomainEventRegister(priv->conn, domain_event_cb, conn, NULL) != -1) priv->domain_event = TRUE; else -- 1.7.6.4
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

From: "Daniel P. Berrange" <berrange@redhat.com> Add gvir_config_domain_get_virt_type and gvir_config_domain_virt_type_get_type * libvirt-gconfig-domain.c, libvirt-gconfig-domain.h, libvirt-gconfig.h, libvirt-gconfig.sym: Add new APIs --- libvirt-gconfig/libvirt-gconfig-domain.c | 32 ++++++++++++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain.h | 10 +++++++++ libvirt-gconfig/libvirt-gconfig.h | 2 +- libvirt-gconfig/libvirt-gconfig.sym | 2 + 4 files changed, 45 insertions(+), 1 deletions(-) diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c index b54d12c..8fb1a2b 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain.c +++ b/libvirt-gconfig/libvirt-gconfig-domain.c @@ -175,6 +175,23 @@ GVirConfigDomain *gvir_config_domain_new(void) return GVIR_CONFIG_DOMAIN(object); } + +void gvir_config_domain_set_virt_type(GVirConfigDomain *domain, GVirConfigDomainVirtType type) +{ + xmlNodePtr node; + const char *type_str; + + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_FILESYS(domain)); + + node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(domain)); + g_return_if_fail(node != NULL); + type_str = gvir_config_genum_get_nick(GVIR_TYPE_CONFIG_DOMAIN_VIRT_TYPE, + type); + g_return_if_fail(type_str != NULL); + xmlNewProp(node, (xmlChar*)"type", (xmlChar*)type_str); +} + + char *gvir_config_domain_get_name(GVirConfigDomain *domain) { return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(domain), @@ -306,3 +323,18 @@ void gvir_config_domain_set_devices(GVirConfigDomain *domain, gvir_config_object_attach(GVIR_CONFIG_OBJECT(domain), devices_node); g_object_unref(G_OBJECT(devices_node)); } + +void gvir_config_domain_add_device(GVirConfigDomain *domain, + GVirConfigDomainDevice *device) +{ + GVirConfigObject *devices_node; + + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN(domain)); + + devices_node = gvir_config_object_add_child(GVIR_CONFIG_OBJECT(domain), + "devices"); + + gvir_config_object_attach(devices_node, GVIR_CONFIG_OBJECT(device)); + gvir_config_object_attach(GVIR_CONFIG_OBJECT(domain), devices_node); + g_object_unref(G_OBJECT(devices_node)); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain.h b/libvirt-gconfig/libvirt-gconfig-domain.h index 08682aa..c97ff46 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain.h +++ b/libvirt-gconfig/libvirt-gconfig-domain.h @@ -59,12 +59,20 @@ struct _GVirConfigDomainClass gpointer padding[20]; }; +typedef enum { + GVIR_CONFIG_DOMAIN_VIRT_XEN, + GVIR_CONFIG_DOMAIN_VIRT_QEMU, + GVIR_CONFIG_DOMAIN_VIRT_KVM, + GVIR_CONFIG_DOMAIN_VIRT_KQEMU, + GVIR_CONFIG_DOMAIN_VIRT_LXC, +} GVirConfigDomainVirtType; GType gvir_config_domain_get_type(void); GVirConfigDomain *gvir_config_domain_new_from_xml(const gchar *xml, GError **error); GVirConfigDomain *gvir_config_domain_new(void); +void gvir_config_domain_set_virt_type(GVirConfigDomain *domain, GVirConfigDomainVirtType type); char *gvir_config_domain_get_name(GVirConfigDomain *domain); void gvir_config_domain_set_name(GVirConfigDomain *domain, const char *name); guint64 gvir_config_domain_get_memory(GVirConfigDomain *domain); @@ -81,6 +89,8 @@ void gvir_config_domain_set_os(GVirConfigDomain *domain, GVirConfigDomainOs *os); void gvir_config_domain_set_devices(GVirConfigDomain *domain, GList *devices); +void gvir_config_domain_add_device(GVirConfigDomain *domain, + GVirConfigDomainDevice *device); G_END_DECLS diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h index ed7623c..8525065 100644 --- a/libvirt-gconfig/libvirt-gconfig.h +++ b/libvirt-gconfig/libvirt-gconfig.h @@ -29,7 +29,6 @@ #include <libvirt-gconfig/libvirt-gconfig-main.h> #include <libvirt-gconfig/libvirt-gconfig-object.h> #include <libvirt-gconfig/libvirt-gconfig-capabilities.h> -#include <libvirt-gconfig/libvirt-gconfig-domain.h> #include <libvirt-gconfig/libvirt-gconfig-domain-clock.h> #include <libvirt-gconfig/libvirt-gconfig-domain-device.h> #include <libvirt-gconfig/libvirt-gconfig-domain-disk.h> @@ -43,6 +42,7 @@ #include <libvirt-gconfig/libvirt-gconfig-domain-snapshot.h> #include <libvirt-gconfig/libvirt-gconfig-domain-timer.h> #include <libvirt-gconfig/libvirt-gconfig-domain-video.h> +#include <libvirt-gconfig/libvirt-gconfig-domain.h> #include <libvirt-gconfig/libvirt-gconfig-enum-types.h> #include <libvirt-gconfig/libvirt-gconfig-helpers.h> #include <libvirt-gconfig/libvirt-gconfig-interface.h> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index e895cb0..9b74c35 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -21,6 +21,8 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_domain_set_os; gvir_config_domain_get_vcpus; gvir_config_domain_set_vcpus; + gvir_config_domain_get_virt_type; + gvir_config_domain_virt_type_get_type; gvir_config_domain_clock_get_type; gvir_config_domain_clock_offset_get_type; -- 1.7.6.4

On Wed, Nov 30, 2011 at 04:52:06PM +0000, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Add gvir_config_domain_get_virt_type and
_set_virt_type
gvir_config_domain_virt_type_get_type
* libvirt-gconfig-domain.c, libvirt-gconfig-domain.h, libvirt-gconfig.h, libvirt-gconfig.sym: Add new APIs --- libvirt-gconfig/libvirt-gconfig-domain.c | 32 ++++++++++++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain.h | 10 +++++++++ libvirt-gconfig/libvirt-gconfig.h | 2 +- libvirt-gconfig/libvirt-gconfig.sym | 2 + 4 files changed, 45 insertions(+), 1 deletions(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c index b54d12c..8fb1a2b 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain.c +++ b/libvirt-gconfig/libvirt-gconfig-domain.c @@ -175,6 +175,23 @@ GVirConfigDomain *gvir_config_domain_new(void) return GVIR_CONFIG_DOMAIN(object); }
+ +void gvir_config_domain_set_virt_type(GVirConfigDomain *domain, GVirConfigDomainVirtType type) +{ + xmlNodePtr node; + const char *type_str; + + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_FILESYS(domain));
Extra _FILESYS here I think
+ + node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(domain)); + g_return_if_fail(node != NULL); + type_str = gvir_config_genum_get_nick(GVIR_TYPE_CONFIG_DOMAIN_VIRT_TYPE, + type); + g_return_if_fail(type_str != NULL); + xmlNewProp(node, (xmlChar*)"type", (xmlChar*)type_str);
gvir_config_node_set_attribute_with_type
+} + + char *gvir_config_domain_get_name(GVirConfigDomain *domain) { return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(domain), @@ -306,3 +323,18 @@ void gvir_config_domain_set_devices(GVirConfigDomain *domain, gvir_config_object_attach(GVIR_CONFIG_OBJECT(domain), devices_node); g_object_unref(G_OBJECT(devices_node)); } + +void gvir_config_domain_add_device(GVirConfigDomain *domain, + GVirConfigDomainDevice *device) +{ + GVirConfigObject *devices_node; + + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN(domain)); + + devices_node = gvir_config_object_add_child(GVIR_CONFIG_OBJECT(domain), + "devices"); + + gvir_config_object_attach(devices_node, GVIR_CONFIG_OBJECT(device));
+ gvir_config_object_attach(GVIR_CONFIG_OBJECT(domain), devices_node);
gvir_config_object_add_child will have attached it already if needed, this should be dropped or we'll get duplicated nodes in the xml tree Actually I'm not sure the addition of this function was meant to be in this commit. It's missing from libvirt-gconfig.sym, and is not used in this commit so I'd rather have it in a separate commit.
+ g_object_unref(G_OBJECT(devices_node)); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain.h b/libvirt-gconfig/libvirt-gconfig-domain.h index 08682aa..c97ff46 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain.h +++ b/libvirt-gconfig/libvirt-gconfig-domain.h @@ -59,12 +59,20 @@ struct _GVirConfigDomainClass gpointer padding[20]; };
+typedef enum { + GVIR_CONFIG_DOMAIN_VIRT_XEN, + GVIR_CONFIG_DOMAIN_VIRT_QEMU, + GVIR_CONFIG_DOMAIN_VIRT_KVM, + GVIR_CONFIG_DOMAIN_VIRT_KQEMU, + GVIR_CONFIG_DOMAIN_VIRT_LXC, +} GVirConfigDomainVirtType;
GType gvir_config_domain_get_type(void);
GVirConfigDomain *gvir_config_domain_new_from_xml(const gchar *xml, GError **error); GVirConfigDomain *gvir_config_domain_new(void);
+void gvir_config_domain_set_virt_type(GVirConfigDomain *domain, GVirConfigDomainVirtType type); char *gvir_config_domain_get_name(GVirConfigDomain *domain); void gvir_config_domain_set_name(GVirConfigDomain *domain, const char *name); guint64 gvir_config_domain_get_memory(GVirConfigDomain *domain); @@ -81,6 +89,8 @@ void gvir_config_domain_set_os(GVirConfigDomain *domain, GVirConfigDomainOs *os); void gvir_config_domain_set_devices(GVirConfigDomain *domain, GList *devices); +void gvir_config_domain_add_device(GVirConfigDomain *domain, + GVirConfigDomainDevice *device);
G_END_DECLS
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h index ed7623c..8525065 100644 --- a/libvirt-gconfig/libvirt-gconfig.h +++ b/libvirt-gconfig/libvirt-gconfig.h @@ -29,7 +29,6 @@ #include <libvirt-gconfig/libvirt-gconfig-main.h> #include <libvirt-gconfig/libvirt-gconfig-object.h> #include <libvirt-gconfig/libvirt-gconfig-capabilities.h> -#include <libvirt-gconfig/libvirt-gconfig-domain.h> #include <libvirt-gconfig/libvirt-gconfig-domain-clock.h> #include <libvirt-gconfig/libvirt-gconfig-domain-device.h> #include <libvirt-gconfig/libvirt-gconfig-domain-disk.h> @@ -43,6 +42,7 @@ #include <libvirt-gconfig/libvirt-gconfig-domain-snapshot.h> #include <libvirt-gconfig/libvirt-gconfig-domain-timer.h> #include <libvirt-gconfig/libvirt-gconfig-domain-video.h> +#include <libvirt-gconfig/libvirt-gconfig-domain.h>
I disagree on this sorting, but no big deal :)
#include <libvirt-gconfig/libvirt-gconfig-enum-types.h> #include <libvirt-gconfig/libvirt-gconfig-helpers.h> #include <libvirt-gconfig/libvirt-gconfig-interface.h> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index e895cb0..9b74c35 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -21,6 +21,8 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_domain_set_os; gvir_config_domain_get_vcpus; gvir_config_domain_set_vcpus; + gvir_config_domain_get_virt_type;
_set_virt_type
+ gvir_config_domain_virt_type_get_type;
gvir_config_domain_clock_get_type; gvir_config_domain_clock_offset_get_type; -- 1.7.6.4
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

From: "Daniel P. Berrange" <berrange@redhat.com> Add GVirConfigDomainGraphicsSdl and GVirConfigDomainGraphicsVnc --- libvirt-gconfig/Makefile.am | 4 + .../libvirt-gconfig-domain-graphics-sdl.c | 100 +++++++++++++++++++ .../libvirt-gconfig-domain-graphics-sdl.h | 71 ++++++++++++++ .../libvirt-gconfig-domain-graphics-vnc.c | 101 ++++++++++++++++++++ .../libvirt-gconfig-domain-graphics-vnc.h | 73 ++++++++++++++ libvirt-gconfig/libvirt-gconfig.h | 2 + libvirt-gconfig/libvirt-gconfig.sym | 12 +++ 7 files changed, 363 insertions(+), 0 deletions(-) create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am index 2c8c2a5..7c9e8c0 100644 --- a/libvirt-gconfig/Makefile.am +++ b/libvirt-gconfig/Makefile.am @@ -18,7 +18,9 @@ GCONFIG_HEADER_FILES = \ libvirt-gconfig-domain-disk.h \ libvirt-gconfig-domain-filesys.h \ libvirt-gconfig-domain-graphics.h \ + libvirt-gconfig-domain-graphics-sdl.h \ libvirt-gconfig-domain-graphics-spice.h \ + libvirt-gconfig-domain-graphics-vnc.h \ libvirt-gconfig-domain-input.h \ libvirt-gconfig-domain-interface.h \ libvirt-gconfig-domain-interface-network.h \ @@ -48,7 +50,9 @@ GCONFIG_SOURCE_FILES = \ libvirt-gconfig-domain-disk.c \ libvirt-gconfig-domain-filesys.c \ libvirt-gconfig-domain-graphics.c \ + libvirt-gconfig-domain-graphics-sdl.c \ libvirt-gconfig-domain-graphics-spice.c \ + libvirt-gconfig-domain-graphics-vnc.c \ libvirt-gconfig-domain-input.c \ libvirt-gconfig-domain-interface.c \ libvirt-gconfig-domain-interface-network.c \ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c new file mode 100644 index 0000000..1d10173 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c @@ -0,0 +1,100 @@ +/* + * libvirt-gobject-config-domain-graphics-sdl.c: libvirt glib integration + * + * Copyright (C) 2011 Red Hat + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@gmail.com> + */ + +#include <config.h> + +#include <string.h> + +#include <libxml/tree.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h" +#include "libvirt-gconfig/libvirt-gconfig-object-private.h" + +#define GVIR_CONFIG_DOMAIN_GRAPHICS_SDL_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL, GVirConfigDomainGraphicsSdlPrivate)) + +struct _GVirConfigDomainGraphicsSdlPrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigDomainGraphicsSdl, gvir_config_domain_graphics_sdl, GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS); + + +static void gvir_config_domain_graphics_sdl_class_init(GVirConfigDomainGraphicsSdlClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigDomainGraphicsSdlPrivate)); +} + + +static void gvir_config_domain_graphics_sdl_init(GVirConfigDomainGraphicsSdl *graphics_sdl) +{ + g_debug("Init GVirConfigDomainGraphicsSdl=%p", graphics_sdl); + + graphics_sdl->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_SDL_GET_PRIVATE(graphics_sdl); +} + + +GVirConfigDomainGraphicsSdl *gvir_config_domain_graphics_sdl_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL, + "graphics", NULL); + gvir_config_object_set_attribute(object, "type", "sdl", NULL); + return GVIR_CONFIG_DOMAIN_GRAPHICS_SDL(object); +} + +GVirConfigDomainGraphicsSdl * +gvir_config_domain_graphics_sdl_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL, + "graphics", NULL, xml, error); + if (object == NULL) + return NULL; + gvir_config_object_set_attribute(object, "type", "sdl", NULL); + return GVIR_CONFIG_DOMAIN_GRAPHICS_SDL(object); +} + +void gvir_config_domain_graphics_sdl_set_xauthority(GVirConfigDomainGraphicsSdl *graphics, + const gchar *path) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_GRAPHICS_SDL(graphics)); + + gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(graphics), + "xauthority", path, + NULL); +} + +void gvir_config_domain_graphics_sdl_set_display(GVirConfigDomainGraphicsSdl *graphics, + const gchar *disp) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_GRAPHICS_SDL(graphics)); + + gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(graphics), + "display", disp, + NULL); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h new file mode 100644 index 0000000..de81566 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h @@ -0,0 +1,71 @@ +/* + * libvirt-gconfig-domain-graphics-sdl.h: libvirt gobject integration + * + * Copyright (C) 2011 Red Hat + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@gmail.com> + */ + +#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD) +#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly." +#endif + +#ifndef __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_SDL_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_SDL_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL (gvir_config_domain_graphics_sdl_get_type ()) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_SDL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL, GVirConfigDomainGraphicsSdl)) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_SDL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL, GVirConfigDomainGraphicsSdlClass)) +#define GVIR_IS_CONFIG_DOMAIN_GRAPHICS_SDL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL)) +#define GVIR_IS_CONFIG_DOMAIN_GRAPHICS_SDL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL)) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_SDL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL, GVirConfigDomainGraphicsSdlClass)) + +typedef struct _GVirConfigDomainGraphicsSdl GVirConfigDomainGraphicsSdl; +typedef struct _GVirConfigDomainGraphicsSdlPrivate GVirConfigDomainGraphicsSdlPrivate; +typedef struct _GVirConfigDomainGraphicsSdlClass GVirConfigDomainGraphicsSdlClass; + +struct _GVirConfigDomainGraphicsSdl +{ + GVirConfigDomainGraphics parent; + + GVirConfigDomainGraphicsSdlPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigDomainGraphicsSdlClass +{ + GVirConfigDomainGraphicsClass parent_class; + + gpointer padding[20]; +}; + +GType gvir_config_domain_graphics_sdl_get_type(void); + +GVirConfigDomainGraphicsSdl *gvir_config_domain_graphics_sdl_new(void); +GVirConfigDomainGraphicsSdl *gvir_config_domain_graphics_sdl_new_from_xml(const gchar *xml, + GError **error); +void gvir_config_domain_graphics_sdl_set_xauthority(GVirConfigDomainGraphicsSdl *graphics, + const gchar *path); +void gvir_config_domain_graphics_sdl_set_display(GVirConfigDomainGraphicsSdl *graphics, + const gchar *disp); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_SDL_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c new file mode 100644 index 0000000..edeccd9 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c @@ -0,0 +1,101 @@ +/* + * libvirt-gobject-config-domain-graphics-vnc.c: libvirt glib integration + * + * Copyright (C) 2011 Red Hat + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@gmail.com> + */ + +#include <config.h> + +#include <string.h> + +#include <libxml/tree.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h" +#include "libvirt-gconfig/libvirt-gconfig-object-private.h" + +#define GVIR_CONFIG_DOMAIN_GRAPHICS_VNC_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC, GVirConfigDomainGraphicsVncPrivate)) + +struct _GVirConfigDomainGraphicsVncPrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigDomainGraphicsVnc, gvir_config_domain_graphics_vnc, GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS); + + +static void gvir_config_domain_graphics_vnc_class_init(GVirConfigDomainGraphicsVncClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigDomainGraphicsVncPrivate)); +} + + +static void gvir_config_domain_graphics_vnc_init(GVirConfigDomainGraphicsVnc *graphics_vnc) +{ + g_debug("Init GVirConfigDomainGraphicsVnc=%p", graphics_vnc); + + graphics_vnc->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_VNC_GET_PRIVATE(graphics_vnc); +} + + +GVirConfigDomainGraphicsVnc *gvir_config_domain_graphics_vnc_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC, + "graphics", NULL); + gvir_config_object_set_attribute(object, "type", "vnc", NULL); + return GVIR_CONFIG_DOMAIN_GRAPHICS_VNC(object); +} + +GVirConfigDomainGraphicsVnc * +gvir_config_domain_graphics_vnc_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC, + "graphics", NULL, xml, error); + if (object == NULL) + return NULL; + gvir_config_object_set_attribute(object, "type", "vnc", NULL); + return GVIR_CONFIG_DOMAIN_GRAPHICS_VNC(object); +} + + +void gvir_config_domain_graphics_vnc_set_autoport(GVirConfigDomainGraphicsVnc *graphics, + gboolean autoport) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_GRAPHICS_VNC(graphics)); + + gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(graphics), + "autoport", autoport ? "yes" : "no", + NULL); +} + +void gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc *graphics, + unsigned int port) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_GRAPHICS_VNC(graphics)); + + gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(graphics), + "port", G_TYPE_UINT, port, + NULL); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h new file mode 100644 index 0000000..93765d5 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h @@ -0,0 +1,73 @@ +/* + * libvirt-gconfig-domain-graphics-vnc.h: libvirt gobject integration + * + * Copyright (C) 2011 Red Hat + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@gmail.com> + */ + +#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD) +#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly." +#endif + +#ifndef __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_VNC_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_VNC_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC (gvir_config_domain_graphics_vnc_get_type ()) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_VNC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC, GVirConfigDomainGraphicsVnc)) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_VNC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC, GVirConfigDomainGraphicsVncClass)) +#define GVIR_IS_CONFIG_DOMAIN_GRAPHICS_VNC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC)) +#define GVIR_IS_CONFIG_DOMAIN_GRAPHICS_VNC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC)) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_VNC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC, GVirConfigDomainGraphicsVncClass)) + +typedef struct _GVirConfigDomainGraphicsVnc GVirConfigDomainGraphicsVnc; +typedef struct _GVirConfigDomainGraphicsVncPrivate GVirConfigDomainGraphicsVncPrivate; +typedef struct _GVirConfigDomainGraphicsVncClass GVirConfigDomainGraphicsVncClass; + +struct _GVirConfigDomainGraphicsVnc +{ + GVirConfigDomainGraphics parent; + + GVirConfigDomainGraphicsVncPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigDomainGraphicsVncClass +{ + GVirConfigDomainGraphicsClass parent_class; + + gpointer padding[20]; +}; + +GType gvir_config_domain_graphics_vnc_get_type(void); + +GVirConfigDomainGraphicsVnc *gvir_config_domain_graphics_vnc_new(void); +GVirConfigDomainGraphicsVnc *gvir_config_domain_graphics_vnc_new_from_xml(const gchar *xml, + GError **error); + +void gvir_config_domain_graphics_vnc_set_autoport(GVirConfigDomainGraphicsVnc *graphics, + gboolean autoport); + +void gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc *graphics, + unsigned int port); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_VNC_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h index 8525065..80ca6f1 100644 --- a/libvirt-gconfig/libvirt-gconfig.h +++ b/libvirt-gconfig/libvirt-gconfig.h @@ -34,7 +34,9 @@ #include <libvirt-gconfig/libvirt-gconfig-domain-disk.h> #include <libvirt-gconfig/libvirt-gconfig-domain-filesys.h> #include <libvirt-gconfig/libvirt-gconfig-domain-graphics.h> +#include <libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h> #include <libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h> +#include <libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h> #include <libvirt-gconfig/libvirt-gconfig-domain-input.h> #include <libvirt-gconfig/libvirt-gconfig-domain-interface.h> #include <libvirt-gconfig/libvirt-gconfig-domain-interface-network.h> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 9b74c35..9236101 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -64,11 +64,23 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_domain_graphics_get_type; + gvir_config_domain_graphics_sdl_get_type; + gvir_config_domain_graphics_sdl_new; + gvir_config_domain_graphics_sdl_new_from_xml; + gvir_config_domain_graphics_sdl_set_display; + gvir_config_domain_graphics_sdl_set_xauthority; + gvir_config_domain_graphics_spice_get_type; gvir_config_domain_graphics_spice_new; gvir_config_domain_graphics_spice_new_from_xml; gvir_config_domain_graphics_spice_set_port; + gvir_config_domain_graphics_vnc_get_type; + gvir_config_domain_graphics_vnc_new; + gvir_config_domain_graphics_vnc_new_from_xml; + gvir_config_domain_graphics_vnc_set_autoport; + gvir_config_domain_graphics_vnc_set_port; + gvir_config_domain_input_bus_get_type; gvir_config_domain_input_get_type; gvir_config_domain_input_device_type_get_type; -- 1.7.6.4

On Wed, Nov 30, 2011 at 04:52:07PM +0000, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Add GVirConfigDomainGraphicsSdl and GVirConfigDomainGraphicsVnc --- libvirt-gconfig/Makefile.am | 4 + .../libvirt-gconfig-domain-graphics-sdl.c | 100 +++++++++++++++++++ .../libvirt-gconfig-domain-graphics-sdl.h | 71 ++++++++++++++ .../libvirt-gconfig-domain-graphics-vnc.c | 101 ++++++++++++++++++++ .../libvirt-gconfig-domain-graphics-vnc.h | 73 ++++++++++++++ libvirt-gconfig/libvirt-gconfig.h | 2 + libvirt-gconfig/libvirt-gconfig.sym | 12 +++ 7 files changed, 363 insertions(+), 0 deletions(-) create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h
diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am index 2c8c2a5..7c9e8c0 100644 --- a/libvirt-gconfig/Makefile.am +++ b/libvirt-gconfig/Makefile.am @@ -18,7 +18,9 @@ GCONFIG_HEADER_FILES = \ libvirt-gconfig-domain-disk.h \ libvirt-gconfig-domain-filesys.h \ libvirt-gconfig-domain-graphics.h \ + libvirt-gconfig-domain-graphics-sdl.h \ libvirt-gconfig-domain-graphics-spice.h \ + libvirt-gconfig-domain-graphics-vnc.h \ libvirt-gconfig-domain-input.h \ libvirt-gconfig-domain-interface.h \ libvirt-gconfig-domain-interface-network.h \ @@ -48,7 +50,9 @@ GCONFIG_SOURCE_FILES = \ libvirt-gconfig-domain-disk.c \ libvirt-gconfig-domain-filesys.c \ libvirt-gconfig-domain-graphics.c \ + libvirt-gconfig-domain-graphics-sdl.c \ libvirt-gconfig-domain-graphics-spice.c \ + libvirt-gconfig-domain-graphics-vnc.c \ libvirt-gconfig-domain-input.c \ libvirt-gconfig-domain-interface.c \ libvirt-gconfig-domain-interface-network.c \ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c new file mode 100644 index 0000000..1d10173 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c @@ -0,0 +1,100 @@ +/* + * libvirt-gobject-config-domain-graphics-sdl.c: libvirt glib integration + * + * Copyright (C) 2011 Red Hat + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@gmail.com>
Wrong author here too
+ */ + +#include <config.h> + +#include <string.h> + +#include <libxml/tree.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h" +#include "libvirt-gconfig/libvirt-gconfig-object-private.h" + +#define GVIR_CONFIG_DOMAIN_GRAPHICS_SDL_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL, GVirConfigDomainGraphicsSdlPrivate)) + +struct _GVirConfigDomainGraphicsSdlPrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigDomainGraphicsSdl, gvir_config_domain_graphics_sdl, GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS); + + +static void gvir_config_domain_graphics_sdl_class_init(GVirConfigDomainGraphicsSdlClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigDomainGraphicsSdlPrivate)); +} + + +static void gvir_config_domain_graphics_sdl_init(GVirConfigDomainGraphicsSdl *graphics_sdl) +{ + g_debug("Init GVirConfigDomainGraphicsSdl=%p", graphics_sdl); + + graphics_sdl->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_SDL_GET_PRIVATE(graphics_sdl); +} + + +GVirConfigDomainGraphicsSdl *gvir_config_domain_graphics_sdl_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL, + "graphics", NULL); + gvir_config_object_set_attribute(object, "type", "sdl", NULL); + return GVIR_CONFIG_DOMAIN_GRAPHICS_SDL(object); +} + +GVirConfigDomainGraphicsSdl * +gvir_config_domain_graphics_sdl_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL, + "graphics", NULL, xml, error); + if (object == NULL) + return NULL; + gvir_config_object_set_attribute(object, "type", "sdl", NULL); + return GVIR_CONFIG_DOMAIN_GRAPHICS_SDL(object); +} + +void gvir_config_domain_graphics_sdl_set_xauthority(GVirConfigDomainGraphicsSdl *graphics, + const gchar *path) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_GRAPHICS_SDL(graphics)); + + gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(graphics), + "xauthority", path,
The attribute name is apparently xauth (looking at the doc at http://libvirt.org/formatdomain.html#elementsGraphics )
+ NULL); +} + +void gvir_config_domain_graphics_sdl_set_display(GVirConfigDomainGraphicsSdl *graphics, + const gchar *disp) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_GRAPHICS_SDL(graphics)); + + gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(graphics), + "display", disp, + NULL); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h new file mode 100644 index 0000000..de81566 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h @@ -0,0 +1,71 @@ +/* + * libvirt-gconfig-domain-graphics-sdl.h: libvirt gobject integration + * + * Copyright (C) 2011 Red Hat + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@gmail.com>
Not me. And I'm noticing just now I used my @gmail.com address instead of my @redhat.com one
+ */ + +#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD) +#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly." +#endif + +#ifndef __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_SDL_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_SDL_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL (gvir_config_domain_graphics_sdl_get_type ()) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_SDL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL, GVirConfigDomainGraphicsSdl)) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_SDL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL, GVirConfigDomainGraphicsSdlClass)) +#define GVIR_IS_CONFIG_DOMAIN_GRAPHICS_SDL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL)) +#define GVIR_IS_CONFIG_DOMAIN_GRAPHICS_SDL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL)) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_SDL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL, GVirConfigDomainGraphicsSdlClass)) + +typedef struct _GVirConfigDomainGraphicsSdl GVirConfigDomainGraphicsSdl; +typedef struct _GVirConfigDomainGraphicsSdlPrivate GVirConfigDomainGraphicsSdlPrivate; +typedef struct _GVirConfigDomainGraphicsSdlClass GVirConfigDomainGraphicsSdlClass; + +struct _GVirConfigDomainGraphicsSdl +{ + GVirConfigDomainGraphics parent; + + GVirConfigDomainGraphicsSdlPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigDomainGraphicsSdlClass +{ + GVirConfigDomainGraphicsClass parent_class; + + gpointer padding[20]; +}; + +GType gvir_config_domain_graphics_sdl_get_type(void); + +GVirConfigDomainGraphicsSdl *gvir_config_domain_graphics_sdl_new(void); +GVirConfigDomainGraphicsSdl *gvir_config_domain_graphics_sdl_new_from_xml(const gchar *xml, + GError **error); +void gvir_config_domain_graphics_sdl_set_xauthority(GVirConfigDomainGraphicsSdl *graphics, + const gchar *path); +void gvir_config_domain_graphics_sdl_set_display(GVirConfigDomainGraphicsSdl *graphics, + const gchar *disp); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_SDL_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c new file mode 100644 index 0000000..edeccd9 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c @@ -0,0 +1,101 @@ +/* + * libvirt-gobject-config-domain-graphics-vnc.c: libvirt glib integration + * + * Copyright (C) 2011 Red Hat + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@gmail.com> + */ + +#include <config.h> + +#include <string.h> + +#include <libxml/tree.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h" +#include "libvirt-gconfig/libvirt-gconfig-object-private.h" + +#define GVIR_CONFIG_DOMAIN_GRAPHICS_VNC_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC, GVirConfigDomainGraphicsVncPrivate)) + +struct _GVirConfigDomainGraphicsVncPrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigDomainGraphicsVnc, gvir_config_domain_graphics_vnc, GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS); + + +static void gvir_config_domain_graphics_vnc_class_init(GVirConfigDomainGraphicsVncClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigDomainGraphicsVncPrivate)); +} + + +static void gvir_config_domain_graphics_vnc_init(GVirConfigDomainGraphicsVnc *graphics_vnc) +{ + g_debug("Init GVirConfigDomainGraphicsVnc=%p", graphics_vnc); + + graphics_vnc->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_VNC_GET_PRIVATE(graphics_vnc); +} + + +GVirConfigDomainGraphicsVnc *gvir_config_domain_graphics_vnc_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC, + "graphics", NULL); + gvir_config_object_set_attribute(object, "type", "vnc", NULL); + return GVIR_CONFIG_DOMAIN_GRAPHICS_VNC(object); +} + +GVirConfigDomainGraphicsVnc * +gvir_config_domain_graphics_vnc_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC, + "graphics", NULL, xml, error); + if (object == NULL) + return NULL; + gvir_config_object_set_attribute(object, "type", "vnc", NULL); + return GVIR_CONFIG_DOMAIN_GRAPHICS_VNC(object); +} + + +void gvir_config_domain_graphics_vnc_set_autoport(GVirConfigDomainGraphicsVnc *graphics, + gboolean autoport) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_GRAPHICS_VNC(graphics)); + + gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(graphics), + "autoport", autoport ? "yes" : "no", + NULL);
set_attribute_with_type handles boolean and will turn them into "yes"/"no"
+} + +void gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc *graphics, + unsigned int port)
We won't be able to set it to -1 to use the legacy syntax, but it doesn't really matter since we have set_autoport
+{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_GRAPHICS_VNC(graphics)); + gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(graphics), + "port", G_TYPE_UINT, port, + NULL); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h new file mode 100644 index 0000000..93765d5 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h @@ -0,0 +1,73 @@ +/* + * libvirt-gconfig-domain-graphics-vnc.h: libvirt gobject integration + * + * Copyright (C) 2011 Red Hat + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@gmail.com> + */ + +#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD) +#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly." +#endif + +#ifndef __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_VNC_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_VNC_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC (gvir_config_domain_graphics_vnc_get_type ()) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_VNC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC, GVirConfigDomainGraphicsVnc)) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_VNC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC, GVirConfigDomainGraphicsVncClass)) +#define GVIR_IS_CONFIG_DOMAIN_GRAPHICS_VNC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC)) +#define GVIR_IS_CONFIG_DOMAIN_GRAPHICS_VNC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC)) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_VNC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC, GVirConfigDomainGraphicsVncClass)) + +typedef struct _GVirConfigDomainGraphicsVnc GVirConfigDomainGraphicsVnc; +typedef struct _GVirConfigDomainGraphicsVncPrivate GVirConfigDomainGraphicsVncPrivate; +typedef struct _GVirConfigDomainGraphicsVncClass GVirConfigDomainGraphicsVncClass; + +struct _GVirConfigDomainGraphicsVnc +{ + GVirConfigDomainGraphics parent; + + GVirConfigDomainGraphicsVncPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigDomainGraphicsVncClass +{ + GVirConfigDomainGraphicsClass parent_class; + + gpointer padding[20]; +}; + +GType gvir_config_domain_graphics_vnc_get_type(void); + +GVirConfigDomainGraphicsVnc *gvir_config_domain_graphics_vnc_new(void); +GVirConfigDomainGraphicsVnc *gvir_config_domain_graphics_vnc_new_from_xml(const gchar *xml, + GError **error); + +void gvir_config_domain_graphics_vnc_set_autoport(GVirConfigDomainGraphicsVnc *graphics, + gboolean autoport); + +void gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc *graphics, + unsigned int port); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_VNC_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h index 8525065..80ca6f1 100644 --- a/libvirt-gconfig/libvirt-gconfig.h +++ b/libvirt-gconfig/libvirt-gconfig.h @@ -34,7 +34,9 @@ #include <libvirt-gconfig/libvirt-gconfig-domain-disk.h> #include <libvirt-gconfig/libvirt-gconfig-domain-filesys.h> #include <libvirt-gconfig/libvirt-gconfig-domain-graphics.h> +#include <libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h> #include <libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h> +#include <libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h> #include <libvirt-gconfig/libvirt-gconfig-domain-input.h> #include <libvirt-gconfig/libvirt-gconfig-domain-interface.h> #include <libvirt-gconfig/libvirt-gconfig-domain-interface-network.h> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 9b74c35..9236101 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -64,11 +64,23 @@ LIBVIRT_GCONFIG_0.0.1 {
gvir_config_domain_graphics_get_type;
+ gvir_config_domain_graphics_sdl_get_type; + gvir_config_domain_graphics_sdl_new; + gvir_config_domain_graphics_sdl_new_from_xml; + gvir_config_domain_graphics_sdl_set_display; + gvir_config_domain_graphics_sdl_set_xauthority; + gvir_config_domain_graphics_spice_get_type; gvir_config_domain_graphics_spice_new; gvir_config_domain_graphics_spice_new_from_xml; gvir_config_domain_graphics_spice_set_port;
+ gvir_config_domain_graphics_vnc_get_type; + gvir_config_domain_graphics_vnc_new; + gvir_config_domain_graphics_vnc_new_from_xml; + gvir_config_domain_graphics_vnc_set_autoport; + gvir_config_domain_graphics_vnc_set_port; + gvir_config_domain_input_bus_get_type; gvir_config_domain_input_get_type; gvir_config_domain_input_device_type_get_type; -- 1.7.6.4
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On Wed, Nov 30, 2011 at 06:48:08PM +0100, Christophe Fergeau wrote:
On Wed, Nov 30, 2011 at 04:52:07PM +0000, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Add GVirConfigDomainGraphicsSdl and GVirConfigDomainGraphicsVnc --- libvirt-gconfig/Makefile.am | 4 + .../libvirt-gconfig-domain-graphics-sdl.c | 100 +++++++++++++++++++ .../libvirt-gconfig-domain-graphics-sdl.h | 71 ++++++++++++++ .../libvirt-gconfig-domain-graphics-vnc.c | 101 ++++++++++++++++++++ .../libvirt-gconfig-domain-graphics-vnc.h | 73 ++++++++++++++ libvirt-gconfig/libvirt-gconfig.h | 2 + libvirt-gconfig/libvirt-gconfig.sym | 12 +++ 7 files changed, 363 insertions(+), 0 deletions(-) create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h
+void gvir_config_domain_graphics_sdl_set_xauthority(GVirConfigDomainGraphicsSdl *graphics, + const gchar *path) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_GRAPHICS_SDL(graphics)); + + gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(graphics), + "xauthority", path,
The attribute name is apparently xauth (looking at the doc at http://libvirt.org/formatdomain.html#elementsGraphics )
Opps, yes I should have known that.
+void gvir_config_domain_graphics_vnc_set_autoport(GVirConfigDomainGraphicsVnc *graphics, + gboolean autoport) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_GRAPHICS_VNC(graphics)); + + gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(graphics), + "autoport", autoport ? "yes" : "no", + NULL);
set_attribute_with_type handles boolean and will turn them into "yes"/"no"
Neat !
+} + +void gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc *graphics, + unsigned int port)
We won't be able to set it to -1 to use the legacy syntax, but it doesn't really matter since we have set_autoport
Actually IMHO it does matter - the corresponding get_port will have to return a signed int, so the setter should accept one too. In addition, for spice we need to be able to set '-1' explicitly for the TLS port. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

From: "Daniel P. Berrange" <berrange@redhat.com> Add support for the <seclabel> element via a new object GVirConfigDomainSeclabel. * libvirt-gconfig-domain-seclabel.c, libvirt-gconfig-domain-seclabel.h, Makefile.am, libvirt-gconfig.h, libvirt-gconfig.sym: New objects * libvirt-gconfig-domain.c, libvirt-gconfig-domain.h: API to associate seclabel with an domain --- libvirt-gconfig/Makefile.am | 2 + libvirt-gconfig/libvirt-gconfig-domain-seclabel.c | 113 +++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-seclabel.h | 76 ++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain.c | 10 ++ libvirt-gconfig/libvirt-gconfig-domain.h | 2 + libvirt-gconfig/libvirt-gconfig.h | 1 + libvirt-gconfig/libvirt-gconfig.sym | 10 ++ 7 files changed, 214 insertions(+), 0 deletions(-) create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-seclabel.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-seclabel.h diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am index 7c9e8c0..ddae5fa 100644 --- a/libvirt-gconfig/Makefile.am +++ b/libvirt-gconfig/Makefile.am @@ -25,6 +25,7 @@ GCONFIG_HEADER_FILES = \ libvirt-gconfig-domain-interface.h \ libvirt-gconfig-domain-interface-network.h \ libvirt-gconfig-domain-os.h \ + libvirt-gconfig-domain-seclabel.h \ libvirt-gconfig-domain-snapshot.h \ libvirt-gconfig-domain-timer.h \ libvirt-gconfig-domain-video.h \ @@ -57,6 +58,7 @@ GCONFIG_SOURCE_FILES = \ libvirt-gconfig-domain-interface.c \ libvirt-gconfig-domain-interface-network.c \ libvirt-gconfig-domain-os.c \ + libvirt-gconfig-domain-seclabel.c \ libvirt-gconfig-domain-snapshot.c \ libvirt-gconfig-domain-timer.c \ libvirt-gconfig-domain-video.c \ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-seclabel.c b/libvirt-gconfig/libvirt-gconfig-domain-seclabel.c new file mode 100644 index 0000000..61fbb48 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-seclabel.c @@ -0,0 +1,113 @@ +/* + * libvirt-gobject-config-domain-seclabel.c: libvirt glib integration + * + * Copyright (C) 2011 Red Hat + * + * 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 PURPSECLABELE. 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., 59 Temple Place, Suite 330, Bseclabelton, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@gmail.com> + */ + +#include <config.h> + +#include <string.h> + +#include <libxml/tree.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h" +#include "libvirt-gconfig/libvirt-gconfig-object-private.h" + +#define GVIR_CONFIG_DOMAIN_SECLABEL_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_SECLABEL, GVirConfigDomainSeclabelPrivate)) + +struct _GVirConfigDomainSeclabelPrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigDomainSeclabel, gvir_config_domain_seclabel, GVIR_TYPE_CONFIG_OBJECT); + + +static void gvir_config_domain_seclabel_class_init(GVirConfigDomainSeclabelClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigDomainSeclabelPrivate)); +} + + +static void gvir_config_domain_seclabel_init(GVirConfigDomainSeclabel *seclabel) +{ + g_debug("Init GVirConfigDomainSeclabel=%p", seclabel); + + seclabel->priv = GVIR_CONFIG_DOMAIN_SECLABEL_GET_PRIVATE(seclabel); +} + + +GVirConfigDomainSeclabel *gvir_config_domain_seclabel_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_SECLABEL, "seclabel", NULL); + return GVIR_CONFIG_DOMAIN_SECLABEL(object); +} + +GVirConfigDomainSeclabel *gvir_config_domain_seclabel_new_from_xml(const gchar *xml, GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_SECLABEL, "seclabel", + NULL, xml, error); + return GVIR_CONFIG_DOMAIN_SECLABEL(object); +} + +void gvir_config_domain_seclabel_set_type(GVirConfigDomainSeclabel *seclabel, + GVirConfigDomainSeclabelType type) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_SECLABEL(seclabel)); + + gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(seclabel), + "type", + GVIR_TYPE_CONFIG_DOMAIN_SECLABEL_TYPE, + type, NULL); +} + +void gvir_config_domain_seclabel_set_model(GVirConfigDomainSeclabel *seclabel, + const gchar *model) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_SECLABEL(seclabel)); + + gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(seclabel), + "model", model, + NULL); + +} + +void gvir_config_domain_seclabel_set_baselabel(GVirConfigDomainSeclabel *seclabel, + const char *label) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_SECLABEL(seclabel)); + + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(seclabel), + "baselabel", label); +} + +void gvir_config_domain_seclabel_set_label(GVirConfigDomainSeclabel *seclabel, + const char *label) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_SECLABEL(seclabel)); + + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(seclabel), + "label", label); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-seclabel.h b/libvirt-gconfig/libvirt-gconfig-domain-seclabel.h new file mode 100644 index 0000000..cfa37a1 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-seclabel.h @@ -0,0 +1,76 @@ +/* + * libvirt-gobject-domain-seclabel.c: libvirt gobject integration + * + * Copyright (C) 2011 Red Hat + * + * 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 PURPSECLABELE. 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., 59 Temple Place, Suite 330, Bseclabelton, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@gmail.com> + */ + +#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD) +#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly." +#endif + +#ifndef __LIBVIRT_GCONFIG_DOMAIN_SECLABEL_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_SECLABEL_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_DOMAIN_SECLABEL (gvir_config_domain_seclabel_get_type ()) +#define GVIR_CONFIG_DOMAIN_SECLABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_SECLABEL, GVirConfigDomainSeclabel)) +#define GVIR_CONFIG_DOMAIN_SECLABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_SECLABEL, GVirConfigDomainSeclabelClass)) +#define GVIR_IS_CONFIG_DOMAIN_SECLABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_SECLABEL)) +#define GVIR_IS_CONFIG_DOMAIN_SECLABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_SECLABEL)) +#define GVIR_CONFIG_DOMAIN_SECLABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_SECLABEL, GVirConfigDomainSeclabelClass)) + +typedef struct _GVirConfigDomainSeclabel GVirConfigDomainSeclabel; +typedef struct _GVirConfigDomainSeclabelPrivate GVirConfigDomainSeclabelPrivate; +typedef struct _GVirConfigDomainSeclabelClass GVirConfigDomainSeclabelClass; + +struct _GVirConfigDomainSeclabel +{ + GVirConfigObject parent; + + GVirConfigDomainSeclabelPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigDomainSeclabelClass +{ + GVirConfigObjectClass parent_class; + + gpointer padding[20]; +}; + +typedef enum { + GVIR_CONFIG_DOMAIN_SECLABEL_TYPE_DYNAMIC, + GVIR_CONFIG_DOMAIN_SECLABEL_TYPE_STATIC +} GVirConfigDomainSeclabelType; + +GType gvir_config_domain_seclabel_get_type(void); + +GVirConfigDomainSeclabel *gvir_config_domain_seclabel_new(void); +GVirConfigDomainSeclabel *gvir_config_domain_seclabel_new_from_xml(const gchar *xml, GError **error); + +void gvir_config_domain_seclabel_set_type(GVirConfigDomainSeclabel *seclabel, GVirConfigDomainSeclabelType type); +void gvir_config_domain_seclabel_set_model(GVirConfigDomainSeclabel *seclabel, const gchar *model); +void gvir_config_domain_seclabel_set_baselabel(GVirConfigDomainSeclabel *seclabel, const gchar *label); +void gvir_config_domain_seclabel_set_label(GVirConfigDomainSeclabel *seclabel, const gchar *label); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_SECLABEL_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c index 8fb1a2b..d83baea 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain.c +++ b/libvirt-gconfig/libvirt-gconfig-domain.c @@ -298,6 +298,16 @@ void gvir_config_domain_set_os(GVirConfigDomain *domain, GVIR_CONFIG_OBJECT(os)); } +void gvir_config_domain_set_seclabel(GVirConfigDomain *domain, + GVirConfigDomainSeclabel *seclabel) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN(domain)); + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_SECLABEL(seclabel)); + + gvir_config_object_attach(GVIR_CONFIG_OBJECT(domain), + GVIR_CONFIG_OBJECT(seclabel)); +} + /** * gvir_config_domain_set_devices: * @devices: (in) (element-type LibvirtGConfig.DomainDevice): diff --git a/libvirt-gconfig/libvirt-gconfig-domain.h b/libvirt-gconfig/libvirt-gconfig-domain.h index c97ff46..6d4195f 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain.h +++ b/libvirt-gconfig/libvirt-gconfig-domain.h @@ -87,6 +87,8 @@ void gvir_config_domain_set_clock(GVirConfigDomain *domain, GVirConfigDomainClock *klock); void gvir_config_domain_set_os(GVirConfigDomain *domain, GVirConfigDomainOs *os); +void gvir_config_domain_set_seclabel(GVirConfigDomain *domain, + GVirConfigDomainSeclabel *seclabel); void gvir_config_domain_set_devices(GVirConfigDomain *domain, GList *devices); void gvir_config_domain_add_device(GVirConfigDomain *domain, diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h index 80ca6f1..ed44682 100644 --- a/libvirt-gconfig/libvirt-gconfig.h +++ b/libvirt-gconfig/libvirt-gconfig.h @@ -41,6 +41,7 @@ #include <libvirt-gconfig/libvirt-gconfig-domain-interface.h> #include <libvirt-gconfig/libvirt-gconfig-domain-interface-network.h> #include <libvirt-gconfig/libvirt-gconfig-domain-os.h> +#include <libvirt-gconfig/libvirt-gconfig-domain-seclabel.h> #include <libvirt-gconfig/libvirt-gconfig-domain-snapshot.h> #include <libvirt-gconfig/libvirt-gconfig-domain-timer.h> #include <libvirt-gconfig/libvirt-gconfig-domain-video.h> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 9236101..b222783 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -19,6 +19,7 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_domain_get_name; gvir_config_domain_set_name; gvir_config_domain_set_os; + gvir_config_domain_set_seclabel; gvir_config_domain_get_vcpus; gvir_config_domain_set_vcpus; gvir_config_domain_get_virt_type; @@ -119,6 +120,15 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_domain_snapshot_new; gvir_config_domain_snapshot_new_from_xml; + gvir_config_domain_seclabel_get_type; + gvir_config_domain_seclabel_type_get_type; + gvir_config_domain_seclabel_new; + gvir_config_domain_seclabel_new_from_xml; + gvir_config_domain_seclabel_set_type; + gvir_config_domain_seclabel_set_model; + gvir_config_domain_seclabel_set_baselabel; + gvir_config_domain_seclabel_set_label; + gvir_config_domain_timer_get_type; gvir_config_domain_timer_new; gvir_config_domain_timer_new_from_xml; -- 1.7.6.4

ACK apart a few small nits below On Wed, Nov 30, 2011 at 05:09:50PM +0000, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Add support for the <seclabel> element via a new object GVirConfigDomainSeclabel.
* libvirt-gconfig-domain-seclabel.c, libvirt-gconfig-domain-seclabel.h, Makefile.am, libvirt-gconfig.h, libvirt-gconfig.sym: New objects * libvirt-gconfig-domain.c, libvirt-gconfig-domain.h: API to associate seclabel with an domain --- libvirt-gconfig/Makefile.am | 2 + libvirt-gconfig/libvirt-gconfig-domain-seclabel.c | 113 +++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-seclabel.h | 76 ++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain.c | 10 ++ libvirt-gconfig/libvirt-gconfig-domain.h | 2 + libvirt-gconfig/libvirt-gconfig.h | 1 + libvirt-gconfig/libvirt-gconfig.sym | 10 ++ 7 files changed, 214 insertions(+), 0 deletions(-) create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-seclabel.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-seclabel.h
diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am index 7c9e8c0..ddae5fa 100644 --- a/libvirt-gconfig/Makefile.am +++ b/libvirt-gconfig/Makefile.am @@ -25,6 +25,7 @@ GCONFIG_HEADER_FILES = \ libvirt-gconfig-domain-interface.h \ libvirt-gconfig-domain-interface-network.h \ libvirt-gconfig-domain-os.h \ + libvirt-gconfig-domain-seclabel.h \ libvirt-gconfig-domain-snapshot.h \ libvirt-gconfig-domain-timer.h \ libvirt-gconfig-domain-video.h \ @@ -57,6 +58,7 @@ GCONFIG_SOURCE_FILES = \ libvirt-gconfig-domain-interface.c \ libvirt-gconfig-domain-interface-network.c \ libvirt-gconfig-domain-os.c \ + libvirt-gconfig-domain-seclabel.c \ libvirt-gconfig-domain-snapshot.c \ libvirt-gconfig-domain-timer.c \ libvirt-gconfig-domain-video.c \ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-seclabel.c b/libvirt-gconfig/libvirt-gconfig-domain-seclabel.c new file mode 100644 index 0000000..61fbb48 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-seclabel.c @@ -0,0 +1,113 @@ +/* + * libvirt-gobject-config-domain-seclabel.c: libvirt glib integration + * + * Copyright (C) 2011 Red Hat + * + * 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 PURPSECLABELE. 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., 59 Temple Place, Suite 330, Bseclabelton, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@gmail.com>
Same comment as all the other patches
+ */ + +#include <config.h> + +#include <string.h> + +#include <libxml/tree.h>
This include can probably be removed from most of the new files you add in this series.
+ +#include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h" +#include "libvirt-gconfig/libvirt-gconfig-object-private.h" + +#define GVIR_CONFIG_DOMAIN_SECLABEL_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_SECLABEL, GVirConfigDomainSeclabelPrivate)) + +struct _GVirConfigDomainSeclabelPrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigDomainSeclabel, gvir_config_domain_seclabel, GVIR_TYPE_CONFIG_OBJECT); + + +static void gvir_config_domain_seclabel_class_init(GVirConfigDomainSeclabelClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigDomainSeclabelPrivate)); +} + + +static void gvir_config_domain_seclabel_init(GVirConfigDomainSeclabel *seclabel) +{ + g_debug("Init GVirConfigDomainSeclabel=%p", seclabel); + + seclabel->priv = GVIR_CONFIG_DOMAIN_SECLABEL_GET_PRIVATE(seclabel); +} + + +GVirConfigDomainSeclabel *gvir_config_domain_seclabel_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_SECLABEL, "seclabel", NULL); + return GVIR_CONFIG_DOMAIN_SECLABEL(object); +} + +GVirConfigDomainSeclabel *gvir_config_domain_seclabel_new_from_xml(const gchar *xml, GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_SECLABEL, "seclabel", + NULL, xml, error); + return GVIR_CONFIG_DOMAIN_SECLABEL(object); +} + +void gvir_config_domain_seclabel_set_type(GVirConfigDomainSeclabel *seclabel, + GVirConfigDomainSeclabelType type) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_SECLABEL(seclabel)); + + gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(seclabel), + "type", + GVIR_TYPE_CONFIG_DOMAIN_SECLABEL_TYPE, + type, NULL); +} + +void gvir_config_domain_seclabel_set_model(GVirConfigDomainSeclabel *seclabel, + const gchar *model) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_SECLABEL(seclabel)); + + gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(seclabel), + "model", model, + NULL); + +} + +void gvir_config_domain_seclabel_set_baselabel(GVirConfigDomainSeclabel *seclabel, + const char *label) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_SECLABEL(seclabel)); + + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(seclabel), + "baselabel", label); +} + +void gvir_config_domain_seclabel_set_label(GVirConfigDomainSeclabel *seclabel, + const char *label) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_SECLABEL(seclabel)); + + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(seclabel), + "label", label); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-seclabel.h b/libvirt-gconfig/libvirt-gconfig-domain-seclabel.h new file mode 100644 index 0000000..cfa37a1 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-seclabel.h @@ -0,0 +1,76 @@ +/* + * libvirt-gobject-domain-seclabel.c: libvirt gobject integration
.h
+ * + * Copyright (C) 2011 Red Hat + * + * 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 PURPSECLABELE. 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., 59 Temple Place, Suite 330, Bseclabelton, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@gmail.com> + */ + +#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD) +#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly." +#endif + +#ifndef __LIBVIRT_GCONFIG_DOMAIN_SECLABEL_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_SECLABEL_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_DOMAIN_SECLABEL (gvir_config_domain_seclabel_get_type ()) +#define GVIR_CONFIG_DOMAIN_SECLABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_SECLABEL, GVirConfigDomainSeclabel)) +#define GVIR_CONFIG_DOMAIN_SECLABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_SECLABEL, GVirConfigDomainSeclabelClass)) +#define GVIR_IS_CONFIG_DOMAIN_SECLABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_SECLABEL)) +#define GVIR_IS_CONFIG_DOMAIN_SECLABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_SECLABEL)) +#define GVIR_CONFIG_DOMAIN_SECLABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_SECLABEL, GVirConfigDomainSeclabelClass)) + +typedef struct _GVirConfigDomainSeclabel GVirConfigDomainSeclabel; +typedef struct _GVirConfigDomainSeclabelPrivate GVirConfigDomainSeclabelPrivate; +typedef struct _GVirConfigDomainSeclabelClass GVirConfigDomainSeclabelClass; + +struct _GVirConfigDomainSeclabel +{ + GVirConfigObject parent; + + GVirConfigDomainSeclabelPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigDomainSeclabelClass +{ + GVirConfigObjectClass parent_class; + + gpointer padding[20]; +}; + +typedef enum { + GVIR_CONFIG_DOMAIN_SECLABEL_TYPE_DYNAMIC, + GVIR_CONFIG_DOMAIN_SECLABEL_TYPE_STATIC +} GVirConfigDomainSeclabelType; + +GType gvir_config_domain_seclabel_get_type(void); + +GVirConfigDomainSeclabel *gvir_config_domain_seclabel_new(void); +GVirConfigDomainSeclabel *gvir_config_domain_seclabel_new_from_xml(const gchar *xml, GError **error); + +void gvir_config_domain_seclabel_set_type(GVirConfigDomainSeclabel *seclabel, GVirConfigDomainSeclabelType type); +void gvir_config_domain_seclabel_set_model(GVirConfigDomainSeclabel *seclabel, const gchar *model); +void gvir_config_domain_seclabel_set_baselabel(GVirConfigDomainSeclabel *seclabel, const gchar *label); +void gvir_config_domain_seclabel_set_label(GVirConfigDomainSeclabel *seclabel, const gchar *label); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_SECLABEL_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c index 8fb1a2b..d83baea 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain.c +++ b/libvirt-gconfig/libvirt-gconfig-domain.c @@ -298,6 +298,16 @@ void gvir_config_domain_set_os(GVirConfigDomain *domain, GVIR_CONFIG_OBJECT(os)); }
+void gvir_config_domain_set_seclabel(GVirConfigDomain *domain, + GVirConfigDomainSeclabel *seclabel) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN(domain)); + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_SECLABEL(seclabel)); + + gvir_config_object_attach(GVIR_CONFIG_OBJECT(domain), + GVIR_CONFIG_OBJECT(seclabel)); +} + /** * gvir_config_domain_set_devices: * @devices: (in) (element-type LibvirtGConfig.DomainDevice): diff --git a/libvirt-gconfig/libvirt-gconfig-domain.h b/libvirt-gconfig/libvirt-gconfig-domain.h index c97ff46..6d4195f 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain.h +++ b/libvirt-gconfig/libvirt-gconfig-domain.h @@ -87,6 +87,8 @@ void gvir_config_domain_set_clock(GVirConfigDomain *domain, GVirConfigDomainClock *klock); void gvir_config_domain_set_os(GVirConfigDomain *domain, GVirConfigDomainOs *os); +void gvir_config_domain_set_seclabel(GVirConfigDomain *domain, + GVirConfigDomainSeclabel *seclabel); void gvir_config_domain_set_devices(GVirConfigDomain *domain, GList *devices); void gvir_config_domain_add_device(GVirConfigDomain *domain, diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h index 80ca6f1..ed44682 100644 --- a/libvirt-gconfig/libvirt-gconfig.h +++ b/libvirt-gconfig/libvirt-gconfig.h @@ -41,6 +41,7 @@ #include <libvirt-gconfig/libvirt-gconfig-domain-interface.h> #include <libvirt-gconfig/libvirt-gconfig-domain-interface-network.h> #include <libvirt-gconfig/libvirt-gconfig-domain-os.h> +#include <libvirt-gconfig/libvirt-gconfig-domain-seclabel.h> #include <libvirt-gconfig/libvirt-gconfig-domain-snapshot.h> #include <libvirt-gconfig/libvirt-gconfig-domain-timer.h> #include <libvirt-gconfig/libvirt-gconfig-domain-video.h> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 9236101..b222783 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -19,6 +19,7 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_domain_get_name; gvir_config_domain_set_name; gvir_config_domain_set_os; + gvir_config_domain_set_seclabel; gvir_config_domain_get_vcpus; gvir_config_domain_set_vcpus; gvir_config_domain_get_virt_type; @@ -119,6 +120,15 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_domain_snapshot_new; gvir_config_domain_snapshot_new_from_xml;
+ gvir_config_domain_seclabel_get_type; + gvir_config_domain_seclabel_type_get_type; + gvir_config_domain_seclabel_new; + gvir_config_domain_seclabel_new_from_xml; + gvir_config_domain_seclabel_set_type; + gvir_config_domain_seclabel_set_model; + gvir_config_domain_seclabel_set_baselabel; + gvir_config_domain_seclabel_set_label; + gvir_config_domain_timer_get_type; gvir_config_domain_timer_new; gvir_config_domain_timer_new_from_xml; -- 1.7.6.4
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
participants (2)
-
Christophe Fergeau
-
Daniel P. Berrange