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

Re: [libvirt] [PATCH v2 2/6] nfs: Add infrastructure to manage XML namespace options



On 1/8/19 6:52 PM, John Ferlan wrote:
> Introduce the virStoragePoolNetFSMountOptionsDef to be used to
> manage the NFS Storage Pool XML Namespace for mount options.
> 
> Using a new virStorageBackendNamespaceInit function, set the
> virStoragePoolXMLNamespace into the _virStoragePoolOptions when
> the storage backend is loaded.
> 
> Signed-off-by: John Ferlan <jferlan redhat com>
> ---
>  src/storage/storage_backend_fs.c | 127 +++++++++++++++++++++++++++++++
>  src/storage/storage_util.c       |  16 ++++
>  src/storage/storage_util.h       |  14 ++++
>  3 files changed, 157 insertions(+)
> 
> diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
> index dc9869417e..4b8878f450 100644
> --- a/src/storage/storage_backend_fs.c
> +++ b/src/storage/storage_backend_fs.c
> @@ -41,6 +41,7 @@ VIR_LOG_INIT("storage.storage_backend_fs");
>  
>  #if WITH_STORAGE_FS
>  
> +# include <libxml/xpathInternals.h>
>  # include <mntent.h>
>  
>  struct _virNetfsDiscoverState {
> @@ -559,6 +560,121 @@ virStorageBackendFileSystemBuild(virStoragePoolObjPtr pool,
>  }
>  
>  
> +#if WITH_STORAGE_FS
> +
> +# define STORAGE_POOL_NETFS_NAMESPACE_HREF "http://libvirt.org/schemas/storagepool/source/netfs/1.0";
> +
> +/* NetFS backend XML Namespace handling for nfs specific mount options to
> + * be added to the mount -o {options_list} command line. The XML will use
> + * the format, such as:
> + *
> + *     <netfs:mount_opts>
> + *       <netfs:option name='nodev'/>
> + *       <netfs:option name='nosuid'/>
> + *     </netfs:mount_opts>
> + *
> + * and the <pool type='netfs'> is required to have a "xmlns:netfs='%s'"
> + * attribute using the STORAGE_POOL_NETFS_NAMESPACE_HREF
> + */
> +
> +static void
> +virStoragePoolDefNetFSNamespaceFree(void *nsdata)
> +{
> +    virStoragePoolNetFSMountOptionsDefPtr cmdopts = nsdata;
> +    size_t i;
> +
> +    if (!cmdopts)
> +        return;
> +
> +    for (i = 0; i < cmdopts->noptions; i++)
> +        VIR_FREE(cmdopts->options[i]);
> +
> +    VIR_FREE(cmdopts);

This is missing VIR_FREE(cmdopts->options);

> +}
> +

Michal


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