From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIa9E-0007Yq-1W for qemu-devel@nongnu.org; Wed, 26 Feb 2014 03:47:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WIa99-0002VN-MK for qemu-devel@nongnu.org; Wed, 26 Feb 2014 03:47:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47889) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIa99-0002Sx-EJ for qemu-devel@nongnu.org; Wed, 26 Feb 2014 03:47:19 -0500 Date: Wed, 26 Feb 2014 09:47:08 +0100 From: Igor Mammedov Message-ID: <20140226094708.76bfef50@nial.usersys.redhat.com> In-Reply-To: <20140226050003.GC28873@G08FNSTD100614.fnst.cn.fujitsu.com> References: <53047351.80300@redhat.com> <20140219103657.4daed264@nial.usersys.redhat.com> <20140225102059.GA20627@G08FNSTD100614.fnst.cn.fujitsu.com> <530CA599.6090109@redhat.com> <20140226050003.GC28873@G08FNSTD100614.fnst.cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao Cc: Paolo Bonzini , lersek@redhat.com, qemu-devel@nongnu.org, Wanlong Gao On Wed, 26 Feb 2014 13:00:03 +0800 Hu Tao wrote: > On Tue, Feb 25, 2014 at 03:15:53PM +0100, Paolo Bonzini wrote: > > Il 25/02/2014 11:20, Hu Tao ha scritto: > > >There is a problem that user_creatable_complete() is called before > > >adding object to "/objects" (see object_create()), which triggers a > > >assert failure when calling object_get_canonical_path() in > > >ram_backend_memory_init(). Any ideas? > > > > You can call object_property_add_child before calling > > user_creatable_complete, and then call object_unparent (in addition > > to object_unref) if creation fails. > > > > Paolo > > Something like this? > > From 59c999c840e4305bb2b95389bbea32e07c1c14c0 Mon Sep 17 00:00:00 2001 > From: Hu Tao > Date: Wed, 26 Feb 2014 12:54:34 +0800 > Subject: [PATCH] call user_creatable_complete() after adding object to > "/objects" > > This makes it possible to get the path of object by calling > object_get_canonical_path() in the complete callback if > someone wants it. > > Signed-off-by: Hu Tao > --- > vl.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/vl.c b/vl.c > index 1d27b34..30b4297 100644 > --- a/vl.c > +++ b/vl.c > @@ -2770,14 +2770,15 @@ static int object_create(QemuOpts *opts, void *opaque) > goto out; > } > > + object_property_add_child(container_get(object_get_root(), "/objects"), > + id, obj, &local_err); > + > user_creatable_complete(obj, &local_err); > if (local_err) { > + object_unparent(obj); > goto out; > } > > - object_property_add_child(container_get(object_get_root(), "/objects"), > - id, obj, &local_err); > - > out: > object_unref(obj); > if (local_err) { Failure case is not handled properly, I'm sorry that I've forgotten to mention prerequisite path https://github.com/imammedo/qemu/commit/72a079b88e055fc690c8895a99ccbcce36f6fc1f in stage tree https://github.com/imammedo/qemu/commits/memory-hotplug-v8