On Fri, Dec 11, 2020 at 12:19:10 +0800, Han Han wrote: > On Fri, Dec 11, 2020 at 4:01 AM Ryan Gahagan <rgaha...@cs.utexas.edu> wrote: > > > Signed-off-by: Ryan Gahagan <rgaha...@cs.utexas.edu> > > --- > > src/util/virstoragefile.c | 8 ++++++++ > > src/util/virstoragefile.h | 5 +++++ > > 2 files changed, 13 insertions(+) > > > > diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c > > index 5a57e5d12d..cff6dabd9e 100644 > > --- a/src/util/virstoragefile.c > > +++ b/src/util/virstoragefile.c > > @@ -2446,6 +2446,11 @@ virStorageSourceCopy(const virStorageSource *src, > > def->ssh_host_key_check_disabled = src->ssh_host_key_check_disabled; > > def->ssh_user = g_strdup(src->ssh_user); > > > > + def->nfs_user = g_strdup(src->nfs_user); > > + def->nfs_group = g_strdup(src->nfs_group); > > + def->nfs_uid = src->nfs_uid; > > + def->nfs_gid = src->nfs_gid; > > + > > return g_steal_pointer(&def); > > } > > > > @@ -2686,6 +2691,9 @@ virStorageSourceClear(virStorageSourcePtr def) > > > > VIR_FREE(def->ssh_user); > > > > + VIR_FREE(def->nfs_user); > > + VIR_FREE(def->nfs_group); > > + > > virStorageSourceInitiatorClear(&def->initiator); > > > > /* clear everything except the class header as the object APIs > > diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h > > index c5d5f0233a..64fc519f87 100644 > > --- a/src/util/virstoragefile.h > > +++ b/src/util/virstoragefile.h > > @@ -385,6 +385,11 @@ struct _virStorageSource { > > /* these must not be used apart from formatting the output JSON in > > the qemu driver */ > > char *ssh_user; > > bool ssh_host_key_check_disabled; > > + > > + char *nfs_user; > > + char *nfs_group; > > + uid_t nfs_uid; > > + gid_t nfs_gid; > > > Only one pair of (nfs_user,nfs_group) or (nfs_uid,nfs_gid) is enough to > identify the nfs connection. Please remove > a duplicated pair.
Not really. The second pair uit_t/gid_t is necessary for storing the looked up uid/gid values. The qemu NFS driver accepts just numerics and we must not try to look up uids/gids in the JSON prop generator.