[libvirt] [glib PATCH V6] Add bindings for virDomainSnapshotCreateXML()
by Jovanka Gulicoska
---
libvirt-gobject/libvirt-gobject-domain.c | 42 ++++++++++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-domain.h | 6 +++++
libvirt-gobject/libvirt-gobject.sym | 1 +
3 files changed, 49 insertions(+)
diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
index 088cd33..ce81971 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -1123,3 +1123,45 @@ GList *gvir_domain_get_devices(GVirDomain *domain,
return g_list_reverse (ret);
}
+
+/**
+ * gvir_domain_snapshot_create_xml:
+ * @dom: the domain
+ * @custom_conf: (allow-none): configuration of snapshot or NULL
+ * @flags: the flags
+ * @err: (allow-none):Place-holder for error or NULL
+ *
+ * Returns: (transfer full): snapshot of domain. The returned object should be
+ * unreffed when no longer needed
+ */
+GVirConfigDomainSnapshot *gvir_domain_snapshot_create_xml
+ (GVirDomain *dom,
+ GVirConfigDomainSnapshot *custom_conf,
+ guint flags,
+ GError **err)
+{
+ GVirDomainPrivate *priv;
+ virDomainSnapshot *snapshot;
+ GVirConfigDomainSnapshot *conf_snapshot;
+ gchar *custom_xml = NULL;
+
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, NULL);
+
+ priv = dom->priv;
+
+ if (custom_conf != NULL)
+ custom_xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(custom_conf));
+
+ if (!(snapshot = virDomainSnapshotCreateXML(priv->handle, custom_xml, flags))) {
+ gvir_set_error_literal(err, GVIR_DOMAIN_ERROR,
+ 0,
+ "Unable to create snapshot of domain");
+ return NULL;
+ }
+
+ conf_snapshot = gvir_config_domain_snapshot_new_from_xml(custom_xml, err);
+
+ g_free(custom_xml);
+ return conf_snapshot;
+}
diff --git a/libvirt-gobject/libvirt-gobject-domain.h b/libvirt-gobject/libvirt-gobject-domain.h
index 87b94f4..8c4d28e 100644
--- a/libvirt-gobject/libvirt-gobject-domain.h
+++ b/libvirt-gobject/libvirt-gobject-domain.h
@@ -202,6 +202,12 @@ gboolean gvir_domain_get_saved(GVirDomain *dom);
GList *gvir_domain_get_devices(GVirDomain *domain,
GError **err);
+GVirConfigDomainSnapshot *gvir_domain_snapshot_create_xml
+ (GVirDomain *dom,
+ GVirConfigDomainSnapshot *custom_conf,
+ guint flags,
+ GError **err);
+
G_END_DECLS
#endif /* __LIBVIRT_GOBJECT_DOMAIN_H__ */
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index 94e441a..045e1b5 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -75,6 +75,7 @@ LIBVIRT_GOBJECT_0.0.8 {
gvir_domain_get_persistent;
gvir_domain_get_saved;
gvir_domain_screenshot;
+ gvir_domain_snapshot_create_xml;
gvir_domain_snapshot_get_type;
gvir_domain_snapshot_handle_get_type;
--
1.7.10.4
12 years, 5 months
[libvirt] [glib PATCH V6] Add bindings for virDomainRestore*()
by Jovanka Gulicoska
---
libvirt-gobject/libvirt-gobject-connection.c | 137 ++++++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-connection.h | 20 ++++
libvirt-gobject/libvirt-gobject-domain.c | 22 ++---
libvirt-gobject/libvirt-gobject-domain.h | 10 ++
libvirt-gobject/libvirt-gobject.sym | 4 +
5 files changed, 180 insertions(+), 13 deletions(-)
diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
index 3a99034..5f21c11 100644
--- a/libvirt-gobject/libvirt-gobject-connection.c
+++ b/libvirt-gobject/libvirt-gobject-connection.c
@@ -1605,3 +1605,140 @@ gvir_connection_get_capabilities_finish(GVirConnection *conn,
return g_object_ref(caps);
}
+
+/**
+ * gvir_connection_domain_restore:
+ * @conn: a #GVirConnection
+ * @filename: path to input file
+ * @custom_conf: (allow-none): configuration for domain or NULL
+ * @flags: the flags
+ *
+ * Returns: TRUE on success, FALSE otherwise
+ */
+gboolean gvir_connection_domain_restore(GVirConnection *conn,
+ gchar *filename,
+ GVirConfigDomain *custom_conf,
+ guint flags,
+ GError **err)
+{
+ GVirConnectionPrivate *priv;
+ int ret;
+
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), FALSE);
+ g_return_val_if_fail((err == NULL) || (*err == NULL), FALSE);
+
+ priv = conn->priv;
+
+ if (flags || custom_conf != NULL) {
+ gchar *custom_xml = NULL;
+
+ if (custom_conf != NULL)
+ custom_xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(custom_conf));
+
+ ret = virDomainRestoreFlags(priv->conn, filename, custom_xml, flags);
+ g_free (custom_xml);
+ }
+ else {
+ ret = virDomainRestore(priv->conn, filename);
+ }
+
+ if (ret < 0) {
+ gvir_set_error_literal(err, GVIR_CONNECTION_ERROR,
+ 0,
+ "Unable to restore domain");
+
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void
+gvir_connection_domain_restore_helper(GSimpleAsyncResult *res,
+ GObject *object,
+ GCancellable *cancellable G_GNUC_UNUSED)
+{
+ GVirConnection *conn = GVIR_CONNECTION(object);
+ GVirDomainRestoreFromFileData *data;
+ GError *err = NULL;
+
+ data = g_simple_async_result_get_op_res_gpointer(res);
+
+ if (!gvir_connection_domain_restore(conn, data->filename, data->custom_conf,
+ data->flags, &err))
+ g_simple_async_result_take_error(res, err);
+}
+
+/**
+ * gvir_connection_domain_restore_async:
+ * @conn: a #GVirConnection
+ * @filename: path to input file
+ * @custom_conf: (allow-none): configuration for domain or NULL
+ * @flags: the flags
+ * @cancellable: (allow-none) (transfer none): cancallation object
+ * @callback: (scope async): completion callback
+ * @user_data: (closure): opaque data for callback
+ *
+ * Asynchronous variant of #gvir_connection_domain_restore
+ */
+void gvir_connection_domain_restore_async(GVirConnection *conn,
+ gchar *filename,
+ GVirConfigDomain *custom_conf,
+ guint flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GSimpleAsyncResult *res;
+ GVirDomainRestoreFromFileData *data;
+
+ g_return_if_fail(GVIR_IS_CONNECTION(conn));
+ g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable));
+
+ data = g_slice_new0(GVirDomainRestoreFromFileData);
+ data->filename = g_strdup(filename);
+ data->custom_conf = g_object_ref(custom_conf);
+ data->flags = flags;
+
+ res = g_simple_async_result_new(G_OBJECT(conn),
+ callback,
+ user_data,
+ gvir_connection_domain_restore_async);
+ g_simple_async_result_set_op_res_gpointer
+ (res, data,
+ (GDestroyNotify)gvir_domain_save_to_file_data_free);
+
+ g_simple_async_result_run_in_thread(res,
+ gvir_connection_domain_restore_helper,
+ G_PRIORITY_DEFAULT,
+ cancellable);
+
+ g_object_unref(res);
+}
+
+/**
+ * gvir_connection_domain_finish:
+ * @conn: a #GVirConnection
+ * @result: (transfer none): async method result
+ * @err: Place-holder for possible errors
+ *
+ * Finishes the operation started by #gvir_domain_restore_async.
+ *
+ * Returns: TRUE if domain was restored successfully, FALSE otherwise.
+ */
+gboolean gvir_connection_domain_restore_finish(GVirConnection *conn,
+ GAsyncResult *result,
+ GError **err)
+{
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), FALSE);
+ g_return_val_if_fail(g_simple_async_result_is_valid
+ (result, G_OBJECT(conn),
+ gvir_connection_domain_restore_async),
+ FALSE);
+
+ if (g_simple_async_result_propagate_error(G_SIMPLE_ASYNC_RESULT(result),
+ err))
+ return FALSE;
+
+ return TRUE;
+}
diff --git a/libvirt-gobject/libvirt-gobject-connection.h b/libvirt-gobject/libvirt-gobject-connection.h
index c80eecf..5932661 100644
--- a/libvirt-gobject/libvirt-gobject-connection.h
+++ b/libvirt-gobject/libvirt-gobject-connection.h
@@ -38,6 +38,8 @@ G_BEGIN_DECLS
#define GVIR_TYPE_CONNECTION_HANDLE (gvir_connection_handle_get_type ())
+#define GVirDomainRestoreFromFileData GVirDomainSaveToFileData
+
typedef struct _GVirNodeInfo GVirNodeInfo;
struct _GVirNodeInfo
{
@@ -202,6 +204,24 @@ gvir_connection_get_capabilities_finish(GVirConnection *conn,
GAsyncResult *result,
GError **err);
+gboolean gvir_connection_domain_restore(GVirConnection *conn,
+ gchar *filename,
+ GVirConfigDomain *custom_conf,
+ guint flags,
+ GError **err);
+
+void gvir_connection_domain_restore_async(GVirConnection *conn,
+ gchar *filename,
+ GVirConfigDomain *custom_conf,
+ guint flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+gboolean gvir_connection_domain_restore_finish(GVirConnection *conn,
+ GAsyncResult *result,
+ GError **err);
+
G_END_DECLS
#endif /* __LIBVIRT_GOBJECT_CONNECTION_H__ */
diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
index 308a817..61c153b 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -602,17 +602,11 @@ gboolean gvir_domain_save_to_file(GVirDomain *dom,
return TRUE;
}
-typedef struct {
- gchar *filename;
- GVirConfigDomain *custom_conf;
- guint flags;
-} DomainSaveToFileData;
-
-static void domain_save_to_file_data_free(DomainSaveToFileData *data)
+void gvir_domain_save_to_file_data_free(GVirDomainSaveToFileData *data)
{
g_free(data->filename);
g_object_unref(data->custom_conf);
- g_slice_free(DomainSaveToFileData, data);
+ g_slice_free(GVirDomainSaveToFileData, data);
}
static void
@@ -621,7 +615,7 @@ gvir_domain_save_to_file_helper(GSimpleAsyncResult *res,
GCancellable *cancellable G_GNUC_UNUSED)
{
GVirDomain *dom = GVIR_DOMAIN(object);
- DomainSaveToFileData *data;
+ GVirDomainSaveToFileData *data;
GError *err = NULL;
data = g_simple_async_result_get_op_res_gpointer(res);
@@ -651,12 +645,12 @@ void gvir_domain_save_to_file_async(GVirDomain *dom,
gpointer user_data)
{
GSimpleAsyncResult *res;
- DomainSaveToFileData *data;
+ GVirDomainSaveToFileData *data;
g_return_if_fail(GVIR_IS_DOMAIN(dom));
g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable));
- data = g_slice_new0(DomainSaveToFileData);
+ data = g_slice_new0(GVirDomainSaveToFileData);
data->filename = g_strdup(filename);
data->custom_conf = g_object_ref(custom_conf);
data->flags = flags;
@@ -665,8 +659,10 @@ void gvir_domain_save_to_file_async(GVirDomain *dom,
callback,
user_data,
gvir_domain_save_to_file_async);
- g_simple_async_result_set_op_res_gpointer(res, data, (GDestroyNotify)
- domain_save_to_file_data_free);
+ g_simple_async_result_set_op_res_gpointer
+ (res, data,
+ (GDestroyNotify)
+ gvir_domain_save_to_file_data_free);
g_simple_async_result_run_in_thread(res,
gvir_domain_save_to_file_helper,
diff --git a/libvirt-gobject/libvirt-gobject-domain.h b/libvirt-gobject/libvirt-gobject-domain.h
index 8f17799..ac225a2 100644
--- a/libvirt-gobject/libvirt-gobject-domain.h
+++ b/libvirt-gobject/libvirt-gobject-domain.h
@@ -112,6 +112,14 @@ struct _GVirDomainInfo
guint64 cpuTime; /* the CPU time used in nanoseconds */
};
+typedef struct _GVirDomainSaveToFileData GVirDomainSaveToFileData;
+struct _GVirDomainSaveToFileData
+{
+ gchar *filename;
+ GVirConfigDomain *custom_conf;
+ guint flags;
+};
+
GType gvir_domain_get_type(void);
GType gvir_domain_info_get_type(void);
GType gvir_domain_handle_get_type(void);
@@ -166,6 +174,8 @@ gboolean gvir_domain_save_to_file_finish(GVirDomain *dom,
GAsyncResult *result,
GError **err);
+void gvir_domain_save_to_file_data_free(GVirDomainSaveToFileData *data);
+
GVirDomainInfo *gvir_domain_get_info(GVirDomain *dom,
GError **err);
void gvir_domain_get_info_async(GVirDomain *dom,
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index 54a093a..dde0e70 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -31,6 +31,9 @@ LIBVIRT_GOBJECT_0.0.8 {
gvir_connection_create_storage_pool;
gvir_connection_start_domain;
gvir_connection_get_node_info;
+ gvir_connection_domain_restore;
+ gvir_connection_domain_restore_async;
+ gvir_connection_domain_restore_finish;
gvir_domain_device_get_type;
gvir_domain_device_get_domain;
@@ -78,6 +81,7 @@ LIBVIRT_GOBJECT_0.0.8 {
gvir_domain_save_to_file;
gvir_domain_save_to_file_async;
gvir_domain_save_to_file_finish;
+ gvir_domain_save_to_file_data_free;
gvir_domain_snapshot_get_type;
gvir_domain_snapshot_handle_get_type;
--
1.7.10.4
12 years, 5 months
[libvirt] dnsmasq didn't work as except
by taget@linux.vnet.ibm.com
hi all
The vm created by libvirtd can not acquire a ip from dnsmasq.
nobody 14203 1 0 21:31 ? 00:00:00 /usr/sbin/dnsmasq
--strict-order --bind-interfaces
--pid-file=/var/run/libvirt/network/default.pid --conf-file=
--except-interface lo --listen-address 192.168.122.1 --dhcp-range
192.168.122.2,192.168.122.254
--dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases
--dhcp-lease-max=253 --dhcp-no-override
note that --conf-file= is empty ,is there any thing I missing?
thanks Eli.
12 years, 5 months
[libvirt] [PATCH] ARMHF: CPU Support for armhf.
by Chuck Short
Adding CPU encoder/decoder for armhf to avoid runtime error messages.
Signed-off-by: Chuck Short <chuck.short(a)canonical.com>
---
src/Makefile.am | 1 +
src/cpu/cpu.c | 2 ++
src/cpu/cpu_arm.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++
src/cpu/cpu_arm.h | 32 ++++++++++++++++++++++
4 files changed, 111 insertions(+)
create mode 100644 src/cpu/cpu_arm.c
create mode 100644 src/cpu/cpu_arm.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 6c3eaa7..bfe74d3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -567,6 +567,7 @@ CPU_SOURCES = \
cpu/cpu_generic.h cpu/cpu_generic.c \
cpu/cpu_x86.h cpu/cpu_x86.c cpu/cpu_x86_data.h \
cpu/cpu_s390.h cpu/cpu_s390.c \
+ cpu/cpu_arm.h cpu/cpu_arm.c \
cpu/cpu_map.h cpu/cpu_map.c cpu/cpu_powerpc.h \
cpu/cpu_powerpc.c
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index 70a1da5..0ccbd4c 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -30,6 +30,7 @@
#include "cpu_x86.h"
#include "cpu_powerpc.h"
#include "cpu_s390.h"
+#include "cpu_arm.h"
#include "cpu_generic.h"
@@ -40,6 +41,7 @@ static struct cpuArchDriver *drivers[] = {
&cpuDriverX86,
&cpuDriverPowerPC,
&cpuDriverS390,
+ &cpuDriverArm,
/* generic driver must always be the last one */
&cpuDriverGeneric
};
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
new file mode 100644
index 0000000..fe97425
--- /dev/null
+++ b/src/cpu/cpu_arm.c
@@ -0,0 +1,76 @@
+
+/*
+ * cpu_arm.c: CPU driver for arm CPUs
+ *
+ * Copyright Canonical Ltd. 2012
+ *
+ * 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
+ *
+ * Authors:
+ * Chuck Short <chuck.short(a)canonical.com>
+ */
+
+#include <config.h>
+
+#include "memory.h"
+#include "cpu.h"
+
+#define VIR_FROM_THIS VIR_FROM_CPU
+
+static const char *archs[] = { "armv7l" };
+
+static union cpuData *
+ArmNodeData(void)
+{
+ union cpuData *data;
+
+ if (VIR_ALLOC(data) < 0) {
+ virReportOOMError();
+ return NULL;
+ }
+
+ return data;
+}
+
+static int
+ArmDecode(virCPUDefPtr cpu ATTRIBUTE_UNUSED,
+ const union cpuData *data ATTRIBUTE_UNUSED,
+ const char **models ATTRIBUTE_UNUSED,
+ unsigned int nmodels ATTRIBUTE_UNUSED,
+ const char *preferred ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static void
+ArmDataFree(union cpuData *data)
+{
+ VIR_FREE(data);
+}
+
+struct cpuArchDriver cpuDriverArm = {
+ .name = "arm",
+ .arch = archs,
+ .narch = ARRAY_CARDINALITY(archs),
+ .compare = NULL,
+ .decode = ArmDecode,
+ .encode = NULL,
+ .free = ArmDataFree,
+ .nodeData = ArmNodeData,
+ .guestData = NULL,
+ .baseline = NULL,
+ .update = NULL,
+ .hasFeature = NULL,
+};
diff --git a/src/cpu/cpu_arm.h b/src/cpu/cpu_arm.h
new file mode 100644
index 0000000..4b7ddc5
--- /dev/null
+++ b/src/cpu/cpu_arm.h
@@ -0,0 +1,32 @@
+
+/*
+ * cpu_arm.h: CPU driver for arm CPUs
+ *
+ * Copyright Canonical Ltd. 2012
+ *
+ * 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
+ *
+ * Authors:
+ * Chuck Short <chuck.short(a)canonical.com>
+ */
+
+#ifndef __VIR_CPU_ARM_H__
+#define __VIR_CPU_ARM_H__
+
+#include "cpu.h"
+
+extern struct cpuArchDriver cpuDriverArm;
+
+#endif /* __VIR_CPU_ARM_H__ */
--
1.7.10.4
12 years, 5 months
[libvirt] Libvirt 0.9.13 - Cannot find suitable emulater for ppc
by B Veera-B37207
Hi ,
I am installed libvirt in power pc.
I am getting following error
root@p2020rdb:~# virsh
Welcome to virsh, the virtualization interactive terminal.
Type: 'help' for help with commands
'quit' to quit
virsh # version
Compiled against library: libvir 0.9.13
Using library: libvir 0.9.13
Using API: QEMU 0.9.13
error: failed to get the hypervisor version
error: internal error Cannot find suitable emulator for ppc
Please help me regarding this
Regards,
Veera.
12 years, 5 months
[libvirt] [PATCH] virsh: remove unnecessary sleep for nodecpustats --percent
by Viktor Mihajlovski
Fix for a minor issue:
the sleep(1) statement was called twice,
effectively doubling the elapsed time
execution "virsh nodecpustats --percent".
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
tools/virsh.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 01e7ce0..767e2fc 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -6840,8 +6840,10 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd)
memset(cpu_stats, 0, sizeof(cpu_stats));
params = vshCalloc(ctl, nparams, sizeof(*params));
- i = 0;
- do {
+ for (i=0; i<2; i++) {
+ if (i>0)
+ sleep(1);
+
if (virNodeGetCPUStats(ctl->conn, cpuNum, params, &nparams, 0) != 0) {
vshError(ctl, "%s", _("Unable to get node cpu stats"));
goto cleanup;
@@ -6866,10 +6868,7 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd)
if (flag_utilization || !flag_percent)
break;
-
- i++;
- sleep(1);
- } while (i < 2);
+ }
if (!flag_percent) {
if (!flag_utilization) {
--
1.7.0.4
12 years, 5 months
[libvirt] Unable to make libvirt
by B Veera-B37207
Hi,
I am unable to compile libvirt -0.9.13
1. ./configure (Executed successfully without any errors)
2. While executing make I am getting following Error
/bin/sed: can't read =/usr/lib/libnl-route.la: No such file or directory
libtool: link: `=/usr/lib/libnl-route.la' is not a valid libtool archive
make[3]: *** [libvirt.la] Error 1
make[3]: Leaving directory `/home/root/libvirt-0.9.13/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/root/libvirt-0.9.13/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/root/libvirt-0.9.13'
make: *** [all] Error 2
But "=/usr/lib/libnl-route.la" file exist
Please help me regarding this.
Regards,
Veera.
12 years, 5 months
[libvirt] [PATCH] Clarify direct migration
by Jiri Denemark
When --direct is used when migrating a domain running on a hypervisor
that does not support direct migration (such as QEMU), the caller would
get the following error message:
this function is not supported by the connection driver:
virDomainMigrateToURI2
which is a complete nonsense since qemu driver implements
virDomainMigrateToURI2. This patch would emit a more sensible error in
this case:
Requested operation is not valid: direct migration is not supported
by the connection driver
---
src/libvirt.c | 8 ++++++--
tools/virsh.pod | 3 +++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index db6ba15..df78e8a 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -5562,7 +5562,9 @@ virDomainMigrateToURI (virDomainPtr domain,
goto error;
} else {
/* Cannot do a migration with only the perform step */
- virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virLibConnError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("direct migration is not supported by the"
+ " connection driver"));
goto error;
}
}
@@ -5696,7 +5698,9 @@ virDomainMigrateToURI2(virDomainPtr domain,
goto error;
} else {
/* Cannot do a migration with only the perform step */
- virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virLibConnError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("direct migration is not supported by the"
+ " connection driver"));
goto error;
}
}
diff --git a/tools/virsh.pod b/tools/virsh.pod
index ae00622..4bddf15 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -990,6 +990,9 @@ is implicitly enabled when supported by the hypervisor, but can be explicitly
used to reject the migration if the hypervisor lacks change protection
support. I<--verbose> displays the progress of migration.
+B<Note>: Individual hypervisors usually do not support all possible types of
+migration. For example, QEMU does not support direct migration.
+
In some cases libvirt may refuse to migrate the domain because doing so may
lead to potential problems such as data corruption, and thus the migration is
considered unsafe. For QEMU domain, this may happen if the domain uses disks
--
1.7.11.1
12 years, 5 months
[libvirt] [glib PATCH V5] Add bindings for virDomainSave*()
by Jovanka Gulicoska
---
libvirt-gobject/libvirt-gobject-domain.c | 153 ++++++++++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-domain.h | 18 ++++
libvirt-gobject/libvirt-gobject.sym | 3 +
3 files changed, 174 insertions(+)
diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
index 088cd33..5d9cfff 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -557,6 +557,159 @@ gboolean gvir_domain_reboot(GVirDomain *dom,
}
/**
+ * gvir_domain_save_to_file:
+ * @dom: the domain
+ * @filename: path to the output file
+ * @custom_conf: (allow-none): configuration for domain or NULL
+ * @flags: the flags
+ *
+ * Returns: TRUE on success, FALSE otherwise
+ */
+gboolean gvir_domain_save_to_file(GVirDomain *dom,
+ gchar *filename,
+ GVirConfigDomain *custom_conf,
+ guint flags,
+ GError **err)
+{
+ GVirDomainPrivate *priv;
+ int ret;
+
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+
+ priv = dom->priv;
+
+ if (flags || custom_conf != NULL) {
+ gchar *custom_xml = NULL;
+
+ if (custom_conf != NULL)
+ custom_xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(custom_conf));
+
+ ret = virDomainSaveFlags(priv->handle, filename, custom_xml, flags);
+ g_free(custom_xml);
+ }
+ else {
+ ret = virDomainSave(priv->handle, filename);
+ }
+
+ if (ret < 0) {
+ gvir_set_error_literal(err, GVIR_DOMAIN_ERROR,
+ 0,
+ "Unable to save domain to file");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+typedef struct {
+ gchar *filename;
+ gchar *custom_xml;
+ guint flags;
+} DomainSaveToFileData;
+
+static void domain_save_to_file_data_free(DomainSaveToFileData *data)
+{
+ g_free(data->filename);
+ g_free(data->custom_xml);
+ g_slice_free(DomainSaveToFileData, data);
+}
+
+static void
+gvir_domain_save_to_file_helper(GSimpleAsyncResult *res,
+ GObject *object,
+ GCancellable *cancellable G_GNUC_UNUSED)
+{
+ GVirDomain *dom = GVIR_DOMAIN(object);
+ DomainSaveToFileData *data;
+ GVirConfigDomain *conf;
+ GError *err = NULL;
+
+ data = g_simple_async_result_get_op_res_gpointer(res);
+ conf = gvir_domain_get_config(dom, data->flags, &err);
+
+ if (!gvir_domain_save_to_file(dom, data->filename, conf, data->flags, &err))
+ g_simple_async_result_take_error(res, err);
+}
+
+/**
+ * gvir_domain_save_to_file_async:
+ * @dom: the domain
+ * @filename: path to output file
+ * @custom_conf: (allow-none): configuration for domain or NULL
+ * @flags: the flags
+ * @cancellable: (allow-none) (transfer none): cancallation object
+ * @callback: (scope async): completion callback
+ * @user_data: (closure): opaque data for callback
+ *
+ * Asynchronous variant of #gvir_domain_save_to_file
+ */
+void gvir_domain_save_to_file_async(GVirDomain *dom,
+ gchar *filename,
+ GVirConfigDomain *custom_conf,
+ guint flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GSimpleAsyncResult *res;
+ DomainSaveToFileData *data;
+ gchar *xml = NULL;
+
+ g_return_if_fail(GVIR_IS_DOMAIN(dom));
+ g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable));
+
+ if (custom_xml != NULL)
+ xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(custom_conf));
+
+ data = g_slice_new0(DomainSaveToFileData);
+ data->filename = g_strdup(filename);
+ data->custom_xml = xml;
+ data->flags = flags;
+
+ res = g_simple_async_result_new(G_OBJECT(dom),
+ callback,
+ user_data,
+ gvir_domain_save_to_file_async);
+ g_simple_async_result_set_op_res_gpointer(res, data, (GDestroyNotify)
+ domain_save_to_file_data_free);
+
+ g_simple_async_result_run_in_thread(res,
+ gvir_domain_save_to_file_helper,
+ G_PRIORITY_DEFAULT,
+ cancellable);
+
+ g_object_unref(res);
+}
+
+/**
+ * gvir_domain_save_to_file_finish:
+ * @dom: the domain to save
+ * @result: (transfer none): async method result
+ * @err: Place-holder for possible errors
+ *
+ * Finishes the operation started by #gvir_domain_save_to_file_async.
+ *
+ * Returns: TRUE if domain was saved successfully, FALSE otherwise.
+ */
+gboolean gvir_domain_save_to_file_finish(GVirDomain *dom,
+ GAsyncResult *result,
+ GError **err)
+{
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail(g_simple_async_result_is_valid
+ (result,
+ G_OBJECT(dom),
+ gvir_domain_save_to_file_async), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+
+ if (g_simple_async_result_propagate_error(G_SIMPLE_ASYNC_RESULT(result), err))
+ return FALSE;
+
+ return TRUE;
+}
+
+/**
* gvir_domain_get_config:
* @dom: the domain
* @flags: the flags
diff --git a/libvirt-gobject/libvirt-gobject-domain.h b/libvirt-gobject/libvirt-gobject-domain.h
index 87b94f4..8f17799 100644
--- a/libvirt-gobject/libvirt-gobject-domain.h
+++ b/libvirt-gobject/libvirt-gobject-domain.h
@@ -148,6 +148,24 @@ gboolean gvir_domain_reboot(GVirDomain *dom,
guint flags,
GError **err);
+gboolean gvir_domain_save_to_file(GVirDomain *dom,
+ gchar *filename,
+ GVirConfigDomain *custom_conf,
+ guint flags,
+ GError **err);
+
+void gvir_domain_save_to_file_async(GVirDomain *dom,
+ gchar *filename,
+ GVirConfigDomain *custom_conf,
+ guint flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+gboolean gvir_domain_save_to_file_finish(GVirDomain *dom,
+ GAsyncResult *result,
+ GError **err);
+
GVirDomainInfo *gvir_domain_get_info(GVirDomain *dom,
GError **err);
void gvir_domain_get_info_async(GVirDomain *dom,
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index 94e441a..54a093a 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -75,6 +75,9 @@ LIBVIRT_GOBJECT_0.0.8 {
gvir_domain_get_persistent;
gvir_domain_get_saved;
gvir_domain_screenshot;
+ gvir_domain_save_to_file;
+ gvir_domain_save_to_file_async;
+ gvir_domain_save_to_file_finish;
gvir_domain_snapshot_get_type;
gvir_domain_snapshot_handle_get_type;
--
1.7.10.4
12 years, 5 months
[libvirt] Libvirt iSCSI APIs
by Ata Bohra
Hi All,
I am interested in extending libvirt APIs to support iSCSI operations such as: add/remove targets, list targets, list remote LUNs, rescan luns etc. The intention is to provide an interface that external programs can hook to manage iSCSI storage devices on a given hypervisor(I would be adding interfaces for ESX first). Looking at the libvirt.c interface for storage driver I'm unable find routines that can be overridden for specific hypervisor. Googling lead to a nice blog presentation that provisions VMs on remote LUN(s) for KVM but uses virish. (http://berrange.com/tags/iscsi/).
My question is; is this as per design not to expose iSCSI related APIs? Will an extention to libvirt.c (_virStorageDriver) so that every hypervisor can implement it is acceptable? Please correct me if I am missing something serious here.
Thanks!
Ata
12 years, 5 months