From: Gerd Hoffmann <kraxel@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/6] spice: client migration.
Date: Mon, 10 Jan 2011 17:37:18 +0100 [thread overview]
Message-ID: <4D2B35BE.7000907@redhat.com> (raw)
In-Reply-To: <20110110161817.GQ2723@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 537 bytes --]
Hi,
>> I like client_migrate_info and it fits both spice+vnc naming too.
>>
>> Given that vnc just needs hostname and port (which are present
>> already) and the arguments not used by vnc are optional all we need
>> to do is rename the command and add a "protocol" argument similar to
>> "set_password", correct?
>
> Yeah, that sounds sufficient to me.
Quick incremental patch attached. Became a bit larger than initially
expected due to some code reorganization (move out of ui/spice-core.c)
needed.
comments?
cheers,
Gerd
[-- Attachment #2: fix --]
[-- Type: text/plain, Size: 7310 bytes --]
diff --git a/hmp-commands.hx b/hmp-commands.hx
index e6d8f36..05b777b 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -815,24 +815,21 @@ ETEXI
},
STEXI
-@item spice_migrate_info @var{hostname} @var{port} @var{tls-port} @var{cert-subject}
-@findex spice_migrate_info
-Set the spice connection info for the migration target. The spice
-server will ask the spice client to automatically reconnect using the
-new parameters (if specified) once the vm migration finished
-successfully.
+@item client_migrate_info @var{protocol} @var{hostname} @var{port} @var{tls-port} @var{cert-subject}
+@findex client_migrate_info
+Set the spice/vnc connection info for the migration target. The spice/vnc
+server will ask the spice/vnc client to automatically reconnect using the
+new parameters (if specified) once the vm migration finished successfully.
ETEXI
-#if defined(CONFIG_SPICE)
{
- .name = "spice_migrate_info",
- .args_type = "hostname:s,port:i?,tls-port:i?,cert-subject:s?",
- .params = "hostname port tls-port cert-subject",
- .help = "send migration info to spice client",
+ .name = "client_migrate_info",
+ .args_type = "protocol:s,hostname:s,port:i?,tls-port:i?,cert-subject:s?",
+ .params = "protocol hostname port tls-port cert-subject",
+ .help = "send migration info to spice/vnc client",
.user_print = monitor_user_noop,
- .mhandler.cmd_new = mon_spice_migrate,
+ .mhandler.cmd_new = client_migrate_info,
},
-#endif
STEXI
@item snapshot_blkdev
diff --git a/monitor.c b/monitor.c
index 038d532..6f5ee14 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1173,6 +1173,33 @@ static int expire_password(Monitor *mon, const QDict *qdict, QObject **ret_data)
return -1;
}
+static int client_migrate_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
+{
+ const char *protocol = qdict_get_str(qdict, "protocol");
+ const char *hostname = qdict_get_str(qdict, "hostname");
+ const char *subject = qdict_get_try_str(qdict, "cert-subject");
+ int port = qdict_get_try_int(qdict, "port", -1);
+ int tls_port = qdict_get_try_int(qdict, "tls-port", -1);
+ int ret;
+
+ if (strcmp(protocol, "spice") == 0) {
+ if (!using_spice) {
+ qerror_report(QERR_DEVICE_NOT_ACTIVE, "spice");
+ return -1;
+ }
+
+ ret = qemu_spice_migrate_info(hostname, port, tls_port, subject);
+ 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 24ada04..2ed8f44 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -503,39 +503,39 @@ EQMP
},
SQMP
-spice_migrate_info
+client_migrate_info
------------------
-Set the spice connection info for the migration target. The spice
-server will ask the spice client to automatically reconnect using the
-new parameters (if specified) once the vm migration finished
-successfully.
+Set the spice/vnc connection info for the migration target. The spice/vnc
+server will ask the spice/vnc client to automatically reconnect using the
+new parameters (if specified) once the vm migration finished successfully.
Arguments:
+- "protocol": protocol: "spice" or "vnc" (json-string)
- "hostname": migration target hostname (json-string)
-- "port": spice tcp port for plaintext channels (json-int, optional)
+- "port": spice/vnc tcp port for plaintext channels (json-int, optional)
- "tls-port": spice tcp port for tls-secured channels (json-int, optional)
- "cert-subject": server certificate subject (json-string, optional)
Example:
--> { "execute": "spice_migrate_info",
- "arguments": { "hostname": "virt42.lab.kraxel.org", "port": 1234 } }
+-> { "execute": "client_migrate_info",
+ "arguments": { "protocol": "spice",
+ "hostname": "virt42.lab.kraxel.org",
+ "port": 1234 } }
<- { "return": {} }
EQMP
-#if defined(CONFIG_SPICE)
{
- .name = "spice_migrate_info",
- .args_type = "hostname:s,port:i?,tls-port:i?,cert-subject:s?",
- .params = "hostname port tls-port cert-subject",
- .help = "send migration info to spice client",
+ .name = "client_migrate_info",
+ .args_type = "protocol:s,hostname:s,port:i?,tls-port:i?,cert-subject:s?",
+ .params = "protocol hostname port tls-port cert-subject",
+ .help = "send migration info to spice/vnc client",
.user_print = monitor_user_noop,
- .mhandler.cmd_new = mon_spice_migrate,
+ .mhandler.cmd_new = client_migrate_info,
},
-#endif
SQMP
migrate_set_speed
diff --git a/ui/qemu-spice.h b/ui/qemu-spice.h
index f234c4d..78df3b4 100644
--- a/ui/qemu-spice.h
+++ b/ui/qemu-spice.h
@@ -36,10 +36,11 @@ int qemu_spice_add_interface(SpiceBaseInstance *sin);
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);
void do_info_spice_print(Monitor *mon, const QObject *data);
void do_info_spice(Monitor *mon, QObject **ret_data);
-int mon_spice_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data);
CharDriverState *qemu_chr_open_spice(QemuOpts *opts);
@@ -48,6 +49,7 @@ CharDriverState *qemu_chr_open_spice(QemuOpts *opts);
#define using_spice 0
#define qemu_spice_set_passwd(_p, _f1, _f2) (-1)
#define qemu_spice_set_pw_expire(_e) (-1)
+#define qemu_spice_migrate_info(_h, _p, _t, _s) (-1)
#endif /* CONFIG_SPICE */
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 95116cc..1aa1a5e 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -431,26 +431,11 @@ static void migration_state_notifier(Notifier *notifier)
}
}
-int mon_spice_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data)
+int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
+ const char *subject)
{
- const char *hostname = qdict_get_str(qdict, "hostname");
- const char *subject = qdict_get_try_str(qdict, "cert-subject");
- int port = qdict_get_try_int(qdict, "port", -1);
- int tls_port = qdict_get_try_int(qdict, "tls-port", -1);
- int ret;
-
- if (!spice_server) {
- qerror_report(QERR_DEVICE_NOT_ACTIVE, "spice");
- return -1;
- }
-
- ret = spice_server_migrate_info(spice_server, hostname,
- port, tls_port, subject);
- if (ret != 0) {
- qerror_report(QERR_UNDEFINED_ERROR);
- return -1;
- }
- return 0;
+ return spice_server_migrate_info(spice_server, hostname,
+ port, tls_port, subject);
}
static int add_channel(const char *name, const char *value, void *opaque)
next prev parent reply other threads:[~2011-01-10 16:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-10 13:31 [Qemu-devel] [PULL 0/6] spice patch queue Gerd Hoffmann
2011-01-10 13:31 ` [Qemu-devel] [PATCH 1/6] add migration state change notifiers Gerd Hoffmann
2011-01-10 13:31 ` [Qemu-devel] [PATCH 2/6] spice: client migration Gerd Hoffmann
2011-01-10 15:49 ` Daniel P. Berrange
2011-01-10 15:57 ` Alon Levy
2011-01-10 16:08 ` Gerd Hoffmann
2011-01-10 16:18 ` Daniel P. Berrange
2011-01-10 16:37 ` Gerd Hoffmann [this message]
2011-01-10 19:26 ` Alon Levy
2011-01-10 19:39 ` Daniel P. Berrange
2011-01-11 8:15 ` Gerd Hoffmann
2011-01-10 13:31 ` [Qemu-devel] [PATCH 3/6] spice: MAINTAINERS update Gerd Hoffmann
2011-01-10 13:31 ` [Qemu-devel] [PATCH 4/6] vnc/spice: fix "never" and "now" expire_time Gerd Hoffmann
2011-01-10 13:31 ` [Qemu-devel] [PATCH 5/6] spice/qxl: zap spice 0.4 migration compatibility bits Gerd Hoffmann
2011-01-10 13:31 ` [Qemu-devel] [PATCH 6/6] spice: add chardev (v4) Gerd Hoffmann
-- strict thread matches above, loose matches on Subject: below --
2011-01-11 12:08 [Qemu-devel] [PULL v2 0/6] spice patch queue Gerd Hoffmann
2011-01-11 12:08 ` [Qemu-devel] [PATCH 2/6] spice: client migration Gerd Hoffmann
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=4D2B35BE.7000907@redhat.com \
--to=kraxel@redhat.com \
--cc=berrange@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).