fog-ovirt 1.2.1 → 1.2.2

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
  SHA256:
3
- metadata.gz: 8782e80f74881843f3d5cfdf3537289c1f828190f9285905989d75f486252d13
4
- data.tar.gz: b9088bc35338d04d9b6408ad91ff11db4623a998ca84346e2bce9c726b449e28
3
+ metadata.gz: 62f57ba56922d0b42dcb1630ca68d8eeaddadb546af155531f067cb69a827f6c
4
+ data.tar.gz: 8cd2223ae09ba6b051766f3c2adf16f16108aa62054809a2a67bc8d9a701b1f0
5
5
  SHA512:
6
- metadata.gz: b25cf3dc201edb0a1b53fadab1d10182d3a7de3ecd26fed18c1e3c19ccad9d2855465f6e8e4f551aa4fcb685058db544e9baf730a90934bb7968e2dda3b770ca
7
- data.tar.gz: e2423a8441309249034df7311e1884265fc5a1c747e3d3f20cb3a182747b8626d3137dd73b23bf02c589af499377a05f318fe8616a242db9f5a31a9f30a5a0a7
6
+ metadata.gz: 01da7011f032c165a82bd81fee927aa1692c5e5f47f6d3a4ff9520d6e2dce4eb05c5b63ce03fe31104da8cf50ab9f1c6416411daf74421e454b5dd4906271e74
7
+ data.tar.gz: 627e9e59398bd1a035d9e9d93fee254830dd57308d41652a2ad61a6f8c4027e9a0950a3ccd0eef14314e4384a3e6e1bea26720b2aadf13a89cb504eb72075b6a
@@ -78,10 +78,10 @@ module Fog
78
78
  class Mock
79
79
  def initialize(options = {})
80
80
  if options[:api_version] == "v4"
81
- Fog::Ovirt::Compute::V4::Mock.send(:include, Fog::Ovirt::Compute::Collections)
81
+ Fog::Ovirt::Compute::V4::Mock.include Fog::Ovirt::Compute::Collections
82
82
  @client = Fog::Ovirt::Compute::V4::Mock.new(options)
83
83
  else
84
- Fog::Ovirt::Compute::V3::Mock.send(:include, Fog::Ovirt::Compute::Collections)
84
+ Fog::Ovirt::Compute::V3::Mock.include Fog::Ovirt::Compute::Collections
85
85
  @client = Fog::Ovirt::Compute::V3::Mock.new(options)
86
86
  end
87
87
  end
@@ -100,10 +100,10 @@ module Fog
100
100
  class Real
101
101
  def initialize(options = {})
102
102
  if options[:api_version] == "v4"
103
- Fog::Ovirt::Compute::V4::Real.send(:include, Fog::Ovirt::Compute::Collections)
103
+ Fog::Ovirt::Compute::V4::Real.include Fog::Ovirt::Compute::Collections
104
104
  @client = Fog::Ovirt::Compute::V4::Real.new(options)
105
105
  else
106
- Fog::Ovirt::Compute::V3::Real.send(:include, Fog::Ovirt::Compute::Collections)
106
+ Fog::Ovirt::Compute::V3::Real.include Fog::Ovirt::Compute::Collections
107
107
  @client = Fog::Ovirt::Compute::V3::Real.new(options)
108
108
  end
109
109
  end
@@ -34,6 +34,7 @@ module Fog
34
34
  request :list_template_volumes
35
35
  request :list_volumes
36
36
  request :add_volume
37
+ request :get_volume
37
38
  request :destroy_volume
38
39
  request :update_volume
39
40
  request :attach_volume
@@ -33,6 +33,7 @@ module Fog
33
33
  request :list_template_volumes
34
34
  request :list_volumes
35
35
  request :add_volume
36
+ request :get_volume
36
37
  request :destroy_volume
37
38
  request :update_volume
38
39
  request :get_api_version
@@ -111,20 +112,22 @@ module Fog
111
112
  end
112
113
  # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
113
114
 
114
- def convert_string_to_bool(opts)
115
- return opts unless opts.present?
116
- opts.each do |key, value|
117
- if value == "true"
118
- opts[key] = true
119
- elsif value == "false"
120
- opts[key] = false
121
- elsif value.is_a? Hash
122
- convert_string_to_bool(value)
123
- elsif value.is_a? Array
124
- value.map { |item| convert_string_to_bool(item) }
115
+ def convert_string_to_bool(value)
116
+ case value
117
+ when "true"
118
+ true
119
+ when "false"
120
+ false
121
+ when Array
122
+ value.map { |elem| convert_string_to_bool(elem) }
123
+ when Hash
124
+ value.each do |key, elem|
125
+ value[key] = convert_string_to_bool(elem)
125
126
  end
127
+ value
128
+ else
129
+ value
126
130
  end
127
- opts
128
131
  end
129
132
  end
130
133
 
@@ -10,6 +10,7 @@ module Fog
10
10
  attribute :description
11
11
  attribute :memory
12
12
  attribute :cores
13
+ attribute :sockets
13
14
  attribute :creation_time
14
15
  attribute :os
15
16
  attribute :ha
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module Ovirt
3
+ class Compute
4
+ class V3
5
+ class Real
6
+ def get_volume(id)
7
+ ovirt_attrs client.disk(id)
8
+ end
9
+ end
10
+ class Mock
11
+ def get_volume(_id)
12
+ xml = read_xml("volume.xml")
13
+ ovirt_attrs OVIRT::Volume.new(self, Nokogiri::XML(xml).root)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,21 @@
1
+ <disks>
2
+ <disk href="/api/vms/192cdd3f-3281-4e20-b81d-93bdc57ac387/disks/9f68ecfd-218b-4f80-8e7a-e70b2ab054cd" id="9f68ecfd-218b-4f80-8e7a-e70b2ab054cd">
3
+ <name>Disk 2</name>
4
+ <link href="/api/vms/192cdd3f-3281-4e20-b81d-93bdc57ac387/disks/9f68ecfd-218b-4f80-8e7a-e70b2ab054cd/statistics" rel="statistics"/>
5
+ <vm href="/api/vms/192cdd3f-3281-4e20-b81d-93bdc57ac387" id="192cdd3f-3281-4e20-b81d-93bdc57ac387"/>
6
+ <storage_domains>
7
+ <storage_domain id="cba62b33-887a-410c-b367-e3d9229a72f7"/>
8
+ </storage_domains>
9
+ <size>5368709120</size>
10
+ <type>data</type>
11
+ <status>
12
+ <state>ok</state>
13
+ </status>
14
+ <interface>virtio</interface>
15
+ <format>raw</format>
16
+ <sparse>true</sparse>
17
+ <bootable>false</bootable>
18
+ <wipe_after_delete>false</wipe_after_delete>
19
+ <propagate_errors>false</propagate_errors>
20
+ </disk>
21
+ </disks>
@@ -40,6 +40,8 @@ module Fog
40
40
  end
41
41
 
42
42
  vms_service = client.system_service.vms_service
43
+
44
+ attrs[:type] = attrs.fetch(:type, OvirtSDK4::VmType::SERVER)
43
45
  attrs[:instance_type] = attrs[:instance_type].present? ? client.system_service.instance_types_service.instance_type_service(attrs[:instance_type]).get : nil
44
46
 
45
47
  if attrs[:template].present?
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module Ovirt
3
+ class Compute
4
+ class V4
5
+ class Real
6
+ def get_volume(id)
7
+ ovirt_attrs client.system_service.disks_service.disk_service(id).get
8
+ end
9
+ end
10
+ class Mock
11
+ def get_volume(_id)
12
+ xml = read_xml("disk.xml")
13
+ ovirt_attrs OvirtSDK4::Reader.read(Nokogiri::XML(xml).root.to_s)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,28 @@
1
+ <disks>
2
+ <disk href="/api/disks/4d1abf9a-da81-4de2-bf20-f5f060018e05" id="4d1abf9a-da81-4de2-bf20-f5f060018e05">
3
+ <actions>
4
+ <link href="/api/disks/4d1abf9a-da81-4de2-bf20-f5f060018e05/export" rel="export"/>
5
+ <link href="/api/disks/4d1abf9a-da81-4de2-bf20-f5f060018e05/move" rel="move"/>
6
+ <link href="/api/disks/4d1abf9a-da81-4de2-bf20-f5f060018e05/copy" rel="copy"/>
7
+ </actions>
8
+ <name>Disk 2</name>
9
+ <link href="/api/disks/4d1abf9a-da81-4de2-bf20-f5f060018e05/permissions" rel="permissions"/>
10
+ <link href="/api/disks/4d1abf9a-da81-4de2-bf20-f5f060018e05/statistics" rel="statistics"/>
11
+ <alias>Disk 2</alias>
12
+ <image_id>d6034a90-39fa-46ee-888f-208a76f3baa4</image_id>
13
+ <storage_domains>
14
+ <storage_domain id="a23a4329-33b9-4246-a393-4f91071825b6"/>
15
+ </storage_domains>
16
+ <provisioned_size>4294967296</provisioned_size>
17
+ <actual_size>1073741824</actual_size>
18
+ <status>ok</status>
19
+ <interface>virtio</interface>
20
+ <format>cow</format>
21
+ <qcow_version>qcow2_v3</qcow_version>
22
+ <sparse>true</sparse>
23
+ <bootable>false</bootable>
24
+ <shareable>false</shareable>
25
+ <wipe_after_delete>false</wipe_after_delete>
26
+ <propagate_errors>false</propagate_errors>
27
+ </disk>
28
+ </disks>
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Ovirt
3
- VERSION = "1.2.1".freeze
3
+ VERSION = "1.2.2".freeze
4
4
  end
5
5
  end
@@ -0,0 +1,23 @@
1
+ Shindo.tests("Fog::Ovirt::Compute.new | instance_type model", ["ovirt"]) do
2
+ instance_types = Fog::Ovirt::Compute.new.instance_types
3
+ instance_type = instance_types.last
4
+
5
+ tests("The instance_type model should") do
6
+ tests("have attributes") do
7
+ model_attribute_hash = instance_type.attributes
8
+ attributes = %i[id name memory sockets cores]
9
+
10
+ tests("The instance type model should respond to") do
11
+ attributes.each do |attribute|
12
+ test(attribute.to_s) { instance_type.respond_to? attribute }
13
+ end
14
+ end
15
+ tests("The attributes hash should have key") do
16
+ attributes.each do |attribute|
17
+ test(attribute.to_s) { model_attribute_hash.key? attribute }
18
+ end
19
+ end
20
+ end
21
+ test("be a kind of Fog::Ovirt::Compute::InstanceType") { instance_type.is_a? Fog::Ovirt::Compute::InstanceType }
22
+ end
23
+ end
@@ -0,0 +1,7 @@
1
+ Shindo.tests("Fog::Ovirt::Compute.new | instance types collection", ["ovirt"]) do
2
+ instance_types = Fog::Ovirt::Compute.new.instance_types
3
+
4
+ tests("The instance types collection") do
5
+ test("should be a kind of Fog::Ovirt::Compute::InstanceTypes") { instance_types.is_a? Fog::Ovirt::Compute::InstanceTypes }
6
+ end
7
+ end
@@ -5,6 +5,7 @@ Shindo.tests("Fog::Ovirt::Compute v4 | vm_create request", "ovirt") do
5
5
  tests("Create VM") do
6
6
  response = compute.create_vm(:name => "fog-" + name_base.to_s, :cluster_name => "Default")
7
7
  test("should be a kind of OvirtSDK4::Vm") { response.is_a? OvirtSDK4::Vm }
8
+ test("should be a 'OvirtSDK4::VmType::SERVER' VM type by default") { response.type == OvirtSDK4::VmType::SERVER }
8
9
  end
9
10
 
10
11
  tests("Create VM from template (clone)") do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-ovirt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ori Rabin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-11 00:00:00.000000000 Z
11
+ date: 2019-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
@@ -212,6 +212,7 @@ files:
212
212
  - lib/fog/ovirt/requests/compute/v3/get_quota.rb
213
213
  - lib/fog/ovirt/requests/compute/v3/get_template.rb
214
214
  - lib/fog/ovirt/requests/compute/v3/get_virtual_machine.rb
215
+ - lib/fog/ovirt/requests/compute/v3/get_volume.rb
215
216
  - lib/fog/ovirt/requests/compute/v3/list_affinity_group_vms.rb
216
217
  - lib/fog/ovirt/requests/compute/v3/list_affinity_groups.rb
217
218
  - lib/fog/ovirt/requests/compute/v3/list_clusters.rb
@@ -243,6 +244,7 @@ files:
243
244
  - lib/fog/ovirt/requests/compute/v3/mock_files/templates.xml
244
245
  - lib/fog/ovirt/requests/compute/v3/mock_files/vm.xml
245
246
  - lib/fog/ovirt/requests/compute/v3/mock_files/vms.xml
247
+ - lib/fog/ovirt/requests/compute/v3/mock_files/volume.xml
246
248
  - lib/fog/ovirt/requests/compute/v3/mock_files/volumes.xml
247
249
  - lib/fog/ovirt/requests/compute/v3/remove_from_affinity_group.rb
248
250
  - lib/fog/ovirt/requests/compute/v3/storage_domains.rb
@@ -265,6 +267,7 @@ files:
265
267
  - lib/fog/ovirt/requests/compute/v4/get_quota.rb
266
268
  - lib/fog/ovirt/requests/compute/v4/get_template.rb
267
269
  - lib/fog/ovirt/requests/compute/v4/get_virtual_machine.rb
270
+ - lib/fog/ovirt/requests/compute/v4/get_volume.rb
268
271
  - lib/fog/ovirt/requests/compute/v4/list_clusters.rb
269
272
  - lib/fog/ovirt/requests/compute/v4/list_instance_types.rb
270
273
  - lib/fog/ovirt/requests/compute/v4/list_networks.rb
@@ -283,6 +286,7 @@ files:
283
286
  - lib/fog/ovirt/requests/compute/v4/mock_files/cluster.xml
284
287
  - lib/fog/ovirt/requests/compute/v4/mock_files/clusters.xml
285
288
  - lib/fog/ovirt/requests/compute/v4/mock_files/data_centers.xml
289
+ - lib/fog/ovirt/requests/compute/v4/mock_files/disk.xml
286
290
  - lib/fog/ovirt/requests/compute/v4/mock_files/disks.xml
287
291
  - lib/fog/ovirt/requests/compute/v4/mock_files/instance_type.xml
288
292
  - lib/fog/ovirt/requests/compute/v4/mock_files/instance_types.xml
@@ -311,6 +315,8 @@ files:
311
315
  - tests/ovirt/compute_tests.rb
312
316
  - tests/ovirt/models/compute/cluster_tests.rb
313
317
  - tests/ovirt/models/compute/clusters_tests.rb
318
+ - tests/ovirt/models/compute/instance_type_tests.rb
319
+ - tests/ovirt/models/compute/instance_types_tests.rb
314
320
  - tests/ovirt/models/compute/interface_tests.rb
315
321
  - tests/ovirt/models/compute/interfaces_tests.rb
316
322
  - tests/ovirt/models/compute/operating_system_tests.rb
@@ -364,6 +370,8 @@ test_files:
364
370
  - tests/ovirt/compute_tests.rb
365
371
  - tests/ovirt/models/compute/cluster_tests.rb
366
372
  - tests/ovirt/models/compute/clusters_tests.rb
373
+ - tests/ovirt/models/compute/instance_type_tests.rb
374
+ - tests/ovirt/models/compute/instance_types_tests.rb
367
375
  - tests/ovirt/models/compute/interface_tests.rb
368
376
  - tests/ovirt/models/compute/interfaces_tests.rb
369
377
  - tests/ovirt/models/compute/operating_system_tests.rb