ffi-vix_disk_lib 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c43c07f9524fec53d769fc90299cde4868b8819
4
- data.tar.gz: 165ccea6e0546c6b18cb6f2155adece6dd3efe79
3
+ metadata.gz: 9398a5a0638208305f25188ce2b0e995813fd8ab
4
+ data.tar.gz: 2c7869d2fe4d8a755abb983be5af680ff1c3766a
5
5
  SHA512:
6
- metadata.gz: aabbfae2cb4f45024217ecdda2c70b6f6dd8e8e18e681aa366adeabc5f76562edf255f38d0cf7dae6ce2b38025b7d879f51a9bbd474e7ace69377b2234552a39
7
- data.tar.gz: 580498a16f23a65fe838e5c4912492800a1df8f26307099e9ae190cfaddcba1fada74769bc30a563e99168dbcbca8a85091476c83936b463a0b33e2d22969eab
6
+ metadata.gz: 2fd76373bbe822f12aefc8c73d15e6eb8af51ee6c88e79b65c0b88a29893c3d9a09d10a533e085d45b94d85e58602bf9c7abc063f4a1b01412440990e8070810
7
+ data.tar.gz: 4720ac948e9a51e41914307b02a9f8610fb6bb3f8601bfaa0e681511000907611e6f80cbf3fd53a2ca0109840b7c3d32f01d921c732894d3e6db9f4c9ed4bfb0
@@ -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 ConnectParams < FFI::Struct
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
@@ -1,5 +1,5 @@
1
1
  module FFI
2
2
  module VixDiskLib
3
- VERSION = "1.0.3"
3
+ VERSION = "1.0.4"
4
4
  end
5
5
  end
@@ -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
@@ -0,0 +1,5 @@
1
+ describe FFI::VixDiskLib::VERSION do
2
+ it "must be defined" do
3
+ expect(FFI::VixDiskLib::VERSION).to_not be_nil
4
+ end
5
+ end
@@ -1,6 +1,3 @@
1
- require 'minitest'
2
- require 'minitest/autorun'
3
-
4
1
  begin
5
2
  require 'ffi-vix_disk_lib'
6
3
  rescue LoadError
@@ -15,3 +12,6 @@ EOMSG
15
12
 
16
13
  exit 1
17
14
  end
15
+
16
+ RSpec.configure do |config|
17
+ end
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.3
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-04-06 00:00:00.000000000 Z
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.4.5.1
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
@@ -1,7 +0,0 @@
1
- require_relative './spec_helper'
2
-
3
- describe FFI::VixDiskLib::VERSION do
4
- it "must be defined" do
5
- FFI::VixDiskLib::VERSION.wont_be_nil
6
- end
7
- end