Received: from eggs.gnu.org ([2001:4830:134:3::10]:43460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdiCW-0007kB-0s for qemu-devel@nongnu.org; Tue, 05 Nov 2013 10:05:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VdiCQ-0007iv-1Z for qemu-devel@nongnu.org; Tue, 05 Nov 2013 10:05:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:62130) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdiCP-0007ia-Ep for qemu-devel@nongnu.org; Tue, 05 Nov 2013 10:05:45 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rA5F5h3H017337 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 5 Nov 2013 10:05:44 -0500 Date: Tue, 5 Nov 2013 23:05:24 +0800 From: Amos Kong Message-ID: <20131105150524.GA14114@amosk.info> References: <1383610089-12168-1-git-send-email-akong@redhat.com> <5278B44E.9000102@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5278B44E.9000102@redhat.com> Subject: Re: [Qemu-devel] [PATCH] iscsi: add error handling for qmp_query_uuid List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, lersek@redhat.com, qemu-devel@nongnu.org On Tue, Nov 05, 2013 at 10:03:10AM +0100, Paolo Bonzini wrote: > Il 05/11/2013 01:08, Amos Kong ha scritto: > > We can't assume that qmp_query_uuid() always returns available value. > > > > Signed-off-by: Amos Kong > > --- > > block/iscsi.c | 7 +++++-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/block/iscsi.c b/block/iscsi.c > > index a2a961e..1fc1da4 100644 > > --- a/block/iscsi.c > > +++ b/block/iscsi.c > > @@ -1059,6 +1059,7 @@ static char *parse_initiator_name(const char *target) > > const char *name; > > char *iscsi_name; > > UuidInfo *uuid_info; > > + Error *errp = NULL; > > > > list = qemu_find_opts("iscsi"); > > if (list) { > > @@ -1074,8 +1075,10 @@ static char *parse_initiator_name(const char *target) > > } > > } > > > > - uuid_info = qmp_query_uuid(NULL); > > - if (strcmp(uuid_info->UUID, UUID_NONE) == 0) { > > + uuid_info = qmp_query_uuid(&errp); > > + if (error_is_set(&errp)) { > > + name = qemu_get_vm_name(); > > + } else if (strcmp(uuid_info->UUID, UUID_NONE) == 0) { > > name = qemu_get_vm_name(); > > } else { > > name = uuid_info->UUID; > > > > Does this fix an actual bug? No a bug fixing. > qmp_query_uuid will never fail, it just > has an Error* argument to comply with the requirements of the code > generator. Yes, this patch isn't necessary for current qmp_query_uuid() We can ignore this patch. > Paolo -- Amos.