Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30A4CC433F5 for ; Thu, 14 Oct 2021 14:53:55 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BAF5A60F36 for ; Thu, 14 Oct 2021 14:53:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BAF5A60F36 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=proxmox.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:39950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mb27F-00023O-Lm for qemu-devel@archiver.kernel.org; Thu, 14 Oct 2021 10:53:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60200) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mb26F-0001I6-I4 for qemu-devel@nongnu.org; Thu, 14 Oct 2021 10:52:51 -0400 Received: from proxmox-new.maurer-it.com ([94.136.29.106]:8195) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mb26C-0004Ex-Sr for qemu-devel@nongnu.org; Thu, 14 Oct 2021 10:52:50 -0400 Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id DA8EF4647E; Thu, 14 Oct 2021 16:52:43 +0200 (CEST) Subject: Re: [PATCH v4 2/2] monitor: refactor set/expire_password and allow VNC display id To: Markus Armbruster References: <20210928090326.1056010-1-s.reiter@proxmox.com> <20210928090326.1056010-3-s.reiter@proxmox.com> <87zgrebnod.fsf@dusky.pond.sub.org> <69473cd0-b01b-a189-e4e8-fcb02738b7b1@proxmox.com> <87bl3skrib.fsf@dusky.pond.sub.org> From: Stefan Reiter Message-ID: <83d76057-8b43-8a21-18c6-6565ea87bf72@proxmox.com> Date: Thu, 14 Oct 2021 16:52:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <87bl3skrib.fsf@dusky.pond.sub.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=94.136.29.106; envelope-from=s.reiter@proxmox.com; helo=proxmox-new.maurer-it.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wolfgang Bumiller , "Dr. David Alan Gilbert" , qemu-devel@nongnu.org, =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Gerd Hoffmann , Paolo Bonzini , =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Eric Blake , Thomas Lamprecht Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 10/14/21 9:14 AM, Markus Armbruster wrote: > Stefan Reiter writes: > >> On 10/12/21 11:24 AM, Markus Armbruster wrote: >>> Stefan Reiter writes: >>> >>>> It is possible to specify more than one VNC server on the command line, >>>> either with an explicit ID or the auto-generated ones à "default", >>>> "vnc2", "vnc3", ... >>>> >>>> It is not possible to change the password on one of these extra VNC >>>> displays though. Fix this by adding a "display" parameter to the >>>> "set_password" and "expire_password" QMP and HMP commands. >>>> >>>> For HMP, the display is specified using the "-d" value flag. >>>> >>>> For QMP, the schema is updated to explicitly express the supported >>>> variants of the commands with protocol-discriminated unions. >>>> >>>> Suggested-by: Eric Blake >>>> Suggested-by: Markus Armbruster >>>> Signed-off-by: Stefan Reiter >>> >>> [...] >>> >>>> [...] >>> >>> Let me describe what you're doing in my own words, to make sure I got >>> both the what and the why: >>> >>> 1. Change @protocol and @connected from str to enum. >>> >>> 2. Turn the argument struct into a union tagged by @protocol, to enable >>> 3. and 4. >>> >>> 3. Add argument @display in branch 'vnc'. >>> >>> 4. Use a separate enum for @connected in each union branch, to enable 4. >>> >>> 5. Trim this enum in branch 'vnc' to the values that are actually >>> supported. Note that just one value remains, i.e. @connected is now >>> an optional argument that can take only the default value. >>> >>> 6. Since such an argument is pointless, deprecate @connected in branch >>> 'vnc'. >>> >>> Correct? >> >> Yes. > > Thanks! > >>> Ignorant question: is it possible to have more than one 'spice' display? >> >> Not in terms of passwords anyway. So only one SPICE password can be set at >> any time, i.e. the 'display' parameter in this function does not apply. >> >>> >>> Item 5. is not a compatibility break: before your patch, >>> qmp_set_password() rejects the values you drop. >> >> Yes. >> >>> >>> Item 5. adds another enum to the schema in return for more accurate >>> introspection and slightly simpler qmp_set_password(). I'm not sure >>> that's worthwhile. I think we could use the same enum for both union >>> branches. >> >> I tried to avoid mixing manual parsing and declarative QAPI stuff as much >> as I could, so I moved as much as possible to QAPI. I personally like the >> extra documentation of having the separate enum. > > It's a valid choice. I'm just pointing out another valid choice. The > difference between them will go away when we remove deprecated > @connected. You choose :) > >>> I'd split this patch into three parts: item 1., 2.+3., 4.-6., because >>> each part can stand on its own. >> >> The reason why I didn't do that initially is more to do with the C side. >> I think splitting it up as you describe would make for some awkward diffs >> on the qmp_set_password/hmp_set_password side. >> >> I can try of course. > > It's a suggestion, not a demand. I'm a compulsory patch splitter. I'll just have a go and see what falls out. I do agree that this patch is a bit long on its own. > >> Though I also want to have it said that I'm not a fan >> of how the HMP functions have to expand so much to accommodate the QAPI >> structure in general. > > Care to elaborate? Well, before this patch 'hmp_set_password' was for all intents and purposes a single function call to 'qmp_set_password'. Now it has a bunch of parameter parsing and even validation (e.g. enum parsing). That's why I asked in the v3 patch (I think?) if there was a way to call the QAPI style parsing from there, since the parameters are all named the same and in a qdict already.. Something like: void hmp_set_password(Monitor *mon, const QDict *qdict) { ExpirePasswordOptions opts = qapi_magical_parse_fn(qdict); qmp_set_password(&opts,·&err); [error handling] } That being said, I don't mind the current form enough to make this a bigger discussion either, so if there isn't an easy way to do the above, let's just leave it like it is.