From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49691) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGzkE-0004iN-5S for qemu-devel@nongnu.org; Thu, 29 Jan 2015 19:47:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGzk9-0000wI-9x for qemu-devel@nongnu.org; Thu, 29 Jan 2015 19:47:34 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:1523) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGzk8-0000t2-P9 for qemu-devel@nongnu.org; Thu, 29 Jan 2015 19:47:29 -0500 Message-ID: <54CAD48A.5020709@huawei.com> Date: Fri, 30 Jan 2015 08:47:06 +0800 From: Gonglei MIME-Version: 1.0 References: <1422538193-13648-1-git-send-email-arei.gonglei@huawei.com> <1422538193-13648-3-git-send-email-arei.gonglei@huawei.com> <54CA59EB.5040005@suse.de> In-Reply-To: <54CA59EB.5040005@suse.de> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/2] bootdevice: add check in restore_boot_order() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: "armbru@redhat.com" , "dvaleev@suse.de" , "qemu-devel@nongnu.org" , "Huangpeng (Peter)" On 2015/1/30 0:03, Alexander Graf wrote: > > > On 29.01.15 14:29, arei.gonglei@huawei.com wrote: >> From: Gonglei >> >> If boot order is invaild or is set failed, >> exit qemu. >> >> Signed-off-by: Gonglei > > Do we really want to kill the machine only because the boot device > string doesn't validate? > Not all of the situation. If people want to change boot order by qmp/hmp command, it just report an error, please see do_boot_set(). But if the boot order is set in qemu command line, it will exit qemu if the boot device string is invalidate, as this patch's situation, which follow the original processing way (commit ef3adf68). Regards, -Gonglei > > Alex > >> --- >> bootdevice.c | 8 +++++++- >> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/bootdevice.c b/bootdevice.c >> index 52d3f9e..8d05b8d 100644 >> --- a/bootdevice.c >> +++ b/bootdevice.c >> @@ -94,6 +94,7 @@ void restore_boot_order(void *opaque) >> { >> char *normal_boot_order = opaque; >> static int first = 1; >> + Error *local_err = NULL; >> >> /* Restore boot order and remove ourselves after the first boot */ >> if (first) { >> @@ -101,7 +102,12 @@ void restore_boot_order(void *opaque) >> return; >> } >> >> - qemu_boot_set(normal_boot_order, NULL); >> + qemu_boot_set(normal_boot_order, &local_err); >> + if (local_err) { >> + error_report("%s", error_get_pretty(local_err)); >> + error_free(local_err); >> + exit(1); >> + } >> >> qemu_unregister_reset(restore_boot_order, normal_boot_order); >> g_free(normal_boot_order); >>