fog-libvirt 0.12.1 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -3
- data/fog-libvirt.gemspec +4 -5
- data/lib/fog/libvirt/compute.rb +9 -26
- data/lib/fog/libvirt/models/compute/network.rb +11 -0
- data/lib/fog/libvirt/models/compute/pool.rb +14 -0
- data/lib/fog/libvirt/models/compute/server.rb +45 -150
- data/lib/fog/libvirt/models/compute/util/util.rb +2 -10
- data/lib/fog/libvirt/models/compute/volume.rb +41 -2
- data/lib/fog/libvirt/requests/compute/clone_volume.rb +7 -5
- data/lib/fog/libvirt/requests/compute/create_domain.rb +6 -4
- data/lib/fog/libvirt/requests/compute/create_volume.rb +6 -3
- data/lib/fog/libvirt/requests/compute/define_domain.rb +6 -4
- data/lib/fog/libvirt/requests/compute/define_pool.rb +6 -3
- data/lib/fog/libvirt/requests/compute/destroy_interface.rb +6 -4
- data/lib/fog/libvirt/requests/compute/destroy_network.rb +6 -4
- data/lib/fog/libvirt/requests/compute/dhcp_leases.rb +4 -5
- data/lib/fog/libvirt/requests/compute/get_node_info.rb +6 -3
- data/lib/fog/libvirt/requests/compute/libversion.rb +6 -4
- data/lib/fog/libvirt/requests/compute/list_domains.rb +27 -31
- data/lib/fog/libvirt/requests/compute/list_interfaces.rb +6 -14
- data/lib/fog/libvirt/requests/compute/list_networks.rb +6 -24
- data/lib/fog/libvirt/requests/compute/list_pool_volumes.rb +6 -3
- data/lib/fog/libvirt/requests/compute/list_pools.rb +20 -42
- data/lib/fog/libvirt/requests/compute/list_volumes.rb +16 -36
- data/lib/fog/libvirt/requests/compute/pool_action.rb +6 -4
- data/lib/fog/libvirt/requests/compute/update_autostart.rb +6 -4
- data/lib/fog/libvirt/requests/compute/update_display.rb +6 -5
- data/lib/fog/libvirt/requests/compute/upload_volume.rb +6 -3
- data/lib/fog/libvirt/requests/compute/vm_action.rb +6 -4
- data/lib/fog/libvirt/requests/compute/volume_action.rb +6 -4
- data/lib/fog/libvirt/version.rb +1 -1
- data/minitests/test_helper.rb +1 -1
- data/tests/helper.rb +1 -1
- data/tests/helpers/formats_helper.rb +3 -2
- data/tests/helpers/formats_helper_tests.rb +8 -8
- data/tests/helpers/mock_helper.rb +1 -1
- data/tests/libvirt/models/compute/network_tests.rb +14 -2
- data/tests/libvirt/models/compute/nic_tests.rb +2 -1
- data/tests/libvirt/models/compute/pools_tests.rb +6 -6
- data/tests/libvirt/models/compute/server_tests.rb +53 -3
- data/tests/libvirt/models/compute/volume_tests.rb +21 -1
- data/tests/libvirt/models/compute/volumes_tests.rb +2 -0
- data/tests/libvirt/requests/compute/list_pools_tests.rb +1 -1
- metadata +38 -43
- data/lib/fog/libvirt/models/compute/templates/network.xml.erb +0 -6
- data/lib/fog/libvirt/models/compute/templates/pool.xml.erb +0 -6
- data/lib/fog/libvirt/models/compute/templates/volume.xml.erb +0 -34
- data/lib/fog/libvirt/requests/compute/mock_files/domain.xml +0 -40
- data/minitests/server/server_test.rb +0 -64
@@ -1,8 +1,8 @@
|
|
1
1
|
Shindo.tests('test_helper', 'meta') do
|
2
2
|
|
3
3
|
tests('comparing welcome data against schema') do
|
4
|
-
data = { welcome
|
5
|
-
data_matches_schema(welcome
|
4
|
+
data = { :welcome => 'Hello' }
|
5
|
+
data_matches_schema(:welcome => String) { data }
|
6
6
|
end
|
7
7
|
|
8
8
|
tests('#data_matches_schema') do
|
@@ -15,7 +15,7 @@ Shindo.tests('test_helper', 'meta') do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
tests('when nested values match schema expectation') do
|
18
|
-
data_matches_schema('key' => { nested_key
|
18
|
+
data_matches_schema('key' => { :nested_key => String }) { { 'key' => { :nested_key => 'Value' } } }
|
19
19
|
end
|
20
20
|
|
21
21
|
tests('when collection of values all match schema expectation') do
|
@@ -23,11 +23,11 @@ Shindo.tests('test_helper', 'meta') do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
tests('when collection is empty although schema covers optional members') do
|
26
|
-
data_matches_schema([{ 'key' => String }], allow_optional_rules
|
26
|
+
data_matches_schema([{ 'key' => String }], :allow_optional_rules => true) { [] }
|
27
27
|
end
|
28
28
|
|
29
29
|
tests('when additional keys are passed and not strict') do
|
30
|
-
data_matches_schema({ 'key' => String }, allow_extra_keys
|
30
|
+
data_matches_schema({ 'key' => String }, :allow_extra_keys => true) { { 'key' => 'Value', :extra => 'Bonus' } }
|
31
31
|
end
|
32
32
|
|
33
33
|
tests('when value is nil and schema expects NilClass') do
|
@@ -47,11 +47,11 @@ Shindo.tests('test_helper', 'meta') do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
tests('when key is missing but value should be NilClass (#1477)') do
|
50
|
-
data_matches_schema({ 'key' => NilClass }, allow_optional_rules
|
50
|
+
data_matches_schema({ 'key' => NilClass }, :allow_optional_rules => true) { {} }
|
51
51
|
end
|
52
52
|
|
53
53
|
tests('when key is missing but value is nullable (#1477)') do
|
54
|
-
data_matches_schema({ 'key' => Fog::Nullable::String }, allow_optional_rules
|
54
|
+
data_matches_schema({ 'key' => Fog::Nullable::String }, :allow_optional_rules => true) { {} }
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -65,7 +65,7 @@ Shindo.tests('test_helper', 'meta') do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
tests('when nested values match schema expectation') do
|
68
|
-
formats('key' => { nested_key
|
68
|
+
formats('key' => { :nested_key => String }) { { 'key' => { :nested_key => 'Value' } } }
|
69
69
|
end
|
70
70
|
|
71
71
|
tests('when collection of values all match schema expectation') do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:libvirt] | network model', ['libvirt']) do
|
2
2
|
|
3
3
|
networks = Fog::Compute[:libvirt].networks
|
4
|
-
network = networks.
|
4
|
+
network = networks.first
|
5
5
|
|
6
6
|
tests('The network model should') do
|
7
7
|
tests('have the action') do
|
@@ -9,7 +9,7 @@ Shindo.tests('Fog::Compute[:libvirt] | network model', ['libvirt']) do
|
|
9
9
|
test('dhcp_leases') { network.respond_to? 'dhcp_leases' }
|
10
10
|
end
|
11
11
|
tests('have a dhcp_leases action that') do
|
12
|
-
test('returns an array') { network.dhcp_leases('
|
12
|
+
test('returns an array') { network.dhcp_leases('aa:bb:cc:dd:ee:ff', 0).kind_of? Array }
|
13
13
|
end
|
14
14
|
tests('have attributes') do
|
15
15
|
model_attribute_hash = network.attributes
|
@@ -28,4 +28,16 @@ Shindo.tests('Fog::Compute[:libvirt] | network model', ['libvirt']) do
|
|
28
28
|
test('be a kind of Fog::Libvirt::Compute::Network') { network.kind_of? Fog::Libvirt::Compute::Network }
|
29
29
|
end
|
30
30
|
|
31
|
+
tests("to_xml") do
|
32
|
+
test("default") do
|
33
|
+
expected = <<~NETWORK
|
34
|
+
<?xml version="1.0"?>
|
35
|
+
<network>
|
36
|
+
<name>default</name>
|
37
|
+
<bridge name="virbr0" stp="on" delay="0"/>
|
38
|
+
</network>
|
39
|
+
NETWORK
|
40
|
+
network.to_xml == expected
|
41
|
+
end
|
42
|
+
end
|
31
43
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:libvirt] | nic model', ['libvirt']) do
|
2
2
|
|
3
|
-
|
3
|
+
server = Fog::Compute[:libvirt].servers.create(:name => Fog::Mock.random_letters(8))
|
4
|
+
nic = server.nics.first
|
4
5
|
|
5
6
|
tests('The nic model should') do
|
6
7
|
tests('have the action') do
|
@@ -3,11 +3,11 @@ Shindo.tests('Fog::Compute[:libvirt] | pools request', ['libvirt']) do
|
|
3
3
|
pools = Fog::Compute[:libvirt].pools
|
4
4
|
|
5
5
|
tests('The pools collection') do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
6
|
+
test('should not be empty') { not pools.empty? }
|
7
|
+
test('should be a kind of Fog::Libvirt::Compute::Pools') { pools.kind_of? Fog::Libvirt::Compute::Pools }
|
8
|
+
tests('should be able to reload itself').succeeds { pools.reload }
|
9
|
+
tests('should be able to get a model') do
|
10
|
+
tests('by instance id').succeeds { pools.get pools.first.uuid }
|
12
11
|
end
|
12
|
+
end
|
13
13
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:libvirt] | server model', ['libvirt']) do
|
2
2
|
|
3
3
|
servers = Fog::Compute[:libvirt].servers
|
4
|
-
|
4
|
+
# Match the mac in dhcp_leases mock
|
5
|
+
nics = Fog.mock? ? [{ :type => 'network', :network => 'default', :mac => 'aa:bb:cc:dd:ee:ff' }] : nil
|
6
|
+
server = servers.create(:name => Fog::Mock.random_letters(8), :nics => nics)
|
5
7
|
|
6
8
|
tests('The server model should') do
|
7
9
|
tests('have the action') do
|
@@ -11,7 +13,7 @@ Shindo.tests('Fog::Compute[:libvirt] | server model', ['libvirt']) do
|
|
11
13
|
%w{ start stop destroy reboot suspend }.each do |action|
|
12
14
|
test(action) { server.respond_to? action }
|
13
15
|
end
|
14
|
-
%w{ start reboot suspend stop
|
16
|
+
%w{ start reboot suspend stop }.each do |action|
|
15
17
|
test("#{action} returns successfully") {
|
16
18
|
begin
|
17
19
|
server.send(action.to_sym)
|
@@ -30,6 +32,10 @@ Shindo.tests('Fog::Compute[:libvirt] | server model', ['libvirt']) do
|
|
30
32
|
attributes = [ :id,
|
31
33
|
:cpus,
|
32
34
|
:cputime,
|
35
|
+
:firmware,
|
36
|
+
:firmware_features,
|
37
|
+
:secure_boot,
|
38
|
+
:loader_attributes,
|
33
39
|
:os_type,
|
34
40
|
:memory_size,
|
35
41
|
:max_memory_size,
|
@@ -58,12 +64,18 @@ Shindo.tests('Fog::Compute[:libvirt] | server model', ['libvirt']) do
|
|
58
64
|
end
|
59
65
|
end
|
60
66
|
end
|
67
|
+
|
68
|
+
test('can destroy') do
|
69
|
+
servers.create(:name => Fog::Mock.random_letters(8)).destroy
|
70
|
+
end
|
71
|
+
|
61
72
|
test('be a kind of Fog::Libvirt::Compute::Server') { server.kind_of? Fog::Libvirt::Compute::Server }
|
62
73
|
tests("serializes to xml") do
|
74
|
+
test("without firmware") { server.to_xml.include?("<os>") }
|
63
75
|
test("with memory") { server.to_xml.match?(%r{<memory>\d+</memory>}) }
|
64
76
|
test("with disk of type file") do
|
65
77
|
xml = server.to_xml
|
66
|
-
xml.match?(/<disk type="file" device="disk">/) && xml.match?(%r{<source file="path
|
78
|
+
xml.match?(/<disk type="file" device="disk">/) && xml.match?(%r{<source file="#{server.volumes.first.path}"/>})
|
67
79
|
end
|
68
80
|
test("with disk of type block") do
|
69
81
|
server = Fog::Libvirt::Compute::Server.new(
|
@@ -79,5 +91,43 @@ Shindo.tests('Fog::Compute[:libvirt] | server model', ['libvirt']) do
|
|
79
91
|
end
|
80
92
|
test("with q35 machine type on x86_64") { server.to_xml.match?(%r{<type arch="x86_64" machine="q35">hvm</type>}) }
|
81
93
|
end
|
94
|
+
test("with efi firmware") do
|
95
|
+
server = Fog::Libvirt::Compute::Server.new(
|
96
|
+
{
|
97
|
+
:firmware => "efi",
|
98
|
+
:nics => [],
|
99
|
+
:volumes => []
|
100
|
+
}
|
101
|
+
)
|
102
|
+
xml = server.to_xml
|
103
|
+
|
104
|
+
os_firmware = xml.include?('<os firmware="efi">')
|
105
|
+
secure_boot = xml.include?('<feature name="secure-boot" enabled="no"/>')
|
106
|
+
loader_attributes = !xml.include?('<loader secure="yes"/>')
|
107
|
+
|
108
|
+
os_firmware && secure_boot && loader_attributes
|
109
|
+
end
|
110
|
+
test("with secure boot enabled") do
|
111
|
+
server = Fog::Libvirt::Compute::Server.new(
|
112
|
+
{
|
113
|
+
:firmware => "efi",
|
114
|
+
:firmware_features => {
|
115
|
+
"secure-boot" => "yes",
|
116
|
+
"enrolled-keys" => "yes"
|
117
|
+
},
|
118
|
+
:loader_attributes => { "secure" => "yes" },
|
119
|
+
:nics => [],
|
120
|
+
:volumes => []
|
121
|
+
}
|
122
|
+
)
|
123
|
+
xml = server.to_xml
|
124
|
+
|
125
|
+
os_firmware = xml.include?('<os firmware="efi">')
|
126
|
+
secure_boot = xml.include?('<feature name="secure-boot" enabled="yes"/>')
|
127
|
+
enrolled_keys = xml.include?('<feature name="enrolled-keys" enabled="yes"/>')
|
128
|
+
loader_attributes = xml.include?('<loader secure="yes"/>')
|
129
|
+
|
130
|
+
os_firmware && secure_boot && enrolled_keys && loader_attributes
|
131
|
+
end
|
82
132
|
end
|
83
133
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Shindo.tests('Fog::Compute[:libvirt] | volume model', ['libvirt']) do
|
2
2
|
|
3
|
-
volume = Fog::Compute[:libvirt].
|
3
|
+
volume = Fog::Compute[:libvirt].volumes.create(:name => 'fog_test')
|
4
4
|
|
5
5
|
tests('The volume model should') do
|
6
6
|
tests('have attributes') do
|
@@ -35,4 +35,24 @@ Shindo.tests('Fog::Compute[:libvirt] | volume model', ['libvirt']) do
|
|
35
35
|
test('succeed') { volume.xml == new_vol.xml }
|
36
36
|
end
|
37
37
|
|
38
|
+
test('to_xml') do
|
39
|
+
test('default') do
|
40
|
+
expected = <<~VOLUME
|
41
|
+
<?xml version="1.0"?>
|
42
|
+
<volume>
|
43
|
+
<name>fog_test</name>
|
44
|
+
<allocation unit="G">1</allocation>
|
45
|
+
<capacity unit="G">10</capacity>
|
46
|
+
<target>
|
47
|
+
<format type="raw"/>
|
48
|
+
<permissions>
|
49
|
+
<mode>0744</mode>
|
50
|
+
<label>virt_image_t</label>
|
51
|
+
</permissions>
|
52
|
+
</target>
|
53
|
+
</volume>
|
54
|
+
VOLUME
|
55
|
+
volume.to_xml == expected
|
56
|
+
end
|
57
|
+
end
|
38
58
|
end
|
@@ -2,6 +2,8 @@ Shindo.tests('Fog::Compute[:libvirt] | volumes collection', ['libvirt']) do
|
|
2
2
|
|
3
3
|
volumes = Fog::Compute[:libvirt].volumes
|
4
4
|
|
5
|
+
volumes.create(:name => 'test')
|
6
|
+
|
5
7
|
tests('The volumes collection') do
|
6
8
|
test('should not be empty') { not volumes.empty? }
|
7
9
|
test('should be a kind of Fog::Libvirt::Compute::Volumes') { volumes.kind_of? Fog::Libvirt::Compute::Volumes }
|
@@ -41,7 +41,7 @@ Shindo.tests("Fog::Compute[:libvirt] | list_pools request", 'libvirt') do
|
|
41
41
|
tests("Lists Pools") do
|
42
42
|
response = compute.list_pools
|
43
43
|
test("should be an array") { response.kind_of? Array }
|
44
|
-
test("should have two pools") { response.length ==
|
44
|
+
test("should have two pools") { response.length == 1 }
|
45
45
|
end
|
46
46
|
|
47
47
|
tests("Handle Inactive Pools") do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-libvirt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- geemus (Wesley Beary)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-core
|
@@ -53,61 +53,81 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.1.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: json
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0
|
61
|
+
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: ruby-libvirt
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 0.7.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 0.7.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: minitest
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '5.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '5.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: mocha
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - ">="
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
103
|
+
version: '1.15'
|
104
|
+
- - "<"
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '3'
|
90
107
|
type: :development
|
91
108
|
prerelease: false
|
92
109
|
version_requirements: !ruby/object:Gem::Requirement
|
93
110
|
requirements:
|
94
111
|
- - ">="
|
95
112
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
113
|
+
version: '1.15'
|
114
|
+
- - "<"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '3'
|
97
117
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
118
|
+
name: net-ssh
|
99
119
|
requirement: !ruby/object:Gem::Requirement
|
100
120
|
requirements:
|
101
|
-
- - "
|
121
|
+
- - ">="
|
102
122
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
123
|
+
version: '0'
|
104
124
|
type: :development
|
105
125
|
prerelease: false
|
106
126
|
version_requirements: !ruby/object:Gem::Requirement
|
107
127
|
requirements:
|
108
|
-
- - "
|
128
|
+
- - ">="
|
109
129
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
130
|
+
version: '0'
|
111
131
|
- !ruby/object:Gem::Dependency
|
112
132
|
name: pry
|
113
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,26 +212,6 @@ dependencies:
|
|
192
212
|
- - ">="
|
193
213
|
- !ruby/object:Gem::Version
|
194
214
|
version: '0'
|
195
|
-
- !ruby/object:Gem::Dependency
|
196
|
-
name: mocha
|
197
|
-
requirement: !ruby/object:Gem::Requirement
|
198
|
-
requirements:
|
199
|
-
- - ">="
|
200
|
-
- !ruby/object:Gem::Version
|
201
|
-
version: '1.15'
|
202
|
-
- - "<"
|
203
|
-
- !ruby/object:Gem::Version
|
204
|
-
version: '3'
|
205
|
-
type: :development
|
206
|
-
prerelease: false
|
207
|
-
version_requirements: !ruby/object:Gem::Requirement
|
208
|
-
requirements:
|
209
|
-
- - ">="
|
210
|
-
- !ruby/object:Gem::Version
|
211
|
-
version: '1.15'
|
212
|
-
- - "<"
|
213
|
-
- !ruby/object:Gem::Version
|
214
|
-
version: '3'
|
215
215
|
description: This library can be used as a module for 'fog' or as standalone libvirt
|
216
216
|
provider.
|
217
217
|
email: geemus@gmail.com
|
@@ -242,9 +242,6 @@ files:
|
|
242
242
|
- lib/fog/libvirt/models/compute/pools.rb
|
243
243
|
- lib/fog/libvirt/models/compute/server.rb
|
244
244
|
- lib/fog/libvirt/models/compute/servers.rb
|
245
|
-
- lib/fog/libvirt/models/compute/templates/network.xml.erb
|
246
|
-
- lib/fog/libvirt/models/compute/templates/pool.xml.erb
|
247
|
-
- lib/fog/libvirt/models/compute/templates/volume.xml.erb
|
248
245
|
- lib/fog/libvirt/models/compute/util/uri.rb
|
249
246
|
- lib/fog/libvirt/models/compute/util/util.rb
|
250
247
|
- lib/fog/libvirt/models/compute/volume.rb
|
@@ -265,7 +262,6 @@ files:
|
|
265
262
|
- lib/fog/libvirt/requests/compute/list_pool_volumes.rb
|
266
263
|
- lib/fog/libvirt/requests/compute/list_pools.rb
|
267
264
|
- lib/fog/libvirt/requests/compute/list_volumes.rb
|
268
|
-
- lib/fog/libvirt/requests/compute/mock_files/domain.xml
|
269
265
|
- lib/fog/libvirt/requests/compute/pool_action.rb
|
270
266
|
- lib/fog/libvirt/requests/compute/update_autostart.rb
|
271
267
|
- lib/fog/libvirt/requests/compute/update_display.rb
|
@@ -273,7 +269,6 @@ files:
|
|
273
269
|
- lib/fog/libvirt/requests/compute/vm_action.rb
|
274
270
|
- lib/fog/libvirt/requests/compute/volume_action.rb
|
275
271
|
- lib/fog/libvirt/version.rb
|
276
|
-
- minitests/server/server_test.rb
|
277
272
|
- minitests/server/user_data_iso_test.rb
|
278
273
|
- minitests/test_helper.rb
|
279
274
|
- tests/helper.rb
|
@@ -313,14 +308,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
313
308
|
requirements:
|
314
309
|
- - ">="
|
315
310
|
- !ruby/object:Gem::Version
|
316
|
-
version: 2.
|
311
|
+
version: '2.7'
|
317
312
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
318
313
|
requirements:
|
319
314
|
- - ">="
|
320
315
|
- !ruby/object:Gem::Version
|
321
316
|
version: '0'
|
322
317
|
requirements: []
|
323
|
-
rubygems_version: 3.
|
318
|
+
rubygems_version: 3.5.22
|
324
319
|
signing_key:
|
325
320
|
specification_version: 2
|
326
321
|
summary: Module for the 'fog' gem to support libvirt
|
@@ -1,34 +0,0 @@
|
|
1
|
-
<volume>
|
2
|
-
<name><%= name %></name>
|
3
|
-
<allocation unit="<%= split_size_unit(allocation)[1] %>"><%= split_size_unit(allocation)[0] %></allocation>
|
4
|
-
<capacity unit="<%= split_size_unit(capacity)[1] %>"><%= split_size_unit(capacity)[0] %></capacity>
|
5
|
-
<target>
|
6
|
-
<format type="<%= format_type %>"/>
|
7
|
-
<permissions>
|
8
|
-
<% if owner -%>
|
9
|
-
<owner><%= owner %></owner>
|
10
|
-
<% end -%>
|
11
|
-
<% if group -%>
|
12
|
-
<group><%= group %></group>
|
13
|
-
<% end -%>
|
14
|
-
<mode>0744</mode>
|
15
|
-
<label>virt_image_t</label>
|
16
|
-
</permissions>
|
17
|
-
</target>
|
18
|
-
<% if backing_volume -%>
|
19
|
-
<backingStore>
|
20
|
-
<path><%= backing_volume.path %></path>
|
21
|
-
<format type="<%= backing_volume.format_type %>"/>
|
22
|
-
<permissions>
|
23
|
-
<% if owner -%>
|
24
|
-
<owner><%= owner %></owner>
|
25
|
-
<% end -%>
|
26
|
-
<% if group -%>
|
27
|
-
<group><%= group %></group>
|
28
|
-
<% end -%>
|
29
|
-
<mode>0744</mode>
|
30
|
-
<label>virt_image_t</label>
|
31
|
-
</permissions>
|
32
|
-
</backingStore>
|
33
|
-
<% end -%>
|
34
|
-
</volume>
|
@@ -1,40 +0,0 @@
|
|
1
|
-
<domain type='kvm'>
|
2
|
-
<name>fog-449765558356062</name>
|
3
|
-
<memory>262144</memory>
|
4
|
-
<vcpu>1</vcpu>
|
5
|
-
<os>
|
6
|
-
<type arch='x86_64'>hvm</type>
|
7
|
-
<boot dev='hd'/>
|
8
|
-
<boot dev='cdrom'/>
|
9
|
-
<boot dev='network'/>
|
10
|
-
</os>
|
11
|
-
<features>
|
12
|
-
<acpi/>
|
13
|
-
<apic/>
|
14
|
-
<pae/>
|
15
|
-
</features>
|
16
|
-
<clock offset='utc'/>
|
17
|
-
<devices>
|
18
|
-
<interface type='network'>
|
19
|
-
<mac address="aa:bb:cc:dd:ee:ff" />
|
20
|
-
<source network='net1' />
|
21
|
-
<model type='virtio'/>
|
22
|
-
</interface>
|
23
|
-
<serial type='pty'>
|
24
|
-
<target port='0'/>
|
25
|
-
</serial>
|
26
|
-
<console type='pty'>
|
27
|
-
<target port='0'/>
|
28
|
-
</console>
|
29
|
-
<input type='mouse' bus='ps2'/>
|
30
|
-
<graphics type='vnc' port='-1' autoport='yes'/>
|
31
|
-
<video>
|
32
|
-
<model type='cirrus' vram='9216' heads='1'/>
|
33
|
-
</video>
|
34
|
-
<disk type='file' device='disk'>
|
35
|
-
<driver name='qemu' type='raw'/>
|
36
|
-
<source file='path/to/disk'/>
|
37
|
-
<target dev='vda' bus='virtio'/>
|
38
|
-
</disk>
|
39
|
-
</devices>
|
40
|
-
</domain>
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class ServerTest < Minitest::Test
|
4
|
-
def setup
|
5
|
-
@compute = Fog::Compute[:libvirt]
|
6
|
-
@server = @compute.servers.new(:name => "test")
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_addresses_calls_compat_version_for_no_dhcp_leases_support
|
10
|
-
network = Libvirt::Network.new
|
11
|
-
@compute.expects(:networks).returns([network])
|
12
|
-
network.expects(:dhcp_leases).raises(NoMethodError)
|
13
|
-
@server.expects(:addresses_ip_command).returns(true)
|
14
|
-
|
15
|
-
@server.send(:addresses)
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_addresses_calls_compat_version_for_older_libvirt
|
19
|
-
network = Libvirt::Network.new
|
20
|
-
@compute.expects(:libversion).returns(1002007)
|
21
|
-
@compute.expects(:networks).returns([network])
|
22
|
-
network.expects(:dhcp_leases).returns(true)
|
23
|
-
@server.expects(:addresses_ip_command).returns(true)
|
24
|
-
|
25
|
-
@server.send(:addresses)
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_addresses_calls_compat_version_for_newer_libvirt
|
29
|
-
network = Libvirt::Network.new
|
30
|
-
@compute.expects(:libversion).returns(1002008)
|
31
|
-
@compute.expects(:networks).returns([network])
|
32
|
-
network.expects(:dhcp_leases).returns(true)
|
33
|
-
@server.expects(:addresses_dhcp).returns(true)
|
34
|
-
|
35
|
-
@server.send(:addresses)
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_ssh_ip_command_success
|
39
|
-
fog_ssh = Minitest::Mock.new
|
40
|
-
result = Minitest::Mock.new
|
41
|
-
result.expect(:status, 0)
|
42
|
-
result.expect(:stdout, "any_ip")
|
43
|
-
fog_ssh.expect(:run, [result], [String])
|
44
|
-
uri = ::Fog::Libvirt::Util::URI.new('qemu+ssh://localhost:22?keyfile=nofile')
|
45
|
-
Fog::SSH.stub(:new, fog_ssh) do
|
46
|
-
@server.send(:ssh_ip_command, "test command", uri)
|
47
|
-
end
|
48
|
-
fog_ssh.verify
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_local_ip_command_success
|
52
|
-
proc_info = Minitest::Mock.new
|
53
|
-
proc_info.expect(:each_line, "127.0.0.1")
|
54
|
-
proc_info.expect(:pid, 0)
|
55
|
-
status = Minitest::Mock.new
|
56
|
-
status.expect(:exitstatus, 0)
|
57
|
-
Process.stubs(:waitpid2).returns([0, status])
|
58
|
-
IO.stub(:popen, true, proc_info) do
|
59
|
-
@server.send(:local_ip_command, "test command")
|
60
|
-
end
|
61
|
-
proc_info.verify
|
62
|
-
status.verify
|
63
|
-
end
|
64
|
-
end
|