Sha256: a289642e1555312902e91711bbfdab5f4b4a54850fc77d5ffc7284a7740c0fee

Contents?: true

Size: 1.39 KB

Versions: 10

Compression:

Stored size: 1.39 KB

Contents

require "vagrant/util/retryable"

module VagrantPlugins
  module ProviderLibvirt
    module Cap
      class MountP9
        extend Vagrant::Util::Retryable

        def self.mount_p9_shared_folder(machine, folders)
          folders.each do |name, opts|
            # Expand the guest path so we can handle things like "~/vagrant"
            expanded_guest_path = machine.guest.capability(
              :shell_expand_guest_path, opts[:guestpath])

            # Do the actual creating and mounting
            machine.communicate.sudo("mkdir -p #{expanded_guest_path}")

            # Mount
            mount_tag = name.dup

            mount_opts="-o trans=virtio"
            mount_opts += ",access=#{opts[:owner]}" if opts[:owner]
            mount_opts += ",version=#{opts[:version]}" if opts[:version]
            mount_opts += ",#{opts[:mount_opts]}" if opts[:mount_opts]

            mount_command = "mount -t 9p #{mount_opts} '#{mount_tag}' #{expanded_guest_path}"
            retryable(:on => Vagrant::Errors::LinuxMountFailed,
                      :tries => 5,
                      :sleep => 3) do
              machine.communicate.sudo('modprobe 9p')
              machine.communicate.sudo('modprobe 9pnet_virtio')
              machine.communicate.sudo(mount_command,
                      :error_class => Vagrant::Errors::LinuxMountFailed)
            end
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
vagrant-libvirt-0.0.30 lib/vagrant-libvirt/cap/mount_p9.rb
vagrant-libvirt-0.0.29 lib/vagrant-libvirt/cap/mount_p9.rb
vagrant-libvirt-0.0.28 lib/vagrant-libvirt/cap/mount_p9.rb
vagrant-libvirt-0.0.27 lib/vagrant-libvirt/cap/mount_p9.rb
vagrant-libvirt-0.0.26 lib/vagrant-libvirt/cap/mount_p9.rb
vagrant-libvirt-0.0.25 lib/vagrant-libvirt/cap/mount_p9.rb
vagrant-libvirt-0.0.24 lib/vagrant-libvirt/cap/mount_p9.rb
vagrant-libvirt-0.0.23 lib/vagrant-libvirt/cap/mount_p9.rb
vagrant-libvirt-0.0.22 lib/vagrant-libvirt/cap/mount_p9.rb
vagrant-libvirt-0.0.21 lib/vagrant-libvirt/cap/mount_p9.rb