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

Re: [libvirt] [PATCH v2 libvirt 1/8] conf: add <model> child element to <filesystem>



On 2014/8/11 22:47, Giuseppe Scrivano wrote:

> @@ -6458,6 +6463,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
>      virDomainFSDefPtr def;
>      xmlNodePtr cur, save_node = ctxt->node;
>      char *type = NULL;
> +    char *model = NULL;
>      char *fsdriver = NULL;
>      char *source = NULL;
>      char *target = NULL;
> @@ -6535,6 +6541,9 @@ virDomainFSDefParseXML(xmlNodePtr node,
>                      wrpolicy = virXMLPropString(cur, "wrpolicy");
>                  if (!format)
>                      format = virXMLPropString(cur, "format");
> +            } else if (!model &&
> +                       xmlStrEqual(cur->name, BAD_CAST "model")) {
> +                model = virXMLPropString(cur, "type");
>              }
>          }
>          cur = cur->next;
> @@ -6556,6 +6565,14 @@ virDomainFSDefParseXML(xmlNodePtr node,
>          }
>      }
>  
> +    if (model) {
> +        if ((def->model = virDomainFSModelTypeFromString(model)) <= 0) {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                           _("unknown model value '%s'"), model);
> +            goto error;
> +        }
> +    }
> +
>      if (wrpolicy) {
>          if ((def->wrpolicy = virDomainFSWrpolicyTypeFromString(wrpolicy)) <= 0) {
>              virReportError(VIR_ERR_CONFIG_UNSUPPORTED,

The memory allocated by model should be freed in cleanup.



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