qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] iscsi: add error handling for qmp_query_uuid


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] iscsi: add error handling for qmp_query_uuid
Date: Tue, 05 Nov 2013 10:03:10 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9

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 <address@hidden>
> ---
>  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?  qmp_query_uuid will never fail, it just
has an Error* argument to comply with the requirements of the code
generator.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]