--- libvirt-gconfig/Makefile.am | 3 + .../libvirt-gconfig-domain-snapshot-disk.c | 88 ++++++++++++++++++++++ .../libvirt-gconfig-domain-snapshot-disk.h | 68 +++++++++++++++++ .../libvirt-gconfig-domain-snapshot-private.h | 38 ++++++++++ libvirt-gconfig/libvirt-gconfig-private.h | 1 + libvirt-gconfig/libvirt-gconfig.h | 1 + libvirt-gconfig/libvirt-gconfig.sym | 4 + 7 files changed, 203 insertions(+) create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.h create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-snapshot-private.h diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am index 68ba39d..36059da 100644 --- a/libvirt-gconfig/Makefile.am +++ b/libvirt-gconfig/Makefile.am @@ -61,6 +61,7 @@ GCONFIG_HEADER_FILES = \ libvirt-gconfig-domain-smartcard-host-certificates.h \ libvirt-gconfig-domain-smartcard-passthrough.h \ libvirt-gconfig-domain-snapshot.h \ + libvirt-gconfig-domain-snapshot-disk.h \ libvirt-gconfig-domain-sound.h \ libvirt-gconfig-domain-timer.h \ libvirt-gconfig-domain-timer-pit.h \ @@ -84,6 +85,7 @@ noinst_HEADERS = \ libvirt-gconfig-capabilities-cpu-private.h \ libvirt-gconfig-compat.h \ libvirt-gconfig-domain-device-private.h \ + libvirt-gconfig-domain-snapshot-private.h \ libvirt-gconfig-helpers-private.h \ libvirt-gconfig-object-private.h \ libvirt-gconfig-xml-doc.h @@ -140,6 +142,7 @@ GCONFIG_SOURCE_FILES = \ libvirt-gconfig-domain-smartcard-host-certificates.c \ libvirt-gconfig-domain-smartcard-passthrough.c \ libvirt-gconfig-domain-snapshot.c \ + libvirt-gconfig-domain-snapshot-disk.c \ libvirt-gconfig-domain-sound.c \ libvirt-gconfig-domain-timer.c \ libvirt-gconfig-domain-timer-pit.c \ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.c b/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.c new file mode 100644 index 0000000..a21f0d6 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.c @@ -0,0 +1,88 @@ +/* + * libvirt-gconfig-secret.c: libvirt secret configuration + * + * Copyright (C) 2008 Daniel P. Berrange + * Copyright (C) 2010-2013 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, see + * <http://www.gnu.org/licenses/>. + * + * Author: Christophe Fergeau <cfergeau@xxxxxxxxxx> + */ + +#include <config.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-private.h" + +#define GVIR_CONFIG_DOMAIN_SNAPSHOT_DISK_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_SNAPSHOT_DISK, GVirConfigDomainSnapshotDiskPrivate)) + +struct _GVirConfigDomainSnapshotDiskPrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigDomainSnapshotDisk, gvir_config_domain_snapshot_disk, GVIR_CONFIG_TYPE_OBJECT); + + +static void gvir_config_domain_snapshot_disk_class_init(GVirConfigDomainSnapshotDiskClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigDomainSnapshotDiskPrivate)); +} + + +static void gvir_config_domain_snapshot_disk_init(GVirConfigDomainSnapshotDisk *disk) +{ + g_debug("Init GVirConfigDomainSnapshotDisk=%p", disk); + + disk->priv = GVIR_CONFIG_DOMAIN_SNAPSHOT_DISK_GET_PRIVATE(disk); +} + + +GVirConfigDomainSnapshotDisk *gvir_config_domain_snapshot_disk_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_SNAPSHOT_DISK, + "disk", + DATADIR "/libvirt/schemas/domainsnapshot.rng"); + return GVIR_CONFIG_DOMAIN_SNAPSHOT_DISK(object); +} + + +GVirConfigDomainSnapshotDisk *gvir_config_domain_snapshot_disk_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_SNAPSHOT_DISK, + "disk", + DATADIR "/libvirt/schemas/domainsnapshot.rng", + xml, error); + return GVIR_CONFIG_DOMAIN_SNAPSHOT_DISK(object); +} + + +GVirConfigDomainSnapshotDisk * +gvir_config_domain_snapshot_disk_new_from_tree(GVirConfigXmlDoc *doc, + xmlNodePtr tree) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_tree(GVIR_CONFIG_TYPE_DOMAIN_SNAPSHOT_DISK, + doc, NULL, tree); + + return GVIR_CONFIG_DOMAIN_SNAPSHOT_DISK(object); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.h b/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.h new file mode 100644 index 0000000..9a73336 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.h @@ -0,0 +1,68 @@ +/* + * libvirt-gconfig-domain-snapshot-disk.h: libvirt snapshot disk configuration + * + * Copyright (C) 2010-2013 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, see + * <http://www.gnu.org/licenses/>. + * + * Author: Christophe Fergeau <cfergeau@xxxxxxxxxx> + */ + +#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_SNAPSHOT_DISK_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_SNAPSHOT_DISK_H__ + +G_BEGIN_DECLS + +#define GVIR_CONFIG_TYPE_DOMAIN_SNAPSHOT_DISK (gvir_config_domain_snapshot_disk_get_type ()) +#define GVIR_CONFIG_DOMAIN_SNAPSHOT_DISK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_SNAPSHOT_DISK, GVirConfigDomainSnapshotDisk)) +#define GVIR_CONFIG_DOMAIN_SNAPSHOT_DISK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_SNAPSHOT_DISK, GVirConfigDomainSnapshotDiskClass)) +#define GVIR_CONFIG_IS_DOMAIN_SNAPSHOT_DISK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_SNAPSHOT_DISK)) +#define GVIR_CONFIG_IS_DOMAIN_SNAPSHOT_DISK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_SNAPSHOT_DISK)) +#define GVIR_CONFIG_DOMAIN_SNAPSHOT_DISK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_SNAPSHOT_DISK, GVirConfigDomainSnapshotDiskClass)) + +typedef struct _GVirConfigDomainSnapshotDisk GVirConfigDomainSnapshotDisk; +typedef struct _GVirConfigDomainSnapshotDiskPrivate GVirConfigDomainSnapshotDiskPrivate; +typedef struct _GVirConfigDomainSnapshotDiskClass GVirConfigDomainSnapshotDiskClass; + +struct _GVirConfigDomainSnapshotDisk +{ + GVirConfigObject parent; + + GVirConfigDomainSnapshotDiskPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigDomainSnapshotDiskClass +{ + GVirConfigObjectClass parent_class; + + gpointer padding[20]; +}; + + +GType gvir_config_domain_snapshot_disk_get_type(void); + +GVirConfigDomainSnapshotDisk *gvir_config_domain_snapshot_disk_new(void); +GVirConfigDomainSnapshotDisk *gvir_config_domain_snapshot_disk_new_from_xml(const gchar *xml, + GError **error); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_SNAPSHOT_DISK_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-snapshot-private.h b/libvirt-gconfig/libvirt-gconfig-domain-snapshot-private.h new file mode 100644 index 0000000..663d2e7 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-snapshot-private.h @@ -0,0 +1,38 @@ +/* + * libvirt-gconfig-domain-snapshot-private.h: libvirt domain snapshot private methods + * + * Copyright (C) 2010-2013 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, see + * <http://www.gnu.org/licenses/>. + * + * Author: Daniel P. Berrange <berrange@xxxxxxxxxx> + */ + +#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_SNAPSHOT_PRIVATE_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_SNAPSHOT_PRIVATE_H__ + +#include <libvirt-gconfig/libvirt-gconfig-domain.h> +#include <libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.h> + +G_BEGIN_DECLS +GVirConfigDomainSnapshotDisk *gvir_config_domain_snapshot_disk_new_from_tree(GVirConfigXmlDoc *doc, + xmlNodePtr tree); +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_SNAPSHOT_PRIVATE_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig-private.h b/libvirt-gconfig/libvirt-gconfig-private.h index 9dc6431..c49c57b 100644 --- a/libvirt-gconfig/libvirt-gconfig-private.h +++ b/libvirt-gconfig/libvirt-gconfig-private.h @@ -25,6 +25,7 @@ #include <libvirt-gconfig/libvirt-gconfig-capabilities-cpu-private.h> #include <libvirt-gconfig/libvirt-gconfig-domain-device-private.h> +#include <libvirt-gconfig/libvirt-gconfig-domain-snapshot-private.h> #include <libvirt-gconfig/libvirt-gconfig-helpers-private.h> #include <libvirt-gconfig/libvirt-gconfig-object-private.h> #include <libvirt-gconfig/libvirt-gconfig-xml-doc.h> diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h index b000747..03e8ce7 100644 --- a/libvirt-gconfig/libvirt-gconfig.h +++ b/libvirt-gconfig/libvirt-gconfig.h @@ -78,6 +78,7 @@ #include <libvirt-gconfig/libvirt-gconfig-domain-smartcard-host-certificates.h> #include <libvirt-gconfig/libvirt-gconfig-domain-smartcard-passthrough.h> #include <libvirt-gconfig/libvirt-gconfig-domain-snapshot.h> +#include <libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.h> #include <libvirt-gconfig/libvirt-gconfig-domain-sound.h> #include <libvirt-gconfig/libvirt-gconfig-domain-timer.h> #include <libvirt-gconfig/libvirt-gconfig-domain-timer-pit.h> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index ccddd88..9352e34 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -557,6 +557,10 @@ LIBVIRT_GCONFIG_0.1.7 { gvir_config_storage_pool_target_get_path; gvir_config_storage_pool_target_get_permissions; + + gvir_config_domain_snapshot_disk_get_type; + gvir_config_domain_snapshot_disk_new; + gvir_config_domain_snapshot_disk_new_from_xml; } LIBVIRT_GCONFIG_0.1.6; # .... define new API here using predicted next version number .... -- 1.8.1.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list