diff mbox

[11/14] qapi: add change-vnc-listen

Message ID 1314211389-28915-12-git-send-email-aliguori@us.ibm.com
State New
Headers show

Commit Message

Anthony Liguori Aug. 24, 2011, 6:43 p.m. UTC
New QMP only command to change the VNC server's listening address.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 qapi-schema.json |   14 ++++++++++++++
 qmp-commands.hx  |    8 ++++++++
 qmp.c            |    7 +++++++
 3 files changed, 29 insertions(+), 0 deletions(-)

Comments

Luiz Capitulino Aug. 25, 2011, 1:32 p.m. UTC | #1
On Wed, 24 Aug 2011 13:43:06 -0500
Anthony Liguori <aliguori@us.ibm.com> wrote:

> New QMP only command to change the VNC server's listening address.
> 
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> ---
>  qapi-schema.json |   14 ++++++++++++++
>  qmp-commands.hx  |    8 ++++++++
>  qmp.c            |    7 +++++++
>  3 files changed, 29 insertions(+), 0 deletions(-)
> 
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 3b2229f..211200a 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -109,3 +109,17 @@
>  #         string.  Existing clients are unaffected by executing this command.
>  ##
>  { 'command': 'change-vnc-password', 'data': {'password': 'str'} }
> +
> +##
> +# @change-vnc-listen:
> +#
> +# Change the host that the VNC server listens on.
> +#
> +# @target:  the new server specification to listen on
> +#
> +# Since: 1.0
> +#
> +# Notes:  At this moment in time, the behavior of existing client connections
> +#         when this command is executed is undefined.
> +##

What's the expected behaviour wrt authentication? Right now it will disable
any authentication set for the previous address. It should at least be noted
in the documentation if that's expected.

> +{ 'command': 'change-vnc-listen', 'data': {'target': 'str'} }
> diff --git a/qmp-commands.hx b/qmp-commands.hx
> index d60f72f..c0d0ca3 100644
> --- a/qmp-commands.hx
> +++ b/qmp-commands.hx
> @@ -876,6 +876,14 @@ EQMP
>      },
>  
>      {
> +        .name       = "change-vnc-listen",
> +        .args_type  = "target:s",
> +        .params     = "target",
> +        .help       = "set vnc listening address",
> +        .mhandler.cmd_new = qmp_marshal_input_change_vnc_listen,
> +    },
> +
> +    {
>          .name       = "set_password",
>          .args_type  = "protocol:s,password:s,connected:s?",
>          .params     = "protocol password action-if-connected",
> diff --git a/qmp.c b/qmp.c
> index f817a88..73d6172 100644
> --- a/qmp.c
> +++ b/qmp.c
> @@ -35,3 +35,10 @@ void qmp_change_vnc_password(const char *password, Error **err)
>          error_set(err, QERR_SET_PASSWD_FAILED);
>      }
>  }
> +
> +void qmp_change_vnc_listen(const char *target, Error **err)
> +{
> +    if (vnc_display_open(NULL, target) < 0) {
> +        error_set(err, QERR_VNC_SERVER_FAILED, target);
> +    }
> +}
Anthony Liguori Sept. 2, 2011, 4:11 p.m. UTC | #2
On 08/25/2011 08:32 AM, Luiz Capitulino wrote:
> On Wed, 24 Aug 2011 13:43:06 -0500
> Anthony Liguori<aliguori@us.ibm.com>  wrote:
>
>> New QMP only command to change the VNC server's listening address.
>>
>> Signed-off-by: Anthony Liguori<aliguori@us.ibm.com>
>> ---
>>   qapi-schema.json |   14 ++++++++++++++
>>   qmp-commands.hx  |    8 ++++++++
>>   qmp.c            |    7 +++++++
>>   3 files changed, 29 insertions(+), 0 deletions(-)
>>
>> diff --git a/qapi-schema.json b/qapi-schema.json
>> index 3b2229f..211200a 100644
>> --- a/qapi-schema.json
>> +++ b/qapi-schema.json
>> @@ -109,3 +109,17 @@
>>   #         string.  Existing clients are unaffected by executing this command.
>>   ##
>>   { 'command': 'change-vnc-password', 'data': {'password': 'str'} }
>> +
>> +##
>> +# @change-vnc-listen:
>> +#
>> +# Change the host that the VNC server listens on.
>> +#
>> +# @target:  the new server specification to listen on
>> +#
>> +# Since: 1.0
>> +#
>> +# Notes:  At this moment in time, the behavior of existing client connections
>> +#         when this command is executed is undefined.
>> +##
>
> What's the expected behaviour wrt authentication? Right now it will disable
> any authentication set for the previous address. It should at least be noted
> in the documentation if that's expected.

Indeed.  Thanks.

Regards,

Anthony Liguori

>
>> +{ 'command': 'change-vnc-listen', 'data': {'target': 'str'} }
>> diff --git a/qmp-commands.hx b/qmp-commands.hx
>> index d60f72f..c0d0ca3 100644
>> --- a/qmp-commands.hx
>> +++ b/qmp-commands.hx
>> @@ -876,6 +876,14 @@ EQMP
>>       },
>>
>>       {
>> +        .name       = "change-vnc-listen",
>> +        .args_type  = "target:s",
>> +        .params     = "target",
>> +        .help       = "set vnc listening address",
>> +        .mhandler.cmd_new = qmp_marshal_input_change_vnc_listen,
>> +    },
>> +
>> +    {
>>           .name       = "set_password",
>>           .args_type  = "protocol:s,password:s,connected:s?",
>>           .params     = "protocol password action-if-connected",
>> diff --git a/qmp.c b/qmp.c
>> index f817a88..73d6172 100644
>> --- a/qmp.c
>> +++ b/qmp.c
>> @@ -35,3 +35,10 @@ void qmp_change_vnc_password(const char *password, Error **err)
>>           error_set(err, QERR_SET_PASSWD_FAILED);
>>       }
>>   }
>> +
>> +void qmp_change_vnc_listen(const char *target, Error **err)
>> +{
>> +    if (vnc_display_open(NULL, target)<  0) {
>> +        error_set(err, QERR_VNC_SERVER_FAILED, target);
>> +    }
>> +}
>
>
diff mbox

Patch

diff --git a/qapi-schema.json b/qapi-schema.json
index 3b2229f..211200a 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -109,3 +109,17 @@ 
 #         string.  Existing clients are unaffected by executing this command.
 ##
 { 'command': 'change-vnc-password', 'data': {'password': 'str'} }
+
+##
+# @change-vnc-listen:
+#
+# Change the host that the VNC server listens on.
+#
+# @target:  the new server specification to listen on
+#
+# Since: 1.0
+#
+# Notes:  At this moment in time, the behavior of existing client connections
+#         when this command is executed is undefined.
+##
+{ 'command': 'change-vnc-listen', 'data': {'target': 'str'} }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index d60f72f..c0d0ca3 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -876,6 +876,14 @@  EQMP
     },
 
     {
+        .name       = "change-vnc-listen",
+        .args_type  = "target:s",
+        .params     = "target",
+        .help       = "set vnc listening address",
+        .mhandler.cmd_new = qmp_marshal_input_change_vnc_listen,
+    },
+
+    {
         .name       = "set_password",
         .args_type  = "protocol:s,password:s,connected:s?",
         .params     = "protocol password action-if-connected",
diff --git a/qmp.c b/qmp.c
index f817a88..73d6172 100644
--- a/qmp.c
+++ b/qmp.c
@@ -35,3 +35,10 @@  void qmp_change_vnc_password(const char *password, Error **err)
         error_set(err, QERR_SET_PASSWD_FAILED);
     }
 }
+
+void qmp_change_vnc_listen(const char *target, Error **err)
+{
+    if (vnc_display_open(NULL, target) < 0) {
+        error_set(err, QERR_VNC_SERVER_FAILED, target);
+    }
+}