On Thu, Jan 17, 2019 at 04:22:15PM -0500, John Ferlan wrote: > If the NetFS Storage Pool Namespace XML data exists, format the > mount options on the MOUNT command line. > > When the pool is started, the options will be generated on the > command line along with the options already defined. > > To view the options of the running pool, use either 'nfsstat -m' > or 'grep $POOLNAME /proc/mounts' for the added Flags/options. > > Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> > --- > src/storage/storage_util.c | 10 +++++++++- > .../pool-netfs-ns-mountopts-freebsd.argv | 2 ++ > .../pool-netfs-ns-mountopts-linux.argv | 2 ++ > .../pool-netfs-ns-mountopts.argv | 1 + > tests/storagepoolxml2argvtest.c | 6 ++++++ > 5 files changed, 20 insertions(+), 1 deletion(-) > create mode 100644 tests/storagepoolxml2argvdata/pool-netfs-ns-mountopts-freebsd.argv > create mode 100644 tests/storagepoolxml2argvdata/pool-netfs-ns-mountopts-linux.argv > create mode 100644 tests/storagepoolxml2argvdata/pool-netfs-ns-mountopts.argv > > diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c > index 2e753f4501..1fdaf54059 100644 > --- a/src/storage/storage_util.c > +++ b/src/storage/storage_util.c > @@ -4293,7 +4293,15 @@ virStorageBackendFileSystemMountNFSAddOptions(virCommandPtr cmd, > virBufferAsprintf(&buf, "nfsvers=%u,", def->source.protocolVer); > > if (*default_nfs_mount_opts != '\0') > - virBufferAddLit(&buf, default_nfs_mount_opts); > + virBufferAsprintf(&buf, "%s,", default_nfs_mount_opts); > + > + if (def->namespaceData) { > + size_t i; > + virStoragePoolNetFSMountOptionsDefPtr opts = def->namespaceData; > + > + for (i = 0; i < opts->noptions; i++) > + virBufferAsprintf(&buf, "%s,", opts->options[i]); > + } For QEMU guests, we mark the guest as tainted when using custom arg passthrough, and log a message at warning level. So we should emit a VIR_WARN here about the storage pool being tainted. > > virBufferTrim(&buf, ",", -1); > mountOpts = virBufferContentAndReset(&buf); > diff --git a/tests/storagepoolxml2argvdata/pool-netfs-ns-mountopts-freebsd.argv b/tests/storagepoolxml2argvdata/pool-netfs-ns-mountopts-freebsd.argv > new file mode 100644 > index 0000000000..d8bd7e378e > --- /dev/null > +++ b/tests/storagepoolxml2argvdata/pool-netfs-ns-mountopts-freebsd.argv > @@ -0,0 +1,2 @@ > +mount -t nfs localhost:/var/lib/libvirt/images /mnt -o nfsvers=3,nosuid,noexec,\ > +sync,lazytime > diff --git a/tests/storagepoolxml2argvdata/pool-netfs-ns-mountopts-linux.argv b/tests/storagepoolxml2argvdata/pool-netfs-ns-mountopts-linux.argv > new file mode 100644 > index 0000000000..486b2183b7 > --- /dev/null > +++ b/tests/storagepoolxml2argvdata/pool-netfs-ns-mountopts-linux.argv > @@ -0,0 +1,2 @@ > +mount -t nfs localhost:/var/lib/libvirt/images /mnt -o nfsvers=3,nodev,nosuid,\ > +noexec,sync,lazytime > diff --git a/tests/storagepoolxml2argvdata/pool-netfs-ns-mountopts.argv b/tests/storagepoolxml2argvdata/pool-netfs-ns-mountopts.argv > new file mode 100644 > index 0000000000..a63d6da456 > --- /dev/null > +++ b/tests/storagepoolxml2argvdata/pool-netfs-ns-mountopts.argv > @@ -0,0 +1 @@ > +mount -t nfs localhost:/var/lib/libvirt/images /mnt -o nfsvers=3,sync,lazytime > diff --git a/tests/storagepoolxml2argvtest.c b/tests/storagepoolxml2argvtest.c > index b6a46280cd..b6bc838f7b 100644 > --- a/tests/storagepoolxml2argvtest.c > +++ b/tests/storagepoolxml2argvtest.c > @@ -162,6 +162,9 @@ mymain(void) > #define DO_TEST_FREEBSD(pool, ...) \ > DO_TEST_FULL(false, pool, false, true) > > + if (storageRegisterAll() < 0) > + return EXIT_FAILURE; > + > DO_TEST_FAIL("pool-dir"); > DO_TEST_FAIL("pool-dir-naming"); > DO_TEST("pool-fs"); > @@ -177,14 +180,17 @@ mymain(void) > DO_TEST_LINUX("pool-netfs"); > DO_TEST_LINUX("pool-netfs-auto"); > DO_TEST_LINUX("pool-netfs-protocol-ver"); > + DO_TEST_LINUX("pool-netfs-ns-mountopts"); > #elif defined(__FreeBSD__) > DO_TEST_FREEBSD("pool-netfs"); > DO_TEST_FREEBSD("pool-netfs-auto"); > DO_TEST_FREEBSD("pool-netfs-protocol-ver"); > + DO_TEST_FREEBSD("pool-netfs-ns-mountopts"); > #else > DO_TEST("pool-netfs"); > DO_TEST("pool-netfs-auto"); > DO_TEST("pool-netfs-protocol-ver"); > + DO_TEST("pool-netfs-ns-mountopts"); > #endif > DO_TEST("pool-netfs-gluster"); > DO_TEST("pool-netfs-cifs"); > -- > 2.20.1 > > -- > libvir-list mailing list > libvir-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/libvir-list Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list