opennebula 4.14.2 → 4.90.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/NOTICE +1 -1
  3. data/lib/cloud/CloudClient.rb +3 -3
  4. data/lib/opennebula.rb +8 -2
  5. data/lib/opennebula/acl.rb +20 -14
  6. data/lib/opennebula/acl_pool.rb +1 -1
  7. data/lib/opennebula/client.rb +1 -1
  8. data/lib/opennebula/cluster.rb +1 -1
  9. data/lib/opennebula/cluster_pool.rb +1 -1
  10. data/lib/opennebula/datastore.rb +2 -2
  11. data/lib/opennebula/datastore_pool.rb +3 -3
  12. data/lib/opennebula/document.rb +16 -1
  13. data/lib/opennebula/document_json.rb +13 -1
  14. data/lib/opennebula/document_pool.rb +1 -1
  15. data/lib/opennebula/document_pool_json.rb +1 -1
  16. data/lib/opennebula/error.rb +1 -1
  17. data/lib/opennebula/group.rb +17 -10
  18. data/lib/opennebula/group_pool.rb +1 -1
  19. data/lib/opennebula/host.rb +26 -14
  20. data/lib/opennebula/host_pool.rb +1 -1
  21. data/lib/opennebula/image.rb +7 -3
  22. data/lib/opennebula/image_pool.rb +1 -2
  23. data/lib/opennebula/ldap_auth.rb +1 -1
  24. data/lib/opennebula/ldap_auth_spec.rb +1 -1
  25. data/lib/opennebula/marketplace.rb +161 -0
  26. data/lib/opennebula/marketplace_pool.rb +55 -0
  27. data/lib/opennebula/marketplaceapp.rb +267 -0
  28. data/lib/opennebula/marketplaceapp_pool.rb +77 -0
  29. data/lib/opennebula/oneflow_client.rb +10 -8
  30. data/lib/opennebula/pool.rb +1 -1
  31. data/lib/opennebula/pool_element.rb +1 -1
  32. data/lib/opennebula/security_group.rb +43 -2
  33. data/lib/opennebula/security_group_pool.rb +1 -1
  34. data/lib/opennebula/server_cipher_auth.rb +1 -1
  35. data/lib/opennebula/server_x509_auth.rb +1 -1
  36. data/lib/opennebula/ssh_auth.rb +1 -1
  37. data/lib/opennebula/system.rb +1 -1
  38. data/lib/opennebula/template.rb +42 -13
  39. data/lib/opennebula/template_pool.rb +1 -1
  40. data/lib/opennebula/user.rb +1 -1
  41. data/lib/opennebula/user_pool.rb +1 -1
  42. data/lib/opennebula/vdc.rb +1 -1
  43. data/lib/opennebula/vdc_pool.rb +1 -1
  44. data/lib/opennebula/virtual_machine.rb +65 -50
  45. data/lib/opennebula/virtual_machine_pool.rb +1 -1
  46. data/lib/opennebula/virtual_network.rb +13 -2
  47. data/lib/opennebula/virtual_network_pool.rb +1 -1
  48. data/lib/opennebula/virtual_router.rb +203 -0
  49. data/lib/opennebula/virtual_router_pool.rb +79 -0
  50. data/lib/opennebula/x509_auth.rb +1 -1
  51. data/lib/opennebula/xml_element.rb +6 -1
  52. data/lib/opennebula/xml_pool.rb +1 -1
  53. data/lib/opennebula/xml_utils.rb +1 -1
  54. data/lib/opennebula/zone.rb +1 -1
  55. data/lib/opennebula/zone_pool.rb +1 -1
  56. metadata +11 -5
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -76,7 +76,7 @@ module OpenNebula
76
76
  # Allocates a new VirtualNetwork in OpenNebula
77
77
  #
78
78
  # @param description [String] The template of the VirtualNetwork.
79
- # @param cluster_id [Integer] Id of the cluster
79
+ # @param cluster_id [Integer] Id of the cluster, -1 to use default
80
80
  #
81
81
  # @return [Integer, OpenNebula::Error] the new ID in case of
82
82
  # success, error otherwise
@@ -324,6 +324,17 @@ module OpenNebula
324
324
  end
325
325
  end
326
326
 
327
+ # Returns an array with the numeric virtual router ids
328
+ def vrouter_ids
329
+ array = Array.new
330
+
331
+ self.each("VROUTERS/ID") do |id|
332
+ array << id.text.to_i
333
+ end
334
+
335
+ return array
336
+ end
337
+
327
338
  private
328
339
  def set_publish(published)
329
340
  group_u = published ? 1 : 0
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -0,0 +1,203 @@
1
+ # -------------------------------------------------------------------------- #
2
+ # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
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 VirtualRouter < PoolElement
22
+ #######################################################################
23
+ # Constants and Class Methods
24
+ #######################################################################
25
+
26
+ VIRTUAL_ROUTER_METHODS = {
27
+ :allocate => "vrouter.allocate",
28
+ :instantiate => "vrouter.instantiate",
29
+ :info => "vrouter.info",
30
+ :update => "vrouter.update",
31
+ :delete => "vrouter.delete",
32
+ :chown => "vrouter.chown",
33
+ :chmod => "vrouter.chmod",
34
+ :rename => "vrouter.rename",
35
+ :attachnic => "vrouter.attachnic",
36
+ :detachnic => "vrouter.detachnic",
37
+ }
38
+
39
+ # Creates a VirtualRouter description with just its identifier
40
+ # this method should be used to create plain VirtualRouter objects.
41
+ # +id+ the id of the user
42
+ #
43
+ # Example:
44
+ # vrouter = VirtualRouter.new(VirtualRouter.build_xml(3),rpc_client)
45
+ #
46
+ def VirtualRouter.build_xml(pe_id=nil)
47
+ if pe_id
48
+ obj_xml = "<VROUTER><ID>#{pe_id}</ID></VROUTER>"
49
+ else
50
+ obj_xml = "<VROUTER></VROUTER>"
51
+ end
52
+
53
+ XMLElement.build_xml(obj_xml,'VROUTER')
54
+ end
55
+
56
+ # Class constructor
57
+ def initialize(xml, client)
58
+ super(xml,client)
59
+
60
+ @client = client
61
+ end
62
+
63
+ #######################################################################
64
+ # XML-RPC Methods for the VirtualRouter Object
65
+ #######################################################################
66
+
67
+ # Retrieves the information of the given Virtual Router
68
+ def info()
69
+ super(VIRTUAL_ROUTER_METHODS[:info], 'VROUTER')
70
+ end
71
+
72
+ alias_method :info!, :info
73
+
74
+ # Allocates a new VirtualRouter in OpenNebula
75
+ #
76
+ # @param description [String] The contents of the VirtualRouter.
77
+ #
78
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
79
+ # otherwise
80
+ def allocate(description)
81
+ super(VIRTUAL_ROUTER_METHODS[:allocate], description)
82
+ end
83
+
84
+ # Creates VM instances from a VM Template. New VMs will be associated
85
+ # to this Virtual Router, and its Virtual Networks
86
+ #
87
+ # @para n_vms [Integer] Number of VMs to instantiate
88
+ # @para template_id [Integer] VM Template id to instantiate
89
+ # @param name [String] Name for the VM instances. If it is an empty
90
+ # string OpenNebula will set a default name. Wildcard %i can be used.
91
+ # @param hold [true,false] false to create the VM in pending state,
92
+ # true to create it on hold
93
+ # @param template [String] User provided Template to merge with the
94
+ # one being instantiated
95
+ #
96
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
97
+ # otherwise
98
+ def instantiate(n_vms, template_id, name="", hold=false, template="")
99
+ return call(VIRTUAL_ROUTER_METHODS[:instantiate], @pe_id,
100
+ n_vms.to_i, template_id.to_i, name, hold, template)
101
+ end
102
+
103
+
104
+ # Deletes the VirtualRouter
105
+ def delete()
106
+ super(VIRTUAL_ROUTER_METHODS[:delete])
107
+ end
108
+
109
+ # Replaces the template contents
110
+ #
111
+ # @param new_template [String] New template contents
112
+ # @param append [true, false] True to append new attributes instead of
113
+ # replace the whole template
114
+ #
115
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
116
+ # otherwise
117
+ def update(new_template, append=false)
118
+ super(VIRTUAL_ROUTER_METHODS[:update], new_template, append ? 1 : 0)
119
+ end
120
+
121
+ # Changes the owner/group
122
+ # @param uid [Integer] the new owner id. Set to -1 to leave the current one
123
+ # @param gid [Integer] the new group id. Set to -1 to leave the current one
124
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
125
+ # otherwise
126
+ def chown(uid, gid)
127
+ super(VIRTUAL_ROUTER_METHODS[:chown], uid, gid)
128
+ end
129
+
130
+ # Changes the VirtualRouter permissions.
131
+ #
132
+ # @param octet [String] Permissions octed , e.g. 640
133
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
134
+ # otherwise
135
+ def chmod_octet(octet)
136
+ super(VIRTUAL_ROUTER_METHODS[:chmod], octet)
137
+ end
138
+
139
+ # Changes the VirtualRouter permissions.
140
+ # Each [Integer] argument must be 1 to allow, 0 deny, -1 do not change
141
+ #
142
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
143
+ # otherwise
144
+ def chmod(owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u,
145
+ other_m, other_a)
146
+ super(VIRTUAL_ROUTER_METHODS[:chmod], owner_u, owner_m, owner_a, group_u,
147
+ group_m, group_a, other_u, other_m, other_a)
148
+ end
149
+
150
+ # Renames this VirtualRouter
151
+ #
152
+ # @param name [String] New name for the VirtualRouter.
153
+ #
154
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
155
+ # otherwise
156
+ def rename(name)
157
+ return call(VIRTUAL_ROUTER_METHODS[:rename], @pe_id, name)
158
+ end
159
+
160
+ # Attaches a NIC to this VirtualRouter, and each one of its VMs
161
+ #
162
+ # @param nic_template [String] Template containing a NIC element
163
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
164
+ # otherwise
165
+ def nic_attach(nic_template)
166
+ return call(VIRTUAL_ROUTER_METHODS[:attachnic], @pe_id, nic_template)
167
+ end
168
+
169
+ # Detaches a NIC from this VirtualRouter, and each one of its VMs
170
+ #
171
+ # @param nic_id [Integer] Id of the NIC to be detached
172
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
173
+ # otherwise
174
+ def nic_detach(nic_id)
175
+ return call(VIRTUAL_ROUTER_METHODS[:detachnic], @pe_id, nic_id)
176
+ end
177
+
178
+ #######################################################################
179
+ # Helpers to get VirtualRouter information
180
+ #######################################################################
181
+
182
+ # Returns the group identifier
183
+ # @return [Integer] the element's group ID
184
+ def gid
185
+ self['GID'].to_i
186
+ end
187
+
188
+ def owner_id
189
+ self['UID'].to_i
190
+ end
191
+
192
+ # Returns an array with the numeric VM ids
193
+ def vm_ids
194
+ array = Array.new
195
+
196
+ self.each("VMS/ID") do |id|
197
+ array << id.text.to_i
198
+ end
199
+
200
+ return array
201
+ end
202
+ end
203
+ end
@@ -0,0 +1,79 @@
1
+ # -------------------------------------------------------------------------- #
2
+ # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
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 VirtualRouterPool < Pool
22
+ #######################################################################
23
+ # Constants and Class attribute accessors
24
+ #######################################################################
25
+
26
+
27
+ VIRTUAL_ROUTER_POOL_METHODS = {
28
+ :info => "vrouterpool.info"
29
+ }
30
+
31
+ #######################################################################
32
+ # Class constructor & Pool Methods
33
+ #######################################################################
34
+
35
+ # +client+ a Client object that represents an XML-RPC connection
36
+ # +user_id+ used to refer to a Pool with Virtual Routers from that user
37
+ def initialize(client, user_id=-1)
38
+ super('VROUTER_POOL','VROUTER',client)
39
+
40
+ @user_id = user_id
41
+ end
42
+
43
+ # Factory method to create Virtual Router objects
44
+ def factory(element_xml)
45
+ OpenNebula::VirtualRouter.new(element_xml,@client)
46
+ end
47
+
48
+ #######################################################################
49
+ # XML-RPC Methods for the Virtual Router Object
50
+ #######################################################################
51
+
52
+ # Retrieves all or part of the Virtual Routers in the pool.
53
+ def info(*args)
54
+ case args.size
55
+ when 0
56
+ info_filter(VIRTUAL_ROUTER_POOL_METHODS[:info],@user_id,-1,-1)
57
+ when 3
58
+ info_filter(VIRTUAL_ROUTER_POOL_METHODS[:info],args[0],args[1],args[2])
59
+ end
60
+ end
61
+
62
+ def info_all()
63
+ return super(VIRTUAL_ROUTER_POOL_METHODS[:info])
64
+ end
65
+
66
+ def info_mine()
67
+ return super(VIRTUAL_ROUTER_POOL_METHODS[:info])
68
+ end
69
+
70
+ def info_group()
71
+ return super(VIRTUAL_ROUTER_POOL_METHODS[:info])
72
+ end
73
+
74
+ alias_method :info!, :info
75
+ alias_method :info_all!, :info_all
76
+ alias_method :info_mine!, :info_mine
77
+ alias_method :info_group!, :info_group
78
+ end
79
+ end
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -65,6 +65,11 @@ module OpenNebula
65
65
  return doc
66
66
  end
67
67
 
68
+ # Checks if the internal XML representation is valid
69
+ def xml_nil?
70
+ return @xml.nil?
71
+ end
72
+
68
73
  # Extract a text element from the XML description of the PoolElement.
69
74
  #
70
75
  # @param [String] key Xpath expression
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opennebula
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.14.2
4
+ version: 4.90.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenNebula
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-25 00:00:00.000000000 Z
11
+ date: 2016-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -82,6 +82,10 @@ files:
82
82
  - lib/opennebula/image_pool.rb
83
83
  - lib/opennebula/ldap_auth.rb
84
84
  - lib/opennebula/ldap_auth_spec.rb
85
+ - lib/opennebula/marketplace.rb
86
+ - lib/opennebula/marketplace_pool.rb
87
+ - lib/opennebula/marketplaceapp.rb
88
+ - lib/opennebula/marketplaceapp_pool.rb
85
89
  - lib/opennebula/oneflow_client.rb
86
90
  - lib/opennebula/pool.rb
87
91
  - lib/opennebula/pool_element.rb
@@ -101,6 +105,8 @@ files:
101
105
  - lib/opennebula/virtual_machine_pool.rb
102
106
  - lib/opennebula/virtual_network.rb
103
107
  - lib/opennebula/virtual_network_pool.rb
108
+ - lib/opennebula/virtual_router.rb
109
+ - lib/opennebula/virtual_router_pool.rb
104
110
  - lib/opennebula/x509_auth.rb
105
111
  - lib/opennebula/xml_element.rb
106
112
  - lib/opennebula/xml_pool.rb
@@ -122,12 +128,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
128
  version: '0'
123
129
  required_rubygems_version: !ruby/object:Gem::Requirement
124
130
  requirements:
125
- - - ">="
131
+ - - ">"
126
132
  - !ruby/object:Gem::Version
127
- version: '0'
133
+ version: 1.3.1
128
134
  requirements: []
129
135
  rubyforge_project:
130
- rubygems_version: 2.4.5.1
136
+ rubygems_version: 2.5.1
131
137
  signing_key:
132
138
  specification_version: 4
133
139
  summary: OpenNebula Client API