qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 6/6] iscsi: Move iqn generation code to util


From: Fam Zheng
Subject: Re: [Qemu-devel] [PATCH 6/6] iscsi: Move iqn generation code to util
Date: Wed, 20 Aug 2014 23:03:12 +0800
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, 08/20 15:32, Paolo Bonzini wrote:
> Il 20/08/2014 12:01, Fam Zheng ha scritto:
> > diff --git a/util/iqn.c b/util/iqn.c
> > new file mode 100644
> > index 0000000..c8d1eda
> > --- /dev/null
> > +++ b/util/iqn.c
> > @@ -0,0 +1,38 @@
> > +/*
> > + * iqn generat function
> > + *
> > + * Copyright Red Hat, Inc., 2014
> > + *
> > + * Author: Paolo Bonzini <address@hidden>
> 
> Why me? :)

For the copied uuid part :)

> 
> > + *         Fam Zheng <address@hidden>
> > + *
> > + * This work is licensed under the terms of the GNU GPL, version 2 or
> > + * later.  See the COPYING file in the top-level directory.
> > + */
> > +
> > +#include <glib.h>
> > +#include "qemu/error-report.h"
> > +#include "qemu-common.h"
> > +#include "sysemu/sysemu.h"
> > +#include "qmp-commands.h"
> > +
> > +char *iqn_generate(const char *prefix)
> > +{
> > +    const char *name;
> > +    char *iqn;
> > +    UuidInfo *uuid_info;
> > +
> > +    uuid_info = qmp_query_uuid(NULL);
> > +    if (strcmp(uuid_info->UUID, UUID_NONE) == 0) {
> > +        name = qemu_get_vm_name();
> > +    } else {
> > +        name = uuid_info->UUID;
> > +    }
> > +    iqn = g_strdup_printf("%s%s%s",
> > +                                 prefix,
> > +                                 name ? ":" : "",
> > +                                 name ? : "");
> > +    qapi_free_UuidInfo(uuid_info);
> > +
> > +    return iqn;
> > +}
> > 
> 
> Ouch, this is ugly... I cannot think of any other way to do it, but
> perhaps Benoit's QMP-in-tools series could help here?

I'll have a look to see if it helps.

> 
> In any case, if we need it I think there's no need to keep the argument
> to iqn_generate.

Fam




reply via email to

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