opennebula 4.6.1 → 4.7.80.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/opennebula/group.rb +37 -3
- data/lib/opennebula/image.rb +2 -2
- data/lib/opennebula/template.rb +1 -0
- data/lib/opennebula/virtual_network.rb +93 -46
- data/lib/opennebula.rb +1 -1
- metadata +45 -51
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 94b0a4e8af842368b4a10db1eb29973da9ef60fd
|
4
|
+
data.tar.gz: 2a601e7dc101041b02e8cd0203acd4f9cecd42fd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 27e3c88db54a97371e89d48ccfc4f4b6c82edb48dfcc915cf75d74f0c48bd568dd36f7342588fdbe493f885480682391733c54071ecde5567d73366cfc108514
|
7
|
+
data.tar.gz: 84a799f0f7a394e524dfe52e2c4ab7172bdcd3570cdac35b6c23689af89c81af7d8d86eec5cba85db0b768ca85e4143909f0073db7835810c1adbde2310c51b5
|
data/lib/opennebula/group.rb
CHANGED
@@ -85,6 +85,10 @@ module OpenNebula
|
|
85
85
|
# group_hash[:resource_providers]
|
86
86
|
# group_hash[:resource_providers][:zone_id]
|
87
87
|
# group_hash[:resource_providers][:cluster_id]
|
88
|
+
# group_hash[:views] Array of sunstone view names, to be stored
|
89
|
+
# in SUNSTONE_VIEWS
|
90
|
+
# group_hash[:default_view] Default sunstone view name, to be stored
|
91
|
+
# in DEFAULT_VIEW
|
88
92
|
#
|
89
93
|
def create(group_hash)
|
90
94
|
# Check arguments
|
@@ -123,18 +127,45 @@ module OpenNebula
|
|
123
127
|
return OpenNebula::Error.new(error_msg)
|
124
128
|
end
|
125
129
|
|
130
|
+
# Set group ACLs to share resources
|
131
|
+
if group_hash[:shared_resources]
|
132
|
+
acls = Array.new
|
133
|
+
acls << "@#{self.id} #{group_hash[:shared_resources]}/@#{self.id} USE"
|
134
|
+
|
135
|
+
rc, msg = create_group_acls(acls)
|
136
|
+
|
137
|
+
if OpenNebula.is_error?(rc)
|
138
|
+
self.delete
|
139
|
+
error_msg = "Error creating group ACL's: #{rc.message}"
|
140
|
+
return OpenNebula::Error.new(error_msg)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
126
144
|
# Create associated group admin if needed
|
127
145
|
rc = create_admin_user(group_hash)
|
128
146
|
|
129
147
|
if OpenNebula.is_error?(rc)
|
130
148
|
self.delete
|
131
|
-
error_msg = "Error creating admin
|
149
|
+
error_msg = "Error creating admin user: #{rc.message}"
|
132
150
|
return OpenNebula::Error.new(error_msg)
|
133
151
|
end
|
134
152
|
|
135
|
-
|
153
|
+
str = ""
|
154
|
+
update = false
|
155
|
+
|
156
|
+
# Add Sunstone views for the group
|
136
157
|
if group_hash[:views]
|
137
|
-
str
|
158
|
+
str += "SUNSTONE_VIEWS=\"#{group_hash[:views].join(",")}\"\n"
|
159
|
+
update = true
|
160
|
+
end
|
161
|
+
|
162
|
+
# Add Sunstone views for the group
|
163
|
+
if group_hash[:default_view]
|
164
|
+
str += "DEFAULT_VIEW=\"#{group_hash[:default_view]}\"\n"
|
165
|
+
update = true
|
166
|
+
end
|
167
|
+
|
168
|
+
if update
|
138
169
|
self.update(str, true)
|
139
170
|
end
|
140
171
|
|
@@ -305,6 +336,9 @@ module OpenNebula
|
|
305
336
|
return rc
|
306
337
|
end
|
307
338
|
|
339
|
+
# Set the default admin view to vdcadmin
|
340
|
+
group_admin.update("DEFAULT_VIEW=#{GROUP_ADMIN_SUNSTONE_VIEWS}", true)
|
341
|
+
|
308
342
|
#Create admin group acls
|
309
343
|
acls = Array.new
|
310
344
|
|
data/lib/opennebula/image.rb
CHANGED
@@ -206,10 +206,10 @@ module OpenNebula
|
|
206
206
|
#
|
207
207
|
# @return [Integer, OpenNebula::Error] The new Image ID in case
|
208
208
|
# of success, Error otherwise
|
209
|
-
def clone(name)
|
209
|
+
def clone(name, target_ds=-1)
|
210
210
|
return Error.new('ID not defined') if !@pe_id
|
211
211
|
|
212
|
-
rc = @client.call(IMAGE_METHODS[:clone], @pe_id, name)
|
212
|
+
rc = @client.call(IMAGE_METHODS[:clone], @pe_id, name, target_ds)
|
213
213
|
|
214
214
|
return rc
|
215
215
|
end
|
data/lib/opennebula/template.rb
CHANGED
@@ -23,26 +23,21 @@ module OpenNebula
|
|
23
23
|
# Constants and Class Methods
|
24
24
|
#######################################################################
|
25
25
|
|
26
|
-
|
27
26
|
VN_METHODS = {
|
28
27
|
:info => "vn.info",
|
29
28
|
:allocate => "vn.allocate",
|
30
29
|
:delete => "vn.delete",
|
31
|
-
:
|
32
|
-
:
|
30
|
+
:add_ar => "vn.add_ar",
|
31
|
+
:rm_ar => "vn.rm_ar",
|
32
|
+
:update_ar => "vn.update_ar",
|
33
33
|
:chown => "vn.chown",
|
34
34
|
:chmod => "vn.chmod",
|
35
35
|
:update => "vn.update",
|
36
36
|
:hold => "vn.hold",
|
37
37
|
:release => "vn.release",
|
38
|
-
:rename => "vn.rename"
|
39
|
-
|
40
|
-
|
41
|
-
VN_TYPES=%w{RANGED FIXED}
|
42
|
-
|
43
|
-
SHORT_VN_TYPES={
|
44
|
-
"RANGED" => "R",
|
45
|
-
"FIXED" => "F"
|
38
|
+
:rename => "vn.rename",
|
39
|
+
:reserve => "vn.reserve",
|
40
|
+
:free_ar => "vn.free_ar"
|
46
41
|
}
|
47
42
|
|
48
43
|
# Creates a VirtualNetwork description with just its identifier
|
@@ -116,38 +111,52 @@ module OpenNebula
|
|
116
111
|
super(VN_METHODS[:delete])
|
117
112
|
end
|
118
113
|
|
119
|
-
# Adds
|
120
|
-
def
|
114
|
+
# Adds Address Ranges to the VirtualNetwork
|
115
|
+
def add_ar(ar_template)
|
121
116
|
return Error.new('ID not defined') if !@pe_id
|
122
117
|
|
123
|
-
|
124
|
-
lease_template << ", MAC = #{mac}" if mac
|
125
|
-
lease_template << " ]"
|
126
|
-
|
127
|
-
rc = @client.call(VN_METHODS[:addleases], @pe_id, lease_template)
|
118
|
+
rc = @client.call(VN_METHODS[:add_ar], @pe_id, ar_template)
|
128
119
|
rc = nil if !OpenNebula.is_error?(rc)
|
129
120
|
|
130
121
|
return rc
|
131
122
|
end
|
132
123
|
|
133
|
-
# Removes
|
134
|
-
def
|
124
|
+
# Removes an Address Range from the VirtualNetwork
|
125
|
+
def rm_ar(ar_id)
|
135
126
|
return Error.new('ID not defined') if !@pe_id
|
136
127
|
|
137
|
-
|
128
|
+
rc = @client.call(VN_METHODS[:rm_ar], @pe_id, ar_id.to_i)
|
129
|
+
rc = nil if !OpenNebula.is_error?(rc)
|
130
|
+
|
131
|
+
return rc
|
132
|
+
end
|
133
|
+
|
134
|
+
# Updates Address Ranges from the VirtualNetwork
|
135
|
+
def update_ar(ar_template)
|
136
|
+
return Error.new('ID not defined') if !@pe_id
|
138
137
|
|
139
|
-
rc = @client.call(VN_METHODS[:
|
138
|
+
rc = @client.call(VN_METHODS[:update_ar], @pe_id, ar_template)
|
140
139
|
rc = nil if !OpenNebula.is_error?(rc)
|
141
140
|
|
142
141
|
return rc
|
143
142
|
end
|
144
143
|
|
145
|
-
# Holds a virtual network
|
146
|
-
# @param ip [String]
|
147
|
-
|
144
|
+
# Holds a virtual network address
|
145
|
+
# @param ip [String] address to hold, if contains ":" a MAC address is assumed
|
146
|
+
# @param ar_id [Integer] The address range to hold the lease. If not set
|
147
|
+
# the lease will be held from all possible address ranges
|
148
|
+
def hold(ip, ar_id=-1)
|
148
149
|
return Error.new('ID not defined') if !@pe_id
|
149
150
|
|
150
|
-
|
151
|
+
if ip.include?':'
|
152
|
+
addr_name = "MAC"
|
153
|
+
else
|
154
|
+
addr_name = "IP"
|
155
|
+
end
|
156
|
+
|
157
|
+
lease_template = "LEASES = [ #{addr_name} = #{ip}"
|
158
|
+
lease_template << ", AR_ID = #{ar_id}" if ar_id != -1
|
159
|
+
lease_template << "]"
|
151
160
|
|
152
161
|
rc = @client.call(VN_METHODS[:hold], @pe_id, lease_template)
|
153
162
|
rc = nil if !OpenNebula.is_error?(rc)
|
@@ -155,12 +164,22 @@ module OpenNebula
|
|
155
164
|
return rc
|
156
165
|
end
|
157
166
|
|
158
|
-
# Releases
|
159
|
-
# @param ip [String] IP to release
|
160
|
-
|
167
|
+
# Releases an address on hold
|
168
|
+
# @param ip [String] IP to release, if contains ":" a MAC address is assumed
|
169
|
+
# @param ar_id [Integer] The address range to release the lease. If not
|
170
|
+
# set the lease will be freed from all possible address ranges
|
171
|
+
def release(ip, ar_id=-1)
|
161
172
|
return Error.new('ID not defined') if !@pe_id
|
162
173
|
|
163
|
-
|
174
|
+
if ip.include?':'
|
175
|
+
addr_name = "MAC"
|
176
|
+
else
|
177
|
+
addr_name = "IP"
|
178
|
+
end
|
179
|
+
|
180
|
+
lease_template = "LEASES = [ #{addr_name} = #{ip}"
|
181
|
+
lease_template << ", AR_ID = #{ar_id}" if ar_id != -1
|
182
|
+
lease_template << "]"
|
164
183
|
|
165
184
|
rc = @client.call(VN_METHODS[:release], @pe_id, lease_template)
|
166
185
|
rc = nil if !OpenNebula.is_error?(rc)
|
@@ -168,6 +187,49 @@ module OpenNebula
|
|
168
187
|
return rc
|
169
188
|
end
|
170
189
|
|
190
|
+
# Reserve a set of addresses from this virtual network
|
191
|
+
# @param name [String] of the reservation
|
192
|
+
# @param rsize[String] number of addresses to reserve
|
193
|
+
# @param ar_id[String] the ar_id to make the reservation. If set to nil
|
194
|
+
# any address range will be used
|
195
|
+
# @param addr [String] the first address in the reservation. If set to
|
196
|
+
# nil the first free address will be used
|
197
|
+
# @param vnet [String] ID of the VNET to add the reservation to. If not
|
198
|
+
# set a new VNET will be created.
|
199
|
+
def reserve(rname, rsize, ar_id, addr, vnet)
|
200
|
+
return Error.new('ID not defined') if !@pe_id
|
201
|
+
|
202
|
+
rtmpl = "SIZE = #{rsize}\n"
|
203
|
+
rtmpl << "NAME = #{rname}\n" if !rname.nil?
|
204
|
+
rtmpl << "AR_ID = #{ar_id}\n" if !ar_id.nil?
|
205
|
+
rtmpl << "NETWORK_ID = #{vnet}\n" if !vnet.nil?
|
206
|
+
|
207
|
+
if !addr.nil?
|
208
|
+
if addr.include?':'
|
209
|
+
addr_name = "MAC"
|
210
|
+
else
|
211
|
+
addr_name = "IP"
|
212
|
+
end
|
213
|
+
|
214
|
+
rtmpl << "#{addr_name} = #{addr}\n"
|
215
|
+
end
|
216
|
+
|
217
|
+
rc = @client.call(VN_METHODS[:reserve], @pe_id, rtmpl)
|
218
|
+
rc = nil if !OpenNebula.is_error?(rc)
|
219
|
+
|
220
|
+
return rc
|
221
|
+
end
|
222
|
+
|
223
|
+
# Removes an Address Range from the VirtualNetwork
|
224
|
+
def free(ar_id)
|
225
|
+
return Error.new('ID not defined') if !@pe_id
|
226
|
+
|
227
|
+
rc = @client.call(VN_METHODS[:free_ar], @pe_id, ar_id.to_i)
|
228
|
+
rc = nil if !OpenNebula.is_error?(rc)
|
229
|
+
|
230
|
+
return rc
|
231
|
+
end
|
232
|
+
|
171
233
|
# Changes the owner/group
|
172
234
|
#
|
173
235
|
# @param uid [Integer] the new owner id. Set to -1 to leave the current one
|
@@ -198,7 +260,7 @@ module OpenNebula
|
|
198
260
|
super(VN_METHODS[:chmod], owner_u, owner_m, owner_a, group_u,
|
199
261
|
group_m, group_a, other_u, other_m, other_a)
|
200
262
|
end
|
201
|
-
|
263
|
+
|
202
264
|
# Renames this virtual network
|
203
265
|
#
|
204
266
|
# @param name [String] New name for the virtual network.
|
@@ -219,21 +281,6 @@ module OpenNebula
|
|
219
281
|
self['GID'].to_i
|
220
282
|
end
|
221
283
|
|
222
|
-
# Returns the type of the Virtual Network (numeric value)
|
223
|
-
def type
|
224
|
-
self['TYPE'].to_i
|
225
|
-
end
|
226
|
-
|
227
|
-
# Returns the type of the Virtual Network (string value)
|
228
|
-
def type_str
|
229
|
-
VN_TYPES[type]
|
230
|
-
end
|
231
|
-
|
232
|
-
# Returns the state of the Virtual Network (string value)
|
233
|
-
def short_type_str
|
234
|
-
SHORT_VN_TYPES[type_str]
|
235
|
-
end
|
236
|
-
|
237
284
|
def public?
|
238
285
|
if self['PERMISSIONS/GROUP_U'] == "1" || self['PERMISSIONS/OTHER_U'] == "1"
|
239
286
|
true
|
data/lib/opennebula.rb
CHANGED
metadata
CHANGED
@@ -1,46 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opennebula
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
5
|
-
prerelease:
|
4
|
+
version: 4.7.80.beta
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- OpenNebula
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-
|
11
|
+
date: 2014-07-17 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: nokogiri
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: json
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
description: Libraries needed to talk to OpenNebula
|
@@ -49,73 +44,72 @@ executables: []
|
|
49
44
|
extensions: []
|
50
45
|
extra_rdoc_files: []
|
51
46
|
files:
|
47
|
+
- LICENSE
|
48
|
+
- NOTICE
|
52
49
|
- lib/opennebula.rb
|
53
|
-
- lib/opennebula/
|
54
|
-
- lib/opennebula/
|
55
|
-
- lib/opennebula/
|
56
|
-
- lib/opennebula/
|
57
|
-
- lib/opennebula/pool.rb
|
50
|
+
- lib/opennebula/acl.rb
|
51
|
+
- lib/opennebula/acl_pool.rb
|
52
|
+
- lib/opennebula/client.rb
|
53
|
+
- lib/opennebula/cluster.rb
|
58
54
|
- lib/opennebula/cluster_pool.rb
|
59
|
-
- lib/opennebula/template_pool.rb
|
60
|
-
- lib/opennebula/document_pool.rb
|
61
55
|
- lib/opennebula/datastore.rb
|
62
56
|
- lib/opennebula/datastore_pool.rb
|
63
|
-
- lib/opennebula/
|
64
|
-
- lib/opennebula/
|
57
|
+
- lib/opennebula/document.rb
|
58
|
+
- lib/opennebula/document_json.rb
|
59
|
+
- lib/opennebula/document_pool.rb
|
65
60
|
- lib/opennebula/document_pool_json.rb
|
66
|
-
- lib/opennebula/acl_pool.rb
|
67
|
-
- lib/opennebula/template.rb
|
68
|
-
- lib/opennebula/zone.rb
|
69
|
-
- lib/opennebula/client.rb
|
70
|
-
- lib/opennebula/cluster.rb
|
71
|
-
- lib/opennebula/pool_element.rb
|
72
|
-
- lib/opennebula/virtual_machine.rb
|
73
|
-
- lib/opennebula/user.rb
|
74
61
|
- lib/opennebula/error.rb
|
75
|
-
- lib/opennebula/
|
62
|
+
- lib/opennebula/group.rb
|
63
|
+
- lib/opennebula/group_pool.rb
|
64
|
+
- lib/opennebula/host.rb
|
76
65
|
- lib/opennebula/host_pool.rb
|
77
|
-
- lib/opennebula/
|
78
|
-
- lib/opennebula/xml_element.rb
|
79
|
-
- lib/opennebula/oneflow_client.rb
|
80
|
-
- lib/opennebula/virtual_network.rb
|
66
|
+
- lib/opennebula/image.rb
|
81
67
|
- lib/opennebula/image_pool.rb
|
82
|
-
- lib/opennebula/virtual_network_pool.rb
|
83
|
-
- lib/opennebula/zone_pool.rb
|
84
|
-
- lib/opennebula/group.rb
|
85
|
-
- lib/opennebula/system.rb
|
86
|
-
- lib/opennebula/virtual_machine_pool.rb
|
87
|
-
- lib/opennebula/acl.rb
|
88
68
|
- lib/opennebula/ldap_auth.rb
|
89
69
|
- lib/opennebula/ldap_auth_spec.rb
|
90
|
-
- lib/opennebula/
|
91
|
-
- lib/opennebula/
|
92
|
-
- lib/opennebula/
|
70
|
+
- lib/opennebula/oneflow_client.rb
|
71
|
+
- lib/opennebula/pool.rb
|
72
|
+
- lib/opennebula/pool_element.rb
|
93
73
|
- lib/opennebula/server_cipher_auth.rb
|
94
|
-
-
|
95
|
-
-
|
74
|
+
- lib/opennebula/server_x509_auth.rb
|
75
|
+
- lib/opennebula/ssh_auth.rb
|
76
|
+
- lib/opennebula/system.rb
|
77
|
+
- lib/opennebula/template.rb
|
78
|
+
- lib/opennebula/template_pool.rb
|
79
|
+
- lib/opennebula/user.rb
|
80
|
+
- lib/opennebula/user_pool.rb
|
81
|
+
- lib/opennebula/virtual_machine.rb
|
82
|
+
- lib/opennebula/virtual_machine_pool.rb
|
83
|
+
- lib/opennebula/virtual_network.rb
|
84
|
+
- lib/opennebula/virtual_network_pool.rb
|
85
|
+
- lib/opennebula/x509_auth.rb
|
86
|
+
- lib/opennebula/xml_element.rb
|
87
|
+
- lib/opennebula/xml_pool.rb
|
88
|
+
- lib/opennebula/xml_utils.rb
|
89
|
+
- lib/opennebula/zone.rb
|
90
|
+
- lib/opennebula/zone_pool.rb
|
96
91
|
homepage: http://opennebula.org
|
97
92
|
licenses: []
|
93
|
+
metadata: {}
|
98
94
|
post_install_message:
|
99
95
|
rdoc_options: []
|
100
96
|
require_paths:
|
101
97
|
- lib
|
102
98
|
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
-
none: false
|
104
99
|
requirements:
|
105
|
-
- -
|
100
|
+
- - ">="
|
106
101
|
- !ruby/object:Gem::Version
|
107
102
|
version: '0'
|
108
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
-
none: false
|
110
104
|
requirements:
|
111
|
-
- -
|
105
|
+
- - ">"
|
112
106
|
- !ruby/object:Gem::Version
|
113
|
-
version:
|
107
|
+
version: 1.3.1
|
114
108
|
requirements: []
|
115
109
|
rubyforge_project:
|
116
|
-
rubygems_version:
|
110
|
+
rubygems_version: 2.2.2
|
117
111
|
signing_key:
|
118
|
-
specification_version:
|
112
|
+
specification_version: 4
|
119
113
|
summary: OpenNebula Client API
|
120
114
|
test_files: []
|
121
115
|
has_rdoc:
|