From: Alon Levy <alevy@redhat.com>
To: qemu-devel@nongnu.org
Cc: kraxel@redhat.com
Subject: [Qemu-devel] [PATCH 3/3] monitor: add client_migrate_switch command (RHBZ 725009)
Date: Fri, 19 Aug 2011 10:08:48 -0700 [thread overview]
Message-ID: <1313773728-6104-4-git-send-email-alevy@redhat.com> (raw)
In-Reply-To: <1313773728-6104-1-git-send-email-alevy@redhat.com>
Complementary to the auto_switch parameter of client_migrate_info, if that is
set to false the new command client_migrate_switch can be used to complete
the switch to the new client. This allows the vm manager (i.e. libvirt) to
first ensure the ticketing information in the target vm is valid before issuing
the switch.
Signed-off-by: Alon Levy <alevy@redhat.com>
---
hmp-commands.hx | 15 +++++++++++++++
monitor.c | 23 +++++++++++++++++++++++
qmp-commands.hx | 27 +++++++++++++++++++++++++++
ui/qemu-spice.h | 5 +++++
ui/spice-core.c | 4 ++++
5 files changed, 74 insertions(+), 0 deletions(-)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index fc2bf99..7979529 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -839,6 +839,21 @@ new parameters (if specified) once the vm migration finished successfully.
ETEXI
{
+ .name = "client_migrate_switch",
+ .args_type = "protocol:s",
+ .params = "protocol",
+ .help = "tell client to disconnect and reconnect to client_migrate_info set destination",
+ .user_print = monitor_user_noop,
+ .mhandler.cmd_new = client_migrate_switch,
+ },
+
+STEXI
+@item client_migrate_switch @var{protocol}
+@findex client_migrate_switch
+Tell the spice/vnc client to switch to the target set previously with client_migrate_info. Only has an effect if the last client_migrate_info used auto_switch=false.
+ETEXI
+
+ {
.name = "snapshot_blkdev",
.args_type = "device:B,snapshot-file:s?,format:s?",
.params = "device [new-image-file] [format]",
diff --git a/monitor.c b/monitor.c
index 1daa283..ae6f4ad 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1248,6 +1248,29 @@ static int client_migrate_info(Monitor *mon, const QDict *qdict, QObject **ret_d
return -1;
}
+static int client_migrate_switch(Monitor *mon, const QDict *qdict,
+ QObject **ret_data)
+{
+ const char *protocol = qdict_get_str(qdict, "protocol");
+ int ret;
+
+ if (strcmp(protocol, "spice") == 0) {
+ if (!using_spice) {
+ qerror_report(QERR_DEVICE_NOT_ACTIVE, "spice");
+ return -1;
+ }
+ ret = qemu_spice_migrate_switch();
+ if (ret != 0) {
+ qerror_report(QERR_UNDEFINED_ERROR);
+ return -1;
+ }
+ return 0;
+ }
+
+ qerror_report(QERR_INVALID_PARAMETER, "protocol");
+ return -1;
+}
+
static int do_screen_dump(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
vga_hw_screen_dump(qdict_get_str(qdict, "filename"));
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 13b2bc6..9e0fecf 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -609,6 +609,33 @@ Example:
EQMP
{
+ .name = "client_migrate_switch",
+ .args_type = "protocol:s",
+ .params = "protocol",
+ .help = "tell client to disconnect and reconnect to client_migrate_info set destination",
+ .user_print = monitor_user_noop,
+ .mhandler.cmd_new = client_migrate_switch,
+ },
+
+SQMP
+client_migrate_switch
+---------------------
+
+Tell the spice/vnc client to switch to the target set previously with client_migrate_info. Only has an effect if the last client_migrate_info used auto_switch=false.
+
+Arguments:
+
+- "protocol": protocol: "spice" or "vnc" (json-string)
+
+Example:
+
+-> { "execute": "client_migrate_switch",
+ "arguments": { "protocol": "spice" } }
+<- { "return": {} }
+
+EQMP
+
+ {
.name = "netdev_add",
.args_type = "netdev:O",
.params = "[user|tap|socket],id=str[,prop=value][,...]",
diff --git a/ui/qemu-spice.h b/ui/qemu-spice.h
index e54f16e..113bd2f 100644
--- a/ui/qemu-spice.h
+++ b/ui/qemu-spice.h
@@ -38,6 +38,7 @@ int qemu_spice_set_passwd(const char *passwd,
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, int auto_switch);
+int qemu_spice_migrate_switch(void);
void do_info_spice_print(Monitor *mon, const QObject *data);
void do_info_spice(Monitor *mon, QObject **ret_data);
@@ -60,6 +61,10 @@ static inline int qemu_spice_set_pw_expire(time_t expires)
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_switch(void)
+{ return -1; }
+
+
#endif /* CONFIG_SPICE */
#endif /* QEMU_SPICE_H */
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 3a1d851..83362c2 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -451,6 +451,10 @@ int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
port, tls_port, subject);
}
+int qemu_spice_migrate_switch(void)
+{
+ return spice_server_migrate_switch(spice_server);
+}
static int add_channel(const char *name, const char *value, void *opaque)
{
--
1.7.6
next prev parent reply other threads:[~2011-08-19 17:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-19 17:08 [Qemu-devel] [PATCH 0/3] client_migrate_switch and auto_switch (RHBZ 725009) Alon Levy
2011-08-19 17:08 ` [Qemu-devel] [PATCH 1/3] monitor: refactor whitespace and optional argument parsing Alon Levy
2011-08-19 17:08 ` [Qemu-devel] [PATCH 2/3] spice-core: client_migrate_info: add optional auto_switch parameter (RHBZ 725009) Alon Levy
2011-08-19 17:08 ` Alon Levy [this message]
2011-08-26 9:54 ` [Qemu-devel] [PATCH 0/3] client_migrate_switch and auto_switch " Gerd Hoffmann
2011-08-26 10:03 ` Daniel P. Berrange
2011-08-26 10:17 ` Gerd Hoffmann
2011-08-26 10:43 ` Alon Levy
2011-08-26 11:00 ` Gerd Hoffmann
2011-08-26 11:04 ` Daniel P. Berrange
2011-08-26 12:39 ` Gerd Hoffmann
2011-08-26 13:13 ` Daniel P. Berrange
2011-08-26 10:23 ` Alon Levy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1313773728-6104-4-git-send-email-alevy@redhat.com \
--to=alevy@redhat.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).