fog-ovirt 1.2.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -0
- data/.rubocop_todo.yml +17 -5
- data/Gemfile +0 -1
- data/Gemfile.local.rb +0 -0
- data/README.md +2 -6
- data/Rakefile +2 -8
- data/fog-ovirt.gemspec +3 -2
- data/lib/fog/ovirt/compute.rb +5 -29
- data/lib/fog/ovirt/compute/v4.rb +42 -24
- data/lib/fog/ovirt/models/compute/instance_type.rb +1 -0
- data/lib/fog/ovirt/models/compute/interfaces.rb +0 -2
- data/lib/fog/ovirt/models/compute/server.rb +0 -2
- data/lib/fog/ovirt/models/compute/volume.rb +1 -0
- data/lib/fog/ovirt/models/compute/volumes.rb +0 -2
- data/lib/fog/ovirt/requests/compute/v4/add_interface.rb +0 -2
- data/lib/fog/ovirt/requests/compute/v4/add_volume.rb +2 -2
- data/lib/fog/ovirt/requests/compute/v4/create_vm.rb +4 -4
- data/lib/fog/ovirt/requests/compute/v4/get_volume.rb +19 -0
- data/lib/fog/ovirt/requests/compute/v4/list_template_volumes.rb +0 -2
- data/lib/fog/ovirt/requests/compute/v4/list_vm_volumes.rb +0 -2
- data/lib/fog/ovirt/requests/compute/v4/mock_files/disk.xml +28 -0
- data/lib/fog/ovirt/requests/compute/v4/mock_files/operating_systems.xml +4 -4
- data/lib/fog/ovirt/requests/compute/v4/mock_files/template.xml +48 -45
- data/lib/fog/ovirt/requests/compute/v4/mock_files/templates.xml +17 -2
- data/lib/fog/ovirt/requests/compute/v4/mock_files/vnic_profile.xml +10 -0
- data/lib/fog/ovirt/requests/compute/v4/storage_domains.rb +1 -0
- data/lib/fog/ovirt/requests/compute/v4/update_vm.rb +0 -2
- data/lib/fog/ovirt/version.rb +1 -1
- data/tests/ovirt/models/compute/instance_type_tests.rb +23 -0
- data/tests/ovirt/models/compute/instance_types_tests.rb +7 -0
- data/tests/ovirt/requests/compute/v4/client_tests.rb +1 -1
- data/tests/ovirt/requests/compute/v4/create_vm_tests.rb +1 -0
- metadata +28 -84
- data/lib/fog/ovirt/compute/v3.rb +0 -137
- data/lib/fog/ovirt/requests/compute/v3/activate_volume.rb +0 -23
- data/lib/fog/ovirt/requests/compute/v3/add_interface.rb +0 -22
- data/lib/fog/ovirt/requests/compute/v3/add_to_affinity_group.rb +0 -23
- data/lib/fog/ovirt/requests/compute/v3/add_volume.rb +0 -23
- data/lib/fog/ovirt/requests/compute/v3/attach_volume.rb +0 -24
- data/lib/fog/ovirt/requests/compute/v3/create_affinity_group.rb +0 -20
- data/lib/fog/ovirt/requests/compute/v3/create_vm.rb +0 -20
- data/lib/fog/ovirt/requests/compute/v3/datacenters.rb +0 -22
- data/lib/fog/ovirt/requests/compute/v3/deactivate_volume.rb +0 -24
- data/lib/fog/ovirt/requests/compute/v3/destroy_affinity_group.rb +0 -21
- data/lib/fog/ovirt/requests/compute/v3/destroy_interface.rb +0 -24
- data/lib/fog/ovirt/requests/compute/v3/destroy_vm.rb +0 -21
- data/lib/fog/ovirt/requests/compute/v3/destroy_volume.rb +0 -24
- data/lib/fog/ovirt/requests/compute/v3/detach_volume.rb +0 -24
- data/lib/fog/ovirt/requests/compute/v3/get_affinity_group.rb +0 -20
- data/lib/fog/ovirt/requests/compute/v3/get_api_version.rb +0 -18
- data/lib/fog/ovirt/requests/compute/v3/get_cluster.rb +0 -19
- data/lib/fog/ovirt/requests/compute/v3/get_instance_type.rb +0 -19
- data/lib/fog/ovirt/requests/compute/v3/get_quota.rb +0 -19
- data/lib/fog/ovirt/requests/compute/v3/get_template.rb +0 -19
- data/lib/fog/ovirt/requests/compute/v3/get_virtual_machine.rb +0 -19
- data/lib/fog/ovirt/requests/compute/v3/list_affinity_group_vms.rb +0 -24
- data/lib/fog/ovirt/requests/compute/v3/list_affinity_groups.rb +0 -22
- data/lib/fog/ovirt/requests/compute/v3/list_clusters.rb +0 -21
- data/lib/fog/ovirt/requests/compute/v3/list_instance_types.rb +0 -21
- data/lib/fog/ovirt/requests/compute/v3/list_networks.rb +0 -18
- data/lib/fog/ovirt/requests/compute/v3/list_operating_systems.rb +0 -21
- data/lib/fog/ovirt/requests/compute/v3/list_quotas.rb +0 -21
- data/lib/fog/ovirt/requests/compute/v3/list_template_interfaces.rb +0 -21
- data/lib/fog/ovirt/requests/compute/v3/list_template_volumes.rb +0 -21
- data/lib/fog/ovirt/requests/compute/v3/list_templates.rb +0 -21
- data/lib/fog/ovirt/requests/compute/v3/list_virtual_machines.rb +0 -21
- data/lib/fog/ovirt/requests/compute/v3/list_vm_interfaces.rb +0 -21
- data/lib/fog/ovirt/requests/compute/v3/list_vm_volumes.rb +0 -21
- data/lib/fog/ovirt/requests/compute/v3/list_volumes.rb +0 -21
- data/lib/fog/ovirt/requests/compute/v3/mock_files/affinitygroup.xml +0 -8
- data/lib/fog/ovirt/requests/compute/v3/mock_files/affinitygroup_vms.xml +0 -9
- data/lib/fog/ovirt/requests/compute/v3/mock_files/affinitygroups.xml +0 -17
- data/lib/fog/ovirt/requests/compute/v3/mock_files/cluster.xml +0 -20
- data/lib/fog/ovirt/requests/compute/v3/mock_files/clusters.xml +0 -39
- data/lib/fog/ovirt/requests/compute/v3/mock_files/data_centers.xml +0 -17
- data/lib/fog/ovirt/requests/compute/v3/mock_files/disks.xml +0 -58
- data/lib/fog/ovirt/requests/compute/v3/mock_files/instance_type.xml +0 -42
- data/lib/fog/ovirt/requests/compute/v3/mock_files/instance_types.xml +0 -197
- data/lib/fog/ovirt/requests/compute/v3/mock_files/nics.xml +0 -10
- data/lib/fog/ovirt/requests/compute/v3/mock_files/operating_systems.xml +0 -10
- data/lib/fog/ovirt/requests/compute/v3/mock_files/quotas.xml +0 -7
- data/lib/fog/ovirt/requests/compute/v3/mock_files/storage_domains.xml +0 -36
- data/lib/fog/ovirt/requests/compute/v3/mock_files/template.xml +0 -39
- data/lib/fog/ovirt/requests/compute/v3/mock_files/templates.xml +0 -110
- data/lib/fog/ovirt/requests/compute/v3/mock_files/vm.xml +0 -52
- data/lib/fog/ovirt/requests/compute/v3/mock_files/vms.xml +0 -152
- data/lib/fog/ovirt/requests/compute/v3/mock_files/volumes.xml +0 -40
- data/lib/fog/ovirt/requests/compute/v3/remove_from_affinity_group.rb +0 -23
- data/lib/fog/ovirt/requests/compute/v3/storage_domains.rb +0 -22
- data/lib/fog/ovirt/requests/compute/v3/update_interface.rb +0 -36
- data/lib/fog/ovirt/requests/compute/v3/update_vm.rb +0 -20
- data/lib/fog/ovirt/requests/compute/v3/update_volume.rb +0 -37
- data/lib/fog/ovirt/requests/compute/v3/vm_action.rb +0 -24
- data/lib/fog/ovirt/requests/compute/v3/vm_start_with_cloudinit.rb +0 -21
- data/lib/fog/ovirt/requests/compute/v3/vm_ticket.rb +0 -19
- data/tests/ovirt/requests/compute/v3/client_tests.rb +0 -31
- data/tests/ovirt/requests/compute/v3/create_vm_tests.rb +0 -17
- data/tests/ovirt/requests/compute/v3/destroy_vm_tests.rb +0 -14
- data/tests/ovirt/requests/compute/v3/list_datacenters_tests.rb +0 -11
- data/tests/ovirt/requests/compute/v3/list_quotas_tests.rb +0 -10
- data/tests/ovirt/requests/compute/v3/list_storage_domains_tests.rb +0 -11
- data/tests/ovirt/requests/compute/v3/update_vm_tests.rb +0 -14
- data/tests/ovirt/requests/compute/v3/update_volume_tests.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0018dbcebca7b9c47941e86933df6d71f9106c80348689ab8ff3e355c5bb550a'
|
4
|
+
data.tar.gz: 312123f1ff82516363de62ed8cc2617117f3a8a9bd11cb655244332bbcf3b6dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3218482b5f4b274c684c906688e59112ea1a67d78a437c89502840ab8a6edecdf5e311072cf8470f88c8752f31527e53e479924290b6f0323a73f3579d7ff27
|
7
|
+
data.tar.gz: e5aa103e4a011613b64a86d2150a4a936d13e0f331bb287c404a912bcce618431d32ecb8d6ddb3c57b2b8c456840d89dd83fba1735663552eecbb27ed49cf77f
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2020-10-15 17:29:26 +0300 using RuboCop version 0.81.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -11,11 +11,18 @@
|
|
11
11
|
Metrics/ClassLength:
|
12
12
|
Max: 150
|
13
13
|
|
14
|
-
# Offense count:
|
14
|
+
# Offense count: 8
|
15
15
|
# Configuration parameters: CountComments, ExcludedMethods.
|
16
16
|
Metrics/MethodLength:
|
17
17
|
Max: 26
|
18
18
|
|
19
|
+
# Offense count: 1
|
20
|
+
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
21
|
+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
22
|
+
Naming/FileName:
|
23
|
+
Exclude:
|
24
|
+
- 'Gemfile.local.rb'
|
25
|
+
|
19
26
|
# Offense count: 1
|
20
27
|
Style/ClassVars:
|
21
28
|
Exclude:
|
@@ -26,7 +33,7 @@ Style/CommentedKeyword:
|
|
26
33
|
Exclude:
|
27
34
|
- 'lib/fog/ovirt/models/compute/server.rb'
|
28
35
|
|
29
|
-
# Offense count:
|
36
|
+
# Offense count: 98
|
30
37
|
Style/Documentation:
|
31
38
|
Enabled: false
|
32
39
|
|
@@ -36,13 +43,18 @@ Style/DoubleNegation:
|
|
36
43
|
- 'lib/fog/ovirt/models/compute/server.rb'
|
37
44
|
- 'tests/helpers/succeeds_helper.rb'
|
38
45
|
|
39
|
-
# Offense count:
|
46
|
+
# Offense count: 84
|
40
47
|
# Cop supports --auto-correct.
|
41
48
|
# Configuration parameters: EnforcedStyle.
|
42
|
-
# SupportedStyles: always, never
|
49
|
+
# SupportedStyles: always, always_true, never
|
43
50
|
Style/FrozenStringLiteralComment:
|
44
51
|
Enabled: false
|
45
52
|
|
53
|
+
# Offense count: 3
|
54
|
+
Style/MissingRespondToMissing:
|
55
|
+
Exclude:
|
56
|
+
- 'lib/fog/ovirt/compute.rb'
|
57
|
+
|
46
58
|
# Offense count: 4
|
47
59
|
Style/MultilineTernaryOperator:
|
48
60
|
Exclude:
|
data/Gemfile
CHANGED
data/Gemfile.local.rb
ADDED
File without changes
|
data/README.md
CHANGED
@@ -40,9 +40,7 @@ compute = Fog::Compute.new(
|
|
40
40
|
|
41
41
|
## API Support
|
42
42
|
|
43
|
-
This gem fully supports API
|
44
|
-
|
45
|
-
Version 1.0.2 adds support API V4 as well.
|
43
|
+
This gem fully supports API V4 of oVirt.
|
46
44
|
The first version does not give full support.
|
47
45
|
The supported requests for API V4 are:
|
48
46
|
|
@@ -72,9 +70,7 @@ This example shows the usage as a fog provider:
|
|
72
70
|
:ovirt_url => url,
|
73
71
|
:ovirt_datacenter => datacenter,
|
74
72
|
:public_key => public_key,
|
75
|
-
:api_version => 'v4'
|
76
73
|
)
|
77
|
-
The :api_version can be sent 'v3' or 'v4' to determine which API version to use.
|
78
74
|
|
79
75
|
|
80
76
|
Feedback is welcome. Please feel free to open issues for the V4 support and contribute.
|
@@ -85,4 +81,4 @@ Please refer to [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
85
81
|
|
86
82
|
## License
|
87
83
|
|
88
|
-
Please refer to [LICENSE.md](LICENSE.md).
|
84
|
+
Please refer to [LICENSE.md](LICENSE.md).
|
data/Rakefile
CHANGED
@@ -9,14 +9,8 @@ require "bundler/gem_tasks"
|
|
9
9
|
|
10
10
|
mock = ENV["FOG_MOCK"] || "true"
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
RuboCop::RakeTask.new do |t|
|
15
|
-
t.patterns = Dir["{lib,spec,tests}/**/*"]
|
16
|
-
end
|
17
|
-
rescue StandardError
|
18
|
-
puts "Rubocop not loaded"
|
19
|
-
end
|
12
|
+
require "rubocop/rake_task"
|
13
|
+
RuboCop::RakeTask.new
|
20
14
|
|
21
15
|
task :test do
|
22
16
|
sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/ovirt")
|
data/fog-ovirt.gemspec
CHANGED
@@ -17,13 +17,14 @@ Gem::Specification.new do |spec|
|
|
17
17
|
|
18
18
|
spec.files = `git ls-files -z`.split("\x0")
|
19
19
|
spec.test_files = spec.files.grep(%r{^tests\/})
|
20
|
-
|
21
20
|
spec.require_paths = ["lib"]
|
21
|
+
spec.required_ruby_version = ">= 2.0.0"
|
22
22
|
|
23
|
+
spec.add_dependency("activesupport")
|
23
24
|
spec.add_dependency("fog-core")
|
24
25
|
spec.add_dependency("fog-json")
|
25
26
|
spec.add_dependency("fog-xml")
|
26
|
-
spec.add_dependency("ovirt-engine-sdk", ">= 4.1
|
27
|
+
spec.add_dependency("ovirt-engine-sdk", ">= 4.3.1")
|
27
28
|
spec.add_dependency("rbovirt", "~> 0.1.5")
|
28
29
|
|
29
30
|
spec.add_development_dependency "bundler"
|
data/lib/fog/ovirt/compute.rb
CHANGED
@@ -50,22 +50,13 @@ module Fog
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
require "fog/ovirt/compute/v3"
|
54
53
|
require "fog/ovirt/compute/v4"
|
55
54
|
|
56
55
|
def self.new(options = {})
|
57
56
|
super(options)
|
58
|
-
|
59
|
-
# rubocop:disable Style/ConditionalAssignment
|
60
|
-
if options[:api_version] == "v4"
|
61
|
-
@client = Fog::Ovirt::Compute::V4.new(options)
|
62
|
-
else
|
63
|
-
@client = Fog::Ovirt::Compute::V3.new(options)
|
64
|
-
end
|
65
|
-
# rubocop:enable Style/ConditionalAssignment
|
57
|
+
@client = Fog::Ovirt::Compute::V4.new(options)
|
66
58
|
end
|
67
59
|
|
68
|
-
# rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
69
60
|
def method_missing(symbol, *args)
|
70
61
|
@client.__send__(symbol, *args)
|
71
62
|
end
|
@@ -73,20 +64,13 @@ module Fog
|
|
73
64
|
def respond_to?(symbol, include_all = false)
|
74
65
|
@client.respond_to?(symbol, include_all)
|
75
66
|
end
|
76
|
-
# rubocop:enable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
77
67
|
|
78
68
|
class Mock
|
79
69
|
def initialize(options = {})
|
80
|
-
|
81
|
-
|
82
|
-
@client = Fog::Ovirt::Compute::V4::Mock.new(options)
|
83
|
-
else
|
84
|
-
Fog::Ovirt::Compute::V3::Mock.send(:include, Fog::Ovirt::Compute::Collections)
|
85
|
-
@client = Fog::Ovirt::Compute::V3::Mock.new(options)
|
86
|
-
end
|
70
|
+
Fog::Ovirt::Compute::V4::Mock.include Fog::Ovirt::Compute::Collections
|
71
|
+
@client = Fog::Ovirt::Compute::V4::Mock.new(options)
|
87
72
|
end
|
88
73
|
|
89
|
-
# rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
90
74
|
def method_missing(symbol, *args)
|
91
75
|
@client.__send__(symbol, *args)
|
92
76
|
end
|
@@ -94,21 +78,14 @@ module Fog
|
|
94
78
|
def respond_to?(symbol, include_all = false)
|
95
79
|
@client.respond_to?(symbol, include_all)
|
96
80
|
end
|
97
|
-
# rubocop:enable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
98
81
|
end
|
99
82
|
|
100
83
|
class Real
|
101
84
|
def initialize(options = {})
|
102
|
-
|
103
|
-
|
104
|
-
@client = Fog::Ovirt::Compute::V4::Real.new(options)
|
105
|
-
else
|
106
|
-
Fog::Ovirt::Compute::V3::Real.send(:include, Fog::Ovirt::Compute::Collections)
|
107
|
-
@client = Fog::Ovirt::Compute::V3::Real.new(options)
|
108
|
-
end
|
85
|
+
Fog::Ovirt::Compute::V4::Real.include Fog::Ovirt::Compute::Collections
|
86
|
+
@client = Fog::Ovirt::Compute::V4::Real.new(options)
|
109
87
|
end
|
110
88
|
|
111
|
-
# rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
112
89
|
def method_missing(symbol, *args)
|
113
90
|
@client.send(symbol, *args)
|
114
91
|
end
|
@@ -116,7 +93,6 @@ module Fog
|
|
116
93
|
def respond_to?(symbol, include_all = false)
|
117
94
|
@client.respond_to?(symbol, include_all)
|
118
95
|
end
|
119
|
-
# rubocop:enable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
120
96
|
end
|
121
97
|
end
|
122
98
|
end
|
data/lib/fog/ovirt/compute/v4.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
require "active_support"
|
2
|
+
require "active_support/core_ext"
|
3
|
+
|
1
4
|
module Fog
|
2
5
|
module Ovirt
|
3
6
|
class Compute
|
@@ -33,6 +36,7 @@ module Fog
|
|
33
36
|
request :list_template_volumes
|
34
37
|
request :list_volumes
|
35
38
|
request :add_volume
|
39
|
+
request :get_volume
|
36
40
|
request :destroy_volume
|
37
41
|
request :update_volume
|
38
42
|
request :get_api_version
|
@@ -41,9 +45,9 @@ module Fog
|
|
41
45
|
request :list_operating_systems
|
42
46
|
|
43
47
|
module Shared
|
44
|
-
# rubocop:disable Metrics/
|
48
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
45
49
|
# converts an OVIRT object into an hash for fog to consume.
|
46
|
-
def
|
50
|
+
def shared_ovirt_attrs(obj)
|
47
51
|
opts = {}
|
48
52
|
# TODO: stop using instance_variables, they will change
|
49
53
|
obj.instance_variables.each do |v|
|
@@ -51,7 +55,7 @@ module Fog
|
|
51
55
|
value = obj.instance_variable_get(v)
|
52
56
|
|
53
57
|
if key == :network
|
54
|
-
opts[key] = obj.vnic_profile.present? ?
|
58
|
+
opts[key] = obj.vnic_profile.present? ? yield(obj) : value
|
55
59
|
next
|
56
60
|
end
|
57
61
|
|
@@ -69,9 +73,10 @@ module Fog
|
|
69
73
|
end
|
70
74
|
opts
|
71
75
|
end
|
72
|
-
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
73
76
|
|
74
|
-
# rubocop:
|
77
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
78
|
+
|
79
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
75
80
|
def get_attr_value(value, opts)
|
76
81
|
case value
|
77
82
|
when OvirtSDK4::List
|
@@ -102,29 +107,31 @@ module Fog
|
|
102
107
|
when OvirtSDK4::Console
|
103
108
|
{ :enabled => value.enabled }
|
104
109
|
else
|
105
|
-
if value.class.respond_to?(:
|
110
|
+
if value.class.respond_to?(:module_parent) && value.class.module_parent == OvirtSDK4
|
106
111
|
value.id if value.respond_to?(:id)
|
107
112
|
else
|
108
113
|
value.to_s.strip
|
109
114
|
end
|
110
115
|
end
|
111
116
|
end
|
112
|
-
# rubocop:enable Metrics/
|
113
|
-
|
114
|
-
def convert_string_to_bool(
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
value
|
117
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
118
|
+
|
119
|
+
def convert_string_to_bool(value)
|
120
|
+
case value
|
121
|
+
when "true"
|
122
|
+
true
|
123
|
+
when "false"
|
124
|
+
false
|
125
|
+
when Array
|
126
|
+
value.map { |elem| convert_string_to_bool(elem) }
|
127
|
+
when Hash
|
128
|
+
value.each do |key, elem|
|
129
|
+
value[key] = convert_string_to_bool(elem)
|
125
130
|
end
|
131
|
+
value
|
132
|
+
else
|
133
|
+
value
|
126
134
|
end
|
127
|
-
opts
|
128
135
|
end
|
129
136
|
end
|
130
137
|
|
@@ -135,6 +142,13 @@ module Fog
|
|
135
142
|
require "ovirtsdk4"
|
136
143
|
end
|
137
144
|
|
145
|
+
def ovirt_attrs(obj)
|
146
|
+
shared_ovirt_attrs(obj) do
|
147
|
+
xml = read_xml("vnic_profile.xml")
|
148
|
+
Nokogiri::XML(xml).xpath("/vnic_profile/network/@id").to_s
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
138
152
|
private
|
139
153
|
|
140
154
|
def client
|
@@ -151,7 +165,6 @@ module Fog
|
|
151
165
|
class Real
|
152
166
|
include Shared
|
153
167
|
|
154
|
-
# rubocop:disable Metrics/AbcSize
|
155
168
|
def initialize(options = {})
|
156
169
|
require "ovirtsdk4"
|
157
170
|
username = options[:ovirt_username]
|
@@ -172,7 +185,12 @@ module Fog
|
|
172
185
|
|
173
186
|
@client = ExceptionWrapper.new(OvirtSDK4::Connection.new(connection_opts))
|
174
187
|
end
|
175
|
-
|
188
|
+
|
189
|
+
def ovirt_attrs(obj)
|
190
|
+
shared_ovirt_attrs(obj) do
|
191
|
+
client.follow_link(obj.vnic_profile).network.id
|
192
|
+
end
|
193
|
+
end
|
176
194
|
|
177
195
|
def api_version
|
178
196
|
api = client.system_service.get
|
@@ -180,11 +198,11 @@ module Fog
|
|
180
198
|
end
|
181
199
|
|
182
200
|
def datacenter
|
183
|
-
|
201
|
+
datacenter_hash[:id]
|
184
202
|
end
|
185
203
|
|
186
204
|
def datacenter_hash
|
187
|
-
@datacenter_hash ||= datacenters.find { |x| x[:id] == @datacenter } if @datacenter
|
205
|
+
@datacenter_hash ||= datacenters.find { |x| x[:id] == @datacenter } || datacenters.find { |x| x[:name] == @datacenter } if @datacenter
|
188
206
|
@datacenter_hash ||= datacenters.first
|
189
207
|
end
|
190
208
|
|
@@ -9,7 +9,6 @@ module Fog
|
|
9
9
|
|
10
10
|
attr_accessor :vm
|
11
11
|
|
12
|
-
# rubocop:disable Metrics/AbcSize
|
13
12
|
def all(_filters = {})
|
14
13
|
requires :vm
|
15
14
|
if vm.is_a? Fog::Ovirt::Compute::Server
|
@@ -20,7 +19,6 @@ module Fog
|
|
20
19
|
raise ::Fog::Ovirt::Errors::OvirtError, "interfaces should have vm or template"
|
21
20
|
end
|
22
21
|
end
|
23
|
-
# rubocop:enable Metrics/AbcSize
|
24
22
|
|
25
23
|
def get(id)
|
26
24
|
new service.get_interface(id)
|
@@ -121,7 +121,6 @@ module Fog
|
|
121
121
|
vm_power_action(:start)
|
122
122
|
end
|
123
123
|
|
124
|
-
# rubocop:disable Metrics/AbcSize
|
125
124
|
def start_with_cloudinit(options = {})
|
126
125
|
wait_for { !locked? } if options[:blocking]
|
127
126
|
user_data = if options[:use_custom_script]
|
@@ -133,7 +132,6 @@ module Fog
|
|
133
132
|
reload
|
134
133
|
action_status
|
135
134
|
end
|
136
|
-
# rubocop:enable Metrics/AbcSize
|
137
135
|
|
138
136
|
def stop(_options = {})
|
139
137
|
vm_power_action(:stop)
|
@@ -9,7 +9,6 @@ module Fog
|
|
9
9
|
|
10
10
|
attr_accessor :vm
|
11
11
|
|
12
|
-
# rubocop:disable Metrics/AbcSize
|
13
12
|
def all(_filters = {})
|
14
13
|
if vm.is_a? Fog::Ovirt::Compute::Server
|
15
14
|
load service.list_vm_volumes(vm.id)
|
@@ -19,7 +18,6 @@ module Fog
|
|
19
18
|
load service.list_volumes
|
20
19
|
end
|
21
20
|
end
|
22
|
-
# rubocop:enable Metrics/AbcSize
|
23
21
|
|
24
22
|
def get(id)
|
25
23
|
new service.get_volume(id)
|
@@ -3,7 +3,6 @@ module Fog
|
|
3
3
|
class Compute
|
4
4
|
class V4
|
5
5
|
class Real
|
6
|
-
# rubocop:disable Metrics/AbcSize
|
7
6
|
def add_interface(id, options = {})
|
8
7
|
raise ArgumentError, "instance id is a required parameter" unless id
|
9
8
|
vm = client.system_service.vms_service.vm_service(id)
|
@@ -26,7 +25,6 @@ module Fog
|
|
26
25
|
interface = OvirtSDK4::Nic.new(options)
|
27
26
|
nics_service.add(interface)
|
28
27
|
end
|
29
|
-
# rubocop:enable Metrics/AbcSize
|
30
28
|
end
|
31
29
|
|
32
30
|
class Mock
|