From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAJ1d-0001Yw-4o for qemu-devel@nongnu.org; Thu, 24 Jul 2014 09:25:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XAJ1V-0000ep-IF for qemu-devel@nongnu.org; Thu, 24 Jul 2014 09:25:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21565) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAJ1V-0000ei-8h for qemu-devel@nongnu.org; Thu, 24 Jul 2014 09:25:29 -0400 Message-ID: <1406208304.13444.16.camel@nilsson.home.kraxel.org> From: Gerd Hoffmann Date: Thu, 24 Jul 2014 15:25:04 +0200 In-Reply-To: <33183CC9F5247A488A2544077AF1902086C1CE14@SZXEMA503-MBS.china.huawei.com> References: <1406191142-16556-1-git-send-email-arei.gonglei@huawei.com> <1406191142-16556-2-git-send-email-arei.gonglei@huawei.com> <1406196531.13444.9.camel@nilsson.home.kraxel.org> <33183CC9F5247A488A2544077AF1902086C1CE14@SZXEMA503-MBS.china.huawei.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/6] bootindex: add {del, modify}_boot_device_path function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Gonglei (Arei)" Cc: "peter.maydell@linaro.org" , "Huangweidong (C)" , "mst@redhat.com" , "aik@ozlabs.ru" , "qemu-devel@nongnu.org" , "agraf@suse.de" , "dmitry@daynix.com" , "akong@redhat.com" , "armbru@redhat.com" , "lersek@redhat.com" , "marcel.a@redhat.com" , "somlo@cmu.edu" , Luonengjun , "Huangpeng (Peter)" , "alex.williamson@redhat.com" , "stefanha@redhat.com" , "pbonzini@redhat.com" , "lcapitulino@redhat.com" , "rth@twiddle.net" , "kwolf@redhat.com" , "peter.crosthwaite@xilinx.com" , "chenliang (T)" , "imammedo@redhat.com" , "afaerber@suse.de" Hi, > > Hmm. I think we should simply lookup the device and modify the > > bootindex, leaving the entry as-is otherwise. In case the new bootindex > > is already used by another device just throw an error. > > > If we just throw an error but not change the bootindex is already used, > we cannot achieve our purpose. For example, we configure a hard disk, > which bootindex=1, a nic which bootindex=2. If we want to boot the guest > from nic firstly, we should must set the nic's bootindex to 1. AFAICT, the > bootindex=1 always be used. No. The devices are simply sorted by bootindex. You don't have to use '1'. And you can have holes in your numbering and use --for example -- 3+5. So you can start qemu with hd=2,cdrom=3,nic=4, then set nic=1 or cdrom=1 for a guest install, change it back when done. > > Should be del_boot_device_path(DeviceState *dev) and simply delete all > > entries belonging to the device. Patch #3 can be much simpler then as > > we can call the function from generic device cleanup code. > > > Because the IDE device may configure two kind of disk, HD and CDROM, we > have to distinguish them by suffix. Yes, the suffix indicated whenever the device is a disk or cdrom. But you'll never have both cdrom+disk paths attached to a single device. Therefore the device is enough to identify the bootpath entry, you don't need the suffix for that. cheers, Gerd