Daniel P. Berrangé <berra...@redhat.com> writes:

> On Mon, Jan 04, 2021 at 03:11:28PM +0800, Zihao Chang wrote:
>> QEMU loads vnc tls certificates only when vm is started. This patch
>> provides a new qmp command to reload vnc tls certificates without
>> restart vnc-server/VM.
>> 
>> Signed-off-by: Zihao Chang <changzih...@huawei.com>
[...]
>> diff --git a/ui/vnc.c b/ui/vnc.c
>> index 7452ac7df2..b0cfbcf47c 100644
>> --- a/ui/vnc.c
>> +++ b/ui/vnc.c
>> @@ -582,6 +582,26 @@ VncInfo2List *qmp_query_vnc_servers(Error **errp)
>>      return prev;
>>  }
>>  
>> +int vnc_display_reload_cert(const char *id, Error **errp)
>> +{
>> +    VncDisplay *vd = vnc_display_find(id);
>> +
>> +    if (!vd) {
>> +        return -EINVAL;
>> +    }
>> +
>> +    if (!vd->tlscreds) {
>> +        error_printf_unless_qmp("If you want use vnc tls  please enable "
>> +                                "vnc tls using '-vnc 
>> tls-creds=${tls-obj-id}'.\n");
>> +        return -EPERM;
>
> You're passing in a 'Error' object, so use that and don't retyrn errnos

Do return a value that indicates success / failure.  See the big comment
in include/qapi/error.h for why.

I recommend bool unless callers need to distinguish between several
failures.

[...]


Reply via email to