5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/fs/modules/WinMount.rb', line 5
def fs_init
@guestOS = "Windows"
@rootFS = MiqFS.getFS(@rootVolume)
raise MiqException::MiqVmMountError, "WinMount: could not mount root volume" unless @rootFS
@allFileSystems << @rootFS
idToDriveLetter = {}
drives = Win32::SystemPath.driveAssignment(@rootFS)
if drives.empty?
idToDriveLetter["#{@rootVolume.diskSig}-#{@rootVolume.lbaStart}"] = "C:"
$log.debug "WinMount.fs_init: [@rootVolume.diskSig}[email protected]] = [#{@rootVolume.diskSig}-#{@rootVolume.lbaStart}]"
else
drives.each do |da|
idToDriveLetter["#{da[:serial_num]}-#{da[:starting_sector]}"] = da[:name].upcase
$log.debug "WinMount.fs_init: [da[:serial_num]}-da[:starting_sector] = [#{da[:serial_num]}-#{da[:starting_sector]}]"
end
end
@driveToFS = {}
if (lvObj = @rootVolume.dInfo.lvObj) && lvObj.driveHint
key = lvObj.lvId
@rootDriveLetter = lvObj.driveHint
$log.debug "WinMount.fs_init: @rootDriveLetter = lvObj.driveHint = #{@rootDriveLetter}"
else
key = "#{@rootVolume.diskSig}-#{@rootVolume.lbaStart}"
@rootDriveLetter = idToDriveLetter[key]
$log.debug "WinMount.fs_init: @rootDriveLetter = idToDriveLetter[#{key}] = #{@rootDriveLetter}"
end
if @rootDriveLetter.nil?
$log.debug("WinMount.fs_init: Could not determine root drive letter. Assuming C: Drive")
@rootDriveLetter = "C:"
idToDriveLetter[key] = @rootDriveLetter
end
@driveToFS[@rootDriveLetter] = @rootFS
saveFs(@rootFS, @rootDriveLetter, key)
@osNames = {}
@volumes.each do |v|
if (lvObj = v.dInfo.lvObj) && lvObj.driveHint
key = lvObj.lvId
dl = lvObj.driveHint
else
key = "#{v.diskSig}-#{v.lbaStart}"
next unless (dl = idToDriveLetter[key])
end
@osNames[v.dInfo.hardwareId + ':' + v.partNum.to_s] = dl
next if v == @rootVolume
next unless (fs = MiqFS.getFS(v))
@allFileSystems << fs
@driveToFS[dl] = fs
saveFs(fs, dl, key)
end
@cwd = "#{@rootDriveLetter}/"
end
|