[libvirt] [libvirt PATCH v7 5/6] xen_common: Change xenParseVfbs to using virConfGetValueStringList

John Ferlan jferlan at redhat.com
Thu Sep 20 20:19:29 UTC 2018



On 09/20/2018 09:28 AM, Fabiano Fidêncio wrote:
> Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
> ---
>  src/xenconfig/xen_common.c | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
> index 9133998cd7..058f35825e 100644
> --- a/src/xenconfig/xen_common.c
> +++ b/src/xenconfig/xen_common.c
> @@ -618,7 +618,6 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def)
>      int val;
>      char *listenAddr = NULL;
>      int hvm = def->os.type == VIR_DOMAIN_OSTYPE_HVM;
> -    virConfValuePtr list;
>      virDomainGraphicsDefPtr graphics = NULL;
>  
>      if (hvm) {
> @@ -674,17 +673,17 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def)
>      }
>  
>      if (!hvm && def->graphics == NULL) { /* New PV guests use this format */
> -        list = virConfGetValue(conf, "vfb");
> -        if (list && list->type == VIR_CONF_LIST &&
> -            list->list && list->list->type == VIR_CONF_STRING &&
> -            list->list->str) {
> +        VIR_AUTOPTR(virString) vfbs = NULL;
> +        int rc;
> +
> +        if ((rc = virConfGetValueStringList(conf, "vfb", false, &vfbs)) == 1) {
>              char vfb[MAX_VFB];
>              char *key = vfb;
>  
> -            if (virStrcpyStatic(vfb, list->list->str) < 0) {
> +            if (virStrcpyStatic(vfb, *vfbs) < 0) {
>                  virReportError(VIR_ERR_INTERNAL_ERROR,
>                                 _("VFB %s too big for destination"),
> -                               list->list->str);
> +                               *vfbs);
>                  goto cleanup;
>              }
>  
> @@ -754,6 +753,11 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def)
>              def->graphics[0] = graphics;
>              def->ngraphics = 1;
>              graphics = NULL;
> +        } else {
> +            rc = xenHandleConfGetValueStringListErrors(rc,
> +                                                       virGetLastErrorCode());
> +            if (rc < 0)

Based on patch4 change, this is simplified to just:

            if (xenHandleConfGetValueStringListErrors(rc) < 0)

I can alter before pushing if you're fine with that.

Reviewed-by: John Ferlan <jferlan at redhat.com>

John

> +                goto cleanup;
>          }
>      }
>  
> 




More information about the libvir-list mailing list