All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: oscar.zhangbo@huawei.com, Zihao Chang <changzihao1@huawei.com>,
	kraxel@redhat.com, xiexiangyou@huawei.com, qemu-devel@nongnu.org
Subject: Re: [PATCH] vnc: add qmp to support reload vnc tls certificates
Date: Fri, 15 Jan 2021 14:25:23 +0100	[thread overview]
Message-ID: <87wnwemiws.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20210104122740.GI640208@redhat.com> ("Daniel P. Berrangé"'s message of "Mon, 4 Jan 2021 12:27:40 +0000")

Daniel P. Berrangé <berrange@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 <changzihao1@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	other threads:[~2021-01-15 14:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04  7:11 [PATCH] vnc: add qmp to support reload vnc tls certificates Zihao Chang
2021-01-04 12:27 ` Daniel P. Berrangé
2021-01-15 13:25   ` Markus Armbruster [this message]
2021-01-19 19:23 ` Eric Blake

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=87wnwemiws.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=changzihao1@huawei.com \
    --cc=kraxel@redhat.com \
    --cc=oscar.zhangbo@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xiexiangyou@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.