From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56568) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGa7x-00079L-Ar for qemu-devel@nongnu.org; Wed, 28 Jan 2015 16:26:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGa7r-0005h9-4w for qemu-devel@nongnu.org; Wed, 28 Jan 2015 16:26:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60643) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGa7q-0005gd-U0 for qemu-devel@nongnu.org; Wed, 28 Jan 2015 16:26:15 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0SLQEao031965 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 28 Jan 2015 16:26:14 -0500 Message-ID: <54C953F4.5010500@redhat.com> Date: Wed, 28 Jan 2015 16:26:12 -0500 From: Max Reitz MIME-Version: 1.0 References: <1422387983-32153-1-git-send-email-mreitz@redhat.com> <1422387983-32153-49-git-send-email-mreitz@redhat.com> <54C95325.8080501@redhat.com> In-Reply-To: <54C95325.8080501@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH RESEND 48/50] hmp: Add read-only option to change command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , qemu-devel@nongnu.org Cc: Kevin Wolf , Fam Zheng , Jeff Cody , Markus Armbruster , Stefan Hajnoczi , John Snow On 2015-01-28 at 16:22, Eric Blake wrote: > On 01/27/2015 12:46 PM, Max Reitz wrote: >> Expose the new read-only option of 'blockdev-change-medium' for the >> 'change' HMP command. >> >> Signed-off-by: Max Reitz >> Reviewed-by: Eric Blake >> --- >> hmp-commands.hx | 20 +++++++++++++++++--- >> hmp.c | 21 ++++++++++++++++++++- >> 2 files changed, 37 insertions(+), 4 deletions(-) >> > Already reviewed... > >> >> +@var{read-only} may be used to change the read-only status of the device. It >> +accepts the following values: >> + >> +@table @var >> +@item retain >> +Retains the current status; this is the default. >> + >> +@item ro >> +Makes the device read-only. >> + >> +@item rw >> +Makes the device writable. > Hmm. I suggested in 47/50 to rename the QMP enum values to something > longer, which would affect this on a rebase. On the other hand, it > would be nice to make the HMP counterpart support BOTH spellings for > convenience ('read-write' for legibility, 'rw' for brevity in typing); > and I have no clue if tab completion starts to play a role either. Up > to you if you want to add complexity or leave things simple and stupid > (the choices we make in HMP for user-friendliness have no bearing on > what libvirt will want to do, so I really have no strong preference). > > ...so my review still stands if nothing changes, and is probably worth > dropping if you respin to add user-friendly complexity. I probably won't care for brevity too much. Again, if we want to allow shortcuts later on, it won't break compatibility so we don't really need to worry about it now (although I guess if we don't add it now, we won't add it ever). >> const char *arg = qdict_get_try_str(qdict, "arg"); >> + const char *read_only = qdict_get_try_str(qdict, "read-only"); >> + BlockdevChangeReadOnlyMode read_only_mode = 0; >> Error *err = NULL; >> >> if (strcmp(device, "vnc") == 0) { >> + if (read_only) { >> + monitor_printf(mon, "Parameter 'read-only' is invalid for VNC"); > Hmm. In HMP, you don't type the parameter name (it is implicit based on > the rules for converting positional HMP arguments into dictionary > entries for use in the rest of the code). In particular, that means > that if I type 'change vnc password rw', that means that 'rw' will be in > the "read-only" parameter position, even though it has nothing to do > with read-only. [hmm - how did 'change vnc password XXX' work anyways, > since the .params for 'change' didn't allow a third argument before your > patch?] Well, "help change" will tell you that that parameter is named "read-only", so I think mentioning the parameter name (instead of "garbage at the end of line" or something like that) is fine. Max > At any rate, the idea I mentioned in the QMP patch about naming the > parameter 'read-mode' instead of 'read-only' might make for nicer error > messages.