GVirConfigDomainCapabilities object has been introduced in order to
represent the output of virConnectGetDomainCapabilities().
For now it's not used anywhere, but its addition allows us to start
building the needed machinery for:
- Creating a wrapper around virConnectGetDomainCapabilities();
- Creating new objects that will be used to return each of the elements
present in the output of virConnectGetDomainCapabilities(),
accordingly to the consumers of this library's need;
Signed-off-by: Fabiano FidĂȘncio <fidencio(a)redhat.com>
---
libvirt-gconfig/Makefile.am | 2 +
.../libvirt-gconfig-domain-capabilities.c | 71 +++++++++++++++++++
.../libvirt-gconfig-domain-capabilities.h | 67 +++++++++++++++++
libvirt-gconfig/libvirt-gconfig.h | 1 +
libvirt-gconfig/libvirt-gconfig.sym | 3 +
5 files changed, 144 insertions(+)
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-capabilities.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-capabilities.h
diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index b976e4d..db2fa79 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -26,6 +26,7 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-domain-address.h \
libvirt-gconfig-domain-address-pci.h \
libvirt-gconfig-domain-address-usb.h \
+ libvirt-gconfig-domain-capabilities.h \
libvirt-gconfig-domain-channel.h \
libvirt-gconfig-domain-chardev.h \
libvirt-gconfig-domain-chardev-source.h \
@@ -119,6 +120,7 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-domain-address.c \
libvirt-gconfig-domain-address-pci.c \
libvirt-gconfig-domain-address-usb.c \
+ libvirt-gconfig-domain-capabilities.c \
libvirt-gconfig-domain-channel.c \
libvirt-gconfig-domain-chardev.c \
libvirt-gconfig-domain-chardev-source.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-capabilities.c
b/libvirt-gconfig/libvirt-gconfig-domain-capabilities.c
new file mode 100644
index 0000000..3377889
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-capabilities.c
@@ -0,0 +1,71 @@
+/*
+ * libvirt-gconfig-domain-capabilities.c: libvirt domain capabilities configuration
+ *
+ * Copyright (C) 2019 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/>.
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_CAPABILITIES_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_CAPABILITIES,
GVirConfigDomainCapabilitiesPrivate))
+
+struct _GVirConfigDomainCapabilitiesPrivate
+{
+ gboolean unused;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GVirConfigDomainCapabilities, gvir_config_domain_capabilities,
GVIR_CONFIG_TYPE_OBJECT);
+
+static void
+gvir_config_domain_capabilities_class_init(GVirConfigDomainCapabilitiesClass *klass
G_GNUC_UNUSED)
+{
+}
+
+
+static void
+gvir_config_domain_capabilities_init(GVirConfigDomainCapabilities *domain_caps)
+{
+ domain_caps->priv = GVIR_CONFIG_DOMAIN_CAPABILITIES_GET_PRIVATE(domain_caps);
+}
+
+
+GVirConfigDomainCapabilities *
+gvir_config_domain_capabilities_new(void)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_CAPABILITIES,
+ "domainCapabilities",
+ DATADIR
"/libvirt/schemas/domaincaps.rng");
+ return GVIR_CONFIG_DOMAIN_CAPABILITIES(object);
+}
+
+GVirConfigDomainCapabilities *
+gvir_config_domain_capabilities_new_from_xml(const gchar *xml,
+ GError **error)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_CAPABILITIES,
+ "domainCapabilities",
+ DATADIR
"/libvirt/schemas/domaincaps.rng",
+ xml, error);
+ return GVIR_CONFIG_DOMAIN_CAPABILITIES(object);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-capabilities.h
b/libvirt-gconfig/libvirt-gconfig-domain-capabilities.h
new file mode 100644
index 0000000..965d2a4
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-capabilities.h
@@ -0,0 +1,67 @@
+/*
+ * libvirt-gconfig-domain-capabilities.c: libvirt domain capabilities configuration
+ *
+ * Copyright (C) 2019 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/>.
+ */
+
+#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_CAPABILITIES_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_CAPABILITIES_H__
+
+#include "libvirt-gconfig/libvirt-gconfig-domain-capabilities-os.h"
+
+G_BEGIN_DECLS
+
+#define GVIR_CONFIG_TYPE_DOMAIN_CAPABILITIES
(gvir_config_domain_capabilities_get_type ())
+#define GVIR_CONFIG_DOMAIN_CAPABILITIES(obj) (G_TYPE_CHECK_INSTANCE_CAST
((obj), GVIR_CONFIG_TYPE_DOMAIN_CAPABILITIES, GVirConfigDomainCapabilities))
+#define GVIR_CONFIG_DOMAIN_CAPABILITIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST
((klass), GVIR_CONFIG_TYPE_DOMAIN_CAPABILITIES, GVirConfigDomainCapabilitiesClass))
+#define GVIR_CONFIG_IS_DOMAIN_CAPABILITIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE
((obj), GVIR_CONFIG_TYPE_DOMAIN_CAPABILITIES))
+#define GVIR_CONFIG_IS_DOMAIN_CAPABILITIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE
((klass), GVIR_CONFIG_TYPE_DOMAIN_CAPABILITIES))
+#define GVIR_CONFIG_DOMAIN_CAPABILITIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS
((obj), GVIR_CONFIG_TYPE_DOMAIN_CAPABILITIES, GVirConfigDomainCapabilitiesClass))
+
+typedef struct _GVirConfigDomainCapabilities GVirConfigDomainCapabilities;
+typedef struct _GVirConfigDomainCapabilitiesPrivate GVirConfigDomainCapabilitiesPrivate;
+typedef struct _GVirConfigDomainCapabilitiesClass GVirConfigDomainCapabilitiesClass;
+
+struct _GVirConfigDomainCapabilities
+{
+ GVirConfigObject parent;
+
+ GVirConfigDomainCapabilitiesPrivate *priv;
+
+ /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainCapabilitiesClass
+{
+ GVirConfigObjectClass parent_class;
+
+ gpointer padding[20];
+};
+
+GType gvir_config_domain_capabilities_get_type(void);
+
+GVirConfigDomainCapabilities *gvir_config_domain_capabilities_new(void);
+GVirConfigDomainCapabilities *gvir_config_domain_capabilities_new_from_xml(const gchar
*xml,
+ GError
**error);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_CAPABILITIES_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index 6462154..9fde05a 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -43,6 +43,7 @@
#include <libvirt-gconfig/libvirt-gconfig-domain-address.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-address-pci.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-address-usb.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-capabilities.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-chardev.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-chardev-source.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-chardev-source-pty.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 746fd1a..4a13635 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -774,6 +774,9 @@ global:
LIBVIRT_GCONFIG_2.0.1 {
global:
+ gvir_config_domain_capabilities_get_type;
+ gvir_config_domain_capabilities_new;
+ gvir_config_domain_capabilities_new_from_xml;
gvir_config_domain_os_firmware_get_type;
gvir_config_domain_os_set_firmware;
gvir_config_storage_vol_target_features_get_type;
--
2.21.0