opennebula-oca 3.9.0.beta → 3.9.90.rc

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/README +1 -0
  2. metadata +35 -108
  3. data/LICENSE +0 -202
  4. data/NOTICE +0 -48
  5. data/lib/opennebula/acl.rb +0 -259
  6. data/lib/opennebula/acl_pool.rb +0 -53
  7. data/lib/opennebula/client.rb +0 -102
  8. data/lib/opennebula/cluster.rb +0 -247
  9. data/lib/opennebula/cluster_pool.rb +0 -56
  10. data/lib/opennebula/datastore.rb +0 -169
  11. data/lib/opennebula/datastore_pool.rb +0 -53
  12. data/lib/opennebula/document.rb +0 -259
  13. data/lib/opennebula/document_json.rb +0 -129
  14. data/lib/opennebula/document_pool.rb +0 -97
  15. data/lib/opennebula/document_pool_json.rb +0 -58
  16. data/lib/opennebula/error.rb +0 -52
  17. data/lib/opennebula/group.rb +0 -161
  18. data/lib/opennebula/group_pool.rb +0 -54
  19. data/lib/opennebula/host.rb +0 -199
  20. data/lib/opennebula/host_pool.rb +0 -91
  21. data/lib/opennebula/image.rb +0 -293
  22. data/lib/opennebula/image_pool.rb +0 -74
  23. data/lib/opennebula/ldap_auth.rb +0 -99
  24. data/lib/opennebula/ldap_auth_spec.rb +0 -70
  25. data/lib/opennebula/pool.rb +0 -157
  26. data/lib/opennebula/pool_element.rb +0 -269
  27. data/lib/opennebula/server_cipher_auth.rb +0 -148
  28. data/lib/opennebula/server_x509_auth.rb +0 -104
  29. data/lib/opennebula/ssh_auth.rb +0 -139
  30. data/lib/opennebula/system.rb +0 -141
  31. data/lib/opennebula/template.rb +0 -201
  32. data/lib/opennebula/template_pool.rb +0 -74
  33. data/lib/opennebula/user.rb +0 -172
  34. data/lib/opennebula/user_pool.rb +0 -53
  35. data/lib/opennebula/virtual_machine.rb +0 -426
  36. data/lib/opennebula/virtual_machine_pool.rb +0 -318
  37. data/lib/opennebula/virtual_network.rb +0 -247
  38. data/lib/opennebula/virtual_network_pool.rb +0 -74
  39. data/lib/opennebula/x509_auth.rb +0 -241
  40. data/lib/opennebula/xml_element.rb +0 -427
  41. data/lib/opennebula/xml_pool.rb +0 -45
  42. data/lib/opennebula/xml_utils.rb +0 -34
  43. data/lib/opennebula.rb +0 -58
@@ -1,53 +0,0 @@
1
- # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) #
3
- # #
4
- # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
- # not use this file except in compliance with the License. You may obtain #
6
- # a copy of the License at #
7
- # #
8
- # http://www.apache.org/licenses/LICENSE-2.0 #
9
- # #
10
- # Unless required by applicable law or agreed to in writing, software #
11
- # distributed under the License is distributed on an "AS IS" BASIS, #
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13
- # See the License for the specific language governing permissions and #
14
- # limitations under the License. #
15
- #--------------------------------------------------------------------------- #
16
-
17
-
18
- require 'opennebula/pool'
19
-
20
- module OpenNebula
21
- class AclPool < Pool
22
-
23
- #######################################################################
24
- # Constants and Class Methods
25
- #######################################################################
26
-
27
-
28
- ACL_POOL_METHODS = {
29
- :info => "acl.info",
30
- :addrule => "acl.addrule",
31
- :delrule => "acl.delrule"
32
- }
33
-
34
- # Class constructor
35
- def initialize(client)
36
- super('ACL_POOL','ACL',client)
37
- end
38
-
39
- def factory(element_xml)
40
- OpenNebula::Acl.new(element_xml, @client)
41
- end
42
-
43
- #######################################################################
44
- # XML-RPC Methods
45
- #######################################################################
46
-
47
- # Retrieves the ACL Pool
48
- def info()
49
- # Retrieves all the Acls in the pool.
50
- super(ACL_POOL_METHODS[:info])
51
- end
52
- end
53
- end
@@ -1,102 +0,0 @@
1
- # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) #
3
- # #
4
- # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
- # not use this file except in compliance with the License. You may obtain #
6
- # a copy of the License at #
7
- # #
8
- # http://www.apache.org/licenses/LICENSE-2.0 #
9
- # #
10
- # Unless required by applicable law or agreed to in writing, software #
11
- # distributed under the License is distributed on an "AS IS" BASIS, #
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13
- # See the License for the specific language governing permissions and #
14
- # limitations under the License. #
15
- #--------------------------------------------------------------------------- #
16
-
17
- require 'xmlrpc/client'
18
-
19
- module OpenNebula
20
- if OpenNebula::NOKOGIRI
21
- class NokogiriStreamParser < XMLRPC::XMLParser::AbstractStreamParser
22
- def initialize
23
- @parser_class = NokogiriParser
24
- end
25
-
26
- class NokogiriParser < Nokogiri::XML::SAX::Document
27
- include XMLRPC::XMLParser::StreamParserMixin
28
-
29
- alias :cdata_block :character
30
- alias :characters :character
31
- alias :end_element :endElement
32
- alias :start_element :startElement
33
-
34
- def parse(str)
35
- parser = Nokogiri::XML::SAX::Parser.new(self)
36
- parser.parse(str)
37
- end
38
- end
39
- end
40
- end
41
-
42
- # The client class, represents the connection with the core and handles the
43
- # xml-rpc calls.
44
- class Client
45
- attr_accessor :one_auth
46
-
47
- begin
48
- require 'xmlparser'
49
- XMLPARSER=true
50
- rescue LoadError
51
- XMLPARSER=false
52
- end
53
-
54
- def initialize(secret=nil, endpoint=nil)
55
- if secret
56
- @one_auth = secret
57
- elsif ENV["ONE_AUTH"] and !ENV["ONE_AUTH"].empty? and File.file?(ENV["ONE_AUTH"])
58
- @one_auth = File.read(ENV["ONE_AUTH"])
59
- elsif File.file?(ENV["HOME"]+"/.one/one_auth")
60
- @one_auth = File.read(ENV["HOME"]+"/.one/one_auth")
61
- else
62
- raise "ONE_AUTH file not present"
63
- end
64
-
65
- @one_auth.rstrip!
66
-
67
- if endpoint
68
- @one_endpoint = endpoint
69
- elsif ENV["ONE_XMLRPC"]
70
- @one_endpoint = ENV["ONE_XMLRPC"]
71
- else
72
- @one_endpoint = "http://localhost:2633/RPC2"
73
- end
74
-
75
- @server = XMLRPC::Client.new2(@one_endpoint)
76
-
77
- if OpenNebula::NOKOGIRI
78
- @server.set_parser(NokogiriStreamParser.new)
79
- elsif XMLPARSER
80
- @server.set_parser(XMLRPC::XMLParser::XMLStreamParser.new)
81
- end
82
- end
83
-
84
- def call(action, *args)
85
- begin
86
- response = @server.call_async("one."+action, @one_auth, *args)
87
-
88
- if response[0] == false
89
- Error.new(response[1], response[2])
90
- else
91
- response[1] #response[1..-1]
92
- end
93
- rescue Exception => e
94
- Error.new(e.message)
95
- end
96
- end
97
-
98
- def get_version()
99
- call("system.version")
100
- end
101
- end
102
- end
@@ -1,247 +0,0 @@
1
- # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) #
3
- # #
4
- # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
- # not use this file except in compliance with the License. You may obtain #
6
- # a copy of the License at #
7
- # #
8
- # http://www.apache.org/licenses/LICENSE-2.0 #
9
- # #
10
- # Unless required by applicable law or agreed to in writing, software #
11
- # distributed under the License is distributed on an "AS IS" BASIS, #
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13
- # See the License for the specific language governing permissions and #
14
- # limitations under the License. #
15
- #--------------------------------------------------------------------------- #
16
-
17
-
18
- require 'opennebula/pool_element'
19
-
20
- module OpenNebula
21
- class Cluster < PoolElement
22
- #######################################################################
23
- # Constants and Class Methods
24
- #######################################################################
25
-
26
- CLUSTER_METHODS = {
27
- :info => "cluster.info",
28
- :allocate => "cluster.allocate",
29
- :delete => "cluster.delete",
30
- :addhost => "cluster.addhost",
31
- :delhost => "cluster.delhost",
32
- :adddatastore => "cluster.adddatastore",
33
- :deldatastore => "cluster.deldatastore",
34
- :addvnet => "cluster.addvnet",
35
- :delvnet => "cluster.delvnet",
36
- :update => "cluster.update",
37
- }
38
-
39
- # Creates a Cluster description with just its identifier
40
- # this method should be used to create plain Cluster objects.
41
- # +id+ the id of the host
42
- #
43
- # Example:
44
- # cluster = Cluster.new(Cluster.build_xml(3),rpc_client)
45
- #
46
- def Cluster.build_xml(pe_id=nil)
47
- if pe_id
48
- cluster_xml = "<CLUSTER><ID>#{pe_id}</ID></CLUSTER>"
49
- else
50
- cluster_xml = "<CLUSTER></CLUSTER>"
51
- end
52
-
53
- XMLElement.build_xml(cluster_xml,'CLUSTER')
54
- end
55
-
56
- # Class constructor
57
- def initialize(xml, client)
58
- super(xml,client)
59
- end
60
-
61
- #######################################################################
62
- # XML-RPC Methods for the Cluster Object
63
- #######################################################################
64
-
65
- # Retrieves the information of the given Cluster.
66
- def info()
67
- super(CLUSTER_METHODS[:info], 'CLUSTER')
68
- end
69
-
70
- # Allocates a new Cluster in OpenNebula
71
- #
72
- # +clustername+ A string containing the name of the Cluster.
73
- def allocate(clustername)
74
- super(CLUSTER_METHODS[:allocate], clustername)
75
- end
76
-
77
- # Deletes the Cluster
78
- def delete()
79
- super(CLUSTER_METHODS[:delete])
80
- end
81
-
82
- # Adds a Host to this Cluster
83
- # @param hid [Integer] Host ID
84
- # @return [nil, OpenNebula::Error] nil in case of success, Error
85
- # otherwise
86
- def addhost(hid)
87
- return Error.new('ID not defined') if !@pe_id
88
-
89
- rc = @client.call(CLUSTER_METHODS[:addhost], @pe_id, hid)
90
- rc = nil if !OpenNebula.is_error?(rc)
91
-
92
- return rc
93
- end
94
-
95
- # Deletes a Host from this Cluster
96
- # @param hid [Integer] Host ID
97
- # @return [nil, OpenNebula::Error] nil in case of success, Error
98
- # otherwise
99
- def delhost(hid)
100
- return Error.new('ID not defined') if !@pe_id
101
-
102
- rc = @client.call(CLUSTER_METHODS[:delhost], @pe_id, hid)
103
- rc = nil if !OpenNebula.is_error?(rc)
104
-
105
- return rc
106
- end
107
-
108
- # Adds a Datastore to this Cluster
109
- # @param ds_id [Integer] Datastore ID
110
- # @return [nil, OpenNebula::Error] nil in case of success, Error
111
- # otherwise
112
- def adddatastore(ds_id)
113
- return Error.new('ID not defined') if !@pe_id
114
-
115
- rc = @client.call(CLUSTER_METHODS[:adddatastore], @pe_id, ds_id)
116
- rc = nil if !OpenNebula.is_error?(rc)
117
-
118
- return rc
119
- end
120
-
121
- # Deletes a Datastore from this Cluster
122
- # @param ds_id [Integer] Datastore ID
123
- # @return [nil, OpenNebula::Error] nil in case of success, Error
124
- # otherwise
125
- def deldatastore(ds_id)
126
- return Error.new('ID not defined') if !@pe_id
127
-
128
- rc = @client.call(CLUSTER_METHODS[:deldatastore], @pe_id, ds_id)
129
- rc = nil if !OpenNebula.is_error?(rc)
130
-
131
- return rc
132
- end
133
-
134
- # Adds a VNet to this Cluster
135
- # @param vnet_id [Integer] VNet ID
136
- # @return [nil, OpenNebula::Error] nil in case of success, Error
137
- # otherwise
138
- def addvnet(vnet_id)
139
- return Error.new('ID not defined') if !@pe_id
140
-
141
- rc = @client.call(CLUSTER_METHODS[:addvnet], @pe_id, vnet_id)
142
- rc = nil if !OpenNebula.is_error?(rc)
143
-
144
- return rc
145
- end
146
-
147
- # Deletes a VNet from this Cluster
148
- # @param vnet_id [Integer] VNet ID
149
- # @return [nil, OpenNebula::Error] nil in case of success, Error
150
- # otherwise
151
- def delvnet(vnet_id)
152
- return Error.new('ID not defined') if !@pe_id
153
-
154
- rc = @client.call(CLUSTER_METHODS[:delvnet], @pe_id, vnet_id)
155
- rc = nil if !OpenNebula.is_error?(rc)
156
-
157
- return rc
158
- end
159
-
160
- # Replaces the template contents
161
- #
162
- # @param new_template [String] New template contents
163
- #
164
- # @return [nil, OpenNebula::Error] nil in case of success, Error
165
- # otherwise
166
- def update(new_template)
167
- super(CLUSTER_METHODS[:update], new_template)
168
- end
169
-
170
- # ---------------------------------------------------------------------
171
- # Helpers to get information
172
- # ---------------------------------------------------------------------
173
-
174
- # Returns whether or not the host with 'id' is part of this cluster
175
- # @param id [Integer|Array] host ID
176
- # @return [Boolean] true if found
177
- def contains_host?(id)
178
- contains_resource?('HOSTS/ID', id)
179
- end
180
-
181
- # Returns an array with the numeric host ids
182
- # @return [Array<Integer>]
183
- def host_ids
184
- array = Array.new
185
-
186
- self.each("HOSTS/ID") do |id|
187
- array << id.text.to_i
188
- end
189
-
190
- return array
191
- end
192
-
193
- # Returns whether or not the datastore with 'id' is part of this cluster
194
- # @param id [Integer|Array] datastore ID
195
- # @return [Boolean] true if found
196
- def contains_datastore?(id)
197
- contains_resource?('DATASTORES/ID', id)
198
- end
199
-
200
- # Returns an array with the numeric datastore ids
201
- # @return [Array<Integer>]
202
- def datastore_ids
203
- array = Array.new
204
-
205
- self.each("DATASTORES/ID") do |id|
206
- array << id.text.to_i
207
- end
208
-
209
- return array
210
- end
211
-
212
- # Returns whether or not the vnet with 'id' is part of this cluster
213
- # @param id [Integer|Arrray] vnet ID
214
- # @return [Boolean] true if found
215
- def contains_vnet?(id)
216
- contains_resource?('VNETS/ID', id)
217
- end
218
-
219
- # Returns an array with the numeric vnet ids
220
- # @return [Array<Integer>]
221
- def vnet_ids
222
- array = Array.new
223
-
224
- self.each("VNETS/ID") do |id|
225
- array << id.text.to_i
226
- end
227
-
228
- return array
229
- end
230
-
231
- private
232
-
233
- def contains_resource?(xpath, id)
234
- id_array = retrieve_elements(xpath)
235
-
236
- return false if id_array.nil?
237
-
238
- id = [id] if id.class != Array
239
-
240
- id.each { |i|
241
- return false if !id_array.include?(i.to_s)
242
- }
243
-
244
- return true
245
- end
246
- end
247
- end
@@ -1,56 +0,0 @@
1
- # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) #
3
- # #
4
- # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
- # not use this file except in compliance with the License. You may obtain #
6
- # a copy of the License at #
7
- # #
8
- # http://www.apache.org/licenses/LICENSE-2.0 #
9
- # #
10
- # Unless required by applicable law or agreed to in writing, software #
11
- # distributed under the License is distributed on an "AS IS" BASIS, #
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13
- # See the License for the specific language governing permissions and #
14
- # limitations under the License. #
15
- #--------------------------------------------------------------------------- #
16
-
17
-
18
- require 'opennebula/pool'
19
-
20
- module OpenNebula
21
- class ClusterPool < Pool
22
- #######################################################################
23
- # Constants and Class attribute accessors
24
- #######################################################################
25
-
26
- NONE_CLUSTER_ID = -1
27
- DEFAULT_CLUSTER_ID = 0
28
-
29
- CLUSTER_POOL_METHODS = {
30
- :info => "clusterpool.info"
31
- }
32
-
33
- #######################################################################
34
- # Class constructor & Pool Methods
35
- #######################################################################
36
-
37
- # +client+ a Client object that represents a XML-RPC connection
38
- def initialize(client)
39
- super('CLUSTER_POOL','CLUSTER',client)
40
- end
41
-
42
- # Factory method to create Cluster objects
43
- def factory(element_xml)
44
- OpenNebula::Cluster.new(element_xml,@client)
45
- end
46
-
47
- #######################################################################
48
- # XML-RPC Methods for the Cluster Object
49
- #######################################################################
50
-
51
- # Retrieves all the Clusters in the pool.
52
- def info()
53
- super(CLUSTER_POOL_METHODS[:info])
54
- end
55
- end
56
- end
@@ -1,169 +0,0 @@
1
- # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) #
3
- # #
4
- # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
- # not use this file except in compliance with the License. You may obtain #
6
- # a copy of the License at #
7
- # #
8
- # http://www.apache.org/licenses/LICENSE-2.0 #
9
- # #
10
- # Unless required by applicable law or agreed to in writing, software #
11
- # distributed under the License is distributed on an "AS IS" BASIS, #
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13
- # See the License for the specific language governing permissions and #
14
- # limitations under the License. #
15
- #--------------------------------------------------------------------------- #
16
-
17
-
18
- require 'opennebula/pool_element'
19
-
20
- module OpenNebula
21
- class Datastore < PoolElement
22
- #######################################################################
23
- # Constants and Class Methods
24
- #######################################################################
25
-
26
- DATASTORE_METHODS = {
27
- :info => "datastore.info",
28
- :allocate => "datastore.allocate",
29
- :delete => "datastore.delete",
30
- :update => "datastore.update",
31
- :chown => "datastore.chown",
32
- :chmod => "datastore.chmod"
33
- }
34
-
35
- DATASTORE_TYPES=%w{IMAGE SYSTEM FILE}
36
-
37
- SHORT_DATASTORE_TYPES = {
38
- "IMAGE" => "img",
39
- "SYSTEM"=> "sys",
40
- "FILE" => "fil"
41
- }
42
-
43
- # Creates a Datastore description with just its identifier
44
- # this method should be used to create plain Datastore objects.
45
- # +id+ the id of the user
46
- #
47
- # Example:
48
- # datastore = Datastore.new(Datastore.build_xml(3),rpc_client)
49
- #
50
- def Datastore.build_xml(pe_id=nil)
51
- if pe_id
52
- datastore_xml = "<DATASTORE><ID>#{pe_id}</ID></DATASTORE>"
53
- else
54
- datastore_xml = "<DATASTORE></DATASTORE>"
55
- end
56
-
57
- XMLElement.build_xml(datastore_xml,'DATASTORE')
58
- end
59
-
60
- # Class constructor
61
- def initialize(xml, client)
62
- super(xml,client)
63
- end
64
-
65
- #######################################################################
66
- # XML-RPC Methods for the Datastore Object
67
- #######################################################################
68
- # Returns the datastore type
69
- def type
70
- self['TYPE'].to_i
71
- end
72
-
73
- # Returns the datastore type (string value)
74
- def type_str
75
- DATASTORE_TYPES[type]
76
- end
77
-
78
- # Returns the datastore type (string value)
79
- def short_type_str
80
- SHORT_DATASTORE_TYPES[type_str]
81
- end
82
-
83
- # Retrieves the information of the given Datastore.
84
- def info()
85
- super(DATASTORE_METHODS[:info], 'DATASTORE')
86
- end
87
-
88
- # Allocates a new Datastore in OpenNebula
89
- #
90
- # @param description [String] The template of the Datastore.
91
- # @param cluster_id [Integer] Id of the cluster
92
- #
93
- # @return [Integer, OpenNebula::Error] the new ID in case of
94
- # success, error otherwise
95
- def allocate(description, cluster_id=ClusterPool::NONE_CLUSTER_ID)
96
- super(DATASTORE_METHODS[:allocate], description, cluster_id)
97
- end
98
-
99
- # Deletes the Datastore
100
- def delete()
101
- super(DATASTORE_METHODS[:delete])
102
- end
103
-
104
- # Replaces the template contents
105
- #
106
- # @param new_template [String] New template contents
107
- #
108
- # @return [nil, OpenNebula::Error] nil in case of success, Error
109
- # otherwise
110
- def update(new_template)
111
- super(DATASTORE_METHODS[:update], new_template)
112
- end
113
-
114
- # Changes the owner/group
115
- #
116
- # @param uid [Integer] the new owner id. Set to -1 to leave the current one
117
- # @param gid [Integer] the new group id. Set to -1 to leave the current one
118
- #
119
- # @return [nil, OpenNebula::Error] nil in case of success, Error
120
- # otherwise
121
- def chown(uid, gid)
122
- super(DATASTORE_METHODS[:chown], uid, gid)
123
- end
124
-
125
- # Changes the datastore permissions.
126
- #
127
- # @param octet [String] Permissions octed , e.g. 640
128
- # @return [nil, OpenNebula::Error] nil in case of success, Error
129
- # otherwise
130
- def chmod_octet(octet)
131
- super(DATASTORE_METHODS[:chmod], octet)
132
- end
133
-
134
- # Changes the datastore permissions.
135
- # Each [Integer] argument must be 1 to allow, 0 deny, -1 do not change
136
- #
137
- # @return [nil, OpenNebula::Error] nil in case of success, Error
138
- # otherwise
139
- def chmod(owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u,
140
- other_m, other_a)
141
- super(DATASTORE_METHODS[:chmod], owner_u, owner_m, owner_a, group_u,
142
- group_m, group_a, other_u, other_m, other_a)
143
- end
144
-
145
- # ---------------------------------------------------------------------
146
- # Helpers to get information
147
- # ---------------------------------------------------------------------
148
-
149
- # Returns whether or not the image with id 'id' is part of this datastore
150
- def contains(id)
151
- #This doesn't work in ruby 1.8.5
152
- #return self["DATASTORE/ID[.=#{uid}]"] != nil
153
-
154
- id_array = retrieve_elements('IMAGES/ID')
155
- return id_array != nil && id_array.include?(uid.to_s)
156
- end
157
-
158
- # Returns an array with the numeric image ids
159
- def img_ids
160
- array = Array.new
161
-
162
- self.each("IMAGES/ID") do |id|
163
- array << id.text.to_i
164
- end
165
-
166
- return array
167
- end
168
- end
169
- end
@@ -1,53 +0,0 @@
1
- # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) #
3
- # #
4
- # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
- # not use this file except in compliance with the License. You may obtain #
6
- # a copy of the License at #
7
- # #
8
- # http://www.apache.org/licenses/LICENSE-2.0 #
9
- # #
10
- # Unless required by applicable law or agreed to in writing, software #
11
- # distributed under the License is distributed on an "AS IS" BASIS, #
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13
- # See the License for the specific language governing permissions and #
14
- # limitations under the License. #
15
- #--------------------------------------------------------------------------- #
16
-
17
-
18
- require 'opennebula/pool'
19
-
20
- module OpenNebula
21
- class DatastorePool < Pool
22
- #######################################################################
23
- # Constants and Class attribute accessors
24
- #######################################################################
25
-
26
- DATASTORE_POOL_METHODS = {
27
- :info => "datastorepool.info"
28
- }
29
-
30
- #######################################################################
31
- # Class constructor & Pool Methods
32
- #######################################################################
33
-
34
- # +client+ a Client object that represents a XML-RPC connection
35
- def initialize(client)
36
- super('DATASTORE_POOL','DATASTORE',client)
37
- end
38
-
39
- # Factory method to create User objects
40
- def factory(element_xml)
41
- OpenNebula::Group.new(element_xml,@client)
42
- end
43
-
44
- #######################################################################
45
- # XML-RPC Methods for the User Object
46
- #######################################################################
47
-
48
- # Retrieves all the Groups in the pool.
49
- def info()
50
- super(DATASTORE_POOL_METHODS[:info])
51
- end
52
- end
53
- end