[libvirt] Storage pool/volume support in libvirt-gconfig

Hi, This patch series adds configuration of storage pools and volumes to libvirt-gconfig. Nothing particularly exciting in there, just more gobjects and setters using the existing helpers. Maybe it would be worth introducing a gvir_config_object_set_content_with_attributes to factor some redundant code. Christophe

--- libvirt-gconfig/libvirt-gconfig-storage-vol.c | 29 +++++++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-storage-vol.h | 7 ++++++ libvirt-gconfig/libvirt-gconfig.sym | 3 ++ 3 files changed, 39 insertions(+), 0 deletions(-) diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol.c b/libvirt-gconfig/libvirt-gconfig-storage-vol.c index 6711ccd..11e21cc 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-vol.c +++ b/libvirt-gconfig/libvirt-gconfig-storage-vol.c @@ -24,6 +24,8 @@ #include <config.h> #include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-object-private.h" + #define GVIR_CONFIG_STORAGE_VOL_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_STORAGE_VOL, GVirConfigStorageVolPrivate)) @@ -71,3 +73,30 @@ GVirConfigStorageVol *gvir_config_storage_vol_new_from_xml(const gchar *xml, xml, error); return GVIR_CONFIG_STORAGE_VOL(object); } + +void gvir_config_storage_vol_set_name(GVirConfigStorageVol *vol, + const char *name) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_VOL(vol)); + + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(vol), + "name", name); +} + +void gvir_config_storage_vol_set_capacity(GVirConfigStorageVol *vol, + guint64 capacity) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_VOL(vol)); + + gvir_config_object_set_node_content_uint64(GVIR_CONFIG_OBJECT(vol), + "capacity", capacity); +} + +void gvir_config_storage_vol_set_allocation(GVirConfigStorageVol *vol, + guint64 allocation) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_VOL(vol)); + + gvir_config_object_set_node_content_uint64(GVIR_CONFIG_OBJECT(vol), + "allocation", allocation); +} diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol.h b/libvirt-gconfig/libvirt-gconfig-storage-vol.h index 7deaa37..b051671 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-vol.h +++ b/libvirt-gconfig/libvirt-gconfig-storage-vol.h @@ -63,6 +63,13 @@ GVirConfigStorageVol *gvir_config_storage_vol_new(void); GVirConfigStorageVol *gvir_config_storage_vol_new_from_xml(const gchar *xml, GError **error); +void gvir_config_storage_vol_set_allocation(GVirConfigStorageVol *vol, + guint64 allocation); +void gvir_config_storage_vol_set_capacity(GVirConfigStorageVol *vol, + guint64 capacity); +void gvir_config_storage_vol_set_name(GVirConfigStorageVol *vol, + const char *name); + G_END_DECLS #endif /* __LIBVIRT_GCONFIG_STORAGE_VOL_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 4ea2b1b..b340b25 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -204,6 +204,9 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_storage_vol_get_type; gvir_config_storage_vol_new; gvir_config_storage_vol_new_from_xml; + gvir_config_storage_vol_set_allocation; + gvir_config_storage_vol_set_capacity; + gvir_config_storage_vol_set_name; local: *; -- 1.7.7.3

On Tue, Dec 06, 2011 at 04:00:50PM +0100, Christophe Fergeau wrote:
--- libvirt-gconfig/libvirt-gconfig-storage-vol.c | 29 +++++++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-storage-vol.h | 7 ++++++ libvirt-gconfig/libvirt-gconfig.sym | 3 ++ 3 files changed, 39 insertions(+), 0 deletions(-)
ACK 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 :|

--- libvirt-gconfig/libvirt-gconfig-storage-pool.c | 49 +++++++++++++++++++++++- libvirt-gconfig/libvirt-gconfig-storage-pool.h | 11 +++++ libvirt-gconfig/libvirt-gconfig.sym | 5 ++ 3 files changed, 64 insertions(+), 1 deletions(-) diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool.c b/libvirt-gconfig/libvirt-gconfig-storage-pool.c index 3cda75b..6c64087 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-pool.c +++ b/libvirt-gconfig/libvirt-gconfig-storage-pool.c @@ -18,12 +18,14 @@ * 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: Daniel P. Berrange <berrange@redhat.com> + * Authors: Daniel P. Berrange <berrange@redhat.com> + * Christophe Fergeau <cfergeau@redhat.com> */ #include <config.h> #include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-object-private.h" #define GVIR_CONFIG_STORAGE_POOL_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_STORAGE_POOL, GVirConfigStoragePoolPrivate)) @@ -71,3 +73,48 @@ GVirConfigStoragePool *gvir_config_storage_pool_new_from_xml(const gchar *xml, xml, error); return GVIR_CONFIG_STORAGE_POOL(object); } + +void gvir_config_storage_pool_set_name(GVirConfigStoragePool *pool, + const char *name) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL(pool)); + + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(pool), + "name", name); +} + +void gvir_config_storage_pool_set_uuid(GVirConfigStoragePool *pool, + const char *uuid) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL(pool)); + + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(pool), + "uuid", uuid); +} + +void gvir_config_storage_pool_set_capacity(GVirConfigStoragePool *pool, + guint64 capacity) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL(pool)); + + gvir_config_object_set_node_content_uint64(GVIR_CONFIG_OBJECT(pool), + "capacity", capacity); +} + +void gvir_config_storage_pool_set_allocation(GVirConfigStoragePool *pool, + guint64 allocation) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL(pool)); + + gvir_config_object_set_node_content_uint64(GVIR_CONFIG_OBJECT(pool), + "allocation", allocation); +} + +void gvir_config_storage_pool_set_available(GVirConfigStoragePool *pool, + guint64 available) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL(pool)); + + gvir_config_object_set_node_content_uint64(GVIR_CONFIG_OBJECT(pool), + "available", available); +} diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool.h b/libvirt-gconfig/libvirt-gconfig-storage-pool.h index bbaa92f..8ffdf77 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-pool.h +++ b/libvirt-gconfig/libvirt-gconfig-storage-pool.h @@ -63,6 +63,17 @@ GVirConfigStoragePool *gvir_config_storage_pool_new(void); GVirConfigStoragePool *gvir_config_storage_pool_new_from_xml(const gchar *xml, GError **error); +void gvir_config_storage_pool_set_allocation(GVirConfigStoragePool *pool, + guint64 allocation); +void gvir_config_storage_pool_set_available(GVirConfigStoragePool *pool, + guint64 available); +void gvir_config_storage_pool_set_capacity(GVirConfigStoragePool *pool, + guint64 capacity); +void gvir_config_storage_pool_set_name(GVirConfigStoragePool *pool, + const char *name); +void gvir_config_storage_pool_set_uuid(GVirConfigStoragePool *pool, + const char *uuid); + G_END_DECLS #endif /* __LIBVIRT_GCONFIG_STORAGE_POOL_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index b340b25..60026af 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -200,6 +200,11 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_storage_pool_get_type; gvir_config_storage_pool_new; gvir_config_storage_pool_new_from_xml; + gvir_config_storage_pool_set_allocation; + gvir_config_storage_pool_set_available; + gvir_config_storage_pool_set_capacity; + gvir_config_storage_pool_set_name; + gvir_config_storage_pool_set_uuid; gvir_config_storage_vol_get_type; gvir_config_storage_vol_new; -- 1.7.7.3

On Tue, Dec 06, 2011 at 04:00:51PM +0100, Christophe Fergeau wrote:
--- libvirt-gconfig/libvirt-gconfig-storage-pool.c | 49 +++++++++++++++++++++++- libvirt-gconfig/libvirt-gconfig-storage-pool.h | 11 +++++ libvirt-gconfig/libvirt-gconfig.sym | 5 ++ 3 files changed, 64 insertions(+), 1 deletions(-)
ACK 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 :|

We'll need several helper classes to implement configuration of storage pools and volumes. This commit introduces all of these in one go. It's just the GObject boilerplate, the actual code will come in other commits. GVirConfigStoragePermissions is namespaced this way because it will be used by both GVirConfigStoragePoolTarget and GVirConfigStorageVolTarget. --- libvirt-gconfig/Makefile.am | 12 +++- .../libvirt-gconfig-storage-permissions.c | 70 +++++++++++++++++++ .../libvirt-gconfig-storage-permissions.h | 68 ++++++++++++++++++ .../libvirt-gconfig-storage-pool-source.c | 72 ++++++++++++++++++++ .../libvirt-gconfig-storage-pool-source.h | 68 ++++++++++++++++++ .../libvirt-gconfig-storage-pool-target.c | 72 ++++++++++++++++++++ .../libvirt-gconfig-storage-pool-target.h | 68 ++++++++++++++++++ .../libvirt-gconfig-storage-vol-backing-store.c | 72 ++++++++++++++++++++ .../libvirt-gconfig-storage-vol-backing-store.h | 68 ++++++++++++++++++ .../libvirt-gconfig-storage-vol-target.c | 72 ++++++++++++++++++++ .../libvirt-gconfig-storage-vol-target.h | 68 ++++++++++++++++++ libvirt-gconfig/libvirt-gconfig.h | 5 ++ libvirt-gconfig/libvirt-gconfig.sym | 20 ++++++ 13 files changed, 734 insertions(+), 1 deletions(-) create mode 100644 libvirt-gconfig/libvirt-gconfig-storage-permissions.c create mode 100644 libvirt-gconfig/libvirt-gconfig-storage-permissions.h create mode 100644 libvirt-gconfig/libvirt-gconfig-storage-pool-source.c create mode 100644 libvirt-gconfig/libvirt-gconfig-storage-pool-source.h create mode 100644 libvirt-gconfig/libvirt-gconfig-storage-pool-target.c create mode 100644 libvirt-gconfig/libvirt-gconfig-storage-pool-target.h create mode 100644 libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.c create mode 100644 libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.h create mode 100644 libvirt-gconfig/libvirt-gconfig-storage-vol-target.c create mode 100644 libvirt-gconfig/libvirt-gconfig-storage-vol-target.h diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am index d9f3096..6363f88 100644 --- a/libvirt-gconfig/Makefile.am +++ b/libvirt-gconfig/Makefile.am @@ -40,8 +40,13 @@ GCONFIG_HEADER_FILES = \ libvirt-gconfig-network-filter.h \ libvirt-gconfig-node-device.h \ libvirt-gconfig-secret.h \ + libvirt-gconfig-storage-permissions.h \ libvirt-gconfig-storage-pool.h \ - libvirt-gconfig-storage-vol.h + libvirt-gconfig-storage-pool-source.h \ + libvirt-gconfig-storage-pool-target.h \ + libvirt-gconfig-storage-vol.h \ + libvirt-gconfig-storage-vol-backing-store.h \ + libvirt-gconfig-storage-vol-target.h noinst_HEADERS = \ libvirt-gconfig-helpers-private.h \ libvirt-gconfig-object-private.h \ @@ -78,8 +83,13 @@ GCONFIG_SOURCE_FILES = \ libvirt-gconfig-network-filter.c \ libvirt-gconfig-node-device.c \ libvirt-gconfig-secret.c \ + libvirt-gconfig-storage-permissions.c \ libvirt-gconfig-storage-pool.c \ + libvirt-gconfig-storage-pool-source.c \ + libvirt-gconfig-storage-pool-target.c \ libvirt-gconfig-storage-vol.c \ + libvirt-gconfig-storage-vol-backing-store.c \ + libvirt-gconfig-storage-vol-target.c \ libvirt-gconfig-xml-doc.c libvirt_gconfig_1_0_ladir = $(includedir)/libvirt-gconfig-1.0/libvirt-gconfig diff --git a/libvirt-gconfig/libvirt-gconfig-storage-permissions.c b/libvirt-gconfig/libvirt-gconfig-storage-permissions.c new file mode 100644 index 0000000..30854c7 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-storage-permissions.c @@ -0,0 +1,70 @@ +/* + * libvirt-gconfig-storage-permissions.c: libvirt storage permissions configuration + * + * Copyright (C) 2011 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@redhat.com> + */ + +#include <config.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" + +#define GVIR_CONFIG_STORAGE_PERMISSIONS_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_STORAGE_PERMISSIONS, GVirConfigStoragePermissionsPrivate)) + +struct _GVirConfigStoragePermissionsPrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigStoragePermissions, gvir_config_storage_permissions, GVIR_TYPE_CONFIG_OBJECT); + + +static void gvir_config_storage_permissions_class_init(GVirConfigStoragePermissionsClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigStoragePermissionsPrivate)); +} + + +static void gvir_config_storage_permissions_init(GVirConfigStoragePermissions *perms) +{ + g_debug("Init GVirConfigStoragePermissions=%p", perms); + + perms->priv = GVIR_CONFIG_STORAGE_PERMISSIONS_GET_PRIVATE(perms); +} + + +GVirConfigStoragePermissions *gvir_config_storage_permissions_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_TYPE_CONFIG_STORAGE_PERMISSIONS, + "permissions", NULL); + return GVIR_CONFIG_STORAGE_PERMISSIONS(object); +} + +GVirConfigStoragePermissions *gvir_config_storage_permissions_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_STORAGE_PERMISSIONS, + "permissions", NULL, + xml, error); + return GVIR_CONFIG_STORAGE_PERMISSIONS(object); +} diff --git a/libvirt-gconfig/libvirt-gconfig-storage-permissions.h b/libvirt-gconfig/libvirt-gconfig-storage-permissions.h new file mode 100644 index 0000000..4b3d09c --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-storage-permissions.h @@ -0,0 +1,68 @@ +/* + * libvirt-gconfig-storage-permissions.h: libvirt storage permissions configuration + * + * Copyright (C) 2011 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau + */ + +#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD) +#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly." +#endif + +#ifndef __LIBVIRT_GCONFIG_STORAGE_PERMISSIONS_H__ +#define __LIBVIRT_GCONFIG_STORAGE_PERMISSIONS_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_STORAGE_PERMISSIONS (gvir_config_storage_permissions_get_type ()) +#define GVIR_CONFIG_STORAGE_PERMISSIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_STORAGE_PERMISSIONS, GVirConfigStoragePermissions)) +#define GVIR_CONFIG_STORAGE_PERMISSIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_STORAGE_PERMISSIONS, GVirConfigStoragePermissionsClass)) +#define GVIR_IS_CONFIG_STORAGE_PERMISSIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_STORAGE_PERMISSIONS)) +#define GVIR_IS_CONFIG_STORAGE_PERMISSIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_STORAGE_PERMISSIONS)) +#define GVIR_CONFIG_STORAGE_PERMISSIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_STORAGE_PERMISSIONS, GVirConfigStoragePermissionsClass)) + +typedef struct _GVirConfigStoragePermissions GVirConfigStoragePermissions; +typedef struct _GVirConfigStoragePermissionsPrivate GVirConfigStoragePermissionsPrivate; +typedef struct _GVirConfigStoragePermissionsClass GVirConfigStoragePermissionsClass; + +struct _GVirConfigStoragePermissions +{ + GVirConfigObject parent; + + GVirConfigStoragePermissionsPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigStoragePermissionsClass +{ + GVirConfigObjectClass parent_class; + + gpointer padding[20]; +}; + + +GType gvir_config_storage_permissions_get_type(void); + +GVirConfigStoragePermissions *gvir_config_storage_permissions_new(void); +GVirConfigStoragePermissions *gvir_config_storage_permissions_new_from_xml(const gchar *xml, + GError **error); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_STORAGE_PERMISSIONS_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool-source.c b/libvirt-gconfig/libvirt-gconfig-storage-pool-source.c new file mode 100644 index 0000000..5e8635b --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-storage-pool-source.c @@ -0,0 +1,72 @@ +/* + * libvirt-gconfig-storage-pool-source.c: libvirt storage pool source configuration + * + * Copyright (C) 2011 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@redhat.com> + */ + +#include <config.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-object-private.h" + + +#define GVIR_CONFIG_STORAGE_POOL_SOURCE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_STORAGE_POOL_SOURCE, GVirConfigStoragePoolSourcePrivate)) + +struct _GVirConfigStoragePoolSourcePrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigStoragePoolSource, gvir_config_storage_pool_source, GVIR_TYPE_CONFIG_OBJECT); + + +static void gvir_config_storage_pool_source_class_init(GVirConfigStoragePoolSourceClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigStoragePoolSourcePrivate)); +} + + +static void gvir_config_storage_pool_source_init(GVirConfigStoragePoolSource *source) +{ + g_debug("Init GVirConfigStoragePoolSource=%p", source); + + source->priv = GVIR_CONFIG_STORAGE_POOL_SOURCE_GET_PRIVATE(source); +} + + +GVirConfigStoragePoolSource *gvir_config_storage_pool_source_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_TYPE_CONFIG_STORAGE_POOL_SOURCE, + "source", NULL); + return GVIR_CONFIG_STORAGE_POOL_SOURCE(object); +} + +GVirConfigStoragePoolSource *gvir_config_storage_pool_source_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_STORAGE_POOL_SOURCE, + "source", NULL, + xml, error); + return GVIR_CONFIG_STORAGE_POOL_SOURCE(object); +} diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool-source.h b/libvirt-gconfig/libvirt-gconfig-storage-pool-source.h new file mode 100644 index 0000000..cd84f9c --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-storage-pool-source.h @@ -0,0 +1,68 @@ +/* + * libvirt-gconfig-storage-pool-target.c: libvirt storage pool target configuration + * + * Copyright (C) 2010-2011 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@redhat.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_STORAGE_POOL_SOURCE_H__ +#define __LIBVIRT_GCONFIG_STORAGE_POOL_SOURCE_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_STORAGE_POOL_SOURCE (gvir_config_storage_pool_source_get_type ()) +#define GVIR_CONFIG_STORAGE_POOL_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_STORAGE_POOL_SOURCE, GVirConfigStoragePoolSource)) +#define GVIR_CONFIG_STORAGE_POOL_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_STORAGE_POOL_SOURCE, GVirConfigStoragePoolSourceClass)) +#define GVIR_IS_CONFIG_STORAGE_POOL_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_STORAGE_POOL_SOURCE)) +#define GVIR_IS_CONFIG_STORAGE_POOL_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_STORAGE_POOL_SOURCE)) +#define GVIR_CONFIG_STORAGE_POOL_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_STORAGE_POOL_SOURCE, GVirConfigStoragePoolSourceClass)) + +typedef struct _GVirConfigStoragePoolSource GVirConfigStoragePoolSource; +typedef struct _GVirConfigStoragePoolSourcePrivate GVirConfigStoragePoolSourcePrivate; +typedef struct _GVirConfigStoragePoolSourceClass GVirConfigStoragePoolSourceClass; + +struct _GVirConfigStoragePoolSource +{ + GVirConfigObject parent; + + GVirConfigStoragePoolSourcePrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigStoragePoolSourceClass +{ + GVirConfigObjectClass parent_class; + + gpointer padding[20]; +}; + + +GType gvir_config_storage_pool_source_get_type(void); + +GVirConfigStoragePoolSource *gvir_config_storage_pool_source_new(void); +GVirConfigStoragePoolSource *gvir_config_storage_pool_source_new_from_xml(const gchar *xml, + GError **error); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_STORAGE_POOL_SOURCE_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c b/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c new file mode 100644 index 0000000..3d9d99c --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c @@ -0,0 +1,72 @@ +/* + * libvirt-gconfig-storage-pool-target.c: libvirt storage pool target configuration + * + * Copyright (C) 2011 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@redhat.com> + */ + +#include <config.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-object-private.h" + + +#define GVIR_CONFIG_STORAGE_POOL_TARGET_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_STORAGE_POOL_TARGET, GVirConfigStoragePoolTargetPrivate)) + +struct _GVirConfigStoragePoolTargetPrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigStoragePoolTarget, gvir_config_storage_pool_target, GVIR_TYPE_CONFIG_OBJECT); + + +static void gvir_config_storage_pool_target_class_init(GVirConfigStoragePoolTargetClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigStoragePoolTargetPrivate)); +} + + +static void gvir_config_storage_pool_target_init(GVirConfigStoragePoolTarget *target) +{ + g_debug("Init GVirConfigStoragePoolTarget=%p", target); + + target->priv = GVIR_CONFIG_STORAGE_POOL_TARGET_GET_PRIVATE(target); +} + + +GVirConfigStoragePoolTarget *gvir_config_storage_pool_target_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_TYPE_CONFIG_STORAGE_POOL_TARGET, + "target", NULL); + return GVIR_CONFIG_STORAGE_POOL_TARGET(object); +} + +GVirConfigStoragePoolTarget *gvir_config_storage_pool_target_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_STORAGE_POOL_TARGET, + "target", NULL, + xml, error); + return GVIR_CONFIG_STORAGE_POOL_TARGET(object); +} diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool-target.h b/libvirt-gconfig/libvirt-gconfig-storage-pool-target.h new file mode 100644 index 0000000..fd68ace --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-storage-pool-target.h @@ -0,0 +1,68 @@ +/* + * libvirt-gconfig-storage-pool-target.h: libvirt storage pool target configuration + * + * Copyright (C) 2011 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@redhat.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_STORAGE_POOL_TARGET_H__ +#define __LIBVIRT_GCONFIG_STORAGE_POOL_TARGET_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_STORAGE_POOL_TARGET (gvir_config_storage_pool_target_get_type ()) +#define GVIR_CONFIG_STORAGE_POOL_TARGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_STORAGE_POOL_TARGET, GVirConfigStoragePoolTarget)) +#define GVIR_CONFIG_STORAGE_POOL_TARGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_STORAGE_POOL_TARGET, GVirConfigStoragePoolTargetClass)) +#define GVIR_IS_CONFIG_STORAGE_POOL_TARGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_STORAGE_POOL_TARGET)) +#define GVIR_IS_CONFIG_STORAGE_POOL_TARGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_STORAGE_POOL_TARGET)) +#define GVIR_CONFIG_STORAGE_POOL_TARGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_STORAGE_POOL_TARGET, GVirConfigStoragePoolTargetClass)) + +typedef struct _GVirConfigStoragePoolTarget GVirConfigStoragePoolTarget; +typedef struct _GVirConfigStoragePoolTargetPrivate GVirConfigStoragePoolTargetPrivate; +typedef struct _GVirConfigStoragePoolTargetClass GVirConfigStoragePoolTargetClass; + +struct _GVirConfigStoragePoolTarget +{ + GVirConfigObject parent; + + GVirConfigStoragePoolTargetPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigStoragePoolTargetClass +{ + GVirConfigObjectClass parent_class; + + gpointer padding[20]; +}; + + +GType gvir_config_storage_pool_target_get_type(void); + +GVirConfigStoragePoolTarget *gvir_config_storage_pool_target_new(void); +GVirConfigStoragePoolTarget *gvir_config_storage_pool_target_new_from_xml(const gchar *xml, + GError **error); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_STORAGE_POOL_TARGET_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.c b/libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.c new file mode 100644 index 0000000..899d4b5 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.c @@ -0,0 +1,72 @@ +/* + * libvirt-gconfig-storage-vol-backing-store.c: libvirt storage vol backing store configuration + * + * Copyright (C) 2011 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * +* Author: Christophe Fergeau <cfergeau@redhat.com> + */ + +#include <config.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-object-private.h" + + +#define GVIR_CONFIG_STORAGE_VOL_BACKING_STORE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_STORAGE_VOL_BACKING_STORE, GVirConfigStorageVolBackingStorePrivate)) + +struct _GVirConfigStorageVolBackingStorePrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigStorageVolBackingStore, gvir_config_storage_vol_backing_store, GVIR_TYPE_CONFIG_OBJECT); + + +static void gvir_config_storage_vol_backing_store_class_init(GVirConfigStorageVolBackingStoreClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigStorageVolBackingStorePrivate)); +} + + +static void gvir_config_storage_vol_backing_store_init(GVirConfigStorageVolBackingStore *backing_store) +{ + g_debug("Init GVirConfigStorageVolBackingStore=%p", backing_store); + + backing_store->priv = GVIR_CONFIG_STORAGE_VOL_BACKING_STORE_GET_PRIVATE(backing_store); +} + + +GVirConfigStorageVolBackingStore *gvir_config_storage_vol_backing_store_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_TYPE_CONFIG_STORAGE_VOL_BACKING_STORE, + "backingStore", NULL); + return GVIR_CONFIG_STORAGE_VOL_BACKING_STORE(object); +} + +GVirConfigStorageVolBackingStore *gvir_config_storage_vol_backing_store_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_STORAGE_VOL_BACKING_STORE, + "backingStore", NULL, + xml, error); + return GVIR_CONFIG_STORAGE_VOL_BACKING_STORE(object); +} diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.h b/libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.h new file mode 100644 index 0000000..8829c66 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.h @@ -0,0 +1,68 @@ +/* + * libvirt-gconfig-storage-vol-backing-store.c: libvirt storage volume backing store configuration + * + * Copyright (C) 2011 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@redhat.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_STORAGE_VOL_BACKING_STORE_H__ +#define __LIBVIRT_GCONFIG_STORAGE_VOL_BACKING_STORE_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_STORAGE_VOL_BACKING_STORE (gvir_config_storage_vol_backing_store_get_type ()) +#define GVIR_CONFIG_STORAGE_VOL_BACKING_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_STORAGE_VOL_BACKING_STORE, GVirConfigStorageVolBackingStore)) +#define GVIR_CONFIG_STORAGE_VOL_BACKING_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_STORAGE_VOL_BACKING_STORE, GVirConfigStorageVolBackingStoreClass)) +#define GVIR_IS_CONFIG_STORAGE_VOL_BACKING_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_STORAGE_VOL_BACKING_STORE)) +#define GVIR_IS_CONFIG_STORAGE_VOL_BACKING_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_STORAGE_VOL_BACKING_STORE)) +#define GVIR_CONFIG_STORAGE_VOL_BACKING_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_STORAGE_VOL_BACKING_STORE, GVirConfigStorageVolBackingStoreClass)) + +typedef struct _GVirConfigStorageVolBackingStore GVirConfigStorageVolBackingStore; +typedef struct _GVirConfigStorageVolBackingStorePrivate GVirConfigStorageVolBackingStorePrivate; +typedef struct _GVirConfigStorageVolBackingStoreClass GVirConfigStorageVolBackingStoreClass; + +struct _GVirConfigStorageVolBackingStore +{ + GVirConfigObject parent; + + GVirConfigStorageVolBackingStorePrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigStorageVolBackingStoreClass +{ + GVirConfigObjectClass parent_class; + + gpointer padding[20]; +}; + + +GType gvir_config_storage_vol_backing_store_get_type(void); + +GVirConfigStorageVolBackingStore *gvir_config_storage_vol_backing_store_new(void); +GVirConfigStorageVolBackingStore *gvir_config_storage_vol_backing_store_new_from_xml(const gchar *xml, + GError **error); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_STORAGE_VOL_BACKING_STORE_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c new file mode 100644 index 0000000..516a4b9 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c @@ -0,0 +1,72 @@ +/* + * libvirt-gconfig-storage-vol-target.c: libvirt storage vol target configuration + * + * Copyright (C) 2011 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@redhat.com> + */ + +#include <config.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-object-private.h" + + +#define GVIR_CONFIG_STORAGE_VOL_TARGET_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_STORAGE_VOL_TARGET, GVirConfigStorageVolTargetPrivate)) + +struct _GVirConfigStorageVolTargetPrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigStorageVolTarget, gvir_config_storage_vol_target, GVIR_TYPE_CONFIG_OBJECT); + + +static void gvir_config_storage_vol_target_class_init(GVirConfigStorageVolTargetClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigStorageVolTargetPrivate)); +} + + +static void gvir_config_storage_vol_target_init(GVirConfigStorageVolTarget *target) +{ + g_debug("Init GVirConfigStorageVolTarget=%p", target); + + target->priv = GVIR_CONFIG_STORAGE_VOL_TARGET_GET_PRIVATE(target); +} + + +GVirConfigStorageVolTarget *gvir_config_storage_vol_target_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_TYPE_CONFIG_STORAGE_VOL_TARGET, + "target", NULL); + return GVIR_CONFIG_STORAGE_VOL_TARGET(object); +} + +GVirConfigStorageVolTarget *gvir_config_storage_vol_target_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_STORAGE_VOL_TARGET, + "target", NULL, + xml, error); + return GVIR_CONFIG_STORAGE_VOL_TARGET(object); +} diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h new file mode 100644 index 0000000..9c14681 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h @@ -0,0 +1,68 @@ +/* + * libvirt-gconfig-storage-vol-target.c: libvirt storage volume target configuration + * + * Copyright (C) 2010-2011 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@redhat.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_STORAGE_VOL_TARGET_H__ +#define __LIBVIRT_GCONFIG_STORAGE_VOL_TARGET_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_STORAGE_VOL_TARGET (gvir_config_storage_vol_target_get_type ()) +#define GVIR_CONFIG_STORAGE_VOL_TARGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_STORAGE_VOL_TARGET, GVirConfigStorageVolTarget)) +#define GVIR_CONFIG_STORAGE_VOL_TARGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_STORAGE_VOL_TARGET, GVirConfigStorageVolTargetClass)) +#define GVIR_IS_CONFIG_STORAGE_VOL_TARGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_STORAGE_VOL_TARGET)) +#define GVIR_IS_CONFIG_STORAGE_VOL_TARGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_STORAGE_VOL_TARGET)) +#define GVIR_CONFIG_STORAGE_VOL_TARGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_STORAGE_VOL_TARGET, GVirConfigStorageVolTargetClass)) + +typedef struct _GVirConfigStorageVolTarget GVirConfigStorageVolTarget; +typedef struct _GVirConfigStorageVolTargetPrivate GVirConfigStorageVolTargetPrivate; +typedef struct _GVirConfigStorageVolTargetClass GVirConfigStorageVolTargetClass; + +struct _GVirConfigStorageVolTarget +{ + GVirConfigObject parent; + + GVirConfigStorageVolTargetPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigStorageVolTargetClass +{ + GVirConfigObjectClass parent_class; + + gpointer padding[20]; +}; + + +GType gvir_config_storage_vol_target_get_type(void); + +GVirConfigStorageVolTarget *gvir_config_storage_vol_target_new(void); +GVirConfigStorageVolTarget *gvir_config_storage_vol_target_new_from_xml(const gchar *xml, + GError **error); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_STORAGE_VOL_TARGET_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h index c60e221..252f51c 100644 --- a/libvirt-gconfig/libvirt-gconfig.h +++ b/libvirt-gconfig/libvirt-gconfig.h @@ -58,7 +58,12 @@ #include <libvirt-gconfig/libvirt-gconfig-network-filter.h> #include <libvirt-gconfig/libvirt-gconfig-node-device.h> #include <libvirt-gconfig/libvirt-gconfig-secret.h> +#include <libvirt-gconfig/libvirt-gconfig-storage-permissions.h> #include <libvirt-gconfig/libvirt-gconfig-storage-pool.h> +#include <libvirt-gconfig/libvirt-gconfig-storage-pool-source.h> +#include <libvirt-gconfig/libvirt-gconfig-storage-pool-target.h> #include <libvirt-gconfig/libvirt-gconfig-storage-vol.h> +#include <libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.h> +#include <libvirt-gconfig/libvirt-gconfig-storage-vol-target.h> #endif /* __LIBVIRT_GCONFIG_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 60026af..34c3d6b 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -197,6 +197,10 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_secret_new; gvir_config_secret_new_from_xml; + gvir_config_storage_permissions_get_type; + gvir_config_storage_permissions_new; + gvir_config_storage_permissions_new_from_xml; + gvir_config_storage_pool_get_type; gvir_config_storage_pool_new; gvir_config_storage_pool_new_from_xml; @@ -206,6 +210,14 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_storage_pool_set_name; gvir_config_storage_pool_set_uuid; + gvir_config_storage_pool_source_get_type; + gvir_config_storage_pool_source_new; + gvir_config_storage_pool_source_new_from_xml; + + gvir_config_storage_pool_target_get_type; + gvir_config_storage_pool_target_new; + gvir_config_storage_pool_target_new_from_xml; + gvir_config_storage_vol_get_type; gvir_config_storage_vol_new; gvir_config_storage_vol_new_from_xml; @@ -213,6 +225,14 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_storage_vol_set_capacity; gvir_config_storage_vol_set_name; + gvir_config_storage_vol_backing_store_get_type; + gvir_config_storage_vol_backing_store_new; + gvir_config_storage_vol_backing_store_new_from_xml; + + gvir_config_storage_vol_target_get_type; + gvir_config_storage_vol_target_new; + gvir_config_storage_vol_target_new_from_xml; + local: *; }; -- 1.7.7.3

On Tue, Dec 06, 2011 at 04:00:52PM +0100, Christophe Fergeau wrote:
We'll need several helper classes to implement configuration of storage pools and volumes. This commit introduces all of these in one go. It's just the GObject boilerplate, the actual code will come in other commits. GVirConfigStoragePermissions is namespaced this way because it will be used by both GVirConfigStoragePoolTarget and GVirConfigStorageVolTarget. --- libvirt-gconfig/Makefile.am | 12 +++- .../libvirt-gconfig-storage-permissions.c | 70 +++++++++++++++++++ .../libvirt-gconfig-storage-permissions.h | 68 ++++++++++++++++++ .../libvirt-gconfig-storage-pool-source.c | 72 ++++++++++++++++++++ .../libvirt-gconfig-storage-pool-source.h | 68 ++++++++++++++++++ .../libvirt-gconfig-storage-pool-target.c | 72 ++++++++++++++++++++ .../libvirt-gconfig-storage-pool-target.h | 68 ++++++++++++++++++ .../libvirt-gconfig-storage-vol-backing-store.c | 72 ++++++++++++++++++++ .../libvirt-gconfig-storage-vol-backing-store.h | 68 ++++++++++++++++++ .../libvirt-gconfig-storage-vol-target.c | 72 ++++++++++++++++++++ .../libvirt-gconfig-storage-vol-target.h | 68 ++++++++++++++++++
The storage volume <backingStore> element is really a subset of the storage volume <target> element schema, so there is perhaps value in having a shared parent class between them 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 :|

On Wed, Dec 14, 2011 at 02:51:33PM +0000, Daniel P. Berrange wrote:
On Tue, Dec 06, 2011 at 04:00:52PM +0100, Christophe Fergeau wrote:
We'll need several helper classes to implement configuration of storage pools and volumes. This commit introduces all of these in one go. It's just the GObject boilerplate, the actual code will come in other commits. GVirConfigStoragePermissions is namespaced this way because it will be used by both GVirConfigStoragePoolTarget and GVirConfigStorageVolTarget. --- libvirt-gconfig/Makefile.am | 12 +++- .../libvirt-gconfig-storage-permissions.c | 70 +++++++++++++++++++ .../libvirt-gconfig-storage-permissions.h | 68 ++++++++++++++++++ .../libvirt-gconfig-storage-pool-source.c | 72 ++++++++++++++++++++ .../libvirt-gconfig-storage-pool-source.h | 68 ++++++++++++++++++ .../libvirt-gconfig-storage-pool-target.c | 72 ++++++++++++++++++++ .../libvirt-gconfig-storage-pool-target.h | 68 ++++++++++++++++++ .../libvirt-gconfig-storage-vol-backing-store.c | 72 ++++++++++++++++++++ .../libvirt-gconfig-storage-vol-backing-store.h | 68 ++++++++++++++++++ .../libvirt-gconfig-storage-vol-target.c | 72 ++++++++++++++++++++ .../libvirt-gconfig-storage-vol-target.h | 68 ++++++++++++++++++
The storage volume <backingStore> element is really a subset of the storage volume <target> element schema, so there is perhaps value in having a shared parent class between them
I'm not sure this would bring much, except if these 2 nodes grow a lot of new attributes. I'd tend to commit this as is for now, and maybe improve it later if this proves worth it. IS it fine with you, or do you prefer to have this done now? Christophe

On Thu, Dec 15, 2011 at 05:07:47PM +0100, Christophe Fergeau wrote:
On Wed, Dec 14, 2011 at 02:51:33PM +0000, Daniel P. Berrange wrote:
On Tue, Dec 06, 2011 at 04:00:52PM +0100, Christophe Fergeau wrote:
We'll need several helper classes to implement configuration of storage pools and volumes. This commit introduces all of these in one go. It's just the GObject boilerplate, the actual code will come in other commits. GVirConfigStoragePermissions is namespaced this way because it will be used by both GVirConfigStoragePoolTarget and GVirConfigStorageVolTarget. --- libvirt-gconfig/Makefile.am | 12 +++- .../libvirt-gconfig-storage-permissions.c | 70 +++++++++++++++++++ .../libvirt-gconfig-storage-permissions.h | 68 ++++++++++++++++++ .../libvirt-gconfig-storage-pool-source.c | 72 ++++++++++++++++++++ .../libvirt-gconfig-storage-pool-source.h | 68 ++++++++++++++++++ .../libvirt-gconfig-storage-pool-target.c | 72 ++++++++++++++++++++ .../libvirt-gconfig-storage-pool-target.h | 68 ++++++++++++++++++ .../libvirt-gconfig-storage-vol-backing-store.c | 72 ++++++++++++++++++++ .../libvirt-gconfig-storage-vol-backing-store.h | 68 ++++++++++++++++++ .../libvirt-gconfig-storage-vol-target.c | 72 ++++++++++++++++++++ .../libvirt-gconfig-storage-vol-target.h | 68 ++++++++++++++++++
The storage volume <backingStore> element is really a subset of the storage volume <target> element schema, so there is perhaps value in having a shared parent class between them
I'm not sure this would bring much, except if these 2 nodes grow a lot of new attributes. I'd tend to commit this as is for now, and maybe improve it later if this proves worth it. IS it fine with you, or do you prefer to have this done now?
Nah it is fine as it is. I just wanted to raise the idea. ACK 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 :|

--- .../libvirt-gconfig-storage-vol-target.c | 13 +++++++++++++ .../libvirt-gconfig-storage-vol-target.h | 3 +++ libvirt-gconfig/libvirt-gconfig.sym | 1 + 3 files changed, 17 insertions(+), 0 deletions(-) diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c index 516a4b9..55022de 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c +++ b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c @@ -70,3 +70,16 @@ GVirConfigStorageVolTarget *gvir_config_storage_vol_target_new_from_xml(const gc xml, error); return GVIR_CONFIG_STORAGE_VOL_TARGET(object); } + +void gvir_config_storage_vol_target_set_format(GVirConfigStorageVolTarget *target, + const char *format) +{ + GVirConfigObject *node; + + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_VOL_TARGET(target)); + + node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(target), "format"); + g_return_if_fail(GVIR_IS_CONFIG_OBJECT(node)); + gvir_config_object_set_attribute(node, "type", format, NULL); + g_object_unref(G_OBJECT(node)); +} diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h index 9c14681..dc3a709 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h +++ b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h @@ -63,6 +63,9 @@ GVirConfigStorageVolTarget *gvir_config_storage_vol_target_new(void); GVirConfigStorageVolTarget *gvir_config_storage_vol_target_new_from_xml(const gchar *xml, GError **error); +void gvir_config_storage_vol_target_set_format(GVirConfigStorageVolTarget *target, + const char *format); + G_END_DECLS #endif /* __LIBVIRT_GCONFIG_STORAGE_VOL_TARGET_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 34c3d6b..3ad0e0b 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -232,6 +232,7 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_storage_vol_target_get_type; gvir_config_storage_vol_target_new; gvir_config_storage_vol_target_new_from_xml; + gvir_config_storage_vol_target_set_format; local: *; -- 1.7.7.3

On Tue, Dec 06, 2011 at 04:00:53PM +0100, Christophe Fergeau wrote:
--- .../libvirt-gconfig-storage-vol-target.c | 13 +++++++++++++ .../libvirt-gconfig-storage-vol-target.h | 3 +++ libvirt-gconfig/libvirt-gconfig.sym | 1 + 3 files changed, 17 insertions(+), 0 deletions(-)
ACK 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 :|

--- .../libvirt-gconfig-storage-vol-backing-store.c | 22 ++++++++++++++++++++ .../libvirt-gconfig-storage-vol-backing-store.h | 4 +++ libvirt-gconfig/libvirt-gconfig.sym | 2 + 3 files changed, 28 insertions(+), 0 deletions(-) diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.c b/libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.c index 899d4b5..2530ed3 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.c +++ b/libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.c @@ -70,3 +70,25 @@ GVirConfigStorageVolBackingStore *gvir_config_storage_vol_backing_store_new_from xml, error); return GVIR_CONFIG_STORAGE_VOL_BACKING_STORE(object); } + +void gvir_config_storage_vol_backing_store_set_format(GVirConfigStorageVolBackingStore *backing_store, + const char *format) +{ + GVirConfigObject *node; + + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_VOL_BACKING_STORE(backing_store)); + + node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(backing_store), "format"); + g_return_if_fail(GVIR_IS_CONFIG_OBJECT(node)); + gvir_config_object_set_attribute(node, "type", format, NULL); + g_object_unref(G_OBJECT(node)); +} + +void gvir_config_storage_vol_backing_store_set_path(GVirConfigStorageVolBackingStore *backing_store, + const char *path) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_VOL_BACKING_STORE(backing_store)); + + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(backing_store), + "path", path); +} diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.h b/libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.h index 8829c66..9b709ed 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.h +++ b/libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.h @@ -62,6 +62,10 @@ GType gvir_config_storage_vol_backing_store_get_type(void); GVirConfigStorageVolBackingStore *gvir_config_storage_vol_backing_store_new(void); GVirConfigStorageVolBackingStore *gvir_config_storage_vol_backing_store_new_from_xml(const gchar *xml, GError **error); +void gvir_config_storage_vol_backing_store_set_format(GVirConfigStorageVolBackingStore *backing_store, + const char *format); +void gvir_config_storage_vol_backing_store_set_path(GVirConfigStorageVolBackingStore *backing_store, + const char *path); G_END_DECLS diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 3ad0e0b..e870108 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -228,6 +228,8 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_storage_vol_backing_store_get_type; gvir_config_storage_vol_backing_store_new; gvir_config_storage_vol_backing_store_new_from_xml; + gvir_config_storage_vol_backing_store_set_format; + gvir_config_storage_vol_backing_store_set_path; gvir_config_storage_vol_target_get_type; gvir_config_storage_vol_target_new; -- 1.7.7.3

On Tue, Dec 06, 2011 at 04:00:54PM +0100, Christophe Fergeau wrote:
--- .../libvirt-gconfig-storage-vol-backing-store.c | 22 ++++++++++++++++++++ .../libvirt-gconfig-storage-vol-backing-store.h | 4 +++ libvirt-gconfig/libvirt-gconfig.sym | 2 + 3 files changed, 28 insertions(+), 0 deletions(-)
ACK 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 :|

--- .../libvirt-gconfig-storage-pool-source.c | 100 ++++++++++++++++++++ .../libvirt-gconfig-storage-pool-source.h | 17 ++++ libvirt-gconfig/libvirt-gconfig.sym | 8 ++ 3 files changed, 125 insertions(+), 0 deletions(-) diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool-source.c b/libvirt-gconfig/libvirt-gconfig-storage-pool-source.c index 5e8635b..b2223a2 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-pool-source.c +++ b/libvirt-gconfig/libvirt-gconfig-storage-pool-source.c @@ -70,3 +70,103 @@ GVirConfigStoragePoolSource *gvir_config_storage_pool_source_new_from_xml(const xml, error); return GVIR_CONFIG_STORAGE_POOL_SOURCE(object); } + +void gvir_config_storage_pool_source_set_adapter(GVirConfigStoragePoolSource *source, + const char *adapter) +{ + GVirConfigObject *node; + + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL_SOURCE(source)); + + node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(source), "adapter"); + g_return_if_fail(GVIR_IS_CONFIG_OBJECT(node)); + gvir_config_object_set_attribute(node, "name", adapter, NULL); + g_object_unref(G_OBJECT(node)); +} + +void gvir_config_storage_pool_source_set_device_path(GVirConfigStoragePoolSource *source, + const char *device_path) +{ + GVirConfigObject *node; + + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL_SOURCE(source)); + + node = gvir_config_object_add_child(GVIR_CONFIG_OBJECT(source), "device"); + g_return_if_fail(GVIR_IS_CONFIG_OBJECT(node)); + gvir_config_object_set_attribute(node, "path", device_path, NULL); + g_object_unref(G_OBJECT(node)); +} + +void gvir_config_storage_pool_source_set_directory(GVirConfigStoragePoolSource *source, + const char *directory) +{ + GVirConfigObject *node; + + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL_SOURCE(source)); + + node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(source), "directory"); + g_return_if_fail(GVIR_IS_CONFIG_OBJECT(node)); + gvir_config_object_set_attribute(node, "path", directory, NULL); + g_object_unref(G_OBJECT(node)); +} + +void gvir_config_storage_pool_source_set_format(GVirConfigStoragePoolSource *source, + const char *format) +{ + GVirConfigObject *node; + + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL_SOURCE(source)); + + node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(source), "format"); + g_return_if_fail(GVIR_IS_CONFIG_OBJECT(node)); + gvir_config_object_set_attribute(node, "type", format, NULL); + g_object_unref(G_OBJECT(node)); +} + +void gvir_config_storage_pool_source_set_host(GVirConfigStoragePoolSource *source, + const char *host) +{ + GVirConfigObject *node; + + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL_SOURCE(source)); + + node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(source), "host"); + g_return_if_fail(GVIR_IS_CONFIG_OBJECT(node)); + gvir_config_object_set_attribute(node, "name", host, NULL); + g_object_unref(G_OBJECT(node)); +} + +void gvir_config_storage_pool_source_set_name(GVirConfigStoragePoolSource *source, + const char *name) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL_SOURCE(source)); + + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(source), + "name", name); +} + +void gvir_config_storage_pool_source_set_product(GVirConfigStoragePoolSource *source, + const char *product) +{ + GVirConfigObject *node; + + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL_SOURCE(source)); + + node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(source), "product"); + g_return_if_fail(GVIR_IS_CONFIG_OBJECT(node)); + gvir_config_object_set_attribute(node, "name", product, NULL); + g_object_unref(G_OBJECT(node)); +} + +void gvir_config_storage_pool_source_set_vendor(GVirConfigStoragePoolSource *source, + const char *vendor) +{ + GVirConfigObject *node; + + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL_SOURCE(source)); + + node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(source), "vendor"); + g_return_if_fail(GVIR_IS_CONFIG_OBJECT(node)); + gvir_config_object_set_attribute(node, "name", vendor, NULL); + g_object_unref(G_OBJECT(node)); +} diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool-source.h b/libvirt-gconfig/libvirt-gconfig-storage-pool-source.h index cd84f9c..295d65d 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-pool-source.h +++ b/libvirt-gconfig/libvirt-gconfig-storage-pool-source.h @@ -63,6 +63,23 @@ GVirConfigStoragePoolSource *gvir_config_storage_pool_source_new(void); GVirConfigStoragePoolSource *gvir_config_storage_pool_source_new_from_xml(const gchar *xml, GError **error); +void gvir_config_storage_pool_source_set_adapter(GVirConfigStoragePoolSource *source, + const char *adapter); +void gvir_config_storage_pool_source_set_device_path(GVirConfigStoragePoolSource *source, + const char *device_path); +void gvir_config_storage_pool_source_set_directory(GVirConfigStoragePoolSource *source, + const char *directory); +void gvir_config_storage_pool_source_set_format(GVirConfigStoragePoolSource *source, + const char *format); +void gvir_config_storage_pool_source_set_host(GVirConfigStoragePoolSource *source, + const char *host); +void gvir_config_storage_pool_source_set_name(GVirConfigStoragePoolSource *source, + const char *name); +void gvir_config_storage_pool_source_set_product(GVirConfigStoragePoolSource *source, + const char *product); +void gvir_config_storage_pool_source_set_vendor(GVirConfigStoragePoolSource *source, + const char *vendor); + G_END_DECLS #endif /* __LIBVIRT_GCONFIG_STORAGE_POOL_SOURCE_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index e870108..f64e77f 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -213,6 +213,14 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_storage_pool_source_get_type; gvir_config_storage_pool_source_new; gvir_config_storage_pool_source_new_from_xml; + gvir_config_storage_pool_source_set_adapter; + gvir_config_storage_pool_source_set_device_path; + gvir_config_storage_pool_source_set_directory; + gvir_config_storage_pool_source_set_format; + gvir_config_storage_pool_source_set_host; + gvir_config_storage_pool_source_set_name; + gvir_config_storage_pool_source_set_product; + gvir_config_storage_pool_source_set_vendor; gvir_config_storage_pool_target_get_type; gvir_config_storage_pool_target_new; -- 1.7.7.3

On Tue, Dec 06, 2011 at 04:00:55PM +0100, Christophe Fergeau wrote:
--- .../libvirt-gconfig-storage-pool-source.c | 100 ++++++++++++++++++++ .../libvirt-gconfig-storage-pool-source.h | 17 ++++ libvirt-gconfig/libvirt-gconfig.sym | 8 ++ 3 files changed, 125 insertions(+), 0 deletions(-)
ACK 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 :|

--- .../libvirt-gconfig-storage-pool-target.c | 9 +++++++++ .../libvirt-gconfig-storage-pool-target.h | 3 +++ libvirt-gconfig/libvirt-gconfig.sym | 1 + 3 files changed, 13 insertions(+), 0 deletions(-) diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c b/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c index 3d9d99c..314ca2d 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c +++ b/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c @@ -70,3 +70,12 @@ GVirConfigStoragePoolTarget *gvir_config_storage_pool_target_new_from_xml(const xml, error); return GVIR_CONFIG_STORAGE_POOL_TARGET(object); } + +void gvir_config_storage_pool_target_set_path(GVirConfigStoragePoolTarget *target, + const char *path) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL_TARGET(target)); + + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(target), + "path", path); +} diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool-target.h b/libvirt-gconfig/libvirt-gconfig-storage-pool-target.h index fd68ace..b81473a 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-pool-target.h +++ b/libvirt-gconfig/libvirt-gconfig-storage-pool-target.h @@ -63,6 +63,9 @@ GVirConfigStoragePoolTarget *gvir_config_storage_pool_target_new(void); GVirConfigStoragePoolTarget *gvir_config_storage_pool_target_new_from_xml(const gchar *xml, GError **error); +void gvir_config_storage_pool_target_set_path(GVirConfigStoragePoolTarget *target, + const char *path); + G_END_DECLS #endif /* __LIBVIRT_GCONFIG_STORAGE_POOL_TARGET_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index f64e77f..b44ca99 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -225,6 +225,7 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_storage_pool_target_get_type; gvir_config_storage_pool_target_new; gvir_config_storage_pool_target_new_from_xml; + gvir_config_storage_pool_target_set_path; gvir_config_storage_vol_get_type; gvir_config_storage_vol_new; -- 1.7.7.3

On Tue, Dec 06, 2011 at 04:00:56PM +0100, Christophe Fergeau wrote:
--- .../libvirt-gconfig-storage-pool-target.c | 9 +++++++++ .../libvirt-gconfig-storage-pool-target.h | 3 +++ libvirt-gconfig/libvirt-gconfig.sym | 1 + 3 files changed, 13 insertions(+), 0 deletions(-)
ACK 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 :|

--- .../libvirt-gconfig-storage-permissions.c | 37 ++++++++++++++++++++ .../libvirt-gconfig-storage-permissions.h | 9 +++++ libvirt-gconfig/libvirt-gconfig.sym | 4 ++ 3 files changed, 50 insertions(+), 0 deletions(-) diff --git a/libvirt-gconfig/libvirt-gconfig-storage-permissions.c b/libvirt-gconfig/libvirt-gconfig-storage-permissions.c index 30854c7..c5f9f49 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-permissions.c +++ b/libvirt-gconfig/libvirt-gconfig-storage-permissions.c @@ -23,6 +23,7 @@ #include <config.h> #include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-object-private.h" #define GVIR_CONFIG_STORAGE_PERMISSIONS_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_STORAGE_PERMISSIONS, GVirConfigStoragePermissionsPrivate)) @@ -68,3 +69,39 @@ GVirConfigStoragePermissions *gvir_config_storage_permissions_new_from_xml(const xml, error); return GVIR_CONFIG_STORAGE_PERMISSIONS(object); } + +void gvir_config_storage_permissions_set_group(GVirConfigStoragePermissions *perms, + guint group) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_PERMISSIONS(perms)); + + gvir_config_object_set_node_content_uint64(GVIR_CONFIG_OBJECT(perms), + "group", group); +} + +void gvir_config_storage_permissions_set_label(GVirConfigStoragePermissions *perms, + const char *label) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_PERMISSIONS(perms)); + + gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(perms), + "label", label); +} + +void gvir_config_storage_permissions_set_mode(GVirConfigStoragePermissions *perms, + guint mode) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_PERMISSIONS(perms)); + + gvir_config_object_set_node_content_uint64(GVIR_CONFIG_OBJECT(perms), + "mode", mode); +} + +void gvir_config_storage_permissions_set_owner(GVirConfigStoragePermissions *perms, + guint owner) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_PERMISSIONS(perms)); + + gvir_config_object_set_node_content_uint64(GVIR_CONFIG_OBJECT(perms), + "owner", owner); +} diff --git a/libvirt-gconfig/libvirt-gconfig-storage-permissions.h b/libvirt-gconfig/libvirt-gconfig-storage-permissions.h index 4b3d09c..458c61d 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-permissions.h +++ b/libvirt-gconfig/libvirt-gconfig-storage-permissions.h @@ -63,6 +63,15 @@ GVirConfigStoragePermissions *gvir_config_storage_permissions_new(void); GVirConfigStoragePermissions *gvir_config_storage_permissions_new_from_xml(const gchar *xml, GError **error); +void gvir_config_storage_permissions_set_group(GVirConfigStoragePermissions *perms, + guint group); +void gvir_config_storage_permissions_set_label(GVirConfigStoragePermissions *perms, + const char *label); +void gvir_config_storage_permissions_set_mode(GVirConfigStoragePermissions *perms, + guint mode); +void gvir_config_storage_permissions_set_owner(GVirConfigStoragePermissions *perms, + guint owner); + G_END_DECLS #endif /* __LIBVIRT_GCONFIG_STORAGE_PERMISSIONS_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index b44ca99..ee7ce16 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -200,6 +200,10 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_storage_permissions_get_type; gvir_config_storage_permissions_new; gvir_config_storage_permissions_new_from_xml; + gvir_config_storage_permissions_set_group; + gvir_config_storage_permissions_set_label; + gvir_config_storage_permissions_set_mode; + gvir_config_storage_permissions_set_owner; gvir_config_storage_pool_get_type; gvir_config_storage_pool_new; -- 1.7.7.3

On Tue, Dec 06, 2011 at 04:00:57PM +0100, Christophe Fergeau wrote:
--- .../libvirt-gconfig-storage-permissions.c | 37 ++++++++++++++++++++ .../libvirt-gconfig-storage-permissions.h | 9 +++++ libvirt-gconfig/libvirt-gconfig.sym | 4 ++ 3 files changed, 50 insertions(+), 0 deletions(-)
ACK 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 :|

GVirConfigStorageVolBackingStore and GVirConfigStorageVolTarget can be associated with a GVirConfigStorageVol. GVirConfigStoragePoolSource and GVirConfigStoragePoolTarget can be associated with a GVirConfigStoragePool. GVirConfigStoragePermissions can be set on either a GVirConfigStorageVolTarget or a GVirConfigStoragePoolTarget. --- .../libvirt-gconfig-storage-pool-target.c | 10 ++++++++++ .../libvirt-gconfig-storage-pool-target.h | 2 ++ libvirt-gconfig/libvirt-gconfig-storage-pool.c | 20 ++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-storage-pool.h | 7 +++++++ .../libvirt-gconfig-storage-vol-target.c | 10 ++++++++++ .../libvirt-gconfig-storage-vol-target.h | 2 ++ libvirt-gconfig/libvirt-gconfig-storage-vol.c | 20 ++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-storage-vol.h | 7 +++++++ libvirt-gconfig/libvirt-gconfig.sym | 6 ++++++ 9 files changed, 84 insertions(+), 0 deletions(-) diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c b/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c index 314ca2d..a5af381 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c +++ b/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c @@ -79,3 +79,13 @@ void gvir_config_storage_pool_target_set_path(GVirConfigStoragePoolTarget *targe gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(target), "path", path); } + +void gvir_config_storage_pool_target_set_permissions(GVirConfigStoragePoolTarget *target, + GVirConfigStoragePermissions *perms) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL_TARGET(target)); + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_PERMISSIONS(perms)); + + gvir_config_object_attach(GVIR_CONFIG_OBJECT(target), + GVIR_CONFIG_OBJECT(perms)); +} diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool-target.h b/libvirt-gconfig/libvirt-gconfig-storage-pool-target.h index b81473a..eeb00f5 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-pool-target.h +++ b/libvirt-gconfig/libvirt-gconfig-storage-pool-target.h @@ -65,6 +65,8 @@ GVirConfigStoragePoolTarget *gvir_config_storage_pool_target_new_from_xml(const void gvir_config_storage_pool_target_set_path(GVirConfigStoragePoolTarget *target, const char *path); +void gvir_config_storage_pool_target_set_permissions(GVirConfigStoragePoolTarget *target, + GVirConfigStoragePermissions *perms); G_END_DECLS diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool.c b/libvirt-gconfig/libvirt-gconfig-storage-pool.c index 6c64087..97bcbb4 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-pool.c +++ b/libvirt-gconfig/libvirt-gconfig-storage-pool.c @@ -118,3 +118,23 @@ void gvir_config_storage_pool_set_available(GVirConfigStoragePool *pool, gvir_config_object_set_node_content_uint64(GVIR_CONFIG_OBJECT(pool), "available", available); } + +void gvir_config_storage_pool_set_source(GVirConfigStoragePool *pool, + GVirConfigStoragePoolSource *source) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL(pool)); + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL_SOURCE(source)); + + gvir_config_object_attach(GVIR_CONFIG_OBJECT(pool), + GVIR_CONFIG_OBJECT(source)); +} + +void gvir_config_storage_pool_set_target(GVirConfigStoragePool *pool, + GVirConfigStoragePoolTarget *target) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL(pool)); + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL_TARGET(target)); + + gvir_config_object_attach(GVIR_CONFIG_OBJECT(pool), + GVIR_CONFIG_OBJECT(target)); +} diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool.h b/libvirt-gconfig/libvirt-gconfig-storage-pool.h index 8ffdf77..3f2a5bd 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-pool.h +++ b/libvirt-gconfig/libvirt-gconfig-storage-pool.h @@ -27,6 +27,9 @@ #ifndef __LIBVIRT_GCONFIG_STORAGE_POOL_H__ #define __LIBVIRT_GCONFIG_STORAGE_POOL_H__ +#include <libvirt-gconfig/libvirt-gconfig-storage-pool-source.h> +#include <libvirt-gconfig/libvirt-gconfig-storage-pool-target.h> + G_BEGIN_DECLS #define GVIR_TYPE_CONFIG_STORAGE_POOL (gvir_config_storage_pool_get_type ()) @@ -71,6 +74,10 @@ void gvir_config_storage_pool_set_capacity(GVirConfigStoragePool *pool, guint64 capacity); void gvir_config_storage_pool_set_name(GVirConfigStoragePool *pool, const char *name); +void gvir_config_storage_pool_set_source(GVirConfigStoragePool *pool, + GVirConfigStoragePoolSource *source); +void gvir_config_storage_pool_set_target(GVirConfigStoragePool *pool, + GVirConfigStoragePoolTarget *target); void gvir_config_storage_pool_set_uuid(GVirConfigStoragePool *pool, const char *uuid); diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c index 55022de..6a3bb0c 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c +++ b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c @@ -83,3 +83,13 @@ void gvir_config_storage_vol_target_set_format(GVirConfigStorageVolTarget *targe gvir_config_object_set_attribute(node, "type", format, NULL); g_object_unref(G_OBJECT(node)); } + +void gvir_config_storage_vol_target_set_permissions(GVirConfigStorageVolTarget *target, + GVirConfigStoragePermissions *perms) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_VOL_TARGET(target)); + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_PERMISSIONS(perms)); + + gvir_config_object_attach(GVIR_CONFIG_OBJECT(target), + GVIR_CONFIG_OBJECT(perms)); +} diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h index dc3a709..266c34e 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h +++ b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h @@ -65,6 +65,8 @@ GVirConfigStorageVolTarget *gvir_config_storage_vol_target_new_from_xml(const gc void gvir_config_storage_vol_target_set_format(GVirConfigStorageVolTarget *target, const char *format); +void gvir_config_storage_vol_target_set_permissions(GVirConfigStorageVolTarget *target, + GVirConfigStoragePermissions *perms); G_END_DECLS diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol.c b/libvirt-gconfig/libvirt-gconfig-storage-vol.c index 11e21cc..079a5fd 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-vol.c +++ b/libvirt-gconfig/libvirt-gconfig-storage-vol.c @@ -100,3 +100,23 @@ void gvir_config_storage_vol_set_allocation(GVirConfigStorageVol *vol, gvir_config_object_set_node_content_uint64(GVIR_CONFIG_OBJECT(vol), "allocation", allocation); } + +void gvir_config_storage_vol_set_target(GVirConfigStorageVol *vol, + GVirConfigStorageVolTarget *target) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_VOL(vol)); + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_VOL_TARGET(target)); + + gvir_config_object_attach(GVIR_CONFIG_OBJECT(vol), + GVIR_CONFIG_OBJECT(target)); +} + +void gvir_config_storage_vol_set_backing_store(GVirConfigStorageVol *vol, + GVirConfigStorageVolBackingStore *backing_store) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_VOL(vol)); + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_VOL_BACKING_STORE(backing_store)); + + gvir_config_object_attach(GVIR_CONFIG_OBJECT(vol), + GVIR_CONFIG_OBJECT(backing_store)); +} diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol.h b/libvirt-gconfig/libvirt-gconfig-storage-vol.h index b051671..d1c10f9 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-vol.h +++ b/libvirt-gconfig/libvirt-gconfig-storage-vol.h @@ -27,6 +27,9 @@ #ifndef __LIBVIRT_GCONFIG_STORAGE_VOL_H__ #define __LIBVIRT_GCONFIG_STORAGE_VOL_H__ +#include <libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.h> +#include <libvirt-gconfig/libvirt-gconfig-storage-vol-target.h> + G_BEGIN_DECLS #define GVIR_TYPE_CONFIG_STORAGE_VOL (gvir_config_storage_vol_get_type ()) @@ -65,10 +68,14 @@ GVirConfigStorageVol *gvir_config_storage_vol_new_from_xml(const gchar *xml, void gvir_config_storage_vol_set_allocation(GVirConfigStorageVol *vol, guint64 allocation); +void gvir_config_storage_vol_set_backing_store(GVirConfigStorageVol *vol, + GVirConfigStorageVolBackingStore *backing_store); void gvir_config_storage_vol_set_capacity(GVirConfigStorageVol *vol, guint64 capacity); void gvir_config_storage_vol_set_name(GVirConfigStorageVol *vol, const char *name); +void gvir_config_storage_vol_set_target(GVirConfigStorageVol *vol, + GVirConfigStorageVolTarget *target); G_END_DECLS diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index ee7ce16..48e2fd7 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -212,6 +212,8 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_storage_pool_set_available; gvir_config_storage_pool_set_capacity; gvir_config_storage_pool_set_name; + gvir_config_storage_pool_set_source; + gvir_config_storage_pool_set_target; gvir_config_storage_pool_set_uuid; gvir_config_storage_pool_source_get_type; @@ -230,13 +232,16 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_storage_pool_target_new; gvir_config_storage_pool_target_new_from_xml; gvir_config_storage_pool_target_set_path; + gvir_config_storage_pool_target_set_permissions; gvir_config_storage_vol_get_type; gvir_config_storage_vol_new; gvir_config_storage_vol_new_from_xml; gvir_config_storage_vol_set_allocation; + gvir_config_storage_vol_set_backing_store; gvir_config_storage_vol_set_capacity; gvir_config_storage_vol_set_name; + gvir_config_storage_vol_set_target; gvir_config_storage_vol_backing_store_get_type; gvir_config_storage_vol_backing_store_new; @@ -248,6 +253,7 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_storage_vol_target_new; gvir_config_storage_vol_target_new_from_xml; gvir_config_storage_vol_target_set_format; + gvir_config_storage_vol_target_set_permissions; local: *; -- 1.7.7.3

On Tue, Dec 06, 2011 at 04:00:58PM +0100, Christophe Fergeau wrote:
GVirConfigStorageVolBackingStore and GVirConfigStorageVolTarget can be associated with a GVirConfigStorageVol.
GVirConfigStoragePoolSource and GVirConfigStoragePoolTarget can be associated with a GVirConfigStoragePool.
GVirConfigStoragePermissions can be set on either a GVirConfigStorageVolTarget or a GVirConfigStoragePoolTarget. --- .../libvirt-gconfig-storage-pool-target.c | 10 ++++++++++ .../libvirt-gconfig-storage-pool-target.h | 2 ++ libvirt-gconfig/libvirt-gconfig-storage-pool.c | 20 ++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-storage-pool.h | 7 +++++++ .../libvirt-gconfig-storage-vol-target.c | 10 ++++++++++ .../libvirt-gconfig-storage-vol-target.h | 2 ++ libvirt-gconfig/libvirt-gconfig-storage-vol.c | 20 ++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-storage-vol.h | 7 +++++++ libvirt-gconfig/libvirt-gconfig.sym | 6 ++++++ 9 files changed, 84 insertions(+), 0 deletions(-)
ACK 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 :|

--- libvirt-gconfig/tests/test-domain-create.c | 62 +++++++++++++++++++++++++++- 1 files changed, 60 insertions(+), 2 deletions(-) diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c index 006ebc6..bcaa29a 100644 --- a/libvirt-gconfig/tests/test-domain-create.c +++ b/libvirt-gconfig/tests/test-domain-create.c @@ -147,7 +147,6 @@ int main(void) g_object_unref(G_OBJECT(pty)); devices = g_list_append(devices, GVIR_CONFIG_DOMAIN_DEVICE(console)); - gvir_config_domain_set_devices(domain, devices); g_list_foreach(devices, (GFunc)g_object_unref, NULL); g_list_free(devices); @@ -155,9 +154,68 @@ int main(void) xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(domain)); - g_print("%s\n", xml); + g_print("%s\n\n", xml); g_free(xml); g_object_unref(G_OBJECT(domain)); + + /* storage pool */ + GVirConfigStoragePool *pool; + GVirConfigStoragePoolSource *pool_source; + GVirConfigStoragePoolTarget *pool_target; + GVirConfigStoragePermissions *perms; + + pool = gvir_config_storage_pool_new(); + + pool_source = gvir_config_storage_pool_source_new(); + gvir_config_storage_pool_source_set_directory(pool_source, "/foo/bar"); + gvir_config_storage_pool_set_source(pool, pool_source); + g_object_unref(G_OBJECT(pool_source)); + + perms = gvir_config_storage_permissions_new(); + gvir_config_storage_permissions_set_owner(perms, 1001); + gvir_config_storage_permissions_set_group(perms, 1007); + gvir_config_storage_permissions_set_mode(perms, 0744); + gvir_config_storage_permissions_set_label(perms, "virt_image_t"); + + pool_target = gvir_config_storage_pool_target_new(); + gvir_config_storage_pool_target_set_path(pool_target, "/dev/disk/by-path"); + gvir_config_storage_pool_target_set_permissions(pool_target, perms); + g_object_unref(G_OBJECT(perms)); + gvir_config_storage_pool_set_target(pool, pool_target); + g_object_unref(G_OBJECT(pool_target)); + + xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(pool)); + g_print("%s\n\n", xml); + g_free(xml); + g_object_unref(G_OBJECT(pool)); + + + /* storage volume */ + GVirConfigStorageVol *vol; + GVirConfigStorageVolTarget *vol_target; + + vol = gvir_config_storage_vol_new(); + gvir_config_storage_vol_set_name(vol, "my-volume"); + gvir_config_storage_vol_set_capacity(vol, 1000000); + + perms = gvir_config_storage_permissions_new(); + gvir_config_storage_permissions_set_owner(perms, 1001); + gvir_config_storage_permissions_set_group(perms, 1007); + gvir_config_storage_permissions_set_mode(perms, 0744); + gvir_config_storage_permissions_set_label(perms, "virt_image_t"); + + vol_target = gvir_config_storage_vol_target_new(); + gvir_config_storage_vol_target_set_format(vol_target, "qcow2"); + gvir_config_storage_vol_target_set_permissions(vol_target, perms); + g_object_unref(G_OBJECT(perms)); + gvir_config_storage_vol_set_target(vol, vol_target); + g_object_unref(G_OBJECT(vol_target)); + + xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(vol)); + g_print("%s\n\n", xml); + g_free(xml); + g_object_unref(G_OBJECT(vol)); + return 0; } -- 1.7.7.3

On Tue, Dec 06, 2011 at 04:00:59PM +0100, Christophe Fergeau wrote:
--- libvirt-gconfig/tests/test-domain-create.c | 62 +++++++++++++++++++++++++++- 1 files changed, 60 insertions(+), 2 deletions(-)
ACK 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 :|

--- libvirt-gconfig/libvirt-gconfig-storage-pool.c | 12 ++++++++++++ libvirt-gconfig/libvirt-gconfig-storage-pool.h | 12 ++++++++++++ libvirt-gconfig/libvirt-gconfig.sym | 2 ++ libvirt-gconfig/tests/test-domain-create.c | 1 + 4 files changed, 27 insertions(+), 0 deletions(-) diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool.c b/libvirt-gconfig/libvirt-gconfig-storage-pool.c index 97bcbb4..95609bb 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-pool.c +++ b/libvirt-gconfig/libvirt-gconfig-storage-pool.c @@ -74,6 +74,18 @@ GVirConfigStoragePool *gvir_config_storage_pool_new_from_xml(const gchar *xml, return GVIR_CONFIG_STORAGE_POOL(object); } +void gvir_config_storage_pool_set_pool_type(GVirConfigStoragePool *pool, + GVirConfigStoragePoolType type) +{ + g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL(pool)); + + gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(pool), + "type", + GVIR_TYPE_CONFIG_STORAGE_POOL_TYPE, + type, + NULL); +} + void gvir_config_storage_pool_set_name(GVirConfigStoragePool *pool, const char *name) { diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool.h b/libvirt-gconfig/libvirt-gconfig-storage-pool.h index 3f2a5bd..84f6c80 100644 --- a/libvirt-gconfig/libvirt-gconfig-storage-pool.h +++ b/libvirt-gconfig/libvirt-gconfig-storage-pool.h @@ -59,6 +59,16 @@ struct _GVirConfigStoragePoolClass gpointer padding[20]; }; +typedef enum { + GVIR_CONFIG_STORAGE_POOL_TYPE_DIR, + GVIR_CONFIG_STORAGE_POOL_TYPE_FS, + GVIR_CONFIG_STORAGE_POOL_TYPE_NETFS, + GVIR_CONFIG_STORAGE_POOL_TYPE_LOGICAL, + GVIR_CONFIG_STORAGE_POOL_TYPE_DISK, + GVIR_CONFIG_STORAGE_POOL_TYPE_ISCSI, + GVIR_CONFIG_STORAGE_POOL_TYPE_SCSI, + GVIR_CONFIG_STORAGE_POOL_TYPE_MPATH +} GVirConfigStoragePoolType; GType gvir_config_storage_pool_get_type(void); @@ -74,6 +84,8 @@ void gvir_config_storage_pool_set_capacity(GVirConfigStoragePool *pool, guint64 capacity); void gvir_config_storage_pool_set_name(GVirConfigStoragePool *pool, const char *name); +void gvir_config_storage_pool_set_pool_type(GVirConfigStoragePool *pool, + GVirConfigStoragePoolType type); void gvir_config_storage_pool_set_source(GVirConfigStoragePool *pool, GVirConfigStoragePoolSource *source); void gvir_config_storage_pool_set_target(GVirConfigStoragePool *pool, diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index d0c35d2..297c1f4 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -216,12 +216,14 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_storage_permissions_set_owner; gvir_config_storage_pool_get_type; + gvir_config_storage_pool_type_get_type; gvir_config_storage_pool_new; gvir_config_storage_pool_new_from_xml; gvir_config_storage_pool_set_allocation; gvir_config_storage_pool_set_available; gvir_config_storage_pool_set_capacity; gvir_config_storage_pool_set_name; + gvir_config_storage_pool_set_pool_type; gvir_config_storage_pool_set_source; gvir_config_storage_pool_set_target; gvir_config_storage_pool_set_uuid; diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c index ea3a3ea..c5f0027 100644 --- a/libvirt-gconfig/tests/test-domain-create.c +++ b/libvirt-gconfig/tests/test-domain-create.c @@ -176,6 +176,7 @@ int main(void) GVirConfigStoragePermissions *perms; pool = gvir_config_storage_pool_new(); + gvir_config_storage_pool_set_pool_type(pool, GVIR_CONFIG_STORAGE_POOL_TYPE_DIR); pool_source = gvir_config_storage_pool_source_new(); gvir_config_storage_pool_source_set_directory(pool_source, "/foo/bar"); -- 1.7.7.3

On Fri, Dec 09, 2011 at 02:20:23PM +0100, Christophe Fergeau wrote:
--- libvirt-gconfig/libvirt-gconfig-storage-pool.c | 12 ++++++++++++ libvirt-gconfig/libvirt-gconfig-storage-pool.h | 12 ++++++++++++ libvirt-gconfig/libvirt-gconfig.sym | 2 ++ libvirt-gconfig/tests/test-domain-create.c | 1 + 4 files changed, 27 insertions(+), 0 deletions(-)
ACK 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 :|
participants (2)
-
Christophe Fergeau
-
Daniel P. Berrange