foreman_kubevirt 0.5.2 → 0.5.3
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 27a32cc9e111db27e1c4e447aeb8fe1c7d556a542999008f54d8593032fa7231
|
|
4
|
+
data.tar.gz: 411a38571296341bcd8cd0d79286d4caa3f15a35f359723ad7b80b3ebd522949
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: afbf6ececc85edf062ccd38a1061b885b46c6cc4c5f1810883a12769d7e054825c0461dcfdabe16025624b567385ae48f2183b2791d23ae6901f462cae6952f9
|
|
7
|
+
data.tar.gz: a9965b82dcef601bc0f941ded45a2a9f8a359826d2328668a094f12951a9c92bc81263b4f4e5f0380f11f6cbf9cc12e4b879e5e7363b203ae1616ba7157499c4
|
|
@@ -14,7 +14,7 @@ module FogExtensions
|
|
|
14
14
|
return fog_memory if fog_memory.is_a?(Numeric)
|
|
15
15
|
return nil if fog_memory.blank?
|
|
16
16
|
|
|
17
|
-
::Fog::Kubevirt::Utils::UnitConverter.convert(fog_memory, :b)
|
|
17
|
+
::Fog::Kubevirt::Utils::UnitConverter.convert("#{fog_memory}b", :b)
|
|
18
18
|
rescue StandardError => e
|
|
19
19
|
Rails.logger.warn("Failed to convert memory '#{fog_memory}': #{e.message}")
|
|
20
20
|
nil
|
|
@@ -35,6 +35,10 @@ module FogExtensions
|
|
|
35
35
|
def volumes_attributes=(attrs)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
+
def id
|
|
39
|
+
name
|
|
40
|
+
end
|
|
41
|
+
|
|
38
42
|
def uuid
|
|
39
43
|
name
|
|
40
44
|
end
|
|
@@ -280,10 +280,10 @@ module ForemanKubevirt
|
|
|
280
280
|
|
|
281
281
|
def new_vm(attr = {})
|
|
282
282
|
vm = super
|
|
283
|
-
|
|
284
|
-
interfaces.map { |i|
|
|
285
|
-
|
|
286
|
-
volumes.map { |v|
|
|
283
|
+
iface_nested_attrs = nested_attributes_for :interfaces, attr[:interfaces_attributes]
|
|
284
|
+
vm.interfaces = iface_nested_attrs.map { |i| new_interface(i) }
|
|
285
|
+
volume_nested_attrs = nested_attributes_for :volumes, attr[:volumes_attributes]
|
|
286
|
+
vm.volumes = volume_nested_attrs.map { |v| new_volume(v) }
|
|
287
287
|
vm
|
|
288
288
|
end
|
|
289
289
|
|
|
@@ -57,6 +57,8 @@ class ForemanKubevirtTest < ActiveSupport::TestCase
|
|
|
57
57
|
|
|
58
58
|
test "raises an error for image based provisioning without an explicit boot volume" do
|
|
59
59
|
record = new_kubevirt_vcr
|
|
60
|
+
client = mocked_client
|
|
61
|
+
record.stubs(:client).returns(client)
|
|
60
62
|
|
|
61
63
|
error = assert_raises(Foreman::Exception) do
|
|
62
64
|
record.create_vm({ :name => "test", :provision_method => 'image', :image_id => "default/template", :volumes_attributes => {}, :interfaces_attributes => { "0" => { "cni_provider" => "multus", "network" => "default/network" } } })
|
|
@@ -93,6 +95,8 @@ class ForemanKubevirtTest < ActiveSupport::TestCase
|
|
|
93
95
|
|
|
94
96
|
test "raises an error for image based provisioning with only an extra data volume" do
|
|
95
97
|
record = new_kubevirt_vcr
|
|
98
|
+
client = mocked_client
|
|
99
|
+
record.stubs(:client).returns(client)
|
|
96
100
|
|
|
97
101
|
error = assert_raises(Foreman::Exception) do
|
|
98
102
|
record.create_vm({ :name => "test", :provision_method => 'image', :image_id => "default/template", :volumes_attributes => { "0" => { :capacity => "10" } }, :interfaces_attributes => { "0" => { "cni_provider" => "multus", "network" => "default/network" } } })
|