File: merge-internal-vmodl.rb

package info (click to toggle)
ruby-rbvmomi 1.8.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,756 kB
  • sloc: ruby: 5,590; sh: 36; makefile: 7
file content (59 lines) | stat: -rwxr-xr-x 1,821 bytes parent folder | download | duplicates (3)
1
2
3
4
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
#!/usr/bin/env ruby
# These types are not public and so may change between releases. Do not
# use them directly.

public_vmodl_filename = ARGV[0] or abort "public vmodl filename required"
internal_vmodl_filename = ARGV[1] or abort "internal vmodl filename required"
output_vmodl_filename = ARGV[2] or abort "output vmodl filename required"

TYPES = %w(
DVSKeyedOpaqueData
DVSOpaqueDataConfigSpec
DVPortgroupSelection
DVPortSelection
DVSSelection
DynamicTypeEnumTypeInfo
DynamicTypeMgrAllTypeInfo
DynamicTypeMgrAnnotation
DynamicTypeMgrDataTypeInfo
DynamicTypeMgrFilterSpec
DynamicTypeMgrManagedTypeInfo
DynamicTypeMgrMethodTypeInfo
DynamicTypeMgrMethodTypeInfoAnnotationType
DynamicTypeMgrMoFilterSpec
DynamicTypeMgrMoInstance
DynamicTypeMgrParamTypeInfo
DynamicTypeMgrParamTypeInfoAnnotationType
DynamicTypeMgrPropertyTypeInfo
DynamicTypeMgrPropertyTypeInfoAnnotationType
DynamicTypeMgrTypeFilterSpec
InternalDynamicTypeManager
ReflectManagedMethodExecuter
ReflectManagedMethodExecuterSoapArgument
ReflectManagedMethodExecuterSoapFault
ReflectManagedMethodExecuterSoapResult
SelectionSet
)

METHODS = %w(
DistributedVirtualSwitchManager.UpdateDvsOpaqueData_Task
HostSystem.RetrieveDynamicTypeManager
HostSystem.RetrieveManagedMethodExecuter
)

public_vmodl = File.open(public_vmodl_filename, 'r') { |io| Marshal.load io }
internal_vmodl = File.open(internal_vmodl_filename, 'r') { |io| Marshal.load io }

TYPES.each do |k|
  puts "Merging in #{k}"
  fail "Couldn't find type #{k} in internal VMODL" unless internal_vmodl.member? k
  public_vmodl[k] = internal_vmodl[k]
end

METHODS.each do |x|
  puts "Merging in #{x}"
  type, method = x.split '.'
  public_vmodl[type]['methods'][method] = internal_vmodl[type]['methods'][method] or fail
end

File.open(output_vmodl_filename, 'w') { |io| Marshal.dump public_vmodl, io }