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.
- checksums.yaml +5 -5
- data/.travis.yml +3 -2
- data/lib/manageiq/smartstate/version.rb +1 -1
- data/manageiq-smartstate.gemspec +1 -1
- metadata +3 -42
- data/lib/MiqVm/test/camcorder_fleece_test.rb +0 -52
- data/lib/MiqVm/test/localVm.rb +0 -38
- data/lib/MiqVm/test/partitionAlignmentCheck.rb +0 -67
- data/lib/MiqVm/test/remoteVm.rb +0 -56
- data/lib/MiqVm/test/rhevmNfsTest.rb +0 -54
- data/lib/MiqVm/test/rhevmNfsTest2.rb +0 -58
- data/lib/MiqVm/test/rhevmTest.rb +0 -62
- data/lib/Scvmm/test/miq_hyperv_disk_test.rb +0 -23
- data/lib/Scvmm/test/miq_scvmm_vm_ssa_info_test.rb +0 -31
- data/lib/VmLocalDiskAccess/test/localCfg.rb +0 -87
- data/lib/VolumeManager/test/blockDevTest.rb +0 -32
- data/lib/VolumeManager/test/ldm.rb +0 -90
- data/lib/fs/MetakitFS/test/Makefile +0 -14
- data/lib/fs/MetakitFS/test/MkCollectFiles.rb +0 -165
- data/lib/fs/MetakitFS/test/MkSelectFiles.rb +0 -20
- data/lib/fs/MetakitFS/test/collect_files.yaml +0 -70
- data/lib/fs/MetakitFS/test/init.rb +0 -3
- data/lib/fs/MetakitFS/test/mk2vmdk.rb +0 -54
- data/lib/fs/MetakitFS/test/mk4test.c +0 -92
- data/lib/fs/MetakitFS/test/mkFsTest.rb +0 -113
- data/lib/fs/MetakitFS/test/proto.rb +0 -97
- data/lib/fs/ext3/test/tc_Ext3BlockPointersPath.rb +0 -74
- data/lib/fs/test/camcorder_fs_test.rb +0 -98
- data/lib/fs/test/collect_files_direct.yaml +0 -22
- data/lib/fs/test/collect_files_in.yaml +0 -24
- data/lib/fs/test/collect_files_in_nc.yaml +0 -22
- data/lib/fs/test/collect_files_out.yaml +0 -6
- data/lib/fs/test/collect_files_rm.yaml +0 -6
- data/lib/fs/test/copyTest.rb +0 -116
- data/lib/fs/test/fsTest.rb +0 -77
- data/lib/fs/test/updateTest.rb +0 -174
- data/lib/metadata/MIQExtract/test/extractTest.rb +0 -33
- data/lib/metadata/MIQExtract/test/full_extract_test.rb +0 -67
- data/lib/metadata/VmConfig/test/GetVMwareCfgTest.rb +0 -40
- data/lib/metadata/linux/test/Name +0 -0
- data/lib/metadata/linux/test/Packages +0 -0
- data/lib/metadata/linux/test/rpoTest.rb +0 -5
- data/lib/metadata/linux/test/tc_LinuxUtils.rb +0 -4157
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'fs/MiqFsUtil'
|
2
|
-
require 'fs/MiqFS/MiqFS'
|
3
|
-
require 'fs/MetakitFS/MetakitFS'
|
4
|
-
require 'fs/MiqFS/modules/LocalFS'
|
5
|
-
|
6
|
-
require 'logger'
|
7
|
-
STDERR.sync = true
|
8
|
-
$log = Logger.new(STDERR)
|
9
|
-
$log.level = Logger::DEBUG
|
10
|
-
|
11
|
-
dobj = OpenStruct.new
|
12
|
-
dobj.mkfile = ARGV[1]
|
13
|
-
dobj.create = true
|
14
|
-
|
15
|
-
toFs = MiqFS.new(MetakitFS, dobj)
|
16
|
-
fromFs = MiqFS.new(LocalFS, nil)
|
17
|
-
|
18
|
-
cf = MiqFsUtil.new(fromFs, toFs, ARGV[0])
|
19
|
-
cf.verbose = true
|
20
|
-
cf.update
|
@@ -1,70 +0,0 @@
|
|
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$/
|
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'ostruct'
|
2
|
-
require 'disk/MiqDisk'
|
3
|
-
|
4
|
-
VMDK = "/Volumes/WDpassport/Virtual Machines/Red Hat Linux.vmwarevm/payload2.vmdk"
|
5
|
-
MKFILE = "rawmkfs"
|
6
|
-
|
7
|
-
require 'logger'
|
8
|
-
$log = Logger.new(STDERR)
|
9
|
-
$log.level = Logger::DEBUG
|
10
|
-
|
11
|
-
diskInfo = OpenStruct.new
|
12
|
-
diskInfo.mountMode = "rw"
|
13
|
-
diskInfo.fileName = VMDK
|
14
|
-
|
15
|
-
disk = MiqDisk.getDisk(diskInfo)
|
16
|
-
|
17
|
-
unless disk
|
18
|
-
puts "Failed to open disk: #{diskInfo.fileName}"
|
19
|
-
exit(1)
|
20
|
-
end
|
21
|
-
|
22
|
-
puts "Disk type: #{disk.diskType}"
|
23
|
-
puts "Disk partition type: #{disk.partType}"
|
24
|
-
puts "Disk block size: #{disk.blockSize}"
|
25
|
-
puts "Disk start LBA: #{disk.lbaStart}"
|
26
|
-
puts "Disk end LBA: #{disk.lbaEnd}"
|
27
|
-
puts "Disk start byte: #{disk.startByteAddr}"
|
28
|
-
puts "Disk end byte: #{disk.endByteAddr}"
|
29
|
-
puts
|
30
|
-
|
31
|
-
parts = disk.getPartitions
|
32
|
-
|
33
|
-
if parts && !parts.empty?
|
34
|
-
puts "Disk is partitioned, exiting"
|
35
|
-
exit(0)
|
36
|
-
end
|
37
|
-
|
38
|
-
diskSize = disk.endByteAddr - disk.startByteAddr
|
39
|
-
mkSize = File.size(MKFILE)
|
40
|
-
diskOffset = diskSize - mkSize
|
41
|
-
|
42
|
-
puts "Disk size: #{diskSize}"
|
43
|
-
puts "Mk size: #{mkSize}"
|
44
|
-
puts "Disk offset: #{diskOffset}"
|
45
|
-
|
46
|
-
mkf = File.open(MKFILE)
|
47
|
-
|
48
|
-
disk.seek(diskOffset)
|
49
|
-
while (buf = mkf.read(1024))
|
50
|
-
disk.write(buf, buf.length)
|
51
|
-
end
|
52
|
-
|
53
|
-
mkf.close
|
54
|
-
disk.close
|
@@ -1,92 +0,0 @@
|
|
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
|
-
|
@@ -1,113 +0,0 @@
|
|
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
|
@@ -1,97 +0,0 @@
|
|
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
|