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"
Oops, there's no such file, yet. Save this for the next patch where the
file is introduced. Or even better - save it for the one after (6/8)
where it's actually needed.
Michal