[libvirt] [PATCH] conf: fix cannot get mutli value settings when parse controllers XML

Peter Krempa pkrempa at redhat.com
Wed Jan 7 09:54:56 UTC 2015


On 01/07/15 10:36, Luyao Huang wrote:
> We will free the old parameter value settings in next loop when we
> get scsi controller's driver specific options.

This description doesn't really explain what is the actual problem you
are fixing.

Please be more specific and as this is in the XML parsing code it should
be fairly easy to do a test case for the scenario.


> 
> Signed-off-by: Luyao Huang <lhuang at redhat.com>
> ---
>  src/conf/domain_conf.c | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index b9858cd..f7b4a7c 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -6870,11 +6870,21 @@ virDomainControllerDefParseXML(xmlNodePtr node,
>  
>      cur = node->children;
>      while (cur != NULL) {
> +        char *queues2 = NULL;
> +        char *cmd_per_lun2 = NULL;
> +        char *max_sectors2 = NULL;
> +
>          if (cur->type == XML_ELEMENT_NODE) {
>              if (xmlStrEqual(cur->name, BAD_CAST "driver")) {
> -                queues = virXMLPropString(cur, "queues");
> -                cmd_per_lun = virXMLPropString(cur, "cmd_per_lun");
> -                max_sectors = virXMLPropString(cur, "max_sectors");
> +                queues2 = virXMLPropString(cur, "queues");
> +                if (queues2)
> +                    queues = queues2;
> +                cmd_per_lun2 = virXMLPropString(cur, "cmd_per_lun");
> +                if (cmd_per_lun2)
> +                    cmd_per_lun = cmd_per_lun2;
> +                max_sectors2 = virXMLPropString(cur, "max_sectors");
> +                if (max_sectors2)
> +                    max_sectors = max_sectors2;
>              }
>          }
>          cur = cur->next;
> 

Without a proper explanation it's hard to see if the fix is right.

Peter


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150107/76627332/attachment-0001.sig>


More information about the libvir-list mailing list