Class: MiqMountManager

Inherits:
MiqFS
  • Object
show all
Defined in:
lib/fs/MiqMountManager.rb

Constant Summary

Constants inherited from MiqFS

MiqFS::GLOB_CHARS

Instance Attribute Summary collapse

Attributes inherited from MiqFS

#dobj, #fsId, #fsType, #volName

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from MiqFS

#chdir, #copyIn, #copyInSingle, #copyOut, #copyOutSingle, #doGlob, #expandPath, #fileBasename, #fileDirname, #fileExtname, #fileFnmatch, #fileOpenLink, #find, #findEach, #findEachPrune, #fs_isSymLink?, #fs_supportsSymLinks, getFS, #isGlob?, #pwd, #rmBranch

Constructor Details

#initialize(rootModule, rootVolume, volMgr, vmCfg, _ost = nil) ⇒ MiqMountManager

def self.mountVolumes



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/fs/MiqMountManager.rb', line 28

def initialize(rootModule, rootVolume, volMgr, vmCfg, _ost = nil)
  @volMgr     = volMgr
  @rootVolume   = rootVolume
  @volumes    = volMgr.visibleVolumes
  @noFsVolumes  = noFsVolumes
  @vmConfig   = vmCfg
  @fileSystems  = []
  @allFileSystems = []
  @payloads   = []
  @devHash    = nil

  super(rootModule, rootVolume)
end

Instance Attribute Details

#devHashObject

Returns the value of attribute devHash.



6
7
8
# File 'lib/fs/MiqMountManager.rb', line 6

def devHash
  @devHash
end

#fileSystemsObject

Returns the value of attribute fileSystems.



6
7
8
# File 'lib/fs/MiqMountManager.rb', line 6

def fileSystems
  @fileSystems
end

#guestOSObject

Returns the value of attribute guestOS.



6
7
8
# File 'lib/fs/MiqMountManager.rb', line 6

def guestOS
  @guestOS
end

#noFsVolumesObject

Returns the value of attribute noFsVolumes.



6
7
8
# File 'lib/fs/MiqMountManager.rb', line 6

def noFsVolumes
  @noFsVolumes
end

#osNamesObject

Returns the value of attribute osNames.



6
7
8
# File 'lib/fs/MiqMountManager.rb', line 6

def osNames
  @osNames
end

#payloadsObject

Returns the value of attribute payloads.



6
7
8
# File 'lib/fs/MiqMountManager.rb', line 6

def payloads
  @payloads
end

#rootVolumeObject

Returns the value of attribute rootVolume.



6
7
8
# File 'lib/fs/MiqMountManager.rb', line 6

def rootVolume
  @rootVolume
end

#volMgrObject

Returns the value of attribute volMgr.



6
7
8
# File 'lib/fs/MiqMountManager.rb', line 6

def volMgr
  @volMgr
end

#volumesObject

Returns the value of attribute volumes.



6
7
8
# File 'lib/fs/MiqMountManager.rb', line 6

def volumes
  @volumes
end

Class Method Details

.mountVolumes(volMgr, vmCfg, ost = nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fs/MiqMountManager.rb', line 8

def self.mountVolumes(volMgr, vmCfg, ost = nil)
  rootTrees = []
  noFsVolumes = []

  volMgr.visibleVolumes.each do |dobj|
    $log.debug("MiqMountManager.mountVolumes >> fileName=#{dobj.dInfo.fileName}, partition=#{dobj.partNum}") if $log
    fs = MiqFS.getFS(dobj)
    if fs.nil?
      $log.debug "MiqMountManager.mountVolumes << SKIPPING because no file system" if $log
      noFsVolumes << dobj
      next
    end
    if (rsm = MountManagerProbe.getRootMod(fs))
      rootTrees << new(rsm, dobj, volMgr, vmCfg, ost)
    end
  end

  rootTrees
end

Instance Method Details

#dirEntries(*dir) ⇒ Object

Directory instance methods



61
62
63
64
# File 'lib/fs/MiqMountManager.rb', line 61

def dirEntries(*dir)
  fs, p = getFsPath(dir)
  fs.dirEntries(p)
end

#dirForeach(*dir, &block) ⇒ Object



66
67
68
69
# File 'lib/fs/MiqMountManager.rb', line 66

def dirForeach(*dir, &block)
  fs, p = getFsPath(dir)
  fs.dirForeach(p, &block)
end

#dirGlob(glb, *flags, &block) ⇒ Object



71
72
73
74
75
76
# File 'lib/fs/MiqMountManager.rb', line 71

def dirGlob(glb, *flags, &block)
  fs, p = getFsPath(@cwd)
  fs.chdir(p)
  return fs.dirGlob(glb, &block) if flags.length == 0
  fs.dirGlob(glb, flags[0], &block)
end

#dirMkdir(dir) ⇒ Object



78
79
80
81
# File 'lib/fs/MiqMountManager.rb', line 78

def dirMkdir(dir)
  fs, p = getFsPath(dir)
  fs.dirMkdir(p)
end

#dirRmdir(dir) ⇒ Object



83
84
85
86
# File 'lib/fs/MiqMountManager.rb', line 83

def dirRmdir(dir)
  fs, p = getFsPath(dir)
  fs.dirRmdir(p)
end

#fileAtime(f) ⇒ Object



131
132
133
134
# File 'lib/fs/MiqMountManager.rb', line 131

def fileAtime(f)
  fs, p = getFsPath(f)
  fs.fileAtime(p)
end

#fileAtime_obj(fo) ⇒ Object



146
147
148
# File 'lib/fs/MiqMountManager.rb', line 146

def fileAtime_obj(fo)
  fo.fs.fileAtime_obj(fo)
end

#fileClose(mfobj) ⇒ Object



117
118
119
# File 'lib/fs/MiqMountManager.rb', line 117

def fileClose(mfobj)
  @mfobj.fs.fileClose(mfobj)
end

#fileCtime(f) ⇒ Object



136
137
138
139
# File 'lib/fs/MiqMountManager.rb', line 136

def fileCtime(f)
  fs, p = getFsPath(f)
  fs.fileCtime(p)
end

#fileCtime_obj(fo) ⇒ Object



150
151
152
# File 'lib/fs/MiqMountManager.rb', line 150

def fileCtime_obj(fo)
  fo.fs.fileCtime_obj(fo)
end

#fileDelete(f) ⇒ Object



121
122
123
124
# File 'lib/fs/MiqMountManager.rb', line 121

def fileDelete(f)
  fs, p = getFsPath(f)
  fs.fileDelete(p)
end

#fileDirectory?(f) ⇒ Boolean

Returns:

  • (Boolean)


102
103
104
105
# File 'lib/fs/MiqMountManager.rb', line 102

def fileDirectory?(f)
  fs, p = getFsPath(f)
  fs.fileDirectory?(p)
end

#fileExists?(f) ⇒ Boolean

File instance methods

Returns:

  • (Boolean)


92
93
94
95
# File 'lib/fs/MiqMountManager.rb', line 92

def fileExists?(f)
  fs, p = getFsPath(f)
  fs.fileExists?(p)
end

#fileFile?(f) ⇒ Boolean

Returns:

  • (Boolean)


97
98
99
100
# File 'lib/fs/MiqMountManager.rb', line 97

def fileFile?(f)
  fs, p = getFsPath(f)
  fs.fileFile?(p)
end

#fileMtime(f) ⇒ Object



141
142
143
144
# File 'lib/fs/MiqMountManager.rb', line 141

def fileMtime(f)
  fs, p = getFsPath(f)
  fs.fileMtime(p)
end

#fileMtime_obj(fo) ⇒ Object



154
155
156
# File 'lib/fs/MiqMountManager.rb', line 154

def fileMtime_obj(fo)
  fo.fs.fileMtime_obj(fo)
end

#fileOpen(f, mode = "r", &block) ⇒ Object



112
113
114
115
# File 'lib/fs/MiqMountManager.rb', line 112

def fileOpen(f, mode = "r", &block)
  fs, p = getFsPath(f)
  fs.fileOpen(p, mode, &block)
end

#fileSize(f) ⇒ Object



126
127
128
129
# File 'lib/fs/MiqMountManager.rb', line 126

def fileSize(f)
  fs, p = getFsPath(f)
  fs.fileSize(p)
end

#fileSymLink?(f) ⇒ Boolean

Returns:

  • (Boolean)


107
108
109
110
# File 'lib/fs/MiqMountManager.rb', line 107

def fileSymLink?(f)
  fs, p = getFsPath(f)
  fs.fileSymLink?(p)
end

#freeBytesObject

Return free space in file system.



52
53
54
55
# File 'lib/fs/MiqMountManager.rb', line 52

def freeBytes
  fs, _p = getFsPath(@cwd)
  fs.freeBytes
end

#internalPath(p) ⇒ Object



158
159
160
161
# File 'lib/fs/MiqMountManager.rb', line 158

def internalPath(p)
  fs, np = getFsPath(p)
  fs.internalPath(np)
end

#toXml(doc = nil) ⇒ Object



163
164
165
166
167
168
169
170
171
# File 'lib/fs/MiqMountManager.rb', line 163

def toXml(doc = nil)
  doc = MiqXml.createDoc(nil) unless doc

  doc.add_element 'FileSystems'
  @fileSystems.each do |fsd|
    $miqOut.puts "FS: #{fsd.fsSpec}, Mounted on: #{fsd.mountPoint}, Type: #{fsd.fs.fsType}, Free bytes: #{fsd.fs.freeBytes}"
  end
  doc
end

#umountObject

Override standard MiqFS methods to account for mount indirection. The getFsPath method is defined by the OS-specific mount modules.



47
48
49
# File 'lib/fs/MiqMountManager.rb', line 47

def umount
  @allFileSystems.each(&:umount)
end