ffi-vix_disk_lib 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ffi-vix_disk_lib/api.rb +12 -0
- data/lib/ffi-vix_disk_lib/struct.rb +18 -6
- data/lib/ffi-vix_disk_lib/version.rb +1 -1
- data/spec/ffi-vix_disk_lib/api_spec.rb +13 -0
- data/spec/ffi-vix_disk_lib/api_wrapper_spec.rb +15 -0
- data/spec/ffi-vix_disk_lib/version_spec.rb +5 -0
- data/spec/spec_helper.rb +3 -3
- metadata +9 -5
- data/spec/version_spec.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9398a5a0638208305f25188ce2b0e995813fd8ab
|
4
|
+
data.tar.gz: 2c7869d2fe4d8a755abb983be5af680ff1c3766a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fd76373bbe822f12aefc8c73d15e6eb8af51ee6c88e79b65c0b88a29893c3d9a09d10a533e085d45b94d85e58602bf9c7abc063f4a1b01412440990e8070810
|
7
|
+
data.tar.gz: 4720ac948e9a51e41914307b02a9f8610fb6bb3f8601bfaa0e681511000907611e6f80cbf3fd53a2ca0109840b7c3d32f01d921c732894d3e6db9f4c9ed4bfb0
|
data/lib/ffi-vix_disk_lib/api.rb
CHANGED
@@ -26,6 +26,7 @@ module FFI
|
|
26
26
|
begin
|
27
27
|
loaded_library = ffi_lib ["vixDiskLib.so.#{version}"]
|
28
28
|
VERSION_MAJOR, VERSION_MINOR = loaded_library.first.name.split(".")[2, 2].collect(&:to_i)
|
29
|
+
VERSION = version
|
29
30
|
if bad_versions.keys.include?(version)
|
30
31
|
loaded_library = ""
|
31
32
|
@load_error = "VixDiskLib #{version} is not supported: #{bad_versions[version]}"
|
@@ -61,6 +62,17 @@ module FFI
|
|
61
62
|
err != VixErrorType[:VIX_OK]
|
62
63
|
end
|
63
64
|
|
65
|
+
def self.evaluate_versioned_connect_params
|
66
|
+
case VERSION
|
67
|
+
when "6.5.0"
|
68
|
+
ConnectParams_6_5_0
|
69
|
+
else
|
70
|
+
ConnectParams_1_0_0
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
ConnectParams = evaluate_versioned_connect_params
|
75
|
+
|
64
76
|
callback :GenericLogFunc, [:string, :pointer], :void
|
65
77
|
|
66
78
|
# Prototype for the progress function called by VixDiskLib.
|
@@ -57,14 +57,26 @@ module FFI
|
|
57
57
|
#
|
58
58
|
# Example VM spec:
|
59
59
|
# "MyVm/MyVm.vmx?dcPath=Path/to/MyDatacenter&dsName=storage1"
|
60
|
-
class
|
61
|
-
layout :vmxSpec, :pointer,
|
62
|
-
:serverName, :pointer,
|
63
|
-
:thumbPrint, :pointer,
|
64
|
-
:privateUse, :long,
|
60
|
+
class ConnectParams_1_0_0 < FFI::Struct
|
61
|
+
layout :vmxSpec, :pointer, # URL like spec of the VM.
|
62
|
+
:serverName, :pointer, # Name or IP address of VC / ESX.
|
63
|
+
:thumbPrint, :pointer, # SSL Certificate thumb print.
|
64
|
+
:privateUse, :long, # This value is ignored.
|
65
65
|
:credType, CredType,
|
66
66
|
:creds, Creds,
|
67
|
-
:port, :uint32
|
67
|
+
:port, :uint32 # port to use for authenticating with VC/ESXi host
|
68
|
+
end
|
69
|
+
|
70
|
+
class ConnectParams_6_5_0 < FFI::Struct
|
71
|
+
layout :vmxSpec, :pointer, # URL like spec of the VM.
|
72
|
+
:serverName, :pointer, # Name or IP address of VC / ESX.
|
73
|
+
:thumbPrint, :pointer, # SSL Certificate thumb print.
|
74
|
+
:privateUse, :long, # This value is ignored.
|
75
|
+
:credType, CredType,
|
76
|
+
:creds, Creds,
|
77
|
+
:port, :uint32, # port to use for authenticating with VC/ESXi host
|
78
|
+
:nfcHostPort, :uint32, # port to use for establishing NFC connection to ESXi host
|
79
|
+
:vimApiVer, :pointer # VIM API version to use, private
|
68
80
|
end
|
69
81
|
|
70
82
|
class Info < FFI::Struct
|
@@ -0,0 +1,13 @@
|
|
1
|
+
describe FFI::VixDiskLib::API do
|
2
|
+
let(:major_version) { described_class::VERSION_MAJOR }
|
3
|
+
let(:minor_version) { described_class::VERSION_MINOR }
|
4
|
+
let(:log) { lambda { |_string, _pointer| } }
|
5
|
+
let(:lib_dir) { nil }
|
6
|
+
|
7
|
+
context "init" do
|
8
|
+
it "initializes successfully" do
|
9
|
+
err = described_class.init(major_version, minor_version, log, log, log, lib_dir)
|
10
|
+
expect(err).to eq(described_class::VixErrorType[:VIX_OK])
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'ffi-vix_disk_lib/api_wrapper'
|
2
|
+
|
3
|
+
describe FFI::VixDiskLib::ApiWrapper do
|
4
|
+
context "connect" do
|
5
|
+
before do
|
6
|
+
described_class.init
|
7
|
+
end
|
8
|
+
|
9
|
+
it "returns a connection" do
|
10
|
+
connect_params = {}
|
11
|
+
connection = described_class.connect(connect_params)
|
12
|
+
expect(connection).not_to be_nil
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-vix_disk_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jerry Keselman
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-12-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -91,8 +91,10 @@ files:
|
|
91
91
|
- lib/ffi-vix_disk_lib/safe_create_params.rb
|
92
92
|
- lib/ffi-vix_disk_lib/struct.rb
|
93
93
|
- lib/ffi-vix_disk_lib/version.rb
|
94
|
+
- spec/ffi-vix_disk_lib/api_spec.rb
|
95
|
+
- spec/ffi-vix_disk_lib/api_wrapper_spec.rb
|
96
|
+
- spec/ffi-vix_disk_lib/version_spec.rb
|
94
97
|
- spec/spec_helper.rb
|
95
|
-
- spec/version_spec.rb
|
96
98
|
homepage: http://github.com/ManageIQ/ffi-vix_disk_lib
|
97
99
|
licenses:
|
98
100
|
- APL 2.0
|
@@ -113,10 +115,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
115
|
version: '0'
|
114
116
|
requirements: []
|
115
117
|
rubyforge_project:
|
116
|
-
rubygems_version: 2.
|
118
|
+
rubygems_version: 2.6.12
|
117
119
|
signing_key:
|
118
120
|
specification_version: 4
|
119
121
|
summary: Ruby FFI Binding to VMware VixDiskLib.
|
120
122
|
test_files:
|
123
|
+
- spec/ffi-vix_disk_lib/api_spec.rb
|
124
|
+
- spec/ffi-vix_disk_lib/api_wrapper_spec.rb
|
125
|
+
- spec/ffi-vix_disk_lib/version_spec.rb
|
121
126
|
- spec/spec_helper.rb
|
122
|
-
- spec/version_spec.rb
|