* [Qemu-devel] [PATCH 0/2] vnc: fix two bugs about qmp_change vnc
@ 2015-02-05 9:36 arei.gonglei
2015-02-05 9:36 ` [Qemu-devel] [PATCH 1/2] vnc: introduce an wrapper for auto assign vnc id arei.gonglei
2015-02-05 9:36 ` [Qemu-devel] [PATCH 2/2] vnc: auto assian an id when calling change vnc qmp interface arei.gonglei
0 siblings, 2 replies; 4+ messages in thread
From: arei.gonglei @ 2015-02-05 9:36 UTC (permalink / raw)
To: qemu-devel; +Cc: Gonglei, kraxel, peter.huangpeng
From: Gonglei <arei.gonglei@huawei.com>
This patch series based on my previous series:
[PATCH v2 0/3] fix qemu crash about vnc
Reproducer:
$ ./qemu-system-x86_64 -enable-kvm -m 4096 -smp 4 -name redhat6.2 -drive file=/home/redhat.img,if=none,id=drive-ide0-0-0 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -drive file=/mnt/sdb/gonglei/iso/rhel-server-7.0-x86_64-dvd.iso,if=none,id=drive-ide0-0-1 -device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1,bootindex=4 -qmp unix:/tmp/qmp,server,nowait -monitor stdio -vnc 0.0.0.0:10,password,sasl
QEMU 2.1.50 monitor - type 'help' for more information
(qemu) change vnc password 123
(qemu) change vnc abc
(qemu) change vnc 0.0.0.0:10,password,sasl
(qemu) change vnc abc=a
Invalid parameter 'abc'
(qemu)
Gonglei (2):
vnc: introduce an wrapper for auto assign vnc id
vnc: auto assian an id when calling change vnc qmp interface
include/ui/console.h | 1 +
qmp.c | 5 +++++
ui/vnc.c | 22 +++++++++++++++-------
3 files changed, 21 insertions(+), 7 deletions(-)
--
1.7.12.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 1/2] vnc: introduce an wrapper for auto assign vnc id
2015-02-05 9:36 [Qemu-devel] [PATCH 0/2] vnc: fix two bugs about qmp_change vnc arei.gonglei
@ 2015-02-05 9:36 ` arei.gonglei
2015-02-05 9:36 ` [Qemu-devel] [PATCH 2/2] vnc: auto assian an id when calling change vnc qmp interface arei.gonglei
1 sibling, 0 replies; 4+ messages in thread
From: arei.gonglei @ 2015-02-05 9:36 UTC (permalink / raw)
To: qemu-devel; +Cc: Gonglei, kraxel, peter.huangpeng
From: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
include/ui/console.h | 1 +
ui/vnc.c | 22 +++++++++++++++-------
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/include/ui/console.h b/include/ui/console.h
index 8a4d671..5c19c3c 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -335,6 +335,7 @@ void vnc_display_init(const char *id);
void vnc_display_open(const char *id, Error **errp);
void vnc_display_add_client(const char *id, int csock, bool skipauth);
char *vnc_display_local_addr(const char *id);
+void vnc_auto_assign_id(QemuOptsList *olist, QemuOpts *opts);
#ifdef CONFIG_VNC
int vnc_display_password(const char *id, const char *password);
int vnc_display_pw_expire(const char *id, time_t expires);
diff --git a/ui/vnc.c b/ui/vnc.c
index 4bae970..1a4117c 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3689,6 +3689,19 @@ QemuOpts *vnc_parse_func(const char *str)
return qemu_opts_parse(qemu_find_opts("vnc"), str, 1);
}
+void vnc_auto_assign_id(QemuOptsList *olist, QemuOpts *opts)
+{
+ int i = 2;
+ char *id;
+
+ id = g_strdup("default");
+ while (qemu_opts_find(olist, id)) {
+ g_free(id);
+ id = g_strdup_printf("vnc%d", i++);
+ }
+ qemu_opts_set_id(opts, id);
+}
+
int vnc_init_func(QemuOpts *opts, void *opaque)
{
Error *local_err = NULL;
@@ -3697,13 +3710,8 @@ int vnc_init_func(QemuOpts *opts, void *opaque)
if (!id) {
/* auto-assign id if not present */
- int i = 2;
- id = g_strdup("default");
- while (qemu_opts_find(olist, id)) {
- g_free(id);
- id = g_strdup_printf("vnc%d", i++);
- }
- qemu_opts_set_id(opts, id);
+ vnc_auto_assign_id(olist, opts);
+ id = (char *)qemu_opts_id(opts);
}
vnc_display_init(id);
--
1.7.12.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 2/2] vnc: auto assian an id when calling change vnc qmp interface
2015-02-05 9:36 [Qemu-devel] [PATCH 0/2] vnc: fix two bugs about qmp_change vnc arei.gonglei
2015-02-05 9:36 ` [Qemu-devel] [PATCH 1/2] vnc: introduce an wrapper for auto assign vnc id arei.gonglei
@ 2015-02-05 9:36 ` arei.gonglei
2015-02-05 9:40 ` Gonglei
1 sibling, 1 reply; 4+ messages in thread
From: arei.gonglei @ 2015-02-05 9:36 UTC (permalink / raw)
To: qemu-devel; +Cc: Gonglei, kraxel, peter.huangpeng
From: Gonglei <arei.gonglei@huawei.com>
Only in this way, change vnc qmp interface can take effect,
because qemu_opts_find(&qemu_vnc_opts, id) will return NULL
in vnc_display_open(), It can't connect successfully vnc
server forever.
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
qmp.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/qmp.c b/qmp.c
index 963305c..028193b 100644
--- a/qmp.c
+++ b/qmp.c
@@ -381,6 +381,11 @@ static void qmp_change_vnc_listen(const char *target, Error **errp)
qemu_opts_del(opts);
}
opts = vnc_parse_func(target);
+ if (opts) {
+ return;
+ }
+
+ vnc_auto_assign_id(olist, opts);
vnc_display_open("default", errp);
}
--
1.7.12.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] vnc: auto assian an id when calling change vnc qmp interface
2015-02-05 9:36 ` [Qemu-devel] [PATCH 2/2] vnc: auto assian an id when calling change vnc qmp interface arei.gonglei
@ 2015-02-05 9:40 ` Gonglei
0 siblings, 0 replies; 4+ messages in thread
From: Gonglei @ 2015-02-05 9:40 UTC (permalink / raw)
To: Gonglei (Arei)
Cc: Huangpeng (Peter), qemu-devel@nongnu.org, kraxel@redhat.com
On 2015/2/5 17:36, Gonglei (Arei) wrote:
> From: Gonglei <arei.gonglei@huawei.com>
>
> Only in this way, change vnc qmp interface can take effect,
> because qemu_opts_find(&qemu_vnc_opts, id) will return NULL
> in vnc_display_open(), It can't connect successfully vnc
> server forever.
>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
> qmp.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/qmp.c b/qmp.c
> index 963305c..028193b 100644
> --- a/qmp.c
> +++ b/qmp.c
> @@ -381,6 +381,11 @@ static void qmp_change_vnc_listen(const char *target, Error **errp)
> qemu_opts_del(opts);
> }
> opts = vnc_parse_func(target);
> + if (opts) {
Oops... I forget to rebase. It should be 'if (!opts)'. :(
Regards,
-Gonglei
> + return;
> + }
> +
> + vnc_auto_assign_id(olist, opts);
> vnc_display_open("default", errp);
> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-02-05 9:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-05 9:36 [Qemu-devel] [PATCH 0/2] vnc: fix two bugs about qmp_change vnc arei.gonglei
2015-02-05 9:36 ` [Qemu-devel] [PATCH 1/2] vnc: introduce an wrapper for auto assign vnc id arei.gonglei
2015-02-05 9:36 ` [Qemu-devel] [PATCH 2/2] vnc: auto assian an id when calling change vnc qmp interface arei.gonglei
2015-02-05 9:40 ` Gonglei
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).