From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMvgm-0000Dt-An for qemu-devel@nongnu.org; Mon, 10 Mar 2014 04:36:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WMvge-0002FN-Rm for qemu-devel@nongnu.org; Mon, 10 Mar 2014 04:36:00 -0400 Received: from mx3-phx2.redhat.com ([209.132.183.24]:44242) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMvge-0002FA-2p for qemu-devel@nongnu.org; Mon, 10 Mar 2014 04:35:52 -0400 Date: Mon, 10 Mar 2014 04:35:49 -0400 (EDT) From: Miroslav Rezanina Message-ID: <4185154.1194203.1394440549303.JavaMail.zimbra@redhat.com> In-Reply-To: <90998dac0113b5e791189eb3240d60c13446c709.1391607703.git.mrezanin@redhat.com> References: <90998dac0113b5e791189eb3240d60c13446c709.1391607703.git.mrezanin@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v6] vl.c: Output error on invalid machine type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: afaerber@suse.de, Peter Maydell Hi, is there any issue with this patch? Mirek ----- Original Message ----- > From: mrezanin@redhat.com > To: qemu-devel@nongnu.org > Sent: Wednesday, February 5, 2014 2:44:23 PM > Subject: [Qemu-devel] [PATCH v6] vl.c: Output error on invalid machine type > > From: Miroslav Rezanina > > Output error message using qemu's error_report() function when user > provides the invalid machine type on the command line. This also saves > time to find what issue is when you downgrade from one version of qemu > to another that doesn't support required machine type yet (the version > user downgraded to have to have this patch applied too, of course). > > Signed-off-by: Miroslav Rezanina > --- > v6: > - print help instead of list supported machines on error > vl.c | 18 ++++++++++++------ > 1 file changed, 12 insertions(+), 6 deletions(-) > > diff --git a/vl.c b/vl.c > index 383be1b..3297c0a 100644 > --- a/vl.c > +++ b/vl.c > @@ -2600,13 +2600,19 @@ static QEMUMachine *machine_parse(const char *name) > if (machine) { > return machine; > } > - printf("Supported machines are:\n"); > - for (m = first_machine; m != NULL; m = m->next) { > - if (m->alias) { > - printf("%-20s %s (alias of %s)\n", m->alias, m->desc, m->name); > + > + if (name && !is_help_option(name)) { > + error_report("Unsupported machine type"); > + printf("\nUse '-M help' to list supported machines!\n"); > + } else { > + printf("Supported machines are:\n"); > + for (m = first_machine; m != NULL; m = m->next) { > + if (m->alias) { > + printf("%-20s %s (alias of %s)\n", m->alias, m->desc, > m->name); > + } > + printf("%-20s %s%s\n", m->name, m->desc, > + m->is_default ? " (default)" : ""); > } > - printf("%-20s %s%s\n", m->name, m->desc, > - m->is_default ? " (default)" : ""); > } > exit(!name || !is_help_option(name)); > } > -- > 1.8.5.3 > > > -- Miroslav Rezanina Software Engineer - Virtualization Team