Received: from eggs.gnu.org ([2001:4830:134:3::10]:42516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ya2RY-0002Xq-4I for qemu-devel@nongnu.org; Mon, 23 Mar 2015 09:31:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ya2RU-0000SE-SA for qemu-devel@nongnu.org; Mon, 23 Mar 2015 09:31:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49357) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ya2RU-0000SA-NF for qemu-devel@nongnu.org; Mon, 23 Mar 2015 09:30:56 -0400 Date: Mon, 23 Mar 2015 14:30:51 +0100 From: Igor Mammedov Message-ID: <20150323143051.4cab2004@nial.brq.redhat.com> In-Reply-To: <55101163.6050201@suse.de> References: <1427105442-23484-1-git-send-email-lma@suse.com> <551001E3.3010304@redhat.com> <55101163.6050201@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/2] object: Add can_be_deleted callback to TypeInfo and TypeImpl List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?UTF-8?B?RsOkcmJlcg==?= Cc: Paolo Bonzini , Peter Crosthwaite , Bruce Rogers , "qemu-devel@nongnu.org Developers" , Lin Ma On Mon, 23 Mar 2015 14:13:07 +0100 Andreas F=C3=A4rber wrote: > Hi, >=20 > For consistency in git-log, please use "qom:" rather than "object:". >=20 > Am 23.03.2015 um 13:06 schrieb Paolo Bonzini: > > On 23/03/2015 11:36, Peter Crosthwaite wrote: > >> I don't think TypeInfo is the right place for this. You can however > >> define function hooks for Object in ObjectClass. See the unparent > >> field of ObjectClass for a precedent. >=20 > Agree. >=20 > > In this case, the right place could be UserCreatable. >=20 > Maybe, not so familiar with that interface myself. Does object_del allow > to delete non-UserCreatable objects? Then it wouldn't help much. object_del() works only with /objects children, and so far the only way that child placed there is via object_add() which requires a new object to have TYPE_USER_CREATABLE interface. I'd go this way rather than overhaul object_unparent() in this case. >=20 > > Alternatively... > >=20 > >> But is a better way to do this to add error handling to > >> object_unparent API and override object_unparent for your device in > >> question to throw the error? Then your change doesn't have to be > >> limited to QMP. > >=20 > > ... this is also a good choice. >=20 > Well, I have doubts about asking someone who's not ultimately familiar > with that code to refactor the API. For instance, we wouldn't want QEMU > on shutdown or in error cases refusing to unparent some object. >=20 > Doing it at QMP level (ObjectClass/UserCreatable) seems safer, given > that Chun Yan's trivial block option fix ended up respinning a QemuOpts > refactoring some twenty times before it got merged. >=20 > Regards, > Andreas >=20