fog-ovirt 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 +4 -4
- data/.rubocop_todo.yml +1 -1
- data/lib/fog/ovirt/compute/v4.rb +1 -0
- data/lib/fog/ovirt/compute.rb +10 -8
- data/lib/fog/ovirt/models/compute/server.rb +1 -0
- data/lib/fog/ovirt/models/compute/volume.rb +2 -3
- data/lib/fog/ovirt/requests/compute/v4/add_interface.rb +1 -1
- data/lib/fog/ovirt/requests/compute/v4/add_volume.rb +2 -4
- data/lib/fog/ovirt/requests/compute/v4/create_vm.rb +8 -6
- data/lib/fog/ovirt/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae44f7ed66761842e8171bb18c980ac4da26c48e
|
4
|
+
data.tar.gz: a1e45426a36e13357584f8adfe82307070f98ee8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 424c2016c3f2d01ad833c65f6f6ade596c0327f1eef47b388adcb5caeccf4bac3380896c0d8d3687627ca7e9ba05f99b54ed753f6a0b580c8b3b114faf217646
|
7
|
+
data.tar.gz: 5a4244fd04d8101d108fe6fce9a75b315785bb4ca42a1d30a5c47d053c97fc190677b4a77be7dbe730973e984f8bdb28ee4a8ab23e4c43c554f40500d1a435c3
|
data/.rubocop_todo.yml
CHANGED
data/lib/fog/ovirt/compute/v4.rb
CHANGED
@@ -80,6 +80,7 @@ module Fog
|
|
80
80
|
value.address
|
81
81
|
when OvirtSDK4::Cpu
|
82
82
|
opts[:cores] = value.topology.nil? ? nil : value.topology.cores
|
83
|
+
opts[:sockets] = value.topology.nil? ? nil : value.topology.sockets
|
83
84
|
when OvirtSDK4::Display
|
84
85
|
subject = value.certificate.subject if value.certificate
|
85
86
|
{
|
data/lib/fog/ovirt/compute.rb
CHANGED
@@ -26,12 +26,14 @@ module Fog
|
|
26
26
|
model :affinity_group
|
27
27
|
collection :affinity_groups
|
28
28
|
|
29
|
+
DISK_SIZE_TO_GB = 1024 * 1024 * 1024
|
30
|
+
|
29
31
|
class ExceptionWrapper
|
30
32
|
def initialize(client)
|
31
33
|
@client = client
|
32
34
|
end
|
33
35
|
|
34
|
-
# rubocop:disable Style/
|
36
|
+
# rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
35
37
|
def method_missing(symbol, *args)
|
36
38
|
if block_given?
|
37
39
|
@client.__send__(symbol, *args) do |*block_args|
|
@@ -47,7 +49,7 @@ module Fog
|
|
47
49
|
def respond_to?(symbol, include_all = false)
|
48
50
|
@client.respond_to?(symbol, include_all)
|
49
51
|
end
|
50
|
-
# rubocop:enable Style/
|
52
|
+
# rubocop:enable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
51
53
|
end
|
52
54
|
|
53
55
|
require "fog/ovirt/compute/v3"
|
@@ -65,7 +67,7 @@ module Fog
|
|
65
67
|
# rubocop:enable Style/ConditionalAssignment
|
66
68
|
end
|
67
69
|
|
68
|
-
# rubocop:disable Style/
|
70
|
+
# rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
69
71
|
def method_missing(symbol, *args)
|
70
72
|
@client.__send__(symbol, *args)
|
71
73
|
end
|
@@ -73,7 +75,7 @@ module Fog
|
|
73
75
|
def respond_to?(symbol, include_all = false)
|
74
76
|
@client.respond_to?(symbol, include_all)
|
75
77
|
end
|
76
|
-
# rubocop:enable Style/
|
78
|
+
# rubocop:enable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
77
79
|
|
78
80
|
class Mock
|
79
81
|
def initialize(options = {})
|
@@ -86,7 +88,7 @@ module Fog
|
|
86
88
|
end
|
87
89
|
end
|
88
90
|
|
89
|
-
# rubocop:disable Style/
|
91
|
+
# rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
90
92
|
def method_missing(symbol, *args)
|
91
93
|
@client.__send__(symbol, *args)
|
92
94
|
end
|
@@ -94,7 +96,7 @@ module Fog
|
|
94
96
|
def respond_to?(symbol, include_all = false)
|
95
97
|
@client.respond_to?(symbol, include_all)
|
96
98
|
end
|
97
|
-
# rubocop:enable Style/
|
99
|
+
# rubocop:enable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
98
100
|
end
|
99
101
|
|
100
102
|
class Real
|
@@ -108,7 +110,7 @@ module Fog
|
|
108
110
|
end
|
109
111
|
end
|
110
112
|
|
111
|
-
# rubocop:disable Style/
|
113
|
+
# rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
112
114
|
def method_missing(symbol, *args)
|
113
115
|
@client.send(symbol, *args)
|
114
116
|
end
|
@@ -116,7 +118,7 @@ module Fog
|
|
116
118
|
def respond_to?(symbol, include_all = false)
|
117
119
|
@client.respond_to?(symbol, include_all)
|
118
120
|
end
|
119
|
-
# rubocop:enable Style/
|
121
|
+
# rubocop:enable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
120
122
|
end
|
121
123
|
end
|
122
124
|
end
|
@@ -3,7 +3,6 @@ module Fog
|
|
3
3
|
class Ovirt
|
4
4
|
class Volume < Fog::Model
|
5
5
|
attr_accessor :raw
|
6
|
-
DISK_SIZE_TO_GB = 1_073_741_824
|
7
6
|
identity :id
|
8
7
|
|
9
8
|
attribute :storage_domain
|
@@ -20,11 +19,11 @@ module Fog
|
|
20
19
|
attribute :wipe_after_delete
|
21
20
|
|
22
21
|
def size_gb
|
23
|
-
attributes[:size_gb] ||= attributes[:size].to_i / DISK_SIZE_TO_GB if attributes[:size]
|
22
|
+
attributes[:size_gb] ||= attributes[:size].to_i / Fog::Compute::Ovirt::DISK_SIZE_TO_GB if attributes[:size]
|
24
23
|
end
|
25
24
|
|
26
25
|
def size_gb=(size)
|
27
|
-
attributes[:size] = size.to_i * DISK_SIZE_TO_GB if size
|
26
|
+
attributes[:size] = size.to_i * Fog::Compute::Ovirt::DISK_SIZE_TO_GB if size
|
28
27
|
end
|
29
28
|
|
30
29
|
def to_s
|
@@ -3,8 +3,6 @@ module Fog
|
|
3
3
|
class Ovirt
|
4
4
|
class V4
|
5
5
|
class Real
|
6
|
-
DISK_SIZE_TO_GB = 1024 * 1024 * 1024
|
7
|
-
|
8
6
|
def add_volume(id, options = {})
|
9
7
|
raise ArgumentError, "instance id is a required parameter" unless id
|
10
8
|
|
@@ -21,11 +19,11 @@ module Fog
|
|
21
19
|
search = options[:search] || format("datacenter=%<datacenter>s", :datacenter => datacenter)
|
22
20
|
options[:bootable] ||= "true"
|
23
21
|
options[:interface] ||= OvirtSDK4::DiskInterface::VIRTIO
|
24
|
-
options[:provisioned_size] = options[:size_gb].to_i * DISK_SIZE_TO_GB if options[:size_gb]
|
22
|
+
options[:provisioned_size] = options[:size_gb].to_i * Fog::Compute::Ovirt::DISK_SIZE_TO_GB if options[:size_gb]
|
25
23
|
|
26
24
|
options[:storage_domain_id] = options[:storage_domain] || storagedomains(:role => "data", :search => search).first.id
|
27
25
|
# If no size is given, default to a volume size of 8GB
|
28
|
-
options[:provisioned_size] ||= 8 * DISK_SIZE_TO_GB
|
26
|
+
options[:provisioned_size] ||= 8 * Fog::Compute::Ovirt::DISK_SIZE_TO_GB
|
29
27
|
options[:type] ||= OvirtSDK4::DiskType::DATA
|
30
28
|
options[:format] ||= OvirtSDK4::DiskFormat::COW
|
31
29
|
options[:sparse] = true unless options[:sparse].present?
|
@@ -24,7 +24,7 @@ module Fog
|
|
24
24
|
end
|
25
25
|
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
26
26
|
|
27
|
-
# rubocop:disable Metrics/AbcSize
|
27
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
28
28
|
def create_vm(attrs)
|
29
29
|
attrs = attrs.dup
|
30
30
|
attrs[:cluster_name] ||= datacenter.clusters.first.name unless attrs[:cluster]
|
@@ -40,19 +40,21 @@ module Fog
|
|
40
40
|
|
41
41
|
attrs[:comment] ||= ""
|
42
42
|
attrs[:quota] = attrs[:quota].present? ? client.system_service.data_centers_service.data_center_service(datacenter).quotas_service.quota_service(attrs[:quota]).get : nil
|
43
|
-
|
44
|
-
|
45
|
-
cpu_topology = OvirtSDK4::CpuTopology.new(:cores => attrs[:cores], :sockets => "1")
|
43
|
+
if attrs[:cores].present? || attrs[:sockets].present?
|
44
|
+
cpu_topology = OvirtSDK4::CpuTopology.new(:cores => attrs.fetch(:cores, "1"), :sockets => attrs.fetch(:sockets, "1"))
|
46
45
|
attrs[:cpu] = OvirtSDK4::Cpu.new(:topology => cpu_topology)
|
47
46
|
end
|
48
47
|
|
48
|
+
if attrs[:memory].to_i < Fog::Compute::Ovirt::DISK_SIZE_TO_GB
|
49
|
+
attrs[:memory_policy] = OvirtSDK4::MemoryPolicy.new(:guaranteed => attrs[:memory])
|
50
|
+
end
|
51
|
+
|
49
52
|
# TODO: handle cloning from template
|
50
53
|
process_vm_opts(attrs)
|
51
|
-
|
52
54
|
new_vm = OvirtSDK4::Vm.new(attrs)
|
53
55
|
vms_service.add(new_vm)
|
54
56
|
end
|
55
|
-
# rubocop:enable Metrics/AbcSize
|
57
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
56
58
|
end
|
57
59
|
|
58
60
|
class Mock
|
data/lib/fog/ovirt/version.rb
CHANGED
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.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ori Rabin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-core
|