From: Justin Cinkelj <justin.cink...@xlab.si>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

cloud-init: allow multiple parameters in NFS mount options

NFS mount options can be in format "uid=NUM,gid=NUM".
In this case, mount-nfs.so requires replacement of "," with "&",
and whole nfs_server string has to be quoted. See also #829.

Signed-off-by: Justin Cinkelj <justin.cink...@xlab.si>
Message-Id: <20170115214919.2007-1-justin.cink...@xlab.si>
Reviewed-by: Benoît Canet <ben...@irqsave.net>

---
diff --git a/modules/cloud-init/cloud-init.cc b/modules/cloud-init/cloud-init.cc
--- a/modules/cloud-init/cloud-init.cc
+++ b/modules/cloud-init/cloud-init.cc
@@ -11,6 +11,7 @@
 #include <memory>
 #include "client.hh"
 #include <boost/asio.hpp>
+#include <boost/algorithm/string/replace.hpp>
 #include "data-source.hh"
 #include <osv/debug.hh>
 #include <osv/firmware.hh>
@@ -219,11 +220,11 @@ void mount_module::yaml_to_request(const YAML::Node& node, http::server::request
     http::server::header param;
     param.name = "command";
     param.value = "/tools/mount-nfs.so";
-    param.value += " " + nfs_server;
+    param.value += " \"" + nfs_server;
     if (options.size() > 0) {
-        param.value += "/?" + options;
+        param.value += "/?" + boost::replace_all_copy(options, ",", "&");
     }
-    param.value += " " + mount_point;
+    param.value += "\" " + mount_point;
     req.query_parameters.push_back(param);
//fprintf(stderr, "MNT: param name='%s' value='%s'", param.name.c_str(), param.value.c_str());
     req.method = method;

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to