Sha256: 7203ae3c48dff04c28e43eefe759bba7cc5506ff9b6d07f48dfda489fbdef3ba
Contents?: true
Size: 1.47 KB
Versions: 1
Compression:
Stored size: 1.47 KB
Contents
module VagrantPlugins module GuestEsxi module Cap class MountNFSFolder extend Vagrant::Util::Retryable def self.mount_nfs_folder(machine, ip, folders) folders.each do |name, opts| guestpath = opts[:guestpath] volume = guestpath.gsub("/", "_") machine.communicate.tap do |comm| if comm.test("localcli storage nfs list | grep '^#{volume}'") comm.execute("localcli storage nfs remove -v #{volume}") end mount_command = "localcli storage nfs add -H #{ip} -s '#{opts[:hostpath]}' -v '#{volume}'" retryable(on: Vagrant::Errors::LinuxNFSMountFailed, tries: 5, sleep: 2) do comm.execute(mount_command, error_class: Vagrant::Errors::LinuxNFSMountFailed) end # symlink vmfs volume to :guestpath if comm.test("test -L '#{guestpath}'") comm.execute("rm -f '#{guestpath}'") end if comm.test("test -d '#{guestpath}'") comm.execute("rmdir '#{guestpath}'") end dir = File.dirname(guestpath) if !comm.test("test -d '#{dir}'") comm.execute("mkdir -p '#{dir}'") end comm.execute("ln -s '/vmfs/volumes/#{volume}' '#{guestpath}'") end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vagrant-cloudstack-1.2.0 | vendor/bundle/bundler/gems/vagrant-c84e05fd063f/plugins/guests/esxi/cap/mount_nfs_folder.rb |