fog-libvirt 0.10.0 → 0.10.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0eeb036772c096dd44785f75d40342a54ba904b25bdc1a9a4fcd6618c5e68d2
|
4
|
+
data.tar.gz: 6724150fb122ed80117725f1ee72d87de38d29ba7e3b10e5da2e752d302c2b92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e793caef5c183c003807f4d1d080575a47c0a64051ff84e76063863beae0e8bf253acf4b5dfb0054125343230578f0ce1f6e7871ca16ae249ace8b3d8c76d82e
|
7
|
+
data.tar.gz: 262443398fed1548bbcec936781cddc5e5f0664f0744021db5f47ed076b245e69b7061c5bcb35ae38270314b0a64e189896b6e923309d39277abf2538b139a45
|
@@ -1,24 +1,10 @@
|
|
1
1
|
module Fog
|
2
2
|
module Libvirt
|
3
3
|
class Compute
|
4
|
-
|
5
|
-
def list_pools(filter = { })
|
6
|
-
data=[]
|
7
|
-
if filter.key?(:name)
|
8
|
-
data << find_pool_by_name(filter[:name], filter[:include_inactive])
|
9
|
-
elsif filter.key?(:uuid)
|
10
|
-
data << find_pool_by_uuid(filter[:uuid], filter[:include_inactive])
|
11
|
-
else
|
12
|
-
(client.list_storage_pools + client.list_defined_storage_pools).each do |name|
|
13
|
-
data << find_pool_by_name(name, filter[:include_inactive])
|
14
|
-
end
|
15
|
-
end
|
16
|
-
data.compact
|
17
|
-
end
|
18
|
-
|
4
|
+
module Shared
|
19
5
|
private
|
20
6
|
|
21
|
-
|
7
|
+
def pool_to_attributes(pool, include_inactive = nil)
|
22
8
|
return nil unless pool.active? || include_inactive
|
23
9
|
|
24
10
|
states=[:inactive, :building, :running, :degrated, :inaccessible]
|
@@ -34,6 +20,26 @@ module Fog
|
|
34
20
|
:state => states[pool.info.state]
|
35
21
|
}
|
36
22
|
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class Real
|
26
|
+
include Shared
|
27
|
+
|
28
|
+
def list_pools(filter = { })
|
29
|
+
data=[]
|
30
|
+
if filter.key?(:name)
|
31
|
+
data << find_pool_by_name(filter[:name], filter[:include_inactive])
|
32
|
+
elsif filter.key?(:uuid)
|
33
|
+
data << find_pool_by_uuid(filter[:uuid], filter[:include_inactive])
|
34
|
+
else
|
35
|
+
(client.list_storage_pools + client.list_defined_storage_pools).each do |name|
|
36
|
+
data << find_pool_by_name(name, filter[:include_inactive])
|
37
|
+
end
|
38
|
+
end
|
39
|
+
data.compact
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
37
43
|
|
38
44
|
def find_pool_by_name name, include_inactive
|
39
45
|
pool_to_attributes(client.lookup_storage_pool_by_name(name), include_inactive)
|
@@ -49,6 +55,8 @@ module Fog
|
|
49
55
|
end
|
50
56
|
|
51
57
|
class Mock
|
58
|
+
include Shared
|
59
|
+
|
52
60
|
def list_pools(filter = { })
|
53
61
|
pool1 = mock_pool 'pool1'
|
54
62
|
pool2 = mock_pool 'pool1'
|
data/lib/fog/libvirt/version.rb
CHANGED
@@ -59,11 +59,11 @@ Shindo.tests("Fog::Compute[:libvirt] | list_pools request", 'libvirt') do
|
|
59
59
|
:num_of_volumes => 3
|
60
60
|
}
|
61
61
|
|
62
|
-
response =
|
62
|
+
response = compute.send(:pool_to_attributes, FakePool.new(inactive_pool), true)
|
63
63
|
|
64
64
|
test("should be hash of attributes") { response.kind_of? Hash }
|
65
65
|
|
66
|
-
response =
|
66
|
+
response = compute.send(:pool_to_attributes, FakePool.new(inactive_pool))
|
67
67
|
|
68
68
|
test("should be nil") { response.nil? }
|
69
69
|
|
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.10.
|
4
|
+
version: 0.10.1
|
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: 2022-12-
|
11
|
+
date: 2022-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-core
|