manageiq-smartstate 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rspec +4 -0
- data/.rspec_ci +4 -0
- data/.travis.yml +15 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +202 -0
- data/README.md +45 -0
- data/Rakefile +23 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/MiqContainerGroup/MiqContainerGroup.rb +31 -0
- data/lib/MiqVm/MiqLocalVm.rb +50 -0
- data/lib/MiqVm/MiqRhevmVm.rb +179 -0
- data/lib/MiqVm/MiqVm.rb +355 -0
- data/lib/MiqVm/miq_azure_vm.rb +96 -0
- data/lib/MiqVm/miq_scvmm_vm.rb +38 -0
- data/lib/MiqVm/test/camcorder_fleece_test.rb +60 -0
- data/lib/MiqVm/test/localVm.rb +45 -0
- data/lib/MiqVm/test/partitionAlignmentCheck.rb +76 -0
- data/lib/MiqVm/test/remoteVm.rb +65 -0
- data/lib/MiqVm/test/rhevmNfsTest.rb +62 -0
- data/lib/MiqVm/test/rhevmNfsTest2.rb +66 -0
- data/lib/MiqVm/test/rhevmTest.rb +70 -0
- data/lib/OpenStackExtract/MiqOpenStackVm/MiqOpenStackCommon.rb +107 -0
- data/lib/OpenStackExtract/MiqOpenStackVm/MiqOpenStackImage.rb +67 -0
- data/lib/OpenStackExtract/MiqOpenStackVm/MiqOpenStackInstance.rb +182 -0
- data/lib/Scvmm/miq_hyperv_disk.rb +273 -0
- data/lib/Scvmm/miq_scvmm_parse_powershell.rb +75 -0
- data/lib/Scvmm/miq_scvmm_vm_ssa_info.rb +135 -0
- data/lib/Scvmm/test/miq_hyperv_disk_test.rb +33 -0
- data/lib/Scvmm/test/miq_scvmm_vm_ssa_info_test.rb +41 -0
- data/lib/VmLocalDiskAccess/test/localCfg.rb +97 -0
- data/lib/VolumeManager/LVM/logical_volume.rb +75 -0
- data/lib/VolumeManager/LVM/lv_segment.rb +43 -0
- data/lib/VolumeManager/LVM/lvm2disk.rb +158 -0
- data/lib/VolumeManager/LVM/parser.rb +138 -0
- data/lib/VolumeManager/LVM/physical_volume.rb +19 -0
- data/lib/VolumeManager/LVM/scanner.rb +156 -0
- data/lib/VolumeManager/LVM/thin/btree.rb +83 -0
- data/lib/VolumeManager/LVM/thin/constants.rb +86 -0
- data/lib/VolumeManager/LVM/thin/data_map.rb +44 -0
- data/lib/VolumeManager/LVM/thin/mapping_tree.rb +19 -0
- data/lib/VolumeManager/LVM/thin/space_maps.rb +58 -0
- data/lib/VolumeManager/LVM/thin/superblock.rb +136 -0
- data/lib/VolumeManager/LVM/thin.rb +6 -0
- data/lib/VolumeManager/LVM/volume_group.rb +97 -0
- data/lib/VolumeManager/LVM.rb +8 -0
- data/lib/VolumeManager/MiqLdm.rb +546 -0
- data/lib/VolumeManager/MiqLvm.rb +17 -0
- data/lib/VolumeManager/MiqNativeVolumeManager.rb +150 -0
- data/lib/VolumeManager/MiqVolumeManager.rb +277 -0
- data/lib/VolumeManager/VolMgrPlatformSupport.rb +18 -0
- data/lib/VolumeManager/VolMgrPlatformSupportLinux.rb +77 -0
- data/lib/VolumeManager/VolMgrPlatformSupportWin.rb +17 -0
- data/lib/VolumeManager/test/blockDevTest.rb +40 -0
- data/lib/VolumeManager/test/ldm.rb +97 -0
- data/lib/blackbox/VmBlackBox.rb +103 -0
- data/lib/blackbox/xmlStorage.rb +180 -0
- data/lib/db/MiqBdb/MiqBdb.rb +309 -0
- data/lib/db/MiqBdb/MiqBdbBtree.rb +219 -0
- data/lib/db/MiqBdb/MiqBdbHash.rb +199 -0
- data/lib/db/MiqBdb/MiqBdbPage.rb +159 -0
- data/lib/db/MiqBdb/MiqBdbUtil.rb +18 -0
- data/lib/db/MiqSqlite/MiqSqlite3.rb +330 -0
- data/lib/db/MiqSqlite/MiqSqlite3Cell.rb +167 -0
- data/lib/db/MiqSqlite/MiqSqlite3Page.rb +151 -0
- data/lib/db/MiqSqlite/MiqSqlite3Table.rb +124 -0
- data/lib/db/MiqSqlite/MiqSqlite3Util.rb +32 -0
- data/lib/disk/DiskProbe.rb +68 -0
- data/lib/disk/MiqDisk.rb +317 -0
- data/lib/disk/camcorder_test.rb +90 -0
- data/lib/disk/dos_mbr.img +0 -0
- data/lib/disk/modules/AzureBlobDisk.rb +101 -0
- data/lib/disk/modules/LocalDevMod.rb +47 -0
- data/lib/disk/modules/LocalDevProbe.rb +6 -0
- data/lib/disk/modules/MSCommon.rb +352 -0
- data/lib/disk/modules/MSVSDiffDisk.rb +91 -0
- data/lib/disk/modules/MSVSDiskProbe.rb +61 -0
- data/lib/disk/modules/MSVSDynamicDisk.rb +42 -0
- data/lib/disk/modules/MSVSFixedDisk.rb +45 -0
- data/lib/disk/modules/MiqLargeFile.rb +63 -0
- data/lib/disk/modules/MiqLargeFileWin32.rb +107 -0
- data/lib/disk/modules/QcowDisk.rb +692 -0
- data/lib/disk/modules/QcowDiskProbe.rb +34 -0
- data/lib/disk/modules/RawBlockIO.rb +116 -0
- data/lib/disk/modules/RawDisk.rb +45 -0
- data/lib/disk/modules/RawDiskProbe.rb +7 -0
- data/lib/disk/modules/RhevmDescriptor.rb +167 -0
- data/lib/disk/modules/RhevmDiskProbe.rb +52 -0
- data/lib/disk/modules/VMWareCowdDisk.rb +207 -0
- data/lib/disk/modules/VMWareDescriptor.rb +214 -0
- data/lib/disk/modules/VMWareDiskProbe.rb +74 -0
- data/lib/disk/modules/VMWareSparseDisk.rb +189 -0
- data/lib/disk/modules/VhdxDisk.rb +625 -0
- data/lib/disk/modules/VhdxDiskProbe.rb +46 -0
- data/lib/disk/modules/VixDiskMod.rb +54 -0
- data/lib/disk/modules/VixDiskProbe.rb +6 -0
- data/lib/disk/modules/miq_disk_cache.rb +135 -0
- data/lib/disk/modules/miq_dummy_disk.rb +41 -0
- data/lib/disk/modules/vhdx_bat_entry.rb +10 -0
- data/lib/disk/test.rb +66 -0
- data/lib/fs/MetakitFS/MetakitFS.rb +530 -0
- data/lib/fs/MetakitFS/test/Makefile +14 -0
- data/lib/fs/MetakitFS/test/MkCollectFiles.rb +165 -0
- data/lib/fs/MetakitFS/test/MkSelectFiles.rb +30 -0
- data/lib/fs/MetakitFS/test/collect_files.yaml +70 -0
- data/lib/fs/MetakitFS/test/init.rb +3 -0
- data/lib/fs/MetakitFS/test/mk2vmdk.rb +64 -0
- data/lib/fs/MetakitFS/test/mk4test.c +92 -0
- data/lib/fs/MetakitFS/test/mkFsTest.rb +113 -0
- data/lib/fs/MetakitFS/test/proto.rb +97 -0
- data/lib/fs/MiqFS/FsProbe.rb +39 -0
- data/lib/fs/MiqFS/MiqFS.rb +515 -0
- data/lib/fs/MiqFS/modules/AUFSProbe.rb +26 -0
- data/lib/fs/MiqFS/modules/Ext3.rb +305 -0
- data/lib/fs/MiqFS/modules/Ext3Probe.rb +25 -0
- data/lib/fs/MiqFS/modules/Ext4.rb +304 -0
- data/lib/fs/MiqFS/modules/Ext4Probe.rb +25 -0
- data/lib/fs/MiqFS/modules/Fat32.rb +318 -0
- data/lib/fs/MiqFS/modules/Fat32Probe.rb +30 -0
- data/lib/fs/MiqFS/modules/HFSProbe.rb +18 -0
- data/lib/fs/MiqFS/modules/Iso9660.rb +293 -0
- data/lib/fs/MiqFS/modules/Iso9660Probe.rb +18 -0
- data/lib/fs/MiqFS/modules/LocalFS.rb +105 -0
- data/lib/fs/MiqFS/modules/NTFS.rb +287 -0
- data/lib/fs/MiqFS/modules/NTFSProbe.rb +21 -0
- data/lib/fs/MiqFS/modules/NativeFS.rb +155 -0
- data/lib/fs/MiqFS/modules/ReFSProbe.rb +17 -0
- data/lib/fs/MiqFS/modules/RealFS.rb +79 -0
- data/lib/fs/MiqFS/modules/RealFSProbe.rb +6 -0
- data/lib/fs/MiqFS/modules/Reiser4Probe.rb +18 -0
- data/lib/fs/MiqFS/modules/ReiserFS.rb +315 -0
- data/lib/fs/MiqFS/modules/ReiserFSProbe.rb +42 -0
- data/lib/fs/MiqFS/modules/UnionFSProbe.rb +18 -0
- data/lib/fs/MiqFS/modules/WebDAV.rb +127 -0
- data/lib/fs/MiqFS/modules/WebDAVFile.rb +68 -0
- data/lib/fs/MiqFS/modules/XFS.rb +300 -0
- data/lib/fs/MiqFS/modules/XFSProbe.rb +26 -0
- data/lib/fs/MiqFS/modules/ZFSProbe.rb +18 -0
- data/lib/fs/MiqFS/test.rb +59 -0
- data/lib/fs/MiqFsUtil.rb +383 -0
- data/lib/fs/MiqMountManager.rb +209 -0
- data/lib/fs/MiqNativeMountManager.rb +101 -0
- data/lib/fs/MountManagerProbe.rb +29 -0
- data/lib/fs/ReiserFS/block.rb +209 -0
- data/lib/fs/ReiserFS/directory.rb +136 -0
- data/lib/fs/ReiserFS/directory_entry.rb +140 -0
- data/lib/fs/ReiserFS/file_data.rb +111 -0
- data/lib/fs/ReiserFS/superblock.rb +140 -0
- data/lib/fs/ReiserFS/utils.rb +95 -0
- data/lib/fs/VimDatastoreFS/VimDatastoreFS.rb +192 -0
- data/lib/fs/ext3/alloc_bitmap.rb +38 -0
- data/lib/fs/ext3/block_pointers_path.rb +130 -0
- data/lib/fs/ext3/directory.rb +51 -0
- data/lib/fs/ext3/directory_entry.rb +67 -0
- data/lib/fs/ext3/ex_attrib_header.rb +14 -0
- data/lib/fs/ext3/ex_attrib_name.rb +23 -0
- data/lib/fs/ext3/file_data.rb +130 -0
- data/lib/fs/ext3/group_descriptor_entry.rb +65 -0
- data/lib/fs/ext3/group_descriptor_table.rb +54 -0
- data/lib/fs/ext3/hash_tree_entry.rb +18 -0
- data/lib/fs/ext3/hash_tree_header.rb +15 -0
- data/lib/fs/ext3/inode.rb +228 -0
- data/lib/fs/ext3/posix_acl_entry.rb +29 -0
- data/lib/fs/ext3/posix_acl_header.rb +11 -0
- data/lib/fs/ext3/superblock.rb +406 -0
- data/lib/fs/ext3/test/tc_Ext3BlockPointersPath.rb +74 -0
- data/lib/fs/ext4/alloc_bitmap.rb +38 -0
- data/lib/fs/ext4/directory.rb +87 -0
- data/lib/fs/ext4/directory_entry.rb +77 -0
- data/lib/fs/ext4/ex_attrib_header.rb +14 -0
- data/lib/fs/ext4/ex_attrib_name.rb +23 -0
- data/lib/fs/ext4/extent.rb +35 -0
- data/lib/fs/ext4/extent_header.rb +40 -0
- data/lib/fs/ext4/extent_index.rb +33 -0
- data/lib/fs/ext4/group_descriptor_entry.rb +69 -0
- data/lib/fs/ext4/group_descriptor_table.rb +54 -0
- data/lib/fs/ext4/hash_tree_entry.rb +58 -0
- data/lib/fs/ext4/hash_tree_header.rb +35 -0
- data/lib/fs/ext4/inode.rb +465 -0
- data/lib/fs/ext4/posix_acl_entry.rb +29 -0
- data/lib/fs/ext4/posix_acl_header.rb +11 -0
- data/lib/fs/ext4/superblock.rb +412 -0
- data/lib/fs/fat32/boot_sect.rb +379 -0
- data/lib/fs/fat32/directory.rb +222 -0
- data/lib/fs/fat32/directory_entry.rb +540 -0
- data/lib/fs/fat32/file_data.rb +128 -0
- data/lib/fs/iso9660/boot_sector.rb +170 -0
- data/lib/fs/iso9660/directory.rb +90 -0
- data/lib/fs/iso9660/directory_entry.rb +147 -0
- data/lib/fs/iso9660/file_data.rb +78 -0
- data/lib/fs/iso9660/rock_ridge.rb +329 -0
- data/lib/fs/iso9660/util.rb +57 -0
- data/lib/fs/modules/LinuxMount.rb +300 -0
- data/lib/fs/modules/LinuxMountProbe.rb +29 -0
- data/lib/fs/modules/WinMount.rb +97 -0
- data/lib/fs/modules/WinMountProbe.rb +24 -0
- data/lib/fs/ntfs/attrib_attribute_list.rb +131 -0
- data/lib/fs/ntfs/attrib_bitmap.rb +26 -0
- data/lib/fs/ntfs/attrib_data.rb +74 -0
- data/lib/fs/ntfs/attrib_file_name.rb +110 -0
- data/lib/fs/ntfs/attrib_header.rb +194 -0
- data/lib/fs/ntfs/attrib_index_allocation.rb +19 -0
- data/lib/fs/ntfs/attrib_index_root.rb +247 -0
- data/lib/fs/ntfs/attrib_object_id.rb +40 -0
- data/lib/fs/ntfs/attrib_standard_information.rb +107 -0
- data/lib/fs/ntfs/attrib_type.rb +49 -0
- data/lib/fs/ntfs/attrib_volume_information.rb +53 -0
- data/lib/fs/ntfs/attrib_volume_name.rb +31 -0
- data/lib/fs/ntfs/boot_sect.rb +253 -0
- data/lib/fs/ntfs/data_run.rb +358 -0
- data/lib/fs/ntfs/directory_index_node.rb +114 -0
- data/lib/fs/ntfs/index_node_header.rb +69 -0
- data/lib/fs/ntfs/index_record_header.rb +85 -0
- data/lib/fs/ntfs/mft_entry.rb +288 -0
- data/lib/fs/ntfs/utils.rb +43 -0
- data/lib/fs/test/camcorder_fs_test.rb +108 -0
- data/lib/fs/test/collect_files_direct.yaml +22 -0
- data/lib/fs/test/collect_files_in.yaml +24 -0
- data/lib/fs/test/collect_files_in_nc.yaml +22 -0
- data/lib/fs/test/collect_files_out.yaml +6 -0
- data/lib/fs/test/collect_files_rm.yaml +6 -0
- data/lib/fs/test/copyTest.rb +126 -0
- data/lib/fs/test/fsTest.rb +87 -0
- data/lib/fs/test/updateTest.rb +184 -0
- data/lib/fs/xfs/allocation_group.rb +160 -0
- data/lib/fs/xfs/bmap_btree_block.rb +125 -0
- data/lib/fs/xfs/bmap_btree_record.rb +80 -0
- data/lib/fs/xfs/bmap_btree_root_node.rb +72 -0
- data/lib/fs/xfs/directory.rb +133 -0
- data/lib/fs/xfs/directory2_data_header.rb +27 -0
- data/lib/fs/xfs/directory3_data_header.rb +34 -0
- data/lib/fs/xfs/directory_block_tail.rb +22 -0
- data/lib/fs/xfs/directory_data_header.rb +46 -0
- data/lib/fs/xfs/directory_entry.rb +106 -0
- data/lib/fs/xfs/inode.rb +532 -0
- data/lib/fs/xfs/inode_map.rb +100 -0
- data/lib/fs/xfs/short_form_directory_entry.rb +91 -0
- data/lib/fs/xfs/short_form_header.rb +44 -0
- data/lib/fs/xfs/superblock.rb +556 -0
- data/lib/lib/tasks/azure.rake +52 -0
- data/lib/manageiq/smartstate/version.rb +5 -0
- data/lib/manageiq/smartstate.rb +7 -0
- data/lib/manageiq-smartstate.rb +1 -0
- data/lib/metadata/MIQExtract/MIQExtract.rb +297 -0
- data/lib/metadata/MIQExtract/test/extractTest.rb +41 -0
- data/lib/metadata/MIQExtract/test/full_extract_test.rb +68 -0
- data/lib/metadata/ScanProfile/HostScanItem.rb +4 -0
- data/lib/metadata/ScanProfile/HostScanProfile.rb +4 -0
- data/lib/metadata/ScanProfile/HostScanProfiles.rb +41 -0
- data/lib/metadata/ScanProfile/ScanItemBase.rb +63 -0
- data/lib/metadata/ScanProfile/ScanProfileBase.rb +51 -0
- data/lib/metadata/ScanProfile/ScanProfilesBase.rb +60 -0
- data/lib/metadata/ScanProfile/VmScanItem.rb +4 -0
- data/lib/metadata/ScanProfile/VmScanProfile.rb +4 -0
- data/lib/metadata/ScanProfile/VmScanProfiles.rb +38 -0
- data/lib/metadata/ScanProfile/modules/HostScanItemFile.rb +51 -0
- data/lib/metadata/ScanProfile/modules/HostScanItemNteventlog.rb +84 -0
- data/lib/metadata/ScanProfile/modules/VmScanItemFile.rb +39 -0
- data/lib/metadata/ScanProfile/modules/VmScanItemNteventlog.rb +34 -0
- data/lib/metadata/ScanProfile/modules/VmScanItemRegistry.rb +64 -0
- data/lib/metadata/VMMount/VMMount.rb +81 -0
- data/lib/metadata/VMMount/VMPlatformMount.rb +18 -0
- data/lib/metadata/VMMount/VMPlatformMountLinux.rb +75 -0
- data/lib/metadata/VMMount/VMPlatformMountWin.rb +13 -0
- data/lib/metadata/VmConfig/GetNativeCfg.rb +45 -0
- data/lib/metadata/VmConfig/VmConfig.rb +947 -0
- data/lib/metadata/VmConfig/cfgConfig.rb +45 -0
- data/lib/metadata/VmConfig/ovfConfig.rb +99 -0
- data/lib/metadata/VmConfig/test/GetVMwareCfgTest.rb +40 -0
- data/lib/metadata/VmConfig/vmcConfig.rb +116 -0
- data/lib/metadata/VmConfig/vmtxConfig.rb +4 -0
- data/lib/metadata/VmConfig/vmxConfig.rb +162 -0
- data/lib/metadata/VmConfig/xmlConfig.rb +79 -0
- data/lib/metadata/VmConfig/xmlMsHyperVConfig.rb +41 -0
- data/lib/metadata/linux/InitProcHash.rb +632 -0
- data/lib/metadata/linux/LinuxInitProcs.rb +142 -0
- data/lib/metadata/linux/LinuxOSInfo.rb +237 -0
- data/lib/metadata/linux/LinuxPackages.rb +209 -0
- data/lib/metadata/linux/LinuxSystemd.rb +130 -0
- data/lib/metadata/linux/LinuxUsers.rb +289 -0
- data/lib/metadata/linux/LinuxUtils.rb +197 -0
- data/lib/metadata/linux/MiqConaryPackages.rb +41 -0
- data/lib/metadata/linux/MiqRpmPackages.rb +160 -0
- data/lib/metadata/linux/test/Name +0 -0
- data/lib/metadata/linux/test/Packages +0 -0
- data/lib/metadata/linux/test/rpoTest.rb +5 -0
- data/lib/metadata/linux/test/tc_LinuxUtils.rb +4157 -0
- data/lib/metadata/util/event_log_filter.rb +61 -0
- data/lib/metadata/util/md5deep.rb +280 -0
- data/lib/metadata/util/win32/Win32Accounts.rb +764 -0
- data/lib/metadata/util/win32/Win32EventLog.rb +743 -0
- data/lib/metadata/util/win32/Win32Services.rb +86 -0
- data/lib/metadata/util/win32/Win32Software.rb +326 -0
- data/lib/metadata/util/win32/Win32System.rb +333 -0
- data/lib/metadata/util/win32/boot_info_win.rb +59 -0
- data/lib/metadata/util/win32/fleece_hives.rb +220 -0
- data/lib/metadata/util/win32/ms-registry.rb +650 -0
- data/lib/metadata/util/win32/peheader.rb +868 -0
- data/lib/metadata/util/win32/remote-registry.rb +142 -0
- data/lib/metadata/util/win32/system_path_win.rb +103 -0
- data/lib/metadata/util/win32/versioninfo.rb +17 -0
- data/manageiq-smartstate.gemspec +35 -0
- metadata +486 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'log4r'
|
2
|
+
require 'fs/MiqFsUtil'
|
3
|
+
require 'fs/MiqFS/MiqFS'
|
4
|
+
require 'fs/MetakitFS/MetakitFS'
|
5
|
+
require 'fs/MiqFS/modules/LocalFS'
|
6
|
+
|
7
|
+
#
|
8
|
+
# Formatter to output log messages to the console.
|
9
|
+
#
|
10
|
+
$stderr.sync = true
|
11
|
+
class ConsoleFormatter < Log4r::Formatter
|
12
|
+
def format(event)
|
13
|
+
t = Time.now
|
14
|
+
"#{t.hour}:#{t.min}:#{t.sec}: " + (event.data.kind_of?(String) ? event.data : event.data.inspect) + "\n"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
$log = Log4r::Logger.new 'toplog'
|
18
|
+
Log4r::StderrOutputter.new('err_console', :level => Log4r::DEBUG, :formatter => ConsoleFormatter)
|
19
|
+
$log.add 'err_console'
|
20
|
+
|
21
|
+
dobj = OpenStruct.new
|
22
|
+
dobj.mkfile = ARGV[1]
|
23
|
+
dobj.create = true
|
24
|
+
|
25
|
+
toFs = MiqFS.new(MetakitFS, dobj)
|
26
|
+
fromFs = MiqFS.new(LocalFS, nil)
|
27
|
+
|
28
|
+
cf = MiqFsUtil.new(fromFs, toFs, ARGV[0])
|
29
|
+
cf.verbose = true
|
30
|
+
cf.update
|
@@ -0,0 +1,70 @@
|
|
1
|
+
---
|
2
|
+
-
|
3
|
+
:basedir: "../../../.."
|
4
|
+
:todir: /
|
5
|
+
:include:
|
6
|
+
# Common
|
7
|
+
- lib/metadata
|
8
|
+
- lib/util
|
9
|
+
- lib/disk
|
10
|
+
- lib/fs
|
11
|
+
- lib/fs/MetakitFS/test/init.rb
|
12
|
+
- lib/db
|
13
|
+
- lib/encryption
|
14
|
+
- lib/VMwareWebService
|
15
|
+
- lib/MiqWebService
|
16
|
+
- lib/blackbox
|
17
|
+
- lib/esx_lib_hooks/miq_lib_hooks.so
|
18
|
+
- lib/MiqVm
|
19
|
+
- lib/VolumeManager
|
20
|
+
# miqhost
|
21
|
+
- host/miqhost/etc
|
22
|
+
- host/miqhost/data
|
23
|
+
- host/miqhost/scheduler
|
24
|
+
- host/miqhost/certs
|
25
|
+
- host/miqhost/miqhost.rb
|
26
|
+
- host/miqhost/expose_services.rb
|
27
|
+
- host/miqhost/MiqHostConfig.rb
|
28
|
+
- host/miqhost/process_queue.rb
|
29
|
+
- host/miqhost/heartbeat.rb
|
30
|
+
- host/miqhost/EmsEventMonitor.rb
|
31
|
+
- host/miqhost/InstallWin.rb
|
32
|
+
- host/miqhost/InstallLinux.rb
|
33
|
+
- host/miqhost/PlatformConfig.rb
|
34
|
+
- host/miqhost/UpdateAgent.rb
|
35
|
+
- host/miqhost/MiqTest.rb
|
36
|
+
- host/miqhost/MiqHostWebServer.rb
|
37
|
+
# miq-cmd
|
38
|
+
- host/miq-cmd/main.rb
|
39
|
+
:exclude:
|
40
|
+
- !ruby/regexp /\/\.svn/
|
41
|
+
- !ruby/regexp /~$/
|
42
|
+
- !ruby/regexp /\/NTFSCPP/
|
43
|
+
- !ruby/regexp /\/TestVm/
|
44
|
+
- !ruby/regexp /\/mk4test/
|
45
|
+
- !ruby/regexp /\.c$/
|
46
|
+
- !ruby/regexp /\.h$/
|
47
|
+
- !ruby/regexp /\.o$/
|
48
|
+
- !ruby/regexp /\.vhd$/
|
49
|
+
- !ruby/regexp /\.vmdk$/
|
50
|
+
- !ruby/regexp /dos_mbr.img$/
|
51
|
+
- !ruby/regexp /test.rb$/
|
52
|
+
- !ruby/regexp /test$/
|
53
|
+
- !ruby/regexp /\/rdoc$/
|
54
|
+
- !ruby/regexp /\/examples$/
|
55
|
+
- !ruby/regexp /\/doc$/
|
56
|
+
- !ruby/regexp /\/miqCryptInit.rb$/
|
57
|
+
- !ruby/regexp /\/miqbb100.zip$/
|
58
|
+
- !ruby/regexp /\/VMwareWebService\/.*\.wsdl$/
|
59
|
+
:encrypt:
|
60
|
+
- !ruby/regexp /\.rb$/
|
61
|
+
:noencrypt:
|
62
|
+
- !ruby/regexp /\/encryption\//
|
63
|
+
- !ruby/regexp /\/etc\//
|
64
|
+
- !ruby/regexp /\/MetakitFS.rb$/
|
65
|
+
- !ruby/regexp /\/init.rb$/
|
66
|
+
:compress:
|
67
|
+
- !ruby/regexp /miq_lib_hooks.so$/
|
68
|
+
- !ruby/regexp /.*$/
|
69
|
+
:nocompress:
|
70
|
+
- !ruby/regexp /\/init.rb$/
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'log4r'
|
2
|
+
require 'ostruct'
|
3
|
+
require 'disk/MiqDisk'
|
4
|
+
|
5
|
+
VMDK = "/Volumes/WDpassport/Virtual Machines/Red Hat Linux.vmwarevm/payload2.vmdk"
|
6
|
+
MKFILE = "rawmkfs"
|
7
|
+
|
8
|
+
#
|
9
|
+
# Formatter to output log messages to the console.
|
10
|
+
#
|
11
|
+
class ConsoleFormatter < Log4r::Formatter
|
12
|
+
def format(event)
|
13
|
+
(event.data.kind_of?(String) ? event.data : event.data.inspect) + "\n"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
$log = Log4r::Logger.new 'toplog'
|
17
|
+
$log.level = Log4r::DEBUG
|
18
|
+
Log4r::StderrOutputter.new('err_console', :formatter => ConsoleFormatter)
|
19
|
+
$log.add 'err_console'
|
20
|
+
|
21
|
+
diskInfo = OpenStruct.new
|
22
|
+
diskInfo.mountMode = "rw"
|
23
|
+
diskInfo.fileName = VMDK
|
24
|
+
|
25
|
+
disk = MiqDisk.getDisk(diskInfo)
|
26
|
+
|
27
|
+
unless disk
|
28
|
+
puts "Failed to open disk: #{diskInfo.fileName}"
|
29
|
+
exit(1)
|
30
|
+
end
|
31
|
+
|
32
|
+
puts "Disk type: #{disk.diskType}"
|
33
|
+
puts "Disk partition type: #{disk.partType}"
|
34
|
+
puts "Disk block size: #{disk.blockSize}"
|
35
|
+
puts "Disk start LBA: #{disk.lbaStart}"
|
36
|
+
puts "Disk end LBA: #{disk.lbaEnd}"
|
37
|
+
puts "Disk start byte: #{disk.startByteAddr}"
|
38
|
+
puts "Disk end byte: #{disk.endByteAddr}"
|
39
|
+
puts
|
40
|
+
|
41
|
+
parts = disk.getPartitions
|
42
|
+
|
43
|
+
if parts && !parts.empty?
|
44
|
+
puts "Disk is partitioned, exiting"
|
45
|
+
exit(0)
|
46
|
+
end
|
47
|
+
|
48
|
+
diskSize = disk.endByteAddr - disk.startByteAddr
|
49
|
+
mkSize = File.size(MKFILE)
|
50
|
+
diskOffset = diskSize - mkSize
|
51
|
+
|
52
|
+
puts "Disk size: #{diskSize}"
|
53
|
+
puts "Mk size: #{mkSize}"
|
54
|
+
puts "Disk offset: #{diskOffset}"
|
55
|
+
|
56
|
+
mkf = File.open(MKFILE)
|
57
|
+
|
58
|
+
disk.seek(diskOffset)
|
59
|
+
while (buf = mkf.read(1024))
|
60
|
+
disk.write(buf, buf.length)
|
61
|
+
end
|
62
|
+
|
63
|
+
mkf.close
|
64
|
+
disk.close
|
@@ -0,0 +1,92 @@
|
|
1
|
+
|
2
|
+
#include <stdio.h>
|
3
|
+
#include <unistd.h>
|
4
|
+
#include <mk4.h>
|
5
|
+
#include <ruby.h>
|
6
|
+
|
7
|
+
const char *MK_FENTRY = "fentry[fpath:S,ftype:I,fsize:I,ftags:B,fdata:B]";
|
8
|
+
const char *MK_HASHVW = "sec[_H:I,_R:I]";
|
9
|
+
|
10
|
+
const char *SAMP_FILE = "/lib/fs/MetakitFS/test/init.rb";
|
11
|
+
|
12
|
+
const char *
|
13
|
+
get_exepath(char *argv[])
|
14
|
+
{
|
15
|
+
static char exe_path[PATH_MAX];
|
16
|
+
# if defined (WIN)
|
17
|
+
GetModuleFileName(NULL, exe_path, MPATH_MAX);
|
18
|
+
# elif defined (LINUX)
|
19
|
+
char proc_path[MPATH_MAX];
|
20
|
+
int len;
|
21
|
+
|
22
|
+
sprintf(proc_path, "/proc/%d/exe", getpid());
|
23
|
+
if ((len = readlink(proc_path, exe_path, sizeof(exe_path)-1)) != -1) {
|
24
|
+
exe_path[len] = '\0';
|
25
|
+
}
|
26
|
+
else {
|
27
|
+
perror(proc_path);
|
28
|
+
exit(1);
|
29
|
+
}
|
30
|
+
# else
|
31
|
+
char *p;
|
32
|
+
|
33
|
+
if ((p = getenv("_")) != NULL) {
|
34
|
+
strcpy(exe_path, p);
|
35
|
+
}
|
36
|
+
else {
|
37
|
+
strcpy(exe_path, argv[0]);
|
38
|
+
}
|
39
|
+
# endif
|
40
|
+
return(exe_path);
|
41
|
+
}
|
42
|
+
|
43
|
+
main(int argc, char *argv[])
|
44
|
+
{
|
45
|
+
int findex;
|
46
|
+
long flen;
|
47
|
+
const t4_byte *buf_ptr;
|
48
|
+
c4_Row findRow;
|
49
|
+
c4_Row row;
|
50
|
+
|
51
|
+
c4_StringProp pPath("fpath");
|
52
|
+
c4_IntProp pType("ftype");
|
53
|
+
c4_IntProp pSize("fsize");
|
54
|
+
c4_BytesProp pData("fdata");
|
55
|
+
|
56
|
+
c4_Storage storage (get_exepath(argv), true);
|
57
|
+
printf("Descriptiom: %s\n", storage.Description());
|
58
|
+
|
59
|
+
c4_View vData = storage.GetAs(MK_FENTRY);
|
60
|
+
c4_View vSec = storage.GetAs(MK_HASHVW);
|
61
|
+
c4_View vFentry = vData.Hash(vSec, true);
|
62
|
+
|
63
|
+
pPath.Set(findRow, SAMP_FILE);
|
64
|
+
findex = vFentry.Find(findRow, 0);
|
65
|
+
printf("%s file index = %d\n", SAMP_FILE, findex);
|
66
|
+
|
67
|
+
if (findex < 0) {
|
68
|
+
printf("File not found: %s\n", SAMP_FILE);
|
69
|
+
exit(1);
|
70
|
+
}
|
71
|
+
|
72
|
+
row = vFentry.GetAt(findex);
|
73
|
+
printf("File: %s, Size: %d\n", pPath.Get(row), pSize.Get(row));
|
74
|
+
|
75
|
+
c4_Bytes file_data = pData.Get(row);
|
76
|
+
flen = file_data.Size();
|
77
|
+
printf("c4_Bytes.Size() = %ld\n", flen);
|
78
|
+
|
79
|
+
buf_ptr = file_data.Contents();
|
80
|
+
|
81
|
+
ruby_init();
|
82
|
+
ruby_init_loadpath();
|
83
|
+
|
84
|
+
rb_funcall(rb_mKernel, rb_intern("eval"), 3,
|
85
|
+
rb_str_new((const char *)buf_ptr, flen),
|
86
|
+
rb_const_get(rb_mKernel, rb_intern("TOPLEVEL_BINDING")),
|
87
|
+
rb_str_new2("myFile.rb"));
|
88
|
+
|
89
|
+
ruby_finalize();
|
90
|
+
exit(0);
|
91
|
+
}
|
92
|
+
|
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
require 'find'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
require 'fs/MiqFS/MiqFS'
|
6
|
+
require 'fs/MetakitFS/MetakitFS'
|
7
|
+
|
8
|
+
# MK_FILE = "mk4test"
|
9
|
+
MK_FILE = "newmkfs"
|
10
|
+
FROM_DIR = "../.."
|
11
|
+
SAMP_FILE = "/lib/fs/MetakitFS/MetakitFS.rb"
|
12
|
+
|
13
|
+
def copyIn(fs, ff, tf)
|
14
|
+
File.open(ff) do |ffo|
|
15
|
+
tfo = fs.fileOpen(tf, "wb")
|
16
|
+
while (buf = ffo.read(1024))
|
17
|
+
tfo.write(buf, buf.length)
|
18
|
+
end
|
19
|
+
tfo.close
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
begin
|
24
|
+
# begin
|
25
|
+
# File.delete(MK_FILE)
|
26
|
+
# rescue
|
27
|
+
# end
|
28
|
+
# FileUtils.cp("hello", MK_FILE)
|
29
|
+
|
30
|
+
dobj = OpenStruct.new
|
31
|
+
dobj.mkfile = MK_FILE
|
32
|
+
dobj.create = true
|
33
|
+
|
34
|
+
unless MetakitFS.supported?(dobj)
|
35
|
+
puts "#{MK_FILE} is not a mkfs"
|
36
|
+
exit
|
37
|
+
end
|
38
|
+
|
39
|
+
mkFS = MiqFS.new(MetakitFS, dobj)
|
40
|
+
|
41
|
+
# Dir.chdir FROM_DIR
|
42
|
+
# Find.find(".") do |path|
|
43
|
+
# if File.directory? path
|
44
|
+
# Find.prune if File.basename(path) == ".svn"
|
45
|
+
# puts "Creating directory: #{path}"
|
46
|
+
# mkFS.dirMkdir(path)
|
47
|
+
# else
|
48
|
+
# next if File.basename(path) == MK_FILE
|
49
|
+
# puts "Copying file: #{path}"
|
50
|
+
# copyIn(mkFS, path, path)
|
51
|
+
# end
|
52
|
+
# end
|
53
|
+
|
54
|
+
puts
|
55
|
+
puts "*****************************"
|
56
|
+
puts
|
57
|
+
|
58
|
+
# puts "fsId = #{mkFS.fsId}"
|
59
|
+
# puts "Tags for /:"
|
60
|
+
# mkFS.tags("/").each { |t| puts "\t#{t}" }
|
61
|
+
# puts
|
62
|
+
|
63
|
+
mkFS.findEach("/") do |path|
|
64
|
+
puts "\t#{path}"
|
65
|
+
mkFS.fileOpen(path) do |_fo|
|
66
|
+
# tags = fo.tags
|
67
|
+
# if !tags.empty?
|
68
|
+
# puts "\tTAGS:"
|
69
|
+
# tags.each { |t| puts "\t\t#{t}" }
|
70
|
+
# puts
|
71
|
+
# end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
unless mkFS.hasTagName?("/", "LABEL")
|
76
|
+
puts "*** Adding label..."
|
77
|
+
mkFS.tagAdd("/", "LABEL=MIQPAYLOAD")
|
78
|
+
end
|
79
|
+
|
80
|
+
exit
|
81
|
+
|
82
|
+
puts
|
83
|
+
puts "*****************************"
|
84
|
+
puts
|
85
|
+
|
86
|
+
fo = mkFS.fileOpen(SAMP_FILE)
|
87
|
+
fo.addTag("Rich")
|
88
|
+
fo.addTag("was")
|
89
|
+
fo.addTag("here")
|
90
|
+
fo.close
|
91
|
+
|
92
|
+
puts "FILE: #{SAMP_FILE}"
|
93
|
+
mkFS.fileOpen(SAMP_FILE) do |fo|
|
94
|
+
puts "\tTAGS:"
|
95
|
+
fo.tags.each { |t| puts "\t\t#{t}" }
|
96
|
+
puts
|
97
|
+
puts "***** CONTENTS:"
|
98
|
+
unzipper = Zlib::Inflate.new
|
99
|
+
while (buf = fo.read(1024)).length != 0
|
100
|
+
unzipper << buf
|
101
|
+
end
|
102
|
+
puts unzipper.inflate(nil)
|
103
|
+
end
|
104
|
+
|
105
|
+
fo = mkFS.fileOpen(SAMP_FILE)
|
106
|
+
fo.deleteTag("was")
|
107
|
+
puts "\tTAGS:"
|
108
|
+
fo.tags.each { |t| puts "\t\t#{t}" }
|
109
|
+
fo.close
|
110
|
+
rescue => err
|
111
|
+
puts err.to_s
|
112
|
+
puts err.backtrace.join("\n")
|
113
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'mk4rb'
|
2
|
+
|
3
|
+
require "fs/MetakitFS/MetakitFS"
|
4
|
+
|
5
|
+
TYPE_FILE = 1
|
6
|
+
TYPE_DIR = 2
|
7
|
+
|
8
|
+
TEST_DATA = "Hello World\n"
|
9
|
+
|
10
|
+
begin
|
11
|
+
pPath = Metakit::StringProp.new "fpath"
|
12
|
+
pType, pSize = Metakit::IntProp[:ftype, :fsize]
|
13
|
+
pData = Metakit::BytesProp.new "fdata"
|
14
|
+
|
15
|
+
Metakit::Storage.open("myfile.dat", 1) do |storage|
|
16
|
+
puts "Description: #{storage.description}"
|
17
|
+
vData = storage.get_as MetakitFS::MK_FENTRY
|
18
|
+
vSec = storage.get_as MetakitFS::MK_HASHVW
|
19
|
+
vFentry = vData.hash(vSec, 1)
|
20
|
+
|
21
|
+
row = Metakit::Row.new
|
22
|
+
|
23
|
+
pPath.set row, "/etc/passwd"
|
24
|
+
pType.set row, TYPE_FILE
|
25
|
+
pSize.set row, 0
|
26
|
+
data = Metakit::Bytes.new("", 0)
|
27
|
+
pData.set row, data
|
28
|
+
vFentry.add row
|
29
|
+
|
30
|
+
pPath.set row, "/etc/hosts"
|
31
|
+
vFentry.add row
|
32
|
+
|
33
|
+
storage.commit
|
34
|
+
end # Metakit::Storage.open
|
35
|
+
|
36
|
+
findrow = Metakit::Row.new
|
37
|
+
|
38
|
+
Metakit::Storage.open("myfile.dat", 1) do |storage|
|
39
|
+
puts "Description: #{storage.description}"
|
40
|
+
raise "myfile.dat is not a MetakitFS" if storage.description != "#{MetakitFS::MK_FENTRY},#{MetakitFS::MK_HASHVW}"
|
41
|
+
vData = storage.get_as MetakitFS::MK_FENTRY
|
42
|
+
vSec = storage.get_as MetakitFS::MK_HASHVW
|
43
|
+
vFentry = vData.hash(vSec, 1)
|
44
|
+
|
45
|
+
(1..100).each do |n|
|
46
|
+
pPath.set findrow, "/etc/hosts"
|
47
|
+
idxsearch = vFentry.find(findrow, 0)
|
48
|
+
puts "idxsearch = #{idxsearch}"
|
49
|
+
raise "File not found: /etc/hosts" if idxsearch < 0
|
50
|
+
|
51
|
+
r = vFentry[idxsearch]
|
52
|
+
puts "row = #{r}"
|
53
|
+
|
54
|
+
puts "Path: #{pPath.get(r)}"
|
55
|
+
dataRef = pData.ref(r)
|
56
|
+
dsize = pSize.get(r)
|
57
|
+
puts "Data size: #{dsize}"
|
58
|
+
|
59
|
+
ds = "Line: #{n}\n"
|
60
|
+
data = Metakit::Bytes.new(ds, ds.length)
|
61
|
+
dataRef.modify(data, dsize, data.size)
|
62
|
+
# dataRef.modify(data, 8, 0) if n == 99
|
63
|
+
pSize.set(r, dsize + data.size)
|
64
|
+
|
65
|
+
storage.commit
|
66
|
+
end
|
67
|
+
|
68
|
+
puts
|
69
|
+
puts "****************"
|
70
|
+
puts
|
71
|
+
|
72
|
+
pPath.set findrow, "/etc/hosts"
|
73
|
+
idxsearch = vFentry.find(findrow, 0)
|
74
|
+
raise "File not found: /etc/hosts" if idxsearch < 0
|
75
|
+
|
76
|
+
r = vFentry[idxsearch]
|
77
|
+
|
78
|
+
puts "Path: #{pPath.get(r)}"
|
79
|
+
puts "idxsearch = #{idxsearch}"
|
80
|
+
puts "row = #{r}"
|
81
|
+
dataRef = pData.ref(r)
|
82
|
+
dsize = pSize.get(r)
|
83
|
+
puts "Data size: #{dsize}"
|
84
|
+
|
85
|
+
rs = 100
|
86
|
+
rp = 0
|
87
|
+
loop do
|
88
|
+
rb = dataRef.access(rp, rs)
|
89
|
+
break if rb.size == 0
|
90
|
+
print rb.contents
|
91
|
+
rp += rs
|
92
|
+
end
|
93
|
+
end
|
94
|
+
rescue => err
|
95
|
+
puts err.to_s
|
96
|
+
puts err.backtrace.join("\n")
|
97
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module FsProbe
|
2
|
+
MODDIR = File.expand_path(File.join(File.dirname(__FILE__), "modules"))
|
3
|
+
|
4
|
+
PROBE_FILES = Dir.glob(File.join(MODDIR, "*Probe.rb*"))
|
5
|
+
PROBE_FILES.each do |p|
|
6
|
+
p.slice!(0..MODDIR.length)
|
7
|
+
p.chomp!(".enc")
|
8
|
+
p.chomp!(".rb")
|
9
|
+
end
|
10
|
+
# Reorder known probes for optimization
|
11
|
+
PROBE_FILES.unshift("Fat32Probe") if PROBE_FILES.delete("Fat32Probe")
|
12
|
+
PROBE_FILES.unshift("Reiser4Probe") if PROBE_FILES.delete("Reiser4Probe")
|
13
|
+
PROBE_FILES.unshift("ReiserFSProbe") if PROBE_FILES.delete("ReiserFSProbe")
|
14
|
+
PROBE_FILES.unshift("Ext4Probe") if PROBE_FILES.delete("Ext4Probe")
|
15
|
+
PROBE_FILES.unshift("Ext3Probe") if PROBE_FILES.delete("Ext3Probe")
|
16
|
+
PROBE_FILES.unshift("NTFSProbe") if PROBE_FILES.delete("NTFSProbe")
|
17
|
+
PROBE_FILES.unshift("XFSProbe") if PROBE_FILES.delete("XFSProbe")
|
18
|
+
|
19
|
+
def self.getFsMod(dobj, probes = nil)
|
20
|
+
probes = PROBE_FILES if probes.nil?
|
21
|
+
probes = [probes] unless probes.kind_of?(Array)
|
22
|
+
|
23
|
+
fname = dobj.dInfo.fileName || "" rescue ""
|
24
|
+
fname = dobj.dInfo.lvObj.lvName || "" if fname.empty? rescue ""
|
25
|
+
partNum = dobj.partNum
|
26
|
+
|
27
|
+
probes.each do |pmod|
|
28
|
+
$log.debug "MIQ(FsProbe-getFsMod) FS probe attempting [#{pmod}] for [#{fname}] [partition: #{partNum}]"
|
29
|
+
require_relative "modules/#{pmod}"
|
30
|
+
if Object.const_get(pmod).probe(dobj)
|
31
|
+
mod = pmod.chomp("Probe")
|
32
|
+
$log.info "MIQ(FsProbe-getFsMod) FS probe detected [#{mod}] for [#{fname}] [partition: #{partNum}]"
|
33
|
+
require_relative "modules/#{mod}"
|
34
|
+
return Object.const_get(mod)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
end
|