manageiq-smartstate 0.5.9 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +34 -35
  3. data/.rubocop.yml +3 -3
  4. data/.rubocop_cc.yml +3 -4
  5. data/.rubocop_local.yml +1 -1
  6. data/.travis.yml +2 -3
  7. data/lib/MiqVm/MiqRhevmVm.rb +1 -1
  8. data/lib/MiqVm/MiqVm.rb +0 -140
  9. data/lib/OpenStackExtract/MiqOpenStackVm/MiqOpenStackImage.rb +0 -1
  10. data/lib/OpenStackExtract/MiqOpenStackVm/MiqOpenStackInstance.rb +0 -1
  11. data/lib/VolumeManager/MiqLdm.rb +1 -1
  12. data/lib/db/MiqSqlite/MiqSqlite3Cell.rb +2 -3
  13. data/lib/disk/modules/MSCommon.rb +3 -1
  14. data/lib/disk/modules/VhdxDisk.rb +3 -1
  15. data/lib/fs/MiqMountManager.rb +2 -29
  16. data/lib/fs/VimDatastoreFS/VimDatastoreFS.rb +1 -6
  17. data/lib/fs/ext3/superblock.rb +1 -1
  18. data/lib/fs/ext4/superblock.rb +2 -2
  19. data/lib/fs/fat32/directory_entry.rb +60 -60
  20. data/lib/fs/iso9660/boot_sector.rb +3 -2
  21. data/lib/fs/iso9660/directory_entry.rb +3 -2
  22. data/lib/fs/iso9660/rock_ridge.rb +3 -1
  23. data/lib/fs/modules/LinuxMount.rb +3 -3
  24. data/lib/fs/ntfs/attrib_attribute_list.rb +3 -1
  25. data/lib/fs/ntfs/attrib_file_name.rb +3 -1
  26. data/lib/fs/ntfs/attrib_header.rb +3 -1
  27. data/lib/fs/ntfs/attrib_index_root.rb +3 -1
  28. data/lib/fs/ntfs/attrib_object_id.rb +1 -1
  29. data/lib/fs/ntfs/attrib_volume_name.rb +3 -1
  30. data/lib/fs/xfs/allocation_group.rb +1 -1
  31. data/lib/fs/xfs/bmap_btree_block.rb +1 -1
  32. data/lib/fs/xfs/superblock.rb +1 -1
  33. data/lib/manageiq/smartstate/util.rb +18 -0
  34. data/lib/manageiq/smartstate/version.rb +1 -1
  35. data/lib/metadata/MIQExtract/MIQExtract.rb +2 -3
  36. data/lib/metadata/VmConfig/GetNativeCfg.rb +2 -4
  37. data/lib/metadata/VmConfig/VmConfig.rb +7 -5
  38. data/lib/metadata/VmConfig/cfgConfig.rb +4 -0
  39. data/lib/metadata/VmConfig/xmlConfig.rb +3 -3
  40. data/lib/metadata/linux/MiqRpmPackages.rb +3 -1
  41. data/lib/metadata/util/md5deep.rb +4 -2
  42. data/lib/metadata/util/win32/Win32Accounts.rb +3 -0
  43. data/lib/metadata/util/win32/Win32EventLog.rb +5 -3
  44. data/lib/metadata/util/win32/Win32Software.rb +5 -3
  45. data/lib/metadata/util/win32/decode.rb +0 -0
  46. data/lib/metadata/util/win32/fleece_hives.rb +0 -8
  47. data/lib/metadata/util/win32/ms-registry.rb +3 -1
  48. data/lib/metadata/util/win32/peheader.rb +7 -8
  49. data/lib/miq_unicode.rb +45 -0
  50. data/manageiq-smartstate.gemspec +9 -7
  51. metadata +76 -33
  52. data/lib/fs/MetakitFS/MetakitFS.rb +0 -530
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d75e73f8d9428561d2b4a97ada29fd241c2a0d2bc1ba1ca1dd8465f8bbbd6112
4
- data.tar.gz: d2f3a3bae73311a0be7c4e5237572326881fd294967710626513e9a3fff37abe
3
+ metadata.gz: 2eed9833b4418d9405995117c01ae36ec8d9dbd8f59c2a71a3b1695fd1845eca
4
+ data.tar.gz: 014abce3c3c7a22594ffe9877046b1a390b0941e58e4052b3eb29525c80bd6fb
5
5
  SHA512:
6
- metadata.gz: 8e6fc1892a1c2b8a18e9114bbc1d3d3b30125c5808ff394b87af671ea9cfde6afc2b4489afab9042cd0e40e5055e21ebc2df1521dfab545c4a8418131802847d
7
- data.tar.gz: 409a17333f94aada6807c384eca810e6bcac9c4d1e27d3d46df072be31a6e33da3539efddc8451f40a569c5e3251ab89e8d4ea80642c8753081e8d912d6db604
6
+ metadata.gz: 417c6b7efe6f1ebdf11f037beb537f9fd48f1654e5985699a6b6c2d29342ea7fd22b59df97b48ae4ba09e1d6c75624c198add8d988b6387d071084ae48b0aafb
7
+ data.tar.gz: 35335b08093b49f9fb4e57aeba97b2c89d6c01ead9de3cb854086f84b0a70b59f90a178f1aaa44230dd1feea24c70acefa0546f43e2b65a279b8bcd59b0d1146
@@ -1,17 +1,23 @@
1
- ---
2
- exclude_paths:
3
- - ".git/"
4
- - "**.xml"
5
- - "**.yaml"
6
- - "**.yml"
7
- - lib/metadata/linux/test/Packages
8
- - lib/metadata/linux/test/tc_LinuxUtils.rb
9
- - locale/
10
- - spec/
11
- - test/
12
- - tools/
13
- - tmp/
14
- engines:
1
+ checks:
2
+ method-complexity:
3
+ enabled: true
4
+ config:
5
+ threshold: 8
6
+ prepare:
7
+ fetch:
8
+ - url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/.rubocop_base.yml
9
+ path: ".rubocop_base.yml"
10
+ - url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/.rubocop_cc_base.yml
11
+ path: ".rubocop_cc_base.yml"
12
+ - url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/styles/base.yml
13
+ path: styles/base.yml
14
+ - url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/styles/cc_base.yml
15
+ path: styles/cc_base.yml
16
+ plugins:
17
+ rubocop:
18
+ enabled: true
19
+ config: ".rubocop_cc.yml"
20
+ channel: rubocop-0-82
15
21
  brakeman:
16
22
  enabled: false
17
23
  bundler-audit:
@@ -25,7 +31,7 @@ engines:
25
31
  ruby:
26
32
  mass_threshold: 25
27
33
  count_threshold: 5
28
- javascript:
34
+ javascript:
29
35
  eslint:
30
36
  enabled: false
31
37
  channel: eslint-3
@@ -33,23 +39,16 @@ engines:
33
39
  enabled: false
34
40
  markdownlint:
35
41
  enabled: false
36
- rubocop:
37
- enabled: true
38
- config: ".rubocop_cc.yml"
39
- channel: rubocop-0-69
40
- checks:
41
- method-complexity:
42
- enabled: true
43
- config:
44
- threshold: 8
45
- prepare:
46
- fetch:
47
- - url: https://raw.githubusercontent.com/ManageIQ/guides/master/.rubocop_base.yml
48
- path: ".rubocop_base.yml"
49
- - url: https://raw.githubusercontent.com/ManageIQ/guides/master/.rubocop_cc_base.yml
50
- path: ".rubocop_cc_base.yml"
51
- ratings:
52
- paths:
53
- - Gemfile.lock
54
- - "**.rake"
55
- - "**.rb"
42
+ exclude_patterns:
43
+ - ".git/"
44
+ - "**.xml"
45
+ - "**.yaml"
46
+ - "**.yml"
47
+ - lib/metadata/linux/test/Packages
48
+ - lib/metadata/linux/test/tc_LinuxUtils.rb
49
+ - locale/
50
+ - spec/
51
+ - test/
52
+ - tools/
53
+ - tmp/
54
+ version: '2'
@@ -1,4 +1,4 @@
1
1
  inherit_from:
2
- - https://raw.githubusercontent.com/ManageIQ/guides/master/.rubocop_base.yml
3
- # put all local rubocop config into .rubocop_local.yml as it will be loaded by .rubocop_cc.yml as well
4
- - .rubocop_local.yml
2
+ - ".rubocop_local.yml"
3
+ inherit_gem:
4
+ manageiq-style: ".rubocop_base.yml"
@@ -1,5 +1,4 @@
1
1
  inherit_from:
2
- # this is downloaded by .codeclimate.yml
3
- - .rubocop_base.yml
4
- - .rubocop_cc_base.yml
5
- - .rubocop_local.yml
2
+ - ".rubocop_base.yml"
3
+ - ".rubocop_cc_base.yml"
4
+ - ".rubocop_local.yml"
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Overrides
3
3
  #
4
- GlobalVars:
4
+ Style/GlobalVars:
5
5
  AllowedVariables:
6
6
  # Loggers
7
7
  - $log
@@ -1,10 +1,9 @@
1
1
  ---
2
- sudo: false
3
2
  cache: bundler
4
3
  language: ruby
5
4
  rvm:
6
- - 2.5.7
7
- - 2.6.5
5
+ - 2.5.8
6
+ - 2.6.6
8
7
  after_script: bundle exec codeclimate-test-reporter
9
8
  notifications:
10
9
  webhooks:
@@ -42,7 +42,7 @@ class MiqRhevmVm < MiqVm
42
42
  disks = @rhevm.collect_vm_disks(@rhevmVm)
43
43
  disks.each_with_index do |disk, idx|
44
44
  $log.debug "MiqRhevmVm#getCfg: disk = #{disk.inspect}"
45
- storage_domain = disk.storage_domains.first
45
+ storage_domain = disk.storage_domains&.first
46
46
  if storage_domain.nil?
47
47
  $log.info("Disk <#{disk.name}> is skipped due to unassigned storage domain")
48
48
  next
@@ -205,143 +205,3 @@ class MiqVm
205
205
  (xml)
206
206
  end
207
207
  end # class MiqVm
208
-
209
- if __FILE__ == $0
210
- require 'metadata/util/win32/boot_info_win'
211
-
212
- # vmDir = File.join(ENV.fetch("HOME", '.'), 'VMs')
213
- vmDir = "/volumes/WDpassport/Virtual Machines"
214
- puts "vmDir = #{vmDir}"
215
-
216
- targetLv = "rpolv2"
217
- rootLv = "LogVol00"
218
-
219
- require 'logger'
220
- $log = Logger.new(STDERR)
221
- $log.level = Logger::DEBUG
222
-
223
- #
224
- # *** Test start
225
- #
226
-
227
- # vmCfg = File.join(vmDir, "cacheguard/cacheguard.vmx")
228
- # vmCfg = File.join(vmDir, "Red Hat Linux.vmwarevm/Red Hat Linux.vmx")
229
- # vmCfg = File.join(vmDir, "MIQ Server Appliance - Ubuntu MD - small/MIQ Server Appliance - Ubuntu.vmx")
230
- # vmCfg = File.join(vmDir, "winxpDev.vmwarevm/winxpDev.vmx")
231
- vmCfg = File.join(vmDir, "Win2K_persistent/Windows 2000 Professional.vmx")
232
- # vmCfg = File.join(vmDir, "Win2K_non_persistent/Windows 2000 Professional.vmx")
233
- puts "VM config file: #{vmCfg}"
234
-
235
- ost = OpenStruct.new
236
- ost.openParent = true
237
-
238
- vm = MiqVm.new(vmCfg, ost)
239
-
240
- puts "\n*** Disk Files:"
241
- vm.vmConfig.getDiskFileHash.each do |k, v|
242
- puts "\t#{k}\t#{v}"
243
- end
244
-
245
- puts "\n*** configHash:"
246
- vm.vmConfig.getHash.each do |k, v|
247
- puts "\t#{k} => #{v}"
248
- end
249
-
250
- tlv = nil
251
- rlv = nil
252
- puts "\n*** Visible Volumes:"
253
- vm.volumeManager.visibleVolumes.each do |vv|
254
- puts "\tDisk type: #{vv.diskType}"
255
- puts "\tDisk sig: #{vv.diskSig}"
256
- puts "\tStart LBA: #{vv.lbaStart}"
257
- if vv.respond_to?(:logicalVolume)
258
- puts "\t\tLV name: #{vv.logicalVolume.lvName}"
259
- puts "\t\tLV UUID: #{vv.logicalVolume.lvId}"
260
- tlv = vv if vv.logicalVolume.lvName == targetLv
261
- rlv = vv if vv.logicalVolume.lvName == rootLv
262
- end
263
- end
264
-
265
- # raise "#{targetLv} not found" if !tlv
266
- #
267
- # tlv.seek(0, IO::SEEK_SET)
268
- # rs = tlv.read(2040)
269
- # puts "\n***** START *****"
270
- # puts rs
271
- # puts "****** END ******"
272
- #
273
- # tlv.seek(2048*512*5119, IO::SEEK_SET)
274
- # rs = tlv.read(2040)
275
- # puts "\n***** START *****"
276
- # puts rs
277
- # puts "****** END ******"
278
- #
279
- # raise "#{rootLv} not found" if !rlv
280
- #
281
- # puts "\n*** Mounting #{rootLv}"
282
- # rfs = MiqFS.getFS(rlv)
283
- # puts "\tFS Type: #{rfs.fsType}"
284
- # puts "\t*** Root-level files and directories:"
285
- # rfs.dirForeach("/") { |de| puts "\t\t#{de}" }
286
-
287
- puts "\n***** Detected Guest OSs:"
288
- raise "No OSs detected" if vm.rootTrees.length == 0
289
- vm.rootTrees.each do |rt|
290
- puts "\t#{rt.guestOS}"
291
- if rt.guestOS == "Linux"
292
- puts "\n\t\t*** /etc/fstab contents:"
293
- rt.fileOpen("/etc/fstab", &:read).each_line do |fstl|
294
- next if fstl =~ /^#.*$/
295
- puts "\t\t\t#{fstl}"
296
- end
297
- end
298
- end
299
-
300
- vm.rootTrees.each do |rt|
301
- if rt.guestOS == "Linux"
302
- # tdirArr = [ "/", "/boot", "/var/www/miq", "/var/www/miq/vmdb/log", "/var/lib/mysql" ]
303
- tdirArr = ["/", "/boot", "/etc/init.d", "/etc/rc.d/init.d", "/etc/rc.d/rc0.d"]
304
-
305
- tdirArr.each do |tdir|
306
- begin
307
- puts "\n*** Listing #{tdir} directory (1):"
308
- rt.dirForeach(tdir) { |de| puts "\t\t#{de}" }
309
- puts "*** end"
310
-
311
- puts "\n*** Listing #{tdir} directory (2):"
312
- rt.chdir(tdir)
313
- rt.dirForeach { |de| puts "\t\t#{de}" }
314
- puts "*** end"
315
- rescue => err
316
- puts "*** #{err}"
317
- end
318
- end
319
-
320
- # lf = rt.fileOpen("/etc/rc0.d/S01halt")
321
- # puts "\n*** Contents of /etc/rc0.d/S01halt:"
322
- # puts lf.read
323
- # puts "*** END"
324
- # lf.close
325
- #
326
- # lfn = "/etc/rc0.d/S01halt"
327
- # puts "Is #{lfn} a symbolic link? #{rt.fileSymLink?(lfn)}"
328
- # puts "#{lfn} => #{rt.getLinkPath(lfn)}"
329
- else # Windows
330
- tdirArr = ["c:/", "e:/", "e:/testE2", "f:/"]
331
-
332
- tdirArr.each do |tdir|
333
- puts "\n*** Listing #{tdir} directory (1):"
334
- rt.dirForeach(tdir) { |de| puts "\t\t#{de}" }
335
- puts "*** end"
336
-
337
- puts "\n*** Listing #{tdir} directory (2):"
338
- rt.chdir(tdir)
339
- rt.dirForeach { |de| puts "\t\t#{de}" }
340
- puts "*** end"
341
- end
342
- end
343
- end
344
-
345
- vm.unmount
346
- puts "...done"
347
- end
@@ -1,5 +1,4 @@
1
1
  require 'miq_tempfile'
2
- require_relative '../../MiqVm/MiqVm'
3
2
  require_relative 'MiqOpenStackCommon'
4
3
 
5
4
  class MiqOpenStackImage
@@ -1,5 +1,4 @@
1
1
  require 'miq_tempfile'
2
- require_relative '../../MiqVm/MiqVm'
3
2
  require_relative 'MiqOpenStackCommon'
4
3
 
5
4
  #
@@ -5,7 +5,7 @@
5
5
 
6
6
  require 'ostruct'
7
7
  require 'binary_struct'
8
- require 'util/miq-uuid'
8
+ require 'uuidtools'
9
9
 
10
10
  class BinaryStruct
11
11
  def self.stepDecode(data, format)
@@ -5,7 +5,6 @@ require 'enumerator'
5
5
 
6
6
  require 'binary_struct'
7
7
  require_relative 'MiqSqlite3Util'
8
- require_relative 'MiqSqlite3Page'
9
8
 
10
9
  module MiqSqlite3DB
11
10
  class MiqSqlite3Cell
@@ -150,8 +149,8 @@ module MiqSqlite3DB
150
149
  when 2 then return 2, 'integer'
151
150
  when 3 then return 3, 'integer'
152
151
  when 4 then return 4, 'integer'
153
- when 6 then return 6, 'integer'
154
- when 8 then return 8, 'integer'
152
+ when 5 then return 6, 'integer'
153
+ when 6 then return 8, 'integer'
155
154
  when 7 then return 8, 'float'
156
155
  when 8 then return 0, 'false'
157
156
  when 9 then return 0, 'true'
@@ -1,10 +1,12 @@
1
1
  require 'disk/modules/MiqLargeFile'
2
- require 'util/miq-unicode'
2
+ require 'miq_unicode'
3
3
  require 'binary_struct'
4
4
  require 'memory_buffer'
5
5
  require 'Scvmm/miq_hyperv_disk'
6
6
 
7
7
  module MSCommon
8
+ using ManageIQ::UnicodeString
9
+
8
10
  # NOTE: All values are stored in network byte order.
9
11
 
10
12
  FOOTER = BinaryStruct.new([
@@ -1,6 +1,6 @@
1
1
  # encoding: US-ASCII
2
2
 
3
- require 'util/miq-unicode'
3
+ require 'miq_unicode'
4
4
  require 'binary_struct'
5
5
  require 'disk/MiqDisk'
6
6
  require 'memory_buffer'
@@ -8,6 +8,8 @@ require 'disk/modules/MiqLargeFile'
8
8
  require 'disk/modules/vhdx_bat_entry'
9
9
 
10
10
  module VhdxDisk
11
+ using ManageIQ::UnicodeString
12
+
11
13
  # NOTE: All values are stored in network byte order.
12
14
 
13
15
  VHDX_FILE_IDENTIFIER = BinaryStruct.new([
@@ -8,6 +8,7 @@ class MiqMountManager < MiqFS
8
8
  def self.mountVolumes(volMgr, vmCfg, ost = nil)
9
9
  rootTrees = []
10
10
  noFsVolumes = []
11
+
11
12
  volMgr.visibleVolumes.each do |dobj|
12
13
  $log.debug("MiqMountManager.mountVolumes >> fileName=#{dobj.dInfo.fileName}, partition=#{dobj.partNum}") if $log
13
14
  fs = MiqFS.getFS(dobj)
@@ -20,10 +21,7 @@ class MiqMountManager < MiqFS
20
21
  rootTrees << new(rsm, dobj, volMgr, vmCfg, ost)
21
22
  end
22
23
  end
23
- if volMgr.kind_of?(MiqNativeVolumeManager)
24
- require 'MetakitFS'
25
- rootTrees.each { |rt| rt.findPayload(noFsVolumes) } unless noFsVolumes.empty?
26
- end
24
+
27
25
  rootTrees
28
26
  end # def self.mountVolumes
29
27
 
@@ -41,31 +39,6 @@ class MiqMountManager < MiqFS
41
39
  super(rootModule, rootVolume)
42
40
  end # def initialize
43
41
 
44
- def findPayload(noFsVolumes)
45
- $log.debug "MiqMountManager.findPayload: searching for payloads:" if $log
46
- noFsVolumes.each do |v|
47
- next unless v.respond_to?(:devFile)
48
- if v.devFile
49
- $log.debug "\tMiqMountManager.findPayload: devFile = #{v.devFile}" if $log
50
- v.mkfile = v.devFile
51
- unless MetakitFS.supported?(v)
52
- $log.debug "\tMiqMountManager.findPayload: devFile = #{v.devFile} not mkfs, skipping" if $log
53
- v.mkfile = nil
54
- next
55
- end
56
- mkFs = MiqFS.new(MetakitFS, v)
57
- if mkFs.fsId == "MIQPAYLOAD"
58
- $log.debug "\tMiqMountManager.findPayload: payload found devFile = #{v.devFile}" if $log
59
- @payloads << mkFs
60
- else
61
- $log.debug "\tMiqMountManager.findPayload: devFile = #{v.devFile} not payload, fsId = #{mkFs.fsId}" if $log
62
- end
63
- else
64
- $log.debug "\tMiqMountManager.findPayload: devFile not set, fileName = #{v.dInfo.fileName}" if $log
65
- end
66
- end
67
- end
68
-
69
42
  #
70
43
  # Override standard MiqFS methods to account for mount indirection.
71
44
  # The getFsPath method is defined by the OS-specific mount modules.
@@ -105,12 +105,7 @@ module VimDatastoreFS
105
105
  #
106
106
  # fpos = 0
107
107
  # fsize = @pSize.get(fileRow)
108
- # if ftruncate && fsize != 0
109
- # @pSize.set fileRow, 0
110
- # @pData.set fileRow, Metakit::Bytes.new("", 0)
111
- # elsif fappend
112
- # fpos = fsize
113
- # end
108
+ # fpos = fsize if fappend
114
109
  #
115
110
  # return(MkFile.new(p, fileRow, fpos, fread, fwrite))
116
111
  # end # def fs_fileOpen
@@ -4,7 +4,7 @@ require 'fs/ext3/group_descriptor_table'
4
4
  require 'fs/ext3/inode'
5
5
 
6
6
  require 'binary_struct'
7
- require 'util/miq-uuid'
7
+ require 'uuidtools'
8
8
  require 'stringio'
9
9
  require 'memory_buffer'
10
10
 
@@ -4,7 +4,7 @@ require 'fs/ext4/group_descriptor_table'
4
4
  require 'fs/ext4/inode'
5
5
 
6
6
  require 'binary_struct'
7
- require 'util/miq-uuid'
7
+ require 'uuidtools'
8
8
  require 'stringio'
9
9
  require 'memory_buffer'
10
10
 
@@ -225,7 +225,7 @@ module Ext4
225
225
  end
226
226
 
227
227
  def groupDescriptorSize
228
- @groupDescriptorSize ||= is_enabled_64_bit? ? @sb['group_desc_size'] : GDE_SIZE
228
+ @groupDescriptorSize ||= is_enabled_64_bit? ? @sb['group_desc_size'] : GDE_SIZE
229
229
  end
230
230
 
231
231
  def freeBytes