[libvirt] [libvirt-glib PATCH v2] Add filterref and filterref parameter support.
by Ian Main
This patch adds support for setting filterref's on interfaces. Also
supported are parameters to the filterref's.
V2:
- alphabetical orderized (don't look it up!) Makefile.am
- s/set_filter/set_name/ s/get_filter/get_name/
- remove trailing whitespace.
- fix missing line.
- add return_val_if_fail check.
- moved qcow fix in demo to a new patch.
- fixed new_from_xml().
Signed-off-by: Ian Main <imain(a)redhat.com>
---
examples/config-demo.py | 7 +
libvirt-gconfig/Makefile.am | 4 +
...-gconfig-domain-interface-filterref-parameter.c | 101 +++++++++++++
...-gconfig-domain-interface-filterref-parameter.h | 75 ++++++++++
.../libvirt-gconfig-domain-interface-filterref.c | 157 +++++++++++++++++++++
.../libvirt-gconfig-domain-interface-filterref.h | 76 ++++++++++
libvirt-gconfig/libvirt-gconfig-domain-interface.c | 41 ++++++
libvirt-gconfig/libvirt-gconfig-domain-interface.h | 5 +
libvirt-gconfig/libvirt-gconfig.h | 2 +
libvirt-gconfig/libvirt-gconfig.sym | 18 +++
10 files changed, 486 insertions(+)
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.h
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.h
diff --git a/examples/config-demo.py b/examples/config-demo.py
index 09b9e89..367d99a 100644
--- a/examples/config-demo.py
+++ b/examples/config-demo.py
@@ -35,6 +35,13 @@ domain.add_device(disk)
interface = LibvirtGConfig.DomainInterfaceNetwork.new()
interface.set_source("default")
+filterref = LibvirtGConfig.DomainInterfaceFilterref.new()
+filterref.set_name("clean-traffic")
+parameter = LibvirtGConfig.DomainInterfaceFilterrefParameter.new()
+parameter.set_name("IP")
+parameter.set_value("205.23.12.40")
+filterref.add_parameter(parameter)
+interface.set_filterref(filterref)
domain.add_device(interface)
interface = LibvirtGConfig.DomainInterfaceUser.new()
diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 35dc978..0793da1 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -47,6 +47,8 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-domain-input.h \
libvirt-gconfig-domain-interface.h \
libvirt-gconfig-domain-interface-bridge.h \
+ libvirt-gconfig-domain-interface-filterref.h \
+ libvirt-gconfig-domain-interface-filterref-parameter.h \
libvirt-gconfig-domain-interface-network.h \
libvirt-gconfig-domain-interface-user.h \
libvirt-gconfig-domain-memballoon.h \
@@ -129,6 +131,8 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-domain-input.c \
libvirt-gconfig-domain-interface.c \
libvirt-gconfig-domain-interface-bridge.c \
+ libvirt-gconfig-domain-interface-filterref.c \
+ libvirt-gconfig-domain-interface-filterref-parameter.c \
libvirt-gconfig-domain-interface-network.c \
libvirt-gconfig-domain-interface-user.c \
libvirt-gconfig-domain-memballoon.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.c b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.c
new file mode 100644
index 0000000..e697e86
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.c
@@ -0,0 +1,101 @@
+/*
+ * libvirt-gconfig-domain-interface-filterref-parameter.c:
+ * libvirt filterref parameters
+ *
+ * Copyright (C) 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/>.
+ *
+ * Authors: Ian Main <imain(a)redhat.com>
+ * Daniel P. Berrange <berrange(a)redhat.com>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER, GVirConfigDomainInterfaceFilterrefParameterPrivate))
+
+struct _GVirConfigDomainInterfaceFilterrefParameterPrivate
+{
+ gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainInterfaceFilterrefParameter, gvir_config_domain_interface_filterref_parameter, GVIR_CONFIG_TYPE_OBJECT);
+
+static void gvir_config_domain_interface_filterref_parameter_class_init(GVirConfigDomainInterfaceFilterrefParameterClass *klass)
+{
+ g_type_class_add_private(klass, sizeof(GVirConfigDomainInterfaceFilterrefParameterPrivate));
+}
+
+static void gvir_config_domain_interface_filterref_parameter_init(GVirConfigDomainInterfaceFilterrefParameter *parameter)
+{
+ g_debug("Init GVirConfigDomainInterfaceFilterrefParameter=%p", parameter);
+
+ parameter->priv = GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_GET_PRIVATE(parameter);
+}
+
+GVirConfigDomainInterfaceFilterrefParameter *gvir_config_domain_interface_filterref_parameter_new(void)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER,
+ "parameter", NULL);
+ return GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER(object);
+}
+
+GVirConfigDomainInterfaceFilterrefParameter *
+gvir_config_domain_interface_filterref_parameter_new_from_xml(const gchar *xml, GError **error)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER,
+ "parameter",
+ NULL,
+ xml,
+ error);
+
+ return GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER(object);
+}
+
+void gvir_config_domain_interface_filterref_parameter_set_name(GVirConfigDomainInterfaceFilterrefParameter *parameter, const gchar *name)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF_PARAMETER(parameter));
+ gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(parameter),
+ "name", name, NULL);
+}
+
+void gvir_config_domain_interface_filterref_parameter_set_value(GVirConfigDomainInterfaceFilterrefParameter *parameter, const gchar *value)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF_PARAMETER(parameter));
+ gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(parameter),
+ "value", value, NULL);
+}
+
+const gchar *gvir_config_domain_interface_filterref_parameter_get_name(GVirConfigDomainInterfaceFilterrefParameter *parameter)
+{
+ return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(parameter),
+ NULL,
+ "name");
+}
+const gchar *gvir_config_domain_interface_filterref_parameter_get_value(GVirConfigDomainInterfaceFilterrefParameter *parameter)
+{
+ return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(parameter),
+ NULL,
+ "value");
+}
+
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.h b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.h
new file mode 100644
index 0000000..a768c84
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.h
@@ -0,0 +1,75 @@
+/*
+ * libvirt-gconfig-domain-interface-filterref-parameter.h:
+ * libvirt filterref parameters
+ *
+ * Copyright (C) 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/>.
+ *
+ * Authors: Ian Main <imain(a)redhat.com>
+ * Daniel P. Berrange <berrange(a)redhat.com>
+ */
+
+#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_INTERFACE_FILTERREF_PARAMETER_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER (gvir_config_domain_interface_filterref_parameter_get_type ())
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER, GVirConfigDomainInterfaceFilterrefParameter))
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER, GVirConfigDomainInterfaceFilterrefParameterClass))
+#define GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF_PARAMETER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER))
+#define GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF_PARAMETER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER))
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER, GVirConfigDomainInterfaceFilterrefParameterClass))
+
+typedef struct _GVirConfigDomainInterfaceFilterrefParameter GVirConfigDomainInterfaceFilterrefParameter;
+typedef struct _GVirConfigDomainInterfaceFilterrefParameterPrivate GVirConfigDomainInterfaceFilterrefParameterPrivate;
+typedef struct _GVirConfigDomainInterfaceFilterrefParameterClass GVirConfigDomainInterfaceFilterrefParameterClass;
+
+struct _GVirConfigDomainInterfaceFilterrefParameter
+{
+ GVirConfigObject parent;
+
+ GVirConfigDomainInterfaceFilterrefParameterPrivate *priv;
+
+ /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainInterfaceFilterrefParameterClass
+{
+ GVirConfigObjectClass parent_class;
+
+ gpointer padding[20];
+};
+
+GType gvir_config_domain_interface_filterref_parameter_get_type(void);
+
+GVirConfigDomainInterfaceFilterrefParameter *gvir_config_domain_interface_filterref_parameter_new(void);
+
+GVirConfigDomainInterfaceFilterrefParameter *
+gvir_config_domain_interface_filterref_parameter_new_from_xml(const gchar *xml, GError **error);
+
+void gvir_config_domain_interface_filterref_parameter_set_name(GVirConfigDomainInterfaceFilterrefParameter *parameter, const gchar *name);
+void gvir_config_domain_interface_filterref_parameter_set_value(GVirConfigDomainInterfaceFilterrefParameter *parameter, const gchar *value);
+const gchar *gvir_config_domain_interface_filterref_parameter_get_name(GVirConfigDomainInterfaceFilterrefParameter *parameter);
+const gchar *gvir_config_domain_interface_filterref_parameter_get_value(GVirConfigDomainInterfaceFilterrefParameter *parameter);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.c b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.c
new file mode 100644
index 0000000..4874aee
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.c
@@ -0,0 +1,157 @@
+/*
+ * libvirt-gconfig-domain-interface-network-filterref.c:
+ * libvirt filter reference config.
+ *
+ * Copyright (C) 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: Ian Main <imain(a)redhat.com>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF, GVirConfigDomainInterfaceFilterrefPrivate))
+
+struct _GVirConfigDomainInterfaceFilterrefPrivate
+{
+ gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainInterfaceFilterref, gvir_config_domain_interface_filterref, GVIR_CONFIG_TYPE_OBJECT);
+
+static void gvir_config_domain_interface_filterref_class_init(GVirConfigDomainInterfaceFilterrefClass *klass)
+{
+ g_type_class_add_private(klass, sizeof(GVirConfigDomainInterfaceFilterrefPrivate));
+}
+
+static void gvir_config_domain_interface_filterref_init(GVirConfigDomainInterfaceFilterref *filterref)
+{
+ g_debug("Init GVirConfigDomainInterfaceFilterref=%p", filterref);
+
+ filterref->priv = GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_GET_PRIVATE(filterref);
+}
+
+
+GVirConfigDomainInterfaceFilterref *gvir_config_domain_interface_filterref_new(void)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF,
+ "filterref", NULL);
+ return GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF(object);
+}
+
+GVirConfigDomainInterfaceFilterref *gvir_config_domain_interface_filterref_new_from_xml(const gchar *xml,
+ GError **error)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF,
+ "filterref", NULL, xml, error);
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "filter"), "filterref") != 0) {
+ g_object_unref(G_OBJECT(object));
+ return NULL;
+ }
+ return GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF(object);
+}
+
+void gvir_config_domain_interface_filterref_set_name(GVirConfigDomainInterfaceFilterref *filterref,
+ const char *filter)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF(filterref));
+
+ gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(filterref),
+ "filter", filter, NULL);
+}
+
+const char *gvir_config_domain_interface_filterref_get_name(GVirConfigDomainInterfaceFilterref *filterref)
+{
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF(filterref), NULL);
+ return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(filterref),
+ NULL,
+ "filter");
+}
+
+void gvir_config_domain_interface_filterref_add_parameter(GVirConfigDomainInterfaceFilterref *filterref,
+ GVirConfigDomainInterfaceFilterrefParameter *parameter)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF(filterref));
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF_PARAMETER(parameter));
+
+ gvir_config_object_attach_add(GVIR_CONFIG_OBJECT(filterref),
+ GVIR_CONFIG_OBJECT(parameter));
+}
+
+struct GetParameterData {
+ GVirConfigXmlDoc *doc;
+ GList *parameters;
+};
+
+
+static gboolean add_filterref_parameter(xmlNodePtr node, gpointer opaque)
+{
+ struct GetParameterData* data = (struct GetParameterData*)opaque;
+ GVirConfigObject *parameter;
+
+ if (g_strcmp0((const gchar *)node->name, "parameter") != 0)
+ return TRUE;
+
+ parameter = gvir_config_object_new_from_tree(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER,
+ data->doc, NULL, node);
+ if (parameter != NULL)
+ data->parameters = g_list_append(data->parameters, parameter);
+ else
+ g_debug("Failed to parse %s node", node->name);
+
+ return TRUE;
+}
+
+/**
+ * gvir_config_domain_interface_filterref_get_parameters:
+ * @filterref: a #GVirConfigDomainInterfaceFilterref
+ *
+ * Gets the list of parameters attached to @filterref. The returned list should be
+ * freed with g_list_free(), after its elements have been unreffed with
+ * g_object_unref().
+ *
+ * Returns: (element-type LibvirtGConfig.DomainInterfaceFilterrefParameter) (transfer full):
+ * a newly allocated #GList of #GVirConfigDomainInterfaceFilterrefParameter.
+ */
+GList *gvir_config_domain_interface_filterref_get_parameters(GVirConfigDomainInterfaceFilterref *filterref)
+{
+ struct GetParameterData data;
+
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF(filterref), NULL);
+
+ g_object_get(G_OBJECT(filterref), "doc", &data.doc, NULL);
+ data.parameters = NULL;
+
+ gvir_config_object_foreach_child(GVIR_CONFIG_OBJECT(filterref),
+ NULL,
+ add_filterref_parameter,
+ &data);
+
+ if (data.doc != NULL) {
+ g_object_unref(G_OBJECT(data.doc));
+ }
+
+ return data.parameters;
+}
+
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.h b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.h
new file mode 100644
index 0000000..4a2bfd4
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.h
@@ -0,0 +1,76 @@
+/*
+ * libvirt-gconfig-domain-interface-network-filterref.h: libvirt filter reference config
+ *
+ * Copyright (C) 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: Ian Main <imain(a)redhat.com>
+ */
+
+#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_INTERFACE_FILTERREF_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_FILTERREF_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF (gvir_config_domain_interface_filterref_get_type ())
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF, GVirConfigDomainInterfaceFilterref))
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF, GVirConfigDomainInterfaceFilterrefClass))
+#define GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF))
+#define GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF))
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF, GVirConfigDomainInterfaceFilterrefClass))
+
+typedef struct _GVirConfigDomainInterfaceFilterref GVirConfigDomainInterfaceFilterref;
+typedef struct _GVirConfigDomainInterfaceFilterrefPrivate GVirConfigDomainInterfaceFilterrefPrivate;
+typedef struct _GVirConfigDomainInterfaceFilterrefClass GVirConfigDomainInterfaceFilterrefClass;
+
+struct _GVirConfigDomainInterfaceFilterref
+{
+ GVirConfigObject parent;
+
+ GVirConfigDomainInterfaceFilterrefPrivate *priv;
+
+ /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainInterfaceFilterrefClass
+{
+ GVirConfigObjectClass parent_class;
+
+ gpointer padding[20];
+};
+
+GType gvir_config_domain_interface_filterref_get_type(void);
+
+GVirConfigDomainInterfaceFilterref *gvir_config_domain_interface_filterref_new(void);
+
+GVirConfigDomainInterfaceFilterref *
+gvir_config_domain_interface_filterref_new_from_xml(const gchar *xml, GError **error);
+
+void gvir_config_domain_interface_filterref_set_name(GVirConfigDomainInterfaceFilterref *filterref,
+ const char *filter);
+const char *gvir_config_domain_interface_filterref_get_name(GVirConfigDomainInterfaceFilterref *filterref);
+
+void gvir_config_domain_interface_filterref_add_parameter(GVirConfigDomainInterfaceFilterref *filterref,
+ GVirConfigDomainInterfaceFilterrefParameter *parameter);
+GList *gvir_config_domain_interface_filterref_get_parameters(GVirConfigDomainInterfaceFilterref *filterref);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_FILTERREF_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface.c b/libvirt-gconfig/libvirt-gconfig-domain-interface.c
index 86a0c34..ce1b3f0 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-interface.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface.c
@@ -131,6 +131,47 @@ const char *gvir_config_domain_interface_get_model(GVirConfigDomainInterface *in
"model", "type");
}
+/**
+ * gvir_config_domain_interface_set_filterref:
+ * @interface: a #GVirConfigDomainInterface
+ * @filterref: (allow-none): the filterref to set
+ */
+void gvir_config_domain_interface_set_filterref(GVirConfigDomainInterface *interface,
+ GVirConfigDomainInterfaceFilterref *filterref)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE(interface));
+ g_return_if_fail(filterref == NULL || GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF(filterref));
+
+ gvir_config_object_attach_replace(GVIR_CONFIG_OBJECT(interface),
+ "filterref",
+ GVIR_CONFIG_OBJECT(filterref));
+}
+
+/**
+ * gvir_config_domain_interface_get_filterref:
+ * @interface: a #GVirConfigDomainInterface
+ *
+ * Gets the filterref associated with the @interface
+ *
+ * Returns: (transfer full): A #GVirConfigDomainInterfaceFilterref. The returned
+ * object should be unreffed with g_object_unref() when no longer needed.
+ */
+
+GVirConfigDomainInterfaceFilterref *gvir_config_domain_interface_get_filterref(GVirConfigDomainInterface *interface)
+{
+ GVirConfigObject *object;
+
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE(interface), NULL);
+
+ object = gvir_config_object_get_child_with_type
+ (GVIR_CONFIG_OBJECT(interface),
+ "filterref",
+ GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF);
+
+ return GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF(object);
+}
+
+
G_GNUC_INTERNAL GVirConfigDomainDevice *
gvir_config_domain_interface_new_from_tree(GVirConfigXmlDoc *doc,
xmlNodePtr tree)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface.h b/libvirt-gconfig/libvirt-gconfig-domain-interface.h
index 65c5d0b..2b0c22f 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-interface.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface.h
@@ -27,6 +27,8 @@
#ifndef __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_H__
#define __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_H__
+#include <libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.h>
+
G_BEGIN_DECLS
#define GVIR_CONFIG_TYPE_DOMAIN_INTERFACE (gvir_config_domain_interface_get_type ())
@@ -76,6 +78,9 @@ const char *gvir_config_domain_interface_get_ifname(GVirConfigDomainInterface *i
GVirConfigDomainInterfaceLinkState gvir_config_domain_interface_get_link_state(GVirConfigDomainInterface *interface);
const char *gvir_config_domain_interface_get_mac(GVirConfigDomainInterface *interface);
const char *gvir_config_domain_interface_get_model(GVirConfigDomainInterface *interface);
+void gvir_config_domain_interface_set_filterref(GVirConfigDomainInterface *interface,
+ GVirConfigDomainInterfaceFilterref *filterref);
+GVirConfigDomainInterfaceFilterref *gvir_config_domain_interface_get_filterref(GVirConfigDomainInterface *interface);
G_END_DECLS
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index 03e8ce7..14386b9 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -62,6 +62,8 @@
#include <libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-input.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-interface.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-interface-bridge.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-interface-network.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 72eafc1..a5f8b05 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -608,6 +608,24 @@ global:
gvir_config_domain_graphics_rdp_set_replace_user;
gvir_config_object_new_from_xml;
+
+ gvir_config_domain_interface_set_filterref;
+ gvir_config_domain_interface_get_filterref;
+
+ gvir_config_domain_interface_filterref_get_type;
+ gvir_config_domain_interface_filterref_new;
+ gvir_config_domain_interface_filterref_new_from_xml;
+ gvir_config_domain_interface_filterref_set_name;
+ gvir_config_domain_interface_filterref_get_name;
+ gvir_config_domain_interface_filterref_add_parameter;
+ gvir_config_domain_interface_filterref_get_parameters;
+ gvir_config_domain_interface_filterref_parameter_get_type;
+ gvir_config_domain_interface_filterref_parameter_new;
+ gvir_config_domain_interface_filterref_parameter_new_from_xml;
+ gvir_config_domain_interface_filterref_parameter_set_name;
+ gvir_config_domain_interface_filterref_parameter_set_value;
+ gvir_config_domain_interface_filterref_parameter_get_name;
+ gvir_config_domain_interface_filterref_parameter_get_value;
} LIBVIRT_GCONFIG_0.1.7;
# .... define new API here using predicted next version number ....
--
1.8.1.4
11 years, 6 months
[libvirt] [PATCH] virsh: fix doc typos
by Eric Blake
Reported in https://bugzilla.redhat.com/show_bug.cgi?id=1022872
* tools/virsh.pod: s/COMMMANDS/COMMANDS/
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing as trivial.
tools/virsh.pod | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 7af5503..68e6e86 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -2823,7 +2823,7 @@ B<blockresize> for live resizing.
=back
-=head1 SECRET COMMMANDS
+=head1 SECRET COMMANDS
The following commands manipulate "secrets" (e.g. passwords, passphrases and
encryption keys). Libvirt can store secrets independently from their use, and
@@ -2870,7 +2870,7 @@ I<--no-private> to list the non-private ones.
=back
-=head1 SNAPSHOT COMMMANDS
+=head1 SNAPSHOT COMMANDS
The following commands manipulate domain snapshots. Snapshots take the
disk, memory, and device state of a domain at a point-of-time, and save it
@@ -3170,7 +3170,7 @@ the data contents from that point in time.
=back
-=head1 NWFILTER COMMMANDS
+=head1 NWFILTER COMMANDS
The following commands manipulate network filters. Network filters allow
filtering of the network traffic coming from and going to virtual machines.
--
1.8.3.1
11 years, 6 months
[libvirt] [PATCH] virsh domxml-from-native to treat SCSI as the bus type for pseries by default
by Shivaprasad G Bhat
From: Shivaprasad G Bhat <sbhat(a)linux.vnet.ibm.com>
The bus type IDE being enum Zero, the bus type on pseries system appears as IDE for all the disk types. Pseries platform needs this to appear as SCSI instead of IDE.
Signed-off-by: Shivaprasad G Bhat <sbhat(a)linux.vnet.ibm.com>
---
src/qemu/qemu_command.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index abb62e9..728409f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9995,6 +9995,7 @@ error:
static virDomainDiskDefPtr
qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
const char *val,
+ virDomainDefPtr dom,
int nvirtiodisk,
bool old_style_ceph_args)
{
@@ -10018,7 +10019,11 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
if (VIR_ALLOC(def) < 0)
goto cleanup;
- def->bus = VIR_DOMAIN_DISK_BUS_IDE;
+ if (((dom->os.arch == VIR_ARCH_PPC64) &&
+ dom->os.machine && STREQ(dom->os.machine, "pseries")))
+ def->bus = VIR_DOMAIN_DISK_BUS_SCSI;
+ else
+ def->bus = VIR_DOMAIN_DISK_BUS_IDE;
def->device = VIR_DOMAIN_DISK_DEVICE_DISK;
def->type = VIR_DOMAIN_DISK_TYPE_FILE;
@@ -11332,8 +11337,13 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
disk->type = VIR_DOMAIN_DISK_TYPE_FILE;
if (STREQ(arg, "-cdrom")) {
disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
- if (VIR_STRDUP(disk->dst, "hdc") < 0)
- goto error;
+ if (((def->os.arch == VIR_ARCH_PPC64) &&
+ def->os.machine && STREQ(def->os.machine, "pseries"))) {
+ disk->bus = VIR_DOMAIN_DISK_BUS_SCSI;
+ if (VIR_STRDUP(disk->dst, "sdc") < 0)
+ goto error;
+ } else if (VIR_STRDUP(disk->dst, "hdc") < 0)
+ goto error;
disk->readonly = true;
} else {
if (STRPREFIX(arg, "-fd")) {
@@ -11345,6 +11355,9 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
disk->bus = VIR_DOMAIN_DISK_BUS_IDE;
else
disk->bus = VIR_DOMAIN_DISK_BUS_SCSI;
+ if (((def->os.arch == VIR_ARCH_PPC64) &&
+ def->os.machine && STREQ(def->os.machine, "pseries")))
+ disk->bus = VIR_DOMAIN_DISK_BUS_SCSI;
}
if (VIR_STRDUP(disk->dst, arg + 1) < 0)
goto error;
@@ -11636,7 +11649,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
}
} else if (STREQ(arg, "-drive")) {
WANT_VALUE();
- if (!(disk = qemuParseCommandLineDisk(xmlopt, val,
+ if (!(disk = qemuParseCommandLineDisk(xmlopt, val, def,
nvirtiodisk,
ceph_args != NULL)))
goto error;
11 years, 6 months
[libvirt] [PATCH] Ignore GNU Global tag files
by Martin Kletzander
... the same way we ignore other TAGS
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
.gitignore | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.gitignore b/.gitignore
index db5abcd..e372876 100644
--- a/.gitignore
+++ b/.gitignore
@@ -233,6 +233,9 @@
/tools/virt-*-validate
/tools/virt-sanlock-cleanup
/update.log
+GPATH
+GRTAGS
+GTAGS
Makefile
Makefile.in
TAGS
--
1.8.4
11 years, 6 months
[libvirt] build: fix linking virt-login-shell
by Jim Fehlig
After commit 3e2f27e1, I've noticed build failures of virt-login-shell
when libapparmor-devel is installed on the build host
CCLD virt-login-shell
../src/.libs/libvirt-setuid-rpc-client.a(libvirt_setuid_rpc_client_la-vircommand.o):
In function `virExec':
/home/jfehlig/virt/upstream/libvirt/src/util/vircommand.c:653: undefined
reference to `aa_change_profile'
collect2: error: ld returned 1 exit status
I was about to commit an easy fix under the build-breaker rule
(build-fix-1.patch), but thought to extend the notion of SECDRIVER_LIBS
to SECDRIVER_CFLAGS, and use both throughout src/Makefile.am where it
makes sense (build-fix-2.patch).
Should I just stick with the simple fix, or is something along the lines
of patch 2 preferred?
Regards,
Jim
11 years, 6 months
[libvirt] [PATCH] build: Fix prohibit_int_ijk (and iijjkk) on RHEL 5
by Martin Kletzander
On RHEL 5, make syntax-check was failing because even strings like
'int isTempChain' matched the 'int i' rule. To be honest, I haven't
found the root cause, but the change added makes it work as expected
and keeps the proper behavior on newer systems as well.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
Notes:
I'm not pushing this one as a build breaker since I haven't found the
root cause, so feel free to object and fix it differently.
cfg.mk | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 56821e2..e9da282 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -555,12 +555,12 @@ sc_avoid_attribute_unused_in_header:
$(_sc_search_regexp)
sc_prohibit_int_ijk:
- @prohibit='\<(int|unsigned) ([^(]* )*(i|j|k)(\s|,|;)' \
+ @prohibit='\<(int|unsigned) ([^(]* )*(i|j|k)\>(\s|,|;)' \
halt='use size_t, not int/unsigned int for loop vars i, j, k' \
$(_sc_search_regexp)
sc_prohibit_loop_iijjkk:
- @prohibit='\<(int|unsigned) ([^=]+ )*(ii|jj|kk)(\s|,|;)' \
+ @prohibit='\<(int|unsigned) ([^=]+ )*(ii|jj|kk)\>(\s|,|;)' \
halt='use i, j, k for loop iterators, not ii, jj, kk' \
$(_sc_search_regexp)
--
1.8.4
11 years, 6 months
[libvirt] [PATCH 0/5]virsh: solutions for hiding '--shareable' option
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
As Daniel mentioned, '--shareable' should be hidden from users.
But we had to take care of backwards compatibility.
These patches give solutions to solve these issues.
Chen Hanxiao (5):
[libvirt]virsh: disable config readonly and shareable in virsh command
[libvirt]virsh: introduce flags VSH_OFLAG_IGNORE
[libvirt]virsh: if VSH_OFLAG_IGNORE set, don't show it in '--help'
[libvirt]virsh: If VSH_OFLAG_IGNORE set, don't auto complete in virsh
[libvirt]virsh: mark '--shareable' as VSH_OFLAG_IGNORE
tools/virsh-domain.c | 3 ++-
tools/virsh.c | 9 +++++++++
tools/virsh.h | 1 +
tools/virsh.pod | 3 +--
4 files changed, 13 insertions(+), 3 deletions(-)
--
1.8.2.1
11 years, 6 months
Re: [libvirt] [RESEND][PATCHv5 1/4] add hostdev passthrough common library
by Daniel P. Berrange
On Wed, Oct 23, 2013 at 04:15:57PM +0800, Chunyan Liu wrote:
> 2013/10/15 Daniel P. Berrange <berrange(a)redhat.com>
>
> > On Fri, Sep 13, 2013 at 11:34:34AM +0800, Chunyan Liu wrote:
> > > Add hostdev passthrough common library so that it could be shared by all
> > drivers
> > > and maintain a global hostdev state.
> > >
> > > Signed-off-by: Chunyan Liu <cyliu(a)suse.com>
> > > ---
> > > docs/schemas/domaincommon.rng | 1 +
> > > src/conf/domain_conf.c | 3 +-
> > > src/conf/domain_conf.h | 1 +
> >
> > I'd prefer to see these changes to the XML parser be done in a separate
> > patch - either before or after this patch.
> >
> > > diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
> > > index 0abf80b..4d6d07b 100644
> > > --- a/src/libxl/libxl_domain.c
> > > +++ b/src/libxl/libxl_domain.c
> > > @@ -393,6 +393,15 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr
> > dev,
> > > STRNEQ(def->os.type, "hvm"))
> > > dev->data.chr->targetType =
> > VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
> > >
> > > + if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
> > > + virDomainHostdevDefPtr hostdev = dev->data.hostdev;
> > > +
> > > + if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
> > > + hostdev->source.subsys.type ==
> > VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
> > > + hostdev->source.subsys.u.pci.backend ==
> > VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT)
> > > + hostdev->source.subsys.u.pci.backend =
> > VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN;
> > > + }
> > > +
> > > return 0;
> > > }
> > >
> >
> > This should be separate too.
> >
> > > diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
> > > new file mode 100644
> > > index 0000000..d131160
> > > --- /dev/null
> > > +++ b/src/util/virhostdev.c
> > > @@ -0,0 +1,1335 @@
> > > +/* virhostdev.c: hostdev management
> > > + *
> > > + * Copyright (C) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
> > > + * Copyright (C) 2006-2007, 2009-2013 Red Hat, Inc.
> > > + * Copyright (C) 2006 Daniel P. Berrange
> > > + *
> > > + * 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: Chunyan Liu <cyliu(a)suse.com>
> > > + * Author: Daniel P. Berrange <berrange(a)redhat.com>
> > > + */
> > > +
> > > +#include <config.h>
> > > +
> > > +#include "virhostdev.h"
> > > +
> > > +#include <sys/types.h>
> > > +#include <sys/stat.h>
> > > +#include <unistd.h>
> > > +#include <stdlib.h>
> > > +#include <stdio.h>
> > > +
> > > +#include "viralloc.h"
> > > +#include "virstring.h"
> > > +#include "virfile.h"
> > > +#include "virerror.h"
> > > +#include "virlog.h"
> > > +#include "virpci.h"
> > > +#include "virusb.h"
> > > +#include "virscsi.h"
> > > +#include "virnetdev.h"
> > > +#include "virutil.h"
> > > +#include "configmake.h"
> > > +
> > > +#define VIR_FROM_THIS VIR_FROM_NONE
> > > +
> > > +#define HOSTDEV_STATE_DIR LOCALSTATEDIR "/run/libvirt/hostdevmgr"
> > > +
> > > +struct _virHostdevManager{
> > > + char *stateDir;
> > > +
> > > + virPCIDeviceListPtr activePciHostdevs;
> > > + virPCIDeviceListPtr inactivePciHostdevs;
> > > + virUSBDeviceListPtr activeUsbHostdevs;
> > > + virSCSIDeviceListPtr activeScsiHostdevs;
> > > +};
> > > +
> > > +static virHostdevManagerPtr hostdevMgr;
> > > +
> > > +static void
> > > +virHostdevManagerCleanup(void)
> > > +{
> > > + if (!hostdevMgr)
> > > + return;
> > > +
> > > + virObjectUnref(hostdevMgr->activePciHostdevs);
> > > + virObjectUnref(hostdevMgr->inactivePciHostdevs);
> > > + virObjectUnref(hostdevMgr->activeUsbHostdevs);
> > > + VIR_FREE(hostdevMgr->stateDir);
> > > +
> > > + VIR_FREE(hostdevMgr);
> > > +}
> > > +
> > > +static int
> > > +virHostdevOnceInit(void)
> > > +{
> > > + if (VIR_ALLOC(hostdevMgr) < 0)
> > > + goto error;
> > > +
> > > + if ((hostdevMgr->activePciHostdevs = virPCIDeviceListNew()) == NULL)
> > > + goto error;
> > > +
> > > + if ((hostdevMgr->activeUsbHostdevs = virUSBDeviceListNew()) == NULL)
> > > + goto error;
> > > +
> > > + if ((hostdevMgr->inactivePciHostdevs = virPCIDeviceListNew()) ==
> > NULL)
> > > + goto error;
> > > +
> > > + if ((hostdevMgr->activeScsiHostdevs = virSCSIDeviceListNew()) ==
> > NULL)
> > > + goto error;
> > > +
> > > + if (VIR_STRDUP(hostdevMgr->stateDir, HOSTDEV_STATE_DIR) < 0)
> > > + goto error;
> >
> > Hmm, this is going to lead to some upgrade problems when libvirt is
> > restarted with existing VMs present. I think we'll need some code
> > in this initialization which looks for the old QEMU-specific path
> > and if found, tries to move the data into the new location.
> >
> >
> I'll do that. But IMO, finding and moving data in the initialization
> function is a little bit painful.
> The hostdevMgr->stateDir is only used to save/store net config of a SR-IOV
> device, the file name could be pflinkdev_
> vfindex or pflinkdev (e.g, eth0, eth0_vf0, p1p2, p1p2_vf0, etc.), hard to
> match through some fix rule.
> Now that it's a upgrade requirement, and I think it only affects when an
> existing VM has a hostdev that stores net config in the old stateDir, we
> can also handle it the restore net config part. (To check whether filename
> is in hostdevMgr->stateDir, if not and hypervisor is qemu, try to find in
> old stateDir /var/run/libvirt/qemu/.)
> How do you think? If that's OK. I'll posting revised version.
Yeah, should be ok. Just want to minimise the amount of code to deal with
back compat, whichever approach you choose.
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
11 years, 6 months
Re: [libvirt] Support QEMU Live Upgrade in Libvirt
by Eric Blake
On 10/23/2013 03:58 AM, Zhou Zheng Sheng wrote:
> Thanks! I am now starting to investigate if we can re-use parts of
> migration code after some refactoring, and how much code should be
> written from scratch. I am not very clear about how the new flow looks
> like. I think the migration protocol v3 is quite reasonable for dealing
> with various cases and errors in the migration. After all, QEMU live
> upgrade is implemented as migration under the hood, so I think common
> migration management logic would be applied to it too. For example, if
> QEMU live upgrade migration fails, target domain should be destroyed and
> source domain should be resumed. Maybe I can re-use some of the parts in
> the migration protocol v3 flow.
Is it even possible to resume the original process if you have already
page-flipped the memory to the destination process? I'm worried that
there may be some catastrophic paths that are non-recoverable, but hope
that's not the case.
>
> By the way. It seems my mail sent to libvir-list(a)redhat.com is not
> appearing in the list. I'm already a member in the list. I see in the
> subscribing web page saying first time posts need moderator approval. I
> thought I've posted before. Maybe it's too long since my last activity.
> I also tried to join the list again and the system sent me a mail saying
> I was already a member. I sent a mail to libvir-list-owner(a)redhat.com
> asking for help but no response yet. Am I blocked? Or is it just because
> I didn't add a [libvirt] tag in the title? I thought the tag is added
> automatically when I was posting in other lists. Would you have a look
> at my subscription status? Thank you!
>
No idea what's going on there - I checked and didn't see anything stuck
in the mod queue or any indication of blacklisting on your email
address. Sometimes things just get stuck in queues somewhere, and
eventually show up later.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
11 years, 6 months
[libvirt] [PATCH] network: Add a missing check in bridge_driver.c
by Hongwei Bi
Signed-off-by: Hongwei Bi <hwbi2008(a)gmail.com>
---
src/network/bridge_driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 8787bdb..73375f0 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -1107,7 +1107,8 @@ networkStartDhcpDaemon(virNetworkDriverStatePtr driver,
if (dctx == NULL)
goto cleanup;
- dnsmasqCapsRefresh(&driver->dnsmasqCaps, false);
+ if (dnsmasqCapsRefresh(&driver->dnsmasqCaps, false) < 0)
+ goto cleanup;
ret = networkBuildDhcpDaemonCommandLine(network, &cmd, pidfile,
dctx, driver->dnsmasqCaps);
--
1.8.1.2
11 years, 6 months