opennebula 5.3.80.beta1 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cloud/CloudClient.rb +1 -1
- data/lib/opennebula.rb +2 -1
- data/lib/opennebula/client.rb +6 -2
- data/lib/opennebula/host.rb +1 -1
- data/lib/opennebula/ldap_auth.rb +22 -4
- data/lib/opennebula/system.rb +18 -1
- data/lib/opennebula/utils.rb +50 -0
- data/lib/opennebula/virtual_machine.rb +4 -14
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca8e48dff96a619344f9f0ecc9898d159e755bee
|
4
|
+
data.tar.gz: 4991ad72e4dc6de08a4df646804e6ba07d8cecc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a8202519ce9a8183a0dbfcc50a70513c26fff537c3962e2a6c81d24415a88f898fe8c1d3a8c8e89229556ff50eb400496e942b97d08b69d37a2cab9ae2786b5
|
7
|
+
data.tar.gz: eae3a740d5e3f1b43a92a05640d8985be8279d03e7a943f6631b0858adbcadd136efa23f4dfce170fa457ff7b59437cd334a67c31269609fc8fe84b3e7c67136
|
data/lib/cloud/CloudClient.rb
CHANGED
data/lib/opennebula.rb
CHANGED
@@ -27,6 +27,7 @@ require 'pp'
|
|
27
27
|
require 'opennebula/xml_utils'
|
28
28
|
require 'opennebula/client'
|
29
29
|
require 'opennebula/error'
|
30
|
+
require 'opennebula/utils'
|
30
31
|
require 'opennebula/virtual_machine'
|
31
32
|
require 'opennebula/virtual_machine_pool'
|
32
33
|
require 'opennebula/virtual_network'
|
@@ -68,5 +69,5 @@ require 'opennebula/vm_group_pool'
|
|
68
69
|
module OpenNebula
|
69
70
|
|
70
71
|
# OpenNebula version
|
71
|
-
VERSION = '5.
|
72
|
+
VERSION = '5.4.0'
|
72
73
|
end
|
data/lib/opennebula/client.rb
CHANGED
@@ -39,9 +39,11 @@ module OpenNebula
|
|
39
39
|
alias :start_element :startElement
|
40
40
|
|
41
41
|
def parse(str)
|
42
|
+
|
42
43
|
Ox.sax_parse(self, StringIO.new(str),
|
43
44
|
:symbolize => false,
|
44
|
-
:convert_special => true
|
45
|
+
:convert_special => true,
|
46
|
+
:skip => false)
|
45
47
|
end
|
46
48
|
end
|
47
49
|
end
|
@@ -83,6 +85,8 @@ module OpenNebula
|
|
83
85
|
# The client class, represents the connection with the core and handles the
|
84
86
|
# xml-rpc calls.
|
85
87
|
class Client
|
88
|
+
NO_ONE_AUTH_ERROR = "ONE_AUTH file not present"
|
89
|
+
|
86
90
|
attr_accessor :one_auth
|
87
91
|
attr_reader :one_endpoint
|
88
92
|
|
@@ -127,7 +131,7 @@ module OpenNebula
|
|
127
131
|
elsif File.file?("/var/lib/one/.one/one_auth")
|
128
132
|
@one_auth = File.read("/var/lib/one/.one/one_auth")
|
129
133
|
else
|
130
|
-
raise
|
134
|
+
raise NO_ONE_AUTH_ERROR
|
131
135
|
end
|
132
136
|
|
133
137
|
@one_auth = @one_auth.rstrip
|
data/lib/opennebula/host.rb
CHANGED
@@ -230,7 +230,7 @@ module OpenNebula
|
|
230
230
|
if vcenter_wild_vm
|
231
231
|
require 'vcenter_driver'
|
232
232
|
host_id = self["ID"]
|
233
|
-
vm_ref
|
233
|
+
vm_ref = wild["DEPLOY_ID"]
|
234
234
|
return VCenterDriver::Importer.import_wild(host_id, vm_ref, vm, template)
|
235
235
|
else
|
236
236
|
rc = vm.allocate(template)
|
data/lib/opennebula/ldap_auth.rb
CHANGED
@@ -48,7 +48,8 @@ class OpenNebula::LdapAuth
|
|
48
48
|
:mapping_filename => 'server1.yaml',
|
49
49
|
:mapping_key => 'GROUP_DN',
|
50
50
|
:mapping_default => 1,
|
51
|
-
:attributes => [ "memberOf" ]
|
51
|
+
:attributes => [ "memberOf" ],
|
52
|
+
:rfc2307bis => true
|
52
53
|
}.merge(options)
|
53
54
|
|
54
55
|
ops={}
|
@@ -61,6 +62,10 @@ class OpenNebula::LdapAuth
|
|
61
62
|
}
|
62
63
|
end
|
63
64
|
|
65
|
+
if !@options[:rfc2307bis]
|
66
|
+
@options[:attributes] << @options[:user_field]
|
67
|
+
end
|
68
|
+
|
64
69
|
ops[:host]=@options[:host] if @options[:host]
|
65
70
|
ops[:port]=@options[:port].to_i if @options[:port]
|
66
71
|
ops[:encryption]=@options[:encryption] if @options[:encryption]
|
@@ -181,9 +186,22 @@ class OpenNebula::LdapAuth
|
|
181
186
|
def get_groups
|
182
187
|
groups = []
|
183
188
|
|
184
|
-
|
185
|
-
|
186
|
-
|
189
|
+
if @options[:rfc2307bis]
|
190
|
+
[@user['memberOf']].flatten.each do |group|
|
191
|
+
if @mapping[group]
|
192
|
+
groups << @mapping[group]
|
193
|
+
end
|
194
|
+
end
|
195
|
+
else
|
196
|
+
filter = "(#{@options[:group_field]}=#{@user[@options[:user_field]].first})"
|
197
|
+
@ldap.search(
|
198
|
+
:base => @options[:base],
|
199
|
+
:attributes => "dn",
|
200
|
+
:filter => filter
|
201
|
+
) do |entry|
|
202
|
+
if @mapping[entry.dn]
|
203
|
+
groups << @mapping[entry.dn]
|
204
|
+
end
|
187
205
|
end
|
188
206
|
end
|
189
207
|
|
data/lib/opennebula/system.rb
CHANGED
@@ -30,7 +30,8 @@ module OpenNebula
|
|
30
30
|
:groupquotaupdate => "groupquota.update",
|
31
31
|
:version => "system.version",
|
32
32
|
:config => "system.config",
|
33
|
-
:sql => "system.sql"
|
33
|
+
:sql => "system.sql",
|
34
|
+
:sqlquery => "system.sqlquery"
|
34
35
|
}
|
35
36
|
|
36
37
|
#######################################################################
|
@@ -57,6 +58,22 @@ module OpenNebula
|
|
57
58
|
return @client.call(SYSTEM_METHODS[:sql], sql, federate)
|
58
59
|
end
|
59
60
|
|
61
|
+
# Executes a SQL query command on OpenNebula DB
|
62
|
+
# @param [String] Sql string
|
63
|
+
# @return [String, OpenNebula::Error] Sql execution result in XML
|
64
|
+
# format in case of success, Error otherwise
|
65
|
+
# <QUERY>
|
66
|
+
# the query sent to oned
|
67
|
+
# </QUERY>
|
68
|
+
# <RESULT>
|
69
|
+
# <ROW>
|
70
|
+
# <column_name>column_value</column_name>
|
71
|
+
# ...
|
72
|
+
# </ROW>
|
73
|
+
# </RESULT>
|
74
|
+
def sql_query_command(sql)
|
75
|
+
return @client.call(SYSTEM_METHODS[:sqlquery], sql)
|
76
|
+
end
|
60
77
|
#
|
61
78
|
# Gets the oned version
|
62
79
|
#
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# -------------------------------------------------------------------------- #
|
2
|
+
# Copyright 2002-2017, 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
|
+
module OpenNebula
|
18
|
+
# we use this file to extend opennebula oca functionalities
|
19
|
+
# It contains generic methods that can be used in oca context
|
20
|
+
# to help other components
|
21
|
+
|
22
|
+
# receive a object key => value format
|
23
|
+
# returns hashed values
|
24
|
+
def self.encrypt(opts, token)
|
25
|
+
res = {}
|
26
|
+
opts.each do |key, value|
|
27
|
+
cipher = OpenSSL::Cipher::AES.new(256,:CBC)
|
28
|
+
cipher.encrypt.key = token[0..31]
|
29
|
+
encrypted = cipher.update(value) + cipher.final
|
30
|
+
res[key] = Base64::encode64(encrypted).gsub("\n", "")
|
31
|
+
end
|
32
|
+
return res
|
33
|
+
end
|
34
|
+
|
35
|
+
# receive hashed values (res) with a token
|
36
|
+
# returns original values
|
37
|
+
def self.decrypt(res, token)
|
38
|
+
opts = {}
|
39
|
+
|
40
|
+
res.each do |key, encrypted_value|
|
41
|
+
decipher = OpenSSL::Cipher::AES.new(256,:CBC)
|
42
|
+
decipher.decrypt
|
43
|
+
decipher.key = token[0..31]
|
44
|
+
plain = decipher.update(Base64::decode64(encrypted_value)) + decipher.final
|
45
|
+
opts[key] = plain
|
46
|
+
end
|
47
|
+
return opts
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -14,7 +14,6 @@
|
|
14
14
|
# limitations under the License. #
|
15
15
|
#--------------------------------------------------------------------------- #
|
16
16
|
|
17
|
-
|
18
17
|
require 'opennebula/pool_element'
|
19
18
|
|
20
19
|
module OpenNebula
|
@@ -343,16 +342,6 @@ module OpenNebula
|
|
343
342
|
|
344
343
|
self.info
|
345
344
|
|
346
|
-
# Add dsid as VM template parameter for vcenter
|
347
|
-
if ds_id!=-1 &&
|
348
|
-
!self["/VM/USER_TEMPLATE/PUBLIC_CLOUD/TYPE"].nil? &&
|
349
|
-
self["/VM/USER_TEMPLATE/PUBLIC_CLOUD/TYPE"].downcase == "vcenter"
|
350
|
-
ds = OpenNebula::Datastore.new_with_id(ds_id, @client)
|
351
|
-
rc = ds.info
|
352
|
-
return rc if OpenNebula.is_error?(rc)
|
353
|
-
self.update("VCENTER_DS_REF=#{ds['/DATASTORE/VCENTER_DS_REF']}", true)
|
354
|
-
end
|
355
|
-
|
356
345
|
return call(VM_METHODS[:deploy],
|
357
346
|
@pe_id,
|
358
347
|
host_id.to_i,
|
@@ -755,10 +744,9 @@ module OpenNebula
|
|
755
744
|
# @return [Integer, OpenNebula::Error] the new Template ID in case of
|
756
745
|
# success, error otherwise
|
757
746
|
REMOVE_VNET_ATTRS = %w{AR_ID BRIDGE CLUSTER_ID IP MAC TARGET NIC_ID NETWORK_ID VN_MAD SECURITY_GROUPS}
|
758
|
-
def save_as_template(name, persistent=nil)
|
747
|
+
def save_as_template(name,description, persistent=nil)
|
759
748
|
img_ids = []
|
760
749
|
new_tid = nil
|
761
|
-
|
762
750
|
begin
|
763
751
|
rc = info()
|
764
752
|
raise if OpenNebula.is_error?(rc)
|
@@ -783,7 +771,9 @@ module OpenNebula
|
|
783
771
|
|
784
772
|
# Replace the original template's capacity with the actual VM values
|
785
773
|
replace = ""
|
786
|
-
|
774
|
+
if !description.nil?
|
775
|
+
replace << "DESCRIPTION = #{description}\n"
|
776
|
+
end
|
787
777
|
cpu = self['TEMPLATE/CPU']
|
788
778
|
if !cpu.nil? && !cpu.empty?
|
789
779
|
replace << "CPU = #{cpu}\n"
|
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: 5.
|
4
|
+
version: 5.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenNebula
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- lib/opennebula/template_pool.rb
|
105
105
|
- lib/opennebula/user.rb
|
106
106
|
- lib/opennebula/user_pool.rb
|
107
|
+
- lib/opennebula/utils.rb
|
107
108
|
- lib/opennebula/vdc.rb
|
108
109
|
- lib/opennebula/vdc_pool.rb
|
109
110
|
- lib/opennebula/virtual_machine.rb
|
@@ -136,9 +137,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
137
|
version: '0'
|
137
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
139
|
requirements:
|
139
|
-
- - "
|
140
|
+
- - ">="
|
140
141
|
- !ruby/object:Gem::Version
|
141
|
-
version:
|
142
|
+
version: '0'
|
142
143
|
requirements: []
|
143
144
|
rubyforge_project:
|
144
145
|
rubygems_version: 2.6.11
|