[PATCH 4/7] conf: Added NFS XML format/parse methods
Peter Krempa
pkrempa at redhat.com
Mon Jan 4 14:27:50 UTC 2021
On Tue, Dec 29, 2020 at 15:21:26 -0600, Ryan Gahagan wrote:
> Signed-off-by: Ryan Gahagan <rgahagan at cs.utexas.edu>
> ---
> src/conf/domain_conf.c | 33 +++++++++++++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index b301ac0a08..565ca680c9 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
This patch can be merged into the previous one if you want.
> @@ -23805,6 +23825,19 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf,
> virBufferAddLit(childBuf, "/>\n");
> }
>
> + if (src->protocol == VIR_STORAGE_NET_PROTOCOL_NFS &&
> + (src->nfs_user || src->nfs_group)) {
> + virBufferAddLit(childBuf, "<nfs");
> +
> + if (src->nfs_user)
virBufferEscapeString has a special corner-case that it doesn't format
anything if the third argument is NULL, so the explicit check is not
necessary.
> + virBufferEscapeString(childBuf, " user='%s'", src->nfs_user);
> + if (src->nfs_group)
> + virBufferEscapeString(childBuf, " group='%s'", src->nfs_group);
> +
> + virBufferAddLit(childBuf, "/>\n");
> + }
With the code simplified:
Reviewed-by: Peter Krempa <pkrempa at redhat.com>
More information about the libvir-list
mailing list