[libvirt] [PATCH 4/5] conf: Refactor virDomainDiskDefParseXML to pass vmdef

Ján Tomko jtomko at redhat.com
Thu Jul 16 12:03:05 UTC 2015


On Mon, Jun 22, 2015 at 05:05:06PM -0400, John Ferlan wrote:
> Rather than passing the def->seclabels and def->nseclabels, refactor
> the API to pass the entire domain definition.  This will be used in a
> future patch as well.

I think it would be nicer to separate XML parsing (which would just
record what was in the XML) and auto-generating missing configuration
(like generating drive addresses or checking for conflicts).

Jan

> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/conf/domain_conf.c | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index e02cd49..6259d4a 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -6390,8 +6390,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
>                           xmlNodePtr node,
>                           xmlXPathContextPtr ctxt,
>                           virHashTablePtr bootHash,
> -                         virSecurityLabelDefPtr* vmSeclabels,
> -                         int nvmSeclabels,
> +                         const virDomainDef *vmdef,
>                           unsigned int flags)
>  {
>      virDomainDiskDefPtr def;
> @@ -6930,8 +6929,8 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
>          ctxt->node = sourceNode;
>          if (virSecurityDeviceLabelDefParseXML(&def->src->seclabels,
>                                                &def->src->nseclabels,
> -                                              vmSeclabels,
> -                                              nvmSeclabels,
> +                                              vmdef->seclabels,
> +                                              vmdef->nseclabels,
>                                                ctxt,
>                                                flags) < 0)
>              goto error;
> @@ -12256,9 +12255,7 @@ virDomainDeviceDefParse(const char *xmlStr,
>      switch ((virDomainDeviceType) dev->type) {
>      case VIR_DOMAIN_DEVICE_DISK:
>          if (!(dev->data.disk = virDomainDiskDefParseXML(xmlopt, node, ctxt,
> -                                                        NULL, def->seclabels,
> -                                                        def->nseclabels,
> -                                                        flags)))
> +                                                        NULL, def, flags)))
>              goto error;
>          break;
>      case VIR_DOMAIN_DEVICE_LEASE:
> @@ -12400,9 +12397,7 @@ virDomainDiskDefSourceParse(const char *xmlStr,
>  
>      flags |= VIR_DOMAIN_DEF_PARSE_DISK_SOURCE;
>      if (!(disk = virDomainDiskDefParseXML(xmlopt, node, ctxt,
> -                                          NULL, def->seclabels,
> -                                          def->nseclabels,
> -                                          flags)))
> +                                          NULL, def, flags)))
>          goto cleanup;
>  
>      ret = disk->src;
> @@ -15418,8 +15413,7 @@ virDomainDefParseXML(xmlDocPtr xml,
>                                                              nodes[i],
>                                                              ctxt,
>                                                              bootHash,
> -                                                            def->seclabels,
> -                                                            def->nseclabels,
> +                                                            def,
>                                                              flags);
>          if (!disk)
>              goto error;
> -- 
> 2.1.0
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150716/02c30e0d/attachment-0001.sig>


More information about the libvir-list mailing list