+1

Looks good, Tests passed.
Except for this message - msg = "Failed to create graphics is string";
But I don't think we should redo the patch just to fix this message.

Regards,
Sharad Mishra
Open Virtualization
Linux Technology Center
IBM

libvirt-cim-bounces@redhat.com wrote on 05/18/2011 01:33:29 PM:

> Chip Vincent <cvincent@linux.vnet.ibm.com>

> Sent by: libvirt-cim-bounces@redhat.com
>

> 05/18/2011 01:33 PM
>
> Please respond to
> List for discussion and development of libvirt CIM <libvirt-cim@redhat.com>

>
> To

>
> libvirt-cim@redhat.com

>
> cc

>
> Subject

>
> [Libvirt-cim] [PATCH] Fix for VirtualSystemManagementService/
> 13_refconfig_additional_devs.py

>
> # HG changeset patch
> # User Chip Vincent <cvincent@us.ibm.com>
> # Date 1305746372 14400
> # Node ID 7432d45a1fae6ef499f53a36e24b66df29bcf7f9
> # Parent  90f8c9f2388e0563baa311c84024ca41a61e1890
> Fix for VirtualSystemManagementService/13_refconfig_additional_devs.py
>
> The cimtest case was failing because libvirt-cim improperly
> processed graphics devices present in the ReferenceClass parameter
> in DefineSystem. Rather than overrdiing them, it was appending them.
> With this patch, the test case now passes and the debug log shows
> the following correct messages.
>
> Virt_VirtualSystemManagementService.c(1184): graphics = vnc
> Virt_VirtualSystemManagementService.c(1326): Overriding device vnc
> from refconf
>
> Signed-off-by: Chip Vincent <cvincent@us.ibm.com>
>
> diff --git a/src/Virt_VirtualSystemManagementService.c b/src/
> Virt_VirtualSystemManagementService.c
> --- a/src/Virt_VirtualSystemManagementService.c
> +++ b/src/Virt_VirtualSystemManagementService.c
> @@ -1162,17 +1162,26 @@
>                           msg = "GraphicsRASD field Address not valid";
>                           goto out;
>                  }
> -       } else {
> +        } else {
>                  CU_DEBUG("Unsupported graphics type %s",
>                          dev->dev.graphics.type);
>                  msg = "Unsupported graphics type";
>                  goto out;
> -       }
> -
> -        CU_DEBUG("graphics = %s:%s:%s",
> -                dev->dev.graphics.type,
> -                dev->dev.graphics.host,
> -                dev->dev.graphics.port);
> +        }
> +
> +        free(dev->id);
> +        if (STREQC(dev->dev.graphics.type, "vnc"))
> +                ret = asprintf(&dev->id, "%s", dev->dev.graphics.type);
> +        else
> +                ret = asprintf(&dev->id, "%s:%s",
> +                               dev->dev.graphics.type,
> dev->dev.graphics.port);
> +
> +        if (ret == -1) {
> +                msg = "Failed to create graphics is string";
> +                goto out;
> +        }
> +
> +        CU_DEBUG("graphics = %s", dev->id);
>  
>   out:
>          return msg;
> @@ -1313,9 +1322,6 @@
>                                 "DiskResourceAllocationSettingData
> in a single "
>                                 "guest";
>  
> -                if (dev->type == CIM_RES_TYPE_GRAPHICS)
> -                        continue;
> -
>                  if (STREQC(ptr->id, dev->id)) {
>                          CU_DEBUG("Overriding device %s from
> refconf", ptr->id);
>                          cleanup_virt_device(ptr);
> @@ -1425,7 +1431,7 @@
>                                                         &domain->dev_net_ct);
>                  } else if (type == CIM_RES_TYPE_GRAPHICS) {
>                          struct virt_device dev;
> -                        int ncount = count + domain->dev_graphics_ct;
> +                        int gcount = count + domain->dev_graphics_ct;
>  
>                          memset(&dev, 0, sizeof(dev));
>                          msg = rasd_to_vdev(inst,
> @@ -1435,7 +1441,7 @@
>                          if (msg == NULL)
>                                  msg = add_device_nodup(&dev,
>                                                  domain->dev_graphics,
> -                                                ncount,
> +                                                gcount,
>                                                  &domain->dev_graphics_ct);
>                  } else if (type == CIM_RES_TYPE_INPUT) {
>                          domain->dev_input_ct = 1;
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim@redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim