[PATCH libvirt-glib 03/15] Add support for <memballoon> configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

---
 libvirt-gconfig/Makefile.am                        |    2 +
 .../libvirt-gconfig-domain-memballoon.c            |   82 ++++++++++++++++++++
 .../libvirt-gconfig-domain-memballoon.h            |   75 ++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig.h                  |    1 +
 libvirt-gconfig/libvirt-gconfig.sym                |    6 ++
 5 files changed, 166 insertions(+), 0 deletions(-)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-memballoon.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-memballoon.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 43f719d..e38b48e 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -26,6 +26,7 @@ GCONFIG_HEADER_FILES = \
 			libvirt-gconfig-domain-input.h \
 			libvirt-gconfig-domain-interface.h \
 			libvirt-gconfig-domain-interface-network.h \
+			libvirt-gconfig-domain-memballoon.h \
 			libvirt-gconfig-domain-os.h \
 			libvirt-gconfig-domain-seclabel.h \
 			libvirt-gconfig-domain-snapshot.h \
@@ -61,6 +62,7 @@ GCONFIG_SOURCE_FILES = \
 			libvirt-gconfig-domain-input.c \
 			libvirt-gconfig-domain-interface.c \
 			libvirt-gconfig-domain-interface-network.c \
+			libvirt-gconfig-domain-memballoon.c \
 			libvirt-gconfig-domain-os.c \
 			libvirt-gconfig-domain-seclabel.c \
 			libvirt-gconfig-domain-snapshot.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-memballoon.c b/libvirt-gconfig/libvirt-gconfig-domain-memballoon.c
new file mode 100644
index 0000000..6bc5a8f
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-memballoon.c
@@ -0,0 +1,82 @@
+/*
+ * libvirt-gconfig-domain-memballoon.c: libvirt domain memballoon configuration
+ *
+ * Copyright (C) 2011 Red Hat
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ * Author: Christophe Fergeau <cfergeau@xxxxxxxxx>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h"
+#include "libvirt-gconfig/libvirt-gconfig-object-private.h"
+
+#define GVIR_CONFIG_DOMAIN_MEMBALLOON_GET_PRIVATE(obj)                         \
+        (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_MEMBALLOON, GVirConfigDomainMemballoonPrivate))
+
+struct _GVirConfigDomainMemballoonPrivate
+{
+    gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainMemballoon, gvir_config_domain_memballoon, GVIR_TYPE_CONFIG_DOMAIN_DEVICE);
+
+
+static void gvir_config_domain_memballoon_class_init(GVirConfigDomainMemballoonClass *klass)
+{
+    g_type_class_add_private(klass, sizeof(GVirConfigDomainMemballoonPrivate));
+}
+
+
+static void gvir_config_domain_memballoon_init(GVirConfigDomainMemballoon *memballoon)
+{
+    g_debug("Init GVirConfigDomainMemballoon=%p", memballoon);
+
+    memballoon->priv = GVIR_CONFIG_DOMAIN_MEMBALLOON_GET_PRIVATE(memballoon);
+}
+
+
+GVirConfigDomainMemballoon *gvir_config_domain_memballoon_new(void)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_MEMBALLOON,
+                                    "memballoon", NULL);
+    return GVIR_CONFIG_DOMAIN_MEMBALLOON(object);
+}
+
+GVirConfigDomainMemballoon *gvir_config_domain_memballoon_new_from_xml(const gchar *xml,
+                                                                       GError **error)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_MEMBALLOON,
+                                             "memballoon", NULL, xml, error);
+    return GVIR_CONFIG_DOMAIN_MEMBALLOON(object);
+}
+
+void gvir_config_domain_memballoon_set_model(GVirConfigDomainMemballoon *memballoon,
+                                             GVirConfigDomainMemballoonModel model)
+{
+    g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_MEMBALLOON(memballoon));
+    gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(memballoon),
+                                               "model",
+                                               GVIR_TYPE_CONFIG_DOMAIN_MEMBALLOON_MODEL,
+                                               model,
+                                               NULL);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-memballoon.h b/libvirt-gconfig/libvirt-gconfig-domain-memballoon.h
new file mode 100644
index 0000000..2754d67
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-memballoon.h
@@ -0,0 +1,75 @@
+/*
+ * libvirt-gconfig-domain-memballoon.h: libvirt domain memballoon configuration
+ *
+ * Copyright (C) 2011 Red Hat
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ * Author: Christophe Fergeau <cfergeau@xxxxxxxxx>
+ */
+
+#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_MEMBALLOON_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_MEMBALLOON_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_TYPE_CONFIG_DOMAIN_MEMBALLOON            (gvir_config_domain_memballoon_get_type ())
+#define GVIR_CONFIG_DOMAIN_MEMBALLOON(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_MEMBALLOON, GVirConfigDomainMemballoon))
+#define GVIR_CONFIG_DOMAIN_MEMBALLOON_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_MEMBALLOON, GVirConfigDomainMemballoonClass))
+#define GVIR_IS_CONFIG_DOMAIN_MEMBALLOON(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_MEMBALLOON))
+#define GVIR_IS_CONFIG_DOMAIN_MEMBALLOON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_MEMBALLOON))
+#define GVIR_CONFIG_DOMAIN_MEMBALLOON_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_MEMBALLOON, GVirConfigDomainMemballoonClass))
+
+typedef struct _GVirConfigDomainMemballoon GVirConfigDomainMemballoon;
+typedef struct _GVirConfigDomainMemballoonPrivate GVirConfigDomainMemballoonPrivate;
+typedef struct _GVirConfigDomainMemballoonClass GVirConfigDomainMemballoonClass;
+
+struct _GVirConfigDomainMemballoon
+{
+    GVirConfigDomainDevice parent;
+
+    GVirConfigDomainMemballoonPrivate *priv;
+
+    /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainMemballoonClass
+{
+    GVirConfigDomainDeviceClass parent_class;
+
+    gpointer padding[20];
+};
+
+typedef enum {
+    GVIR_CONFIG_DOMAIN_MEMBALLOON_MODEL_NONE,
+    GVIR_CONFIG_DOMAIN_MEMBALLOON_MODEL_VIRTIO,
+} GVirConfigDomainMemballoonModel;
+
+GType gvir_config_domain_memballoon_get_type(void);
+
+GVirConfigDomainMemballoon *gvir_config_domain_memballoon_new(void);
+GVirConfigDomainMemballoon *gvir_config_domain_memballoon_new_from_xml(const gchar *xml,
+                                                                       GError **error);
+void gvir_config_domain_memballoon_set_model(GVirConfigDomainMemballoon *memballoon,
+                                             GVirConfigDomainMemballoonModel model);
+
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_MEMBALLOON_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index 0afe75a..ee6a429 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -43,6 +43,7 @@
 #include <libvirt-gconfig/libvirt-gconfig-domain-input.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-interface.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-interface-network.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-memballoon.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-os.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-seclabel.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-snapshot.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index ce29414..a7574f4 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -108,6 +108,12 @@ LIBVIRT_GCONFIG_0.0.1 {
 	gvir_config_domain_interface_network_new_from_xml;
 	gvir_config_domain_interface_network_set_source;
 
+	gvir_config_domain_memballoon_get_type;
+	gvir_config_domain_memballoon_model_get_type;
+	gvir_config_domain_memballoon_new;
+	gvir_config_domain_memballoon_new_from_xml;
+	gvir_config_domain_memballoon_set_model;
+
 	gvir_config_domain_os_get_type;
 	gvir_config_domain_os_boot_device_get_type;
 	gvir_config_domain_os_sm_bios_mode_get_type;
-- 
1.7.6.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]