Previous syntax was for mounts was slightly different as for Linux.
In particular, the first entry was tailor made for libnfs ("nfs://IP/DIR"),
while Linux uses string like "IP:/DIR". This resulted in additional
complication when converting Linux code to OSv.Fix that by doing doing required conversion inside OSv cloud-init. The provided example with two options (uid=1000,gid=1000) is only partially functional - only the first option is accepted, the second is silently ignored. This will be fixed after #829 is fixed. Signed-off-by: Justin Cinkelj <[email protected]> --- modules/cloud-init/cloud-init.cc | 17 ++++++++++++++--- modules/cloud-init/cloud-init.yaml | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/cloud-init/cloud-init.cc b/modules/cloud-init/cloud-init.cc index acee13d..b5ec190 100644 --- a/modules/cloud-init/cloud-init.cc +++ b/modules/cloud-init/cloud-init.cc @@ -189,7 +189,7 @@ Mount NFS mountpoint specified via cloud-init. Cloud-init config snippet: mounts: - - [ nfs://192.168.122.1/ggg, /ggg, auto, uid=0 ] + - [ "192.168.122.1:/ggg", /ggg, "nfs", "uid=1000,gid=1000", "0", "0" ] This results in running command /tools/mount-nfs.so nfs://192.168.122.1/ggg/?uid=0 /ggg @@ -197,13 +197,24 @@ This results in running command void mount_module::yaml_to_request(const YAML::Node& node, http::server::request& req) { std::string method = "PUT"; - std::string nfs_server = node[0].as<string>(); + std::string srv_hostname_dir = node[0].as<string>(); std::string mount_point = node[1].as<string>(); - // node[2] is "auto" flag - we ignore it + std::string type = node[2].as<string>(); std::string options = ""; if (node.size() >= 4) { options = node[3].as<string>(); } + // node[4] and [5] are ignored. + + if (type != "nfs") { + fprintf(stderr, "Ignoring unsupported filesystem type %s\n", type.c_str()); + return; + } + + auto pos = srv_hostname_dir.find_first_of(":"); + auto srv_hostname = srv_hostname_dir.substr(0, pos); + auto srv_dir = srv_hostname_dir.substr(pos+1, srv_hostname_dir.size()); + auto nfs_server = type + "://" + srv_hostname + srv_dir; http::server::header param; param.name = "command"; diff --git a/modules/cloud-init/cloud-init.yaml b/modules/cloud-init/cloud-init.yaml index ac7bd7c..76b4ccb 100644 --- a/modules/cloud-init/cloud-init.yaml +++ b/modules/cloud-init/cloud-init.yaml @@ -4,7 +4,7 @@ run: # mount NFS export example #mounts: -# - [ nfs://192.168.122.1/ggg, /ggg, auto, uid=0 ] +# - [ "192.168.122.1:/ggg", /ggg, "nfs", "uid=1000,gid=1000", "0", "0" ] # set hostname example #hostname: uber-vm -- 2.9.3 -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
