manageiq-smartstate 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +3 -2
  3. data/lib/manageiq/smartstate/version.rb +1 -1
  4. data/manageiq-smartstate.gemspec +1 -1
  5. metadata +3 -42
  6. data/lib/MiqVm/test/camcorder_fleece_test.rb +0 -52
  7. data/lib/MiqVm/test/localVm.rb +0 -38
  8. data/lib/MiqVm/test/partitionAlignmentCheck.rb +0 -67
  9. data/lib/MiqVm/test/remoteVm.rb +0 -56
  10. data/lib/MiqVm/test/rhevmNfsTest.rb +0 -54
  11. data/lib/MiqVm/test/rhevmNfsTest2.rb +0 -58
  12. data/lib/MiqVm/test/rhevmTest.rb +0 -62
  13. data/lib/Scvmm/test/miq_hyperv_disk_test.rb +0 -23
  14. data/lib/Scvmm/test/miq_scvmm_vm_ssa_info_test.rb +0 -31
  15. data/lib/VmLocalDiskAccess/test/localCfg.rb +0 -87
  16. data/lib/VolumeManager/test/blockDevTest.rb +0 -32
  17. data/lib/VolumeManager/test/ldm.rb +0 -90
  18. data/lib/fs/MetakitFS/test/Makefile +0 -14
  19. data/lib/fs/MetakitFS/test/MkCollectFiles.rb +0 -165
  20. data/lib/fs/MetakitFS/test/MkSelectFiles.rb +0 -20
  21. data/lib/fs/MetakitFS/test/collect_files.yaml +0 -70
  22. data/lib/fs/MetakitFS/test/init.rb +0 -3
  23. data/lib/fs/MetakitFS/test/mk2vmdk.rb +0 -54
  24. data/lib/fs/MetakitFS/test/mk4test.c +0 -92
  25. data/lib/fs/MetakitFS/test/mkFsTest.rb +0 -113
  26. data/lib/fs/MetakitFS/test/proto.rb +0 -97
  27. data/lib/fs/ext3/test/tc_Ext3BlockPointersPath.rb +0 -74
  28. data/lib/fs/test/camcorder_fs_test.rb +0 -98
  29. data/lib/fs/test/collect_files_direct.yaml +0 -22
  30. data/lib/fs/test/collect_files_in.yaml +0 -24
  31. data/lib/fs/test/collect_files_in_nc.yaml +0 -22
  32. data/lib/fs/test/collect_files_out.yaml +0 -6
  33. data/lib/fs/test/collect_files_rm.yaml +0 -6
  34. data/lib/fs/test/copyTest.rb +0 -116
  35. data/lib/fs/test/fsTest.rb +0 -77
  36. data/lib/fs/test/updateTest.rb +0 -174
  37. data/lib/metadata/MIQExtract/test/extractTest.rb +0 -33
  38. data/lib/metadata/MIQExtract/test/full_extract_test.rb +0 -67
  39. data/lib/metadata/VmConfig/test/GetVMwareCfgTest.rb +0 -40
  40. data/lib/metadata/linux/test/Name +0 -0
  41. data/lib/metadata/linux/test/Packages +0 -0
  42. data/lib/metadata/linux/test/rpoTest.rb +0 -5
  43. data/lib/metadata/linux/test/tc_LinuxUtils.rb +0 -4157
@@ -1,74 +0,0 @@
1
- require 'minitest/unit'
2
- require 'enumerator'
3
-
4
- require 'fs/ext3/block_pointers_path'
5
- include Ext3
6
-
7
- class TestBlockPointersPath < MiniTest::Unit::TestCase
8
- NUM_INDIRECTS = 15
9
- MAX_BLOCK = 3626
10
-
11
- EXPECTED = [
12
- 0, [0, nil, nil, nil], :direct,
13
-
14
- 11, [11, nil, nil, nil], :direct,
15
- 12, [12, 0, nil, nil], :single_indirect,
16
- 13, [12, 1, nil, nil], :single_indirect,
17
-
18
- 26, [12, 14, nil, nil], :single_indirect,
19
- 27, [13, 0, 0, nil], :double_indirect,
20
- 28, [13, 0, 1, nil], :double_indirect,
21
-
22
- 41, [13, 0, 14, nil], :double_indirect,
23
- 42, [13, 1, 0, nil], :double_indirect,
24
-
25
- 251, [13, 14, 14, nil], :double_indirect,
26
- 252, [14, 0, 0, 0], :triple_indirect,
27
- 253, [14, 0, 0, 1], :triple_indirect,
28
-
29
- 266, [14, 0, 0, 14], :triple_indirect,
30
- 267, [14, 0, 1, 0], :triple_indirect,
31
-
32
- 476, [14, 0, 14, 14], :triple_indirect,
33
- 477, [14, 1, 0, 0], :triple_indirect,
34
-
35
- MAX_BLOCK, [14, 14, 14, 14], :triple_indirect
36
- ]
37
-
38
- def test_block_set
39
- path = BlockPointersPath.new(NUM_INDIRECTS)
40
-
41
- assert_raise(ArgumentError) { path.block = -1 }
42
- assert_raise(ArgumentError) { path.block = MAX_BLOCK + 1 }
43
-
44
- EXPECTED.each_slice(3) do |block, path_a, type|
45
- path.block = block
46
- assert_equal block, path.block
47
- assert_equal path_a, path.to_a
48
- assert_equal type, path.index_type
49
- end
50
- end
51
-
52
- def test_succ!
53
- path = BlockPointersPath.new(NUM_INDIRECTS)
54
-
55
- EXPECTED.each_slice(3) do |block, path_a, type|
56
- path.succ! until path.block == block
57
- assert_equal block, path.block
58
- assert_equal path_a, path.to_a
59
- assert_equal type, path.index_type
60
- break if block == MAX_BLOCK
61
- end
62
-
63
- assert_raise(RangeError) { path.succ! }
64
- end
65
-
66
- def test_path_to_block
67
- path = BlockPointersPath.new(NUM_INDIRECTS)
68
-
69
- EXPECTED.each_slice(3) do |block, _path_a, _type|
70
- path.block = block
71
- assert_equal block, path.send(:path_to_block)
72
- end
73
- end
74
- end
@@ -1,98 +0,0 @@
1
- require 'manageiq-gems-pending'
2
- require 'openssl' # Required for 'Digest' in camcorder (< Ruby 2.1)
3
- require 'camcorder'
4
- require 'ostruct'
5
- require 'disk/MiqDisk'
6
- require 'fs/MiqFS/MiqFS'
7
- require 'disk/modules/MiqLargeFile'
8
-
9
- require 'logger'
10
- $log = Logger.new(STDERR)
11
- $log.level = Logger::DEBUG
12
-
13
- #
14
- # Path to RAW disk image.
15
- #
16
- VIRTUAL_DISK_FILE = "path to raw disk image file"
17
-
18
- commit = true
19
-
20
- begin
21
- recorder = Camcorder::Recorder.new("#{File.dirname(__FILE__)}/foo.yml")
22
- Camcorder.default_recorder = recorder
23
- Camcorder.intercept_constructor(MiqLargeFile::MiqLargeFileOther) do
24
- methods_with_side_effects :seek, :read, :write
25
- end
26
- Camcorder.intercept_constructor(MiqLargeFile::MiqLargeFileStat)
27
-
28
- recorder.start
29
-
30
- diskInfo = OpenStruct.new
31
- diskInfo.rawDisk = true # remove if image is not in RAW format.
32
- diskInfo.fileName = VIRTUAL_DISK_FILE
33
-
34
- disk = MiqDisk.getDisk(diskInfo)
35
- raise "Failed to open disk: #{diskInfo.fileName}" unless disk
36
-
37
- puts "Disk type: #{disk.diskType}"
38
- puts "Disk partition type: #{disk.partType}"
39
- puts "Disk block size: #{disk.blockSize}"
40
- puts "Disk start LBA: #{disk.lbaStart}"
41
- puts "Disk end LBA: #{disk.lbaEnd}"
42
- puts "Disk start byte: #{disk.startByteAddr}"
43
- puts "Disk end byte: #{disk.endByteAddr}"
44
-
45
- parts = disk.getPartitions || []
46
-
47
- i = 1
48
- parts.each do |p|
49
- puts "\nPartition #{i}:"
50
- puts "\tDisk type: #{p.diskType}"
51
- puts "\tPart partition type: #{p.partType}"
52
- puts "\tPart block size: #{p.blockSize}"
53
- puts "\tPart start LBA: #{p.lbaStart}"
54
- puts "\tPart end LBA: #{p.lbaEnd}"
55
- puts "\tPart start byte: #{p.startByteAddr}"
56
- puts "\tPart end byte: #{p.endByteAddr}"
57
- i += 1
58
- end
59
-
60
- target_partition = parts.first || disk
61
- puts "\nTarget partition: #{target_partition.partNum}"
62
-
63
- raise "No filesystem detected" unless (mfs = MiqFS.getFS(target_partition))
64
-
65
- puts "FS type: #{mfs.fsType}"
66
- puts "pwd = #{mfs.pwd}"
67
-
68
- all_paths = mfs.find('/')
69
- directories = all_paths.select { |p| mfs.fileDirectory?(p) }
70
- files = all_paths.select { |p| mfs.fileFile?(p) }
71
- sym_links = all_paths.select { |p| mfs.fileSymLink?(p) }
72
- unclassified = all_paths - directories - files - sym_links
73
-
74
- puts "files: #{files.length}"
75
- puts "directories: #{directories.length}"
76
- puts "sym_links: #{sym_links.length}"
77
- puts "unclassified: #{unclassified.length}"
78
- puts "total: #{files.length + directories.length + sym_links.length + unclassified.length}"
79
- puts "all_paths: #{all_paths.length}"
80
-
81
- unless unclassified.empty?
82
- puts
83
- puts "unclassified files:"
84
- unclassified.each { |p| puts "\t#{p}" }
85
- end
86
- rescue => err
87
- puts err.to_s
88
- puts err.backtrace.join("\n")
89
- commit = false # don't commit recording on error
90
- ensure
91
- disk.close if disk
92
- if recorder && commit
93
- puts
94
- puts "camcorder: committing recording..."
95
- recorder.commit
96
- puts "done."
97
- end
98
- end
@@ -1,22 +0,0 @@
1
- ---
2
- -
3
- :basedir: "../../.."
4
- :todir: "copy_dst_ref"
5
- :include:
6
- - vmdb
7
- :exclude:
8
- - !ruby/regexp /\/\.svn/
9
- - !ruby/regexp /~$/
10
- - !ruby/regexp /\/NTFSCPP/
11
- - !ruby/regexp /\/TestVm/
12
- - !ruby/regexp /\.c$/
13
- - !ruby/regexp /\.h$/
14
- - !ruby/regexp /\.o$/
15
- - !ruby/regexp /\.vmdk$/
16
- - !ruby/regexp /dos_mbr.img$/
17
- - !ruby/regexp /test.rb$/
18
- - !ruby/regexp /\/rdoc$/
19
- - !ruby/regexp /\/examples$/
20
- - !ruby/regexp /\/test$/
21
- - !ruby/regexp /\/miqCryptInit.rb$/
22
- - !ruby/regexp /\/VMwareWebService\/.*\.wsdl$/
@@ -1,24 +0,0 @@
1
- ---
2
- -
3
- :basedir: "../../.."
4
- :todir: "/"
5
- :include:
6
- - vmdb
7
- :exclude:
8
- - !ruby/regexp /\/\.svn/
9
- - !ruby/regexp /~$/
10
- - !ruby/regexp /\/NTFSCPP/
11
- - !ruby/regexp /\/TestVm/
12
- - !ruby/regexp /\.c$/
13
- - !ruby/regexp /\.h$/
14
- - !ruby/regexp /\.o$/
15
- - !ruby/regexp /\.vmdk$/
16
- - !ruby/regexp /dos_mbr.img$/
17
- - !ruby/regexp /test.rb$/
18
- - !ruby/regexp /\/rdoc$/
19
- - !ruby/regexp /\/examples$/
20
- - !ruby/regexp /\/test$/
21
- - !ruby/regexp /\/miqCryptInit.rb$/
22
- - !ruby/regexp /\/VMwareWebService\/.*\.wsdl$/
23
- :compress:
24
- - !ruby/regexp /^vmdb\/.*$/
@@ -1,22 +0,0 @@
1
- ---
2
- -
3
- :basedir: "../../.."
4
- :todir: "/"
5
- :include:
6
- - vmdb
7
- :exclude:
8
- - !ruby/regexp /\/\.svn/
9
- - !ruby/regexp /~$/
10
- - !ruby/regexp /\/NTFSCPP/
11
- - !ruby/regexp /\/TestVm/
12
- - !ruby/regexp /\.c$/
13
- - !ruby/regexp /\.h$/
14
- - !ruby/regexp /\.o$/
15
- - !ruby/regexp /\.vmdk$/
16
- - !ruby/regexp /dos_mbr.img$/
17
- - !ruby/regexp /test.rb$/
18
- - !ruby/regexp /\/rdoc$/
19
- - !ruby/regexp /\/examples$/
20
- - !ruby/regexp /\/test$/
21
- - !ruby/regexp /\/miqCryptInit.rb$/
22
- - !ruby/regexp /\/VMwareWebService\/.*\.wsdl$/
@@ -1,6 +0,0 @@
1
- ---
2
- -
3
- :basedir: "/"
4
- :todir: "copy_dst"
5
- :include:
6
- - vmdb
@@ -1,6 +0,0 @@
1
- ---
2
- -
3
- :basedir: "/"
4
- :todir: "copy_dst"
5
- :remove:
6
- - !ruby/regexp /\.pdf$/
@@ -1,116 +0,0 @@
1
- require 'ostruct'
2
- require 'fs/MiqFS/MiqFS'
3
- require 'fs/MiqFsUtil'
4
- require 'fs/MetakitFS/MetakitFS'
5
- require 'fs/MiqFS/modules/LocalFS'
6
-
7
- SRC_DIR = "../../../.."
8
- DST_DIR = "copy_dst"
9
- MK_FILE = "mkfs"
10
-
11
- require 'logger'
12
- STDOUT.sync = true
13
- STDERR.sync = true
14
- $log = Logger.new(STDERR)
15
- $log.level = Logger::DEBUG
16
-
17
- #
18
- # First, copy files from the local filesystem to another directory in the local filesystem.
19
- #
20
-
21
- fromFs = MiqFS.new(LocalFS, nil)
22
- toFs = MiqFS.new(LocalFS, nil)
23
-
24
- cf = MiqFsUtil.new(fromFs, toFs)
25
- cf.verbose = true
26
-
27
- #
28
- # Make sure the destination directory exists and is empty.
29
- #
30
- toFs.rmBranch(DST_DIR) if toFs.fileDirectory?(DST_DIR)
31
- toFs.dirMkdir(DST_DIR)
32
-
33
- #
34
- # Recursively copy the directory contents.
35
- #
36
- puts "Copying #{SRC_DIR} to #{DST_DIR}"
37
- cf.copy(SRC_DIR, DST_DIR, true)
38
- puts "copy complete"
39
-
40
- #
41
- # Compare the contents of the original directory to that of its copy.
42
- # They should be the same.
43
- #
44
- dd = File.join(DST_DIR, File.basename(SRC_DIR))
45
- puts "Comparing #{SRC_DIR} to #{dd}"
46
- system("diff", "-qr", SRC_DIR, dd)
47
- if $?.exitstatus != 0
48
- puts "FAIL: Directory contents are not the same"
49
- exit($?.exitstatus)
50
- else
51
- puts "SUCCESS: Directory contents match"
52
- end
53
-
54
- #
55
- # Now, copy files from the local filesystem to a metakit filesystem.
56
- #
57
-
58
- #
59
- # Create a new metakit filesystem.
60
- #
61
- File.delete(MK_FILE) if File.exist?(MK_FILE)
62
- dobj = OpenStruct.new
63
- dobj.mkfile = MK_FILE
64
- dobj.create = true
65
- toFs = MiqFS.new(MetakitFS, dobj)
66
-
67
- #
68
- # Set the new metakit filssystem as the destination of the copy.
69
- #
70
- cf.toFs = toFs
71
-
72
- #
73
- # Recursively copy the directory contents.
74
- #
75
- puts "Copying #{SRC_DIR} to / (on mkfs)"
76
- cf.copy(SRC_DIR, "/", true)
77
- puts "copy complete"
78
-
79
- #
80
- # Now, reverse the copy.
81
- # Copy files out of the metakit FS to the local FS.
82
- #
83
- fromFs, toFs = toFs, fromFs
84
- cf.toFs = toFs
85
- cf.fromFs = fromFs
86
-
87
- #
88
- # Make sure the destination directory exists and is empty.
89
- #
90
- toFs.rmBranch(DST_DIR) if toFs.fileDirectory?(DST_DIR)
91
- toFs.dirMkdir(DST_DIR)
92
-
93
- puts
94
- puts "Copying /vmdb (on mkfs) to #{DST_DIR}"
95
- cf.copy("/vmdb", DST_DIR, true)
96
- puts "copy complete"
97
-
98
- #
99
- # Compare the contents of the original directory to that of its copy.
100
- # They should be the same.
101
- #
102
- puts
103
- puts "Comparing #{SRC_DIR} to #{dd}"
104
- system("diff", "-qr", SRC_DIR, dd)
105
- if $?.exitstatus != 0
106
- puts "FAIL: Directory contents are not the same"
107
- exit($?.exitstatus)
108
- else
109
- puts "SUCCESS: Directory contents match"
110
- end
111
-
112
- #
113
- # Clean up.
114
- #
115
- File.delete(MK_FILE) if File.exist?(MK_FILE)
116
- toFs.rmBranch(DST_DIR) if toFs.fileDirectory?(DST_DIR)
@@ -1,77 +0,0 @@
1
- require 'manageiq-gems-pending'
2
- require 'ostruct'
3
- require 'disk/MiqDisk'
4
- require 'fs/MiqFS/MiqFS'
5
-
6
- require 'logger'
7
- $log = Logger.new(STDERR)
8
- $log.level = Logger::DEBUG
9
-
10
- #
11
- # Path to RAW disk image.
12
- #
13
- VIRTUAL_DISK_FILE = "path to disk image file"
14
-
15
- begin
16
- diskInfo = OpenStruct.new
17
- diskInfo.rawDisk = true # remove if image is not in RAW format.
18
- diskInfo.fileName = VIRTUAL_DISK_FILE
19
-
20
- disk = MiqDisk.getDisk(diskInfo)
21
- raise "Failed to open disk: #{diskInfo.fileName}" unless disk
22
-
23
- puts "Disk type: #{disk.diskType}"
24
- puts "Disk partition type: #{disk.partType}"
25
- puts "Disk block size: #{disk.blockSize}"
26
- puts "Disk start LBA: #{disk.lbaStart}"
27
- puts "Disk end LBA: #{disk.lbaEnd}"
28
- puts "Disk start byte: #{disk.startByteAddr}"
29
- puts "Disk end byte: #{disk.endByteAddr}"
30
-
31
- parts = disk.getPartitions || []
32
-
33
- i = 1
34
- parts.each do |p|
35
- puts "\nPartition #{i}:"
36
- puts "\tDisk type: #{p.diskType}"
37
- puts "\tPart partition type: #{p.partType}"
38
- puts "\tPart block size: #{p.blockSize}"
39
- puts "\tPart start LBA: #{p.lbaStart}"
40
- puts "\tPart end LBA: #{p.lbaEnd}"
41
- puts "\tPart start byte: #{p.startByteAddr}"
42
- puts "\tPart end byte: #{p.endByteAddr}"
43
- i += 1
44
- end
45
-
46
- target_partition = parts.first || disk
47
- puts "\nTarget partition: #{target_partition.partNum}"
48
-
49
- raise "No filesystem detected" unless (mfs = MiqFS.getFS(target_partition))
50
-
51
- puts "FS type: #{mfs.fsType}"
52
- puts "pwd = #{mfs.pwd}"
53
-
54
- all_paths = mfs.find('/')
55
- directories = all_paths.select { |p| mfs.fileDirectory?(p) }
56
- files = all_paths.select { |p| mfs.fileFile?(p) }
57
- sym_links = all_paths.select { |p| mfs.fileSymLink?(p) }
58
- unclassified = all_paths - directories - files - sym_links
59
-
60
- puts "files: #{files.length}"
61
- puts "directories: #{directories.length}"
62
- puts "sym_links: #{sym_links.length}"
63
- puts "unclassified: #{unclassified.length}"
64
- puts "total: #{files.length + directories.length + sym_links.length + unclassified.length}"
65
- puts "all_paths: #{all_paths.length}"
66
-
67
- unless unclassified.empty?
68
- puts
69
- puts "unclassified files:"
70
- unclassified.each { |p| puts "\t#{p}" }
71
- end
72
- rescue => err
73
- puts err.to_s
74
- puts err.backtrace.join("\n")
75
- ensure
76
- disk.close if disk
77
- end