diff options
-rw-r--r-- | libvirt-builder/Makefile.am | 2 | ||||
-rw-r--r-- | libvirt-builder/libvirt-builder-installer.c | 120 | ||||
-rw-r--r-- | libvirt-builder/libvirt-builder-installer.h | 66 | ||||
-rw-r--r-- | libvirt-builder/libvirt-builder.h | 1 | ||||
-rw-r--r-- | libvirt-builder/libvirt-builder.sym | 3 |
5 files changed, 192 insertions, 0 deletions
diff --git a/libvirt-builder/Makefile.am b/libvirt-builder/Makefile.am index a1ea535..8e9a3f2 100644 --- a/libvirt-builder/Makefile.am +++ b/libvirt-builder/Makefile.am @@ -22,10 +22,12 @@ BUILDER_HEADER_FILES = \ libvirt-builder.h \ libvirt-builder-internal.h \ libvirt-builder-domain.h \ + libvirt-builder-installer.h \ libvirt-builder-main.h \ $(NULL) BUILDER_SOURCE_FILES = \ libvirt-builder-domain.c \ + libvirt-builder-installer.c \ libvirt-builder-main.c \ $(NULL) diff --git a/libvirt-builder/libvirt-builder-installer.c b/libvirt-builder/libvirt-builder-installer.c new file mode 100644 index 0000000..9a33bf4 --- /dev/null +++ b/libvirt-builder/libvirt-builder-installer.c @@ -0,0 +1,120 @@ +/* + * libvirt-builder-installer.c: libvirt domain configuration for unattended installations + * + * Copyright (C) 2012-2014 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/>. + * + * Authors: + * Daniel P. Berrange <berrange@redhat.com> + * Christophe Fergeau <cfergeau@redhat.com> + */ + +#include <config.h> +#include <string.h> +#include <sys/utsname.h> + +#include "libvirt-builder/libvirt-builder.h" +#include "libvirt-builder/libvirt-builder-internal.h" + +#define GVIR_BUILDER_INSTALLER_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_BUILDER_TYPE_INSTALLER, GVirBuilderInstallerPrivate)) + +struct _GVirBuilderInstallerPrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirBuilderInstaller, gvir_builder_installer, GVIR_BUILDER_TYPE_DOMAIN); + +#if 0 +#define GVIR_BUILDER_INSTALLER_ERROR gvir_builder_installer_error_quark() + +static GQuark +gvir_builder_installer_error_quark(void) +{ + return g_quark_from_static_string("gvir-builder-installer"); +} + +static gboolean error_is_set(GError **error) +{ + return ((error != NULL) && (*error != NULL)); +} +#endif + +enum { + PROP_0, +}; + +static void gvir_builder_installer_get_property(GObject *object, + guint prop_id, + G_GNUC_UNUSED GValue *value, + GParamSpec *pspec) +{ + g_return_if_fail(GVIR_BUILDER_IS_INSTALLER(object)); + + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + } +} + + +static void gvir_builder_installer_set_property(GObject *object, + guint prop_id, + G_GNUC_UNUSED const GValue *value, + GParamSpec *pspec) +{ + g_return_if_fail(GVIR_BUILDER_IS_INSTALLER(object)); + + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + } +} + + +static void gvir_builder_installer_finalize(GObject *object) +{ + G_OBJECT_CLASS(gvir_builder_installer_parent_class)->finalize(object); +} + + +static void gvir_builder_installer_class_init(GVirBuilderInstallerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS(klass); + + object_class->finalize = gvir_builder_installer_finalize; + + object_class->get_property = gvir_builder_installer_get_property; + object_class->set_property = gvir_builder_installer_set_property; + + g_type_class_add_private(klass, sizeof(GVirBuilderInstallerPrivate)); +} + +static void gvir_builder_installer_init(GVirBuilderInstaller *design) +{ + g_debug("Init GVirBuilderInstaller=%p", design); + + design->priv = GVIR_BUILDER_INSTALLER_GET_PRIVATE(design); +} + + +GVirBuilderInstaller *gvir_builder_installer_new(void) +{ + return GVIR_BUILDER_INSTALLER(g_object_new(GVIR_BUILDER_TYPE_INSTALLER, + NULL)); +} + diff --git a/libvirt-builder/libvirt-builder-installer.h b/libvirt-builder/libvirt-builder-installer.h new file mode 100644 index 0000000..9fdffce --- /dev/null +++ b/libvirt-builder/libvirt-builder-installer.h @@ -0,0 +1,66 @@ +/* + * libvirt-builder-installer.h: libvirt domain configuration for unattended installations + * + * Copyright (C) 2012, 2014 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@redhat.com> + * Christophe Fergeau <cfergeau@redhat.com> + */ + +#if !defined(__LIBVIRT_BUILDER_H__) && !defined(LIBVIRT_BUILDER_BUILD) +#error "Only <libvirt-builder/libvirt-builder.h> can be included directly." +#endif + +#ifndef __LIBVIRT_BUILDER_INSTALLER_H__ +#define __LIBVIRT_BUILDER_INSTALLER_H__ + +G_BEGIN_DECLS + +#define GVIR_BUILDER_TYPE_INSTALLER (gvir_builder_installer_get_type ()) +#define GVIR_BUILDER_INSTALLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_BUILDER_TYPE_INSTALLER, GVirBuilderInstaller)) +#define GVIR_BUILDER_INSTALLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_BUILDER_TYPE_INSTALLER, GVirBuilderInstallerClass)) +#define GVIR_BUILDER_IS_INSTALLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_BUILDER_TYPE_INSTALLER)) +#define GVIR_BUILDER_IS_INSTALLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_BUILDER_TYPE_INSTALLER)) +#define GVIR_BUILDER_INSTALLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_BUILDER_TYPE_INSTALLER, GVirBuilderInstallerClass)) + +typedef struct _GVirBuilderInstaller GVirBuilderInstaller; +typedef struct _GVirBuilderInstallerPrivate GVirBuilderInstallerPrivate; +typedef struct _GVirBuilderInstallerClass GVirBuilderInstallerClass; + +struct _GVirBuilderInstaller +{ + GVirBuilderDomain parent; + + GVirBuilderInstallerPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirBuilderInstallerClass +{ + GVirBuilderDomainClass parent_class; + + gpointer padding[20]; +}; + +GType gvir_builder_installer_get_type(void); + +GVirBuilderInstaller *gvir_builder_installer_new(void); + +G_END_DECLS + +#endif /* __LIBVIRT_BUILDER_INSTALLER_H__ */ diff --git a/libvirt-builder/libvirt-builder.h b/libvirt-builder/libvirt-builder.h index d8e2b12..49aa812 100644 --- a/libvirt-builder/libvirt-builder.h +++ b/libvirt-builder/libvirt-builder.h @@ -29,6 +29,7 @@ /* Local includes */ #include <libvirt-builder/libvirt-builder-domain.h> +#include <libvirt-builder/libvirt-builder-installer.h> #include <libvirt-builder/libvirt-builder-main.h> #include <libvirt-builder/libvirt-builder-enum-types.h> diff --git a/libvirt-builder/libvirt-builder.sym b/libvirt-builder/libvirt-builder.sym index 2ac4aec..0963988 100644 --- a/libvirt-builder/libvirt-builder.sym +++ b/libvirt-builder/libvirt-builder.sym @@ -6,6 +6,9 @@ LIBVIRT_BUILDER_0.0.1 { gvir_builder_domain_get_type; gvir_builder_domain_new; + gvir_builder_installer_get_type; + gvir_builder_installer_new; + local: *; }; |