[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 02/11] spice: turn client_migrate_info to async
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 02/11] spice: turn client_migrate_info to async |
Date: |
Tue, 25 Oct 2011 14:25:41 +0200 |
From: Yonit Halperin <address@hidden>
RHBZ 737921
Spice client is required to connect to the migration target before/as migration
starts. Since after migration starts, the target qemu is blocked and cannot
accept new spice client
we trigger the connection to the target upon client_migrate_info command.
client_migrate_info completion cb will be called after spice client has been
connected to the target (or a timeout). See following patches and spice patches.
Signed-off-by: Yonit Halperin <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hmp-commands.hx | 3 ++-
monitor.c | 6 ++++--
qmp-commands.hx | 3 ++-
ui/qemu-spice.h | 14 +++++++++++---
ui/spice-core.c | 10 +++++++---
5 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index ab08d58..e181267 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -824,7 +824,8 @@ ETEXI
.params = "protocol hostname port tls-port cert-subject",
.help = "send migration info to spice/vnc client",
.user_print = monitor_user_noop,
- .mhandler.cmd_new = client_migrate_info,
+ .mhandler.cmd_async = client_migrate_info,
+ .flags = MONITOR_CMD_ASYNC,
},
STEXI
diff --git a/monitor.c b/monitor.c
index ffda0fe..13b0fa5 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1153,7 +1153,8 @@ static int add_graphics_client(Monitor *mon, const QDict
*qdict, QObject **ret_d
return -1;
}
-static int client_migrate_info(Monitor *mon, const QDict *qdict, QObject
**ret_data)
+static int client_migrate_info(Monitor *mon, const QDict *qdict,
+ MonitorCompletion cb, void *opaque)
{
const char *protocol = qdict_get_str(qdict, "protocol");
const char *hostname = qdict_get_str(qdict, "hostname");
@@ -1168,7 +1169,8 @@ static int client_migrate_info(Monitor *mon, const QDict
*qdict, QObject **ret_d
return -1;
}
- ret = qemu_spice_migrate_info(hostname, port, tls_port, subject);
+ ret = qemu_spice_migrate_info(hostname, port, tls_port, subject,
+ cb, opaque);
if (ret != 0) {
qerror_report(QERR_UNDEFINED_ERROR);
return -1;
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 4328e8b..cb60d0c 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -569,7 +569,8 @@ EQMP
.params = "protocol hostname port tls-port cert-subject",
.help = "send migration info to spice/vnc client",
.user_print = monitor_user_noop,
- .mhandler.cmd_new = client_migrate_info,
+ .mhandler.cmd_async = client_migrate_info,
+ .flags = MONITOR_CMD_ASYNC,
},
SQMP
diff --git a/ui/qemu-spice.h b/ui/qemu-spice.h
index f34be69..c35b29c 100644
--- a/ui/qemu-spice.h
+++ b/ui/qemu-spice.h
@@ -25,6 +25,7 @@
#include "qemu-option.h"
#include "qemu-config.h"
#include "qemu-char.h"
+#include "monitor.h"
extern int using_spice;
@@ -37,7 +38,8 @@ int qemu_spice_set_passwd(const char *passwd,
bool fail_if_connected, bool
disconnect_if_connected);
int qemu_spice_set_pw_expire(time_t expires);
int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
- const char *subject);
+ const char *subject,
+ MonitorCompletion cb, void *opaque);
void do_info_spice_print(Monitor *mon, const QObject *data);
void do_info_spice(Monitor *mon, QObject **ret_data);
@@ -45,6 +47,7 @@ void do_info_spice(Monitor *mon, QObject **ret_data);
int qemu_chr_open_spice(QemuOpts *opts, CharDriverState **_chr);
#else /* CONFIG_SPICE */
+#include "monitor.h"
#define using_spice 0
static inline int qemu_spice_set_passwd(const char *passwd,
@@ -57,8 +60,13 @@ static inline int qemu_spice_set_pw_expire(time_t expires)
{
return -1;
}
-static inline int qemu_spice_migrate_info(const char *h, int p, int t, const
char *s)
-{ return -1; }
+static inline int qemu_spice_migrate_info(const char *h, int p, int t,
+ const char *s,
+ MonitorCompletion cb, void *opaque)
+{
+ cb(opaque, NULL);
+ return -1;
+}
#endif /* CONFIG_SPICE */
diff --git a/ui/spice-core.c b/ui/spice-core.c
index b33366e..62ffb9b 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -457,10 +457,14 @@ static void migration_state_notifier(Notifier *notifier,
void *data)
}
int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
- const char *subject)
+ const char *subject,
+ MonitorCompletion *cb, void *opaque)
{
- return spice_server_migrate_info(spice_server, hostname,
- port, tls_port, subject);
+ int ret;
+ ret = spice_server_migrate_info(spice_server, hostname,
+ port, tls_port, subject);
+ cb(opaque, NULL);
+ return ret;
}
static int add_channel(const char *name, const char *value, void *opaque)
--
1.7.1
- [Qemu-devel] [PATCH 04/11] spice: Convert core to QEMU thread API, (continued)
- [Qemu-devel] [PATCH 04/11] spice: Convert core to QEMU thread API, Gerd Hoffmann, 2011/10/25
- [Qemu-devel] [PATCH 07/11] ui/spice-core: fix segfault in monitor, Gerd Hoffmann, 2011/10/25
- [Qemu-devel] [PATCH 03/11] spice: support the new migration interface (spice 0.8.3), Gerd Hoffmann, 2011/10/25
- [Qemu-devel] [PATCH 08/11] qxl: factor out properties, Gerd Hoffmann, 2011/10/25
- [Qemu-devel] [PATCH 01/11] migration: add status query functions, Gerd Hoffmann, 2011/10/25
- [Qemu-devel] [PATCH 05/11] qxl: Convert to QEMU thread API, Gerd Hoffmann, 2011/10/25
- [Qemu-devel] [PATCH 06/11] qxl: Drop phread_yield on OOM, Gerd Hoffmann, 2011/10/25
- [Qemu-devel] [PATCH 11/11] spice: fix file handle cleanup, Gerd Hoffmann, 2011/10/25
- [Qemu-devel] [PATCH 10/11] qxl: reset update_surface, Gerd Hoffmann, 2011/10/25
- [Qemu-devel] [PATCH 09/11] qxl: fix guest cursor tracking, Gerd Hoffmann, 2011/10/25
- [Qemu-devel] [PATCH 02/11] spice: turn client_migrate_info to async,
Gerd Hoffmann <=
- Re: [Qemu-devel] [PULL] spice patch queue, Anthony Liguori, 2011/10/31