From mboxrd@z Thu Jan 1 00:00:00 1970 From: Luiz Capitulino Subject: Re: [Qemu-devel] qemu aborts if i add a already registered device from qemu monitor .. Date: Tue, 19 Oct 2010 10:11:44 -0200 Message-ID: <20101019101144.47362c8c@doriath> References: <20101019152737.234e2e51@skywalker> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: kvm-devel , qemu-devel@nongnu.org, Avi Kivity To: pradeep Return-path: Received: from mx1.redhat.com ([209.132.183.28]:13443 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758322Ab0JSMMF (ORCPT ); Tue, 19 Oct 2010 08:12:05 -0400 In-Reply-To: <20101019152737.234e2e51@skywalker> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, 19 Oct 2010 15:27:37 +0530 pradeep wrote: > Hi > > I tried to add a device to guest from upstream qemu monitor using > "device_add". Are you developing a new device or does it happen with existing ones? If it's the latter, can you describe steps to reproduce it? > Unknowingly i try to add already registered devices from qemu > monitor, my qemu monitor is aborted. I don't see a reason to kill > monitor. I think abort() is a bit rough. we need a better way to handle > it. If a user try to add a already registered device, qemu should > convey this to user saying that, this device already registered and an > error message should be fine than aborting qemu. > > > QLIST_FOREACH(block, &ram_list.blocks, next) { > if (!strcmp(block->idstr, new_block->idstr)) { > fprintf(stderr, "RAMBlock \"%s\" already registered, > abort!\n", > new_block->idstr); > abort(); > } > > > If i return some other value in above code, instead of abort(), I > would need change the code for every device, which i dont want to. > Is there a way to check, if device is already enrolled or not in the very beginning of "device_add" > call. > > > > Thanks > Pradeep >