]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: Add fields for VIR_STORAGE_NET_PROTOCOL_NFS to virStorageSource
authorRyan Gahagan <rgahagan@cs.utexas.edu>
Wed, 6 Jan 2021 21:32:27 +0000 (15:32 -0600)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 8 Jan 2021 14:03:52 +0000 (15:03 +0100)
'nfs_user'/'nfs_group' represents the XML configuration.

'nfs_uid'/'nfs_gid' is internal store when libvirt looks up the user's
uid/gid in the system.

Signed-off-by: Ryan Gahagan <rgahagan@cs.utexas.edu>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/util/virstoragefile.c
src/util/virstoragefile.h

index 117663028278a4af4758ed7d7ba6dc94118504aa..3097e11984722c4fd479b19485d3a9a6e8c3e16d 100644 (file)
@@ -2293,6 +2293,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);
 }
 
@@ -2533,6 +2538,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
index e1fbbafe266dfe9a4cf1cc0401228e66c366ea4a..47d901a478bf1ae55f4f8352bc3ca14d4709ec35 100644 (file)
@@ -385,6 +385,14 @@ 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;
+
+    /* nfs_user and nfs_group store the strings passed in by the user for NFS params.
+     * nfs_uid and nfs_gid represent the converted/looked up ID numbers which are used
+     * during run time, and are not based on the configuration */
+    char *nfs_user;
+    char *nfs_group;
+    uid_t nfs_uid;
+    gid_t nfs_gid;
 };
 
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virStorageSource, virObjectUnref);