Module: VagrantPlugins::Utm::Cap::MountOptions

Extended by:
SyncedFolder::UnixMountHelpers
Defined in:
lib/vagrant_utm/cap/mount_options.rb

Overview

Capability for mount options

Constant Summary collapse

UTM_MOUNT_TYPE =

Mount type for VirtFS

"9p"

Class Method Summary collapse

Methods included from SyncedFolder::UnixMountHelpers

detect_owner_group_ids, emit_upstart_notification, extended, find_mount_options_id, merge_mount_options

Class Method Details

.mount_name(_machine, name, _data) ⇒ Object



49
50
51
# File 'lib/vagrant_utm/cap/mount_options.rb', line 49

def self.mount_name(_machine, name, _data)
  name.gsub(%r{[\s/\\]}, "_").sub(/^_/, "")
end

.mount_options(machine, _name, guest_path, options) ⇒ Object

Returns mount options for a utm synced folder



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/vagrant_utm/cap/mount_options.rb', line 24

def self.mount_options(machine, _name, guest_path, options)
  mount_options = options.fetch(:mount_options, [])
  detected_ids = detect_owner_group_ids(machine, guest_path, mount_options, options)
  mount_uid = detected_ids[:uid]
  mount_gid = detected_ids[:gid]

  # VirtFS mount options
  mount_options << "trans=virtio"
  mount_options << "version=9p2000.L"
  mount_options << if mount_options.include?("ro")
                     "ro"
                   else
                     "rw"
                   end
  mount_options << "_netdev"
  mount_options << "nofail"

  mount_options = mount_options.join(",")
  [mount_options, mount_uid, mount_gid]
end

.mount_type(_machine) ⇒ Object



45
46
47
# File 'lib/vagrant_utm/cap/mount_options.rb', line 45

def self.mount_type(_machine)
  UTM_MOUNT_TYPE
end