opennebula 6.0.3 → 6.1.80.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cloud/CloudClient.rb +1 -1
- data/lib/datastore.rb +6 -2
- data/lib/models/role.rb +13 -37
- data/lib/opennebula/ldap_auth.rb +3 -1
- data/lib/opennebula/server_cipher_auth.rb +6 -3
- data/lib/opennebula/virtual_machine.rb +42 -8
- data/lib/opennebula/zone.rb +40 -1
- data/lib/opennebula.rb +1 -1
- data/lib/vcenter_importer.rb +3 -1
- data/lib/virtual_machine.rb +13 -6
- data/lib/vm_template.rb +3 -0
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ec17a7a8b4c347550f293bb4db7f82cee1f1daf
|
4
|
+
data.tar.gz: 55f73a012fe7fae60070f37afca0cfab81fad686
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 504d1fd56b5b115bf6d6f49b689791eaf238ef75be357dd1debac901e2495fccc43d9cabc9c174e25d307768454254468201643975ee1920f7aafa98d2e26109
|
7
|
+
data.tar.gz: 2b295c38fd943e500cb78890462a0e98f34289646422ce5092080b03ea694d99bd2d0240e6bb0a706854daa9848acb42702bb47a2c4d0156b895f5038e007015
|
data/lib/cloud/CloudClient.rb
CHANGED
data/lib/datastore.rb
CHANGED
@@ -558,8 +558,12 @@ module VCenterDriver
|
|
558
558
|
raise 'Could not get file size or capacity' if size.nil?
|
559
559
|
|
560
560
|
size
|
561
|
-
rescue StandardError
|
562
|
-
|
561
|
+
rescue StandardError => e
|
562
|
+
message = "Could not find file. Reason: \"#{e.message}\"."
|
563
|
+
if VCenterDriver::CONFIG[:debug_information]
|
564
|
+
message += ' ' + e.backtrace
|
565
|
+
end
|
566
|
+
raise message
|
563
567
|
end
|
564
568
|
end
|
565
569
|
|
data/lib/models/role.rb
CHANGED
@@ -571,11 +571,20 @@ module OpenNebula
|
|
571
571
|
vm = OpenNebula::VirtualMachine.new_with_id(vm_id,
|
572
572
|
@service.client)
|
573
573
|
|
574
|
-
|
574
|
+
if do_offset
|
575
|
+
offset = (index / vms_per_period.to_i).floor
|
576
|
+
time_offset = offset * period.to_i
|
577
|
+
end
|
578
|
+
|
579
|
+
tmp_str = 'SCHED_ACTION = ['
|
580
|
+
tmp_str << "ACTION = #{action},"
|
581
|
+
tmp_str << "ARGS = \"#{args}\"," if args
|
582
|
+
tmp_str << "TIME = #{now + time_offset}]"
|
575
583
|
|
584
|
+
rc = vm.sched_action_add(tmp_str)
|
576
585
|
if OpenNebula.is_error?(rc)
|
577
|
-
msg = "Role #{name} : VM #{vm_id}
|
578
|
-
|
586
|
+
msg = "Role #{name} : VM #{vm_id} error scheduling "\
|
587
|
+
"action; #{rc.message}"
|
579
588
|
|
580
589
|
error_msgs << msg
|
581
590
|
|
@@ -583,40 +592,7 @@ module OpenNebula
|
|
583
592
|
|
584
593
|
@service.log_error(msg)
|
585
594
|
else
|
586
|
-
|
587
|
-
|
588
|
-
id = 0
|
589
|
-
if !ids.nil? && !ids.empty?
|
590
|
-
ids.map! {|e| e.to_i }
|
591
|
-
id = ids.max + 1
|
592
|
-
end
|
593
|
-
|
594
|
-
tmp_str = vm.user_template_str
|
595
|
-
|
596
|
-
if do_offset
|
597
|
-
offset = (index / vms_per_period.to_i).floor
|
598
|
-
time_offset = offset * period.to_i
|
599
|
-
end
|
600
|
-
|
601
|
-
tmp_str << "\nSCHED_ACTION = ["
|
602
|
-
tmp_str << "ID = #{id},"
|
603
|
-
tmp_str << "ACTION = #{action},"
|
604
|
-
tmp_str << "ARGS = \"#{args}\"," if args
|
605
|
-
tmp_str << "TIME = #{now + time_offset}]"
|
606
|
-
|
607
|
-
rc = vm.update(tmp_str)
|
608
|
-
if OpenNebula.is_error?(rc)
|
609
|
-
msg = "Role #{name} : VM #{vm_id} error scheduling "\
|
610
|
-
"action; #{rc.message}"
|
611
|
-
|
612
|
-
error_msgs << msg
|
613
|
-
|
614
|
-
Log.error LOG_COMP, msg, @service.id
|
615
|
-
|
616
|
-
@service.log_error(msg)
|
617
|
-
else
|
618
|
-
vms_id << vm.id
|
619
|
-
end
|
595
|
+
vms_id << vm.id
|
620
596
|
end
|
621
597
|
end
|
622
598
|
|
data/lib/opennebula/ldap_auth.rb
CHANGED
@@ -161,7 +161,8 @@ class OpenNebula::LdapAuth
|
|
161
161
|
end
|
162
162
|
|
163
163
|
def is_in_group?(user, group)
|
164
|
-
username =
|
164
|
+
username = Net::LDAP::Filter.escape(
|
165
|
+
user.first.force_encoding(Encoding::UTF_8))
|
165
166
|
result=@ldap.search(
|
166
167
|
:base => group,
|
167
168
|
:attributes => [@options[:group_field]],
|
@@ -273,6 +274,7 @@ def get_server_order(opts, user)
|
|
273
274
|
user = m[1] if m[1]
|
274
275
|
|
275
276
|
order << to_array(server)
|
277
|
+
break
|
276
278
|
end
|
277
279
|
end
|
278
280
|
|
@@ -41,8 +41,10 @@ class OpenNebula::ServerCipherAuth
|
|
41
41
|
if !srv_passwd.empty?
|
42
42
|
# truncate token to 32-bytes for Ruby >= 2.4
|
43
43
|
@key = Digest::SHA256.hexdigest(@srv_passwd)[0..31]
|
44
|
-
|
44
|
+
@iv = @key[0..15]
|
45
|
+
else
|
45
46
|
@key = ""
|
47
|
+
@iv = ""
|
46
48
|
end
|
47
49
|
|
48
50
|
@cipher = OpenSSL::Cipher.new(CIPHER)
|
@@ -112,6 +114,7 @@ class OpenNebula::ServerCipherAuth
|
|
112
114
|
begin
|
113
115
|
# truncate token to 32-bytes for Ruby >= 2.4
|
114
116
|
@key = srv_pass[0..31]
|
117
|
+
@iv = srv_pass[0..15]
|
115
118
|
|
116
119
|
token_array = decrypt(signed_text).split(':')
|
117
120
|
|
@@ -133,7 +136,7 @@ class OpenNebula::ServerCipherAuth
|
|
133
136
|
def encrypt(data)
|
134
137
|
@cipher.encrypt
|
135
138
|
@cipher.key = @key
|
136
|
-
|
139
|
+
@cipher.iv = @iv
|
137
140
|
rc = @cipher.update(data)
|
138
141
|
rc << @cipher.final
|
139
142
|
|
@@ -143,7 +146,7 @@ class OpenNebula::ServerCipherAuth
|
|
143
146
|
def decrypt(data)
|
144
147
|
@cipher.decrypt
|
145
148
|
@cipher.key = @key
|
146
|
-
|
149
|
+
@cipher.iv = @iv
|
147
150
|
rc = @cipher.update(Base64::decode64(data))
|
148
151
|
rc << @cipher.final
|
149
152
|
|
@@ -50,8 +50,11 @@ module OpenNebula
|
|
50
50
|
:disksnapshotrename => "vm.disksnapshotrename",
|
51
51
|
:diskresize => "vm.diskresize",
|
52
52
|
:updateconf => "vm.updateconf",
|
53
|
-
:lock
|
54
|
-
:unlock
|
53
|
+
:lock => "vm.lock",
|
54
|
+
:unlock => "vm.unlock",
|
55
|
+
:schedadd => "vm.schedadd",
|
56
|
+
:scheddelete => "vm.scheddelete",
|
57
|
+
:schedupdate => "vm.schedupdate"
|
55
58
|
}
|
56
59
|
|
57
60
|
VM_STATE=%w{INIT PENDING HOLD ACTIVE STOPPED SUSPENDED DONE FAILED
|
@@ -260,7 +263,7 @@ module OpenNebula
|
|
260
263
|
# +id+ the id of the vm
|
261
264
|
#
|
262
265
|
# Example:
|
263
|
-
#
|
266
|
+
# vm = VirtualMachine.new(VirtualMachine.build_xml(3),rpc_client)
|
264
267
|
#
|
265
268
|
def VirtualMachine.build_xml(pe_id=nil)
|
266
269
|
if pe_id
|
@@ -710,18 +713,49 @@ module OpenNebula
|
|
710
713
|
end
|
711
714
|
end
|
712
715
|
|
713
|
-
#
|
714
|
-
#
|
715
|
-
#
|
716
|
+
# Changes the attributes of a VM in power off, failure and undeploy
|
717
|
+
# states
|
718
|
+
#
|
719
|
+
# @param new_conf, string describing the new attributes. Each attribute
|
716
720
|
# will replace the existing ones or delete it if empty. Attributes that
|
717
721
|
# can be updated are: INPUT/{TYPE, BUS}; RAW/{TYPE, DATA, DATA_VMX},
|
718
722
|
# OS/{BOOT, BOOTLOADER, ARCH, MACHINE, KERNEL, INITRD},
|
719
723
|
# FEATURES/{ACPI, APIC, PAE, LOCALTIME, HYPERV, GUEST_AGENT},
|
720
724
|
# and GRAPHICS/{TYPE, LISTEN, PASSWD, KEYMAP}
|
725
|
+
# @param append, append template, do not delete empty attributes
|
726
|
+
# @return [nil, OpenNebula::Error] nil in case of success, Error
|
727
|
+
# otherwise
|
728
|
+
def updateconf(new_conf, append = false)
|
729
|
+
return call(VM_METHODS[:updateconf], @pe_id, new_conf, append ? 1 : 0)
|
730
|
+
end
|
731
|
+
|
732
|
+
# Add sched actions
|
733
|
+
#
|
734
|
+
# @param sched_template [String] Template with SCHED_ACTIONs
|
735
|
+
# @return [nil, OpenNebula::Error] nil in case of success, Error
|
736
|
+
# otherwise
|
737
|
+
def sched_action_add(sched_template)
|
738
|
+
return call(VM_METHODS[:schedadd], @pe_id, sched_template)
|
739
|
+
end
|
740
|
+
|
741
|
+
# Delete sched action
|
742
|
+
#
|
743
|
+
# @param sched_id [Int] id of the SCHED_ACTION
|
744
|
+
# @return [nil, OpenNebula::Error] nil in case of success, Error
|
745
|
+
# otherwise
|
746
|
+
def sched_action_delete(sched_id)
|
747
|
+
return call(VM_METHODS[:scheddelete], @pe_id, sched_id.to_i)
|
748
|
+
end
|
749
|
+
|
750
|
+
# Update sched_action
|
751
|
+
#
|
752
|
+
# @param sched_id [Int] id of the SCHED_ACTION
|
753
|
+
# @param sched_template [String] Template containing a SCHED_ACTION
|
721
754
|
# @return [nil, OpenNebula::Error] nil in case of success, Error
|
722
755
|
# otherwise
|
723
|
-
def
|
724
|
-
return call(VM_METHODS[:
|
756
|
+
def sched_action_update(sched_id, sched_template)
|
757
|
+
return call(VM_METHODS[:schedupdate], @pe_id, sched_id.to_i,
|
758
|
+
sched_template)
|
725
759
|
end
|
726
760
|
|
727
761
|
########################################################################
|
data/lib/opennebula/zone.rb
CHANGED
@@ -31,7 +31,15 @@ module OpenNebula
|
|
31
31
|
:delete => "zone.delete",
|
32
32
|
:addserver => "zone.addserver",
|
33
33
|
:delserver => "zone.delserver",
|
34
|
-
:resetserver => "zone.resetserver"
|
34
|
+
:resetserver => "zone.resetserver",
|
35
|
+
:enable => "zone.enable"
|
36
|
+
}
|
37
|
+
|
38
|
+
ZONE_STATES=%w{ENABLED DISABLED}
|
39
|
+
|
40
|
+
SHORT_ZONE_STATES={
|
41
|
+
"ENABLED" => "on",
|
42
|
+
"DISABLED" => "off"
|
35
43
|
}
|
36
44
|
|
37
45
|
# Creates a Zone description with just its identifier
|
@@ -179,6 +187,37 @@ module OpenNebula
|
|
179
187
|
return call(ZONE_METHODS[:resetserver], @pe_id, server_id)
|
180
188
|
end
|
181
189
|
|
190
|
+
# Enable zone
|
191
|
+
#
|
192
|
+
# @return [nil, OpenNebula::Error] nil in case of success, Error
|
193
|
+
# otherwise
|
194
|
+
def enable()
|
195
|
+
return call(ZONE_METHODS[:enable], @pe_id, true)
|
196
|
+
end
|
197
|
+
|
198
|
+
# Disable zone, only readonly commands can be executed in disabled
|
199
|
+
# state
|
200
|
+
#
|
201
|
+
# @return [nil, OpenNebula::Error] nil in case of success, Error
|
202
|
+
# otherwise
|
203
|
+
def disable()
|
204
|
+
return call(ZONE_METHODS[:enable], @pe_id, false)
|
205
|
+
end
|
206
|
+
|
207
|
+
#######################################################################
|
208
|
+
# Helpers to get Zone information
|
209
|
+
#######################################################################
|
210
|
+
|
211
|
+
# Returns the state of the Zone (numeric value)
|
212
|
+
def state
|
213
|
+
self['STATE'].to_i
|
214
|
+
end
|
215
|
+
|
216
|
+
# Returns the state of the Zone (string value)
|
217
|
+
def state_str
|
218
|
+
ZONE_STATES[state]
|
219
|
+
end
|
220
|
+
|
182
221
|
private
|
183
222
|
|
184
223
|
# These methods adds elements to the given node of the zone
|
data/lib/opennebula.rb
CHANGED
data/lib/vcenter_importer.rb
CHANGED
@@ -369,9 +369,11 @@ module VCenterDriver
|
|
369
369
|
error_msg = "\nError: #{e.message}\n"
|
370
370
|
error_msg << "#{e.backtrace}\n" \
|
371
371
|
if VCenterDriver::CONFIG[:debug_information]
|
372
|
-
|
372
|
+
STDERR.puts error_msg
|
373
|
+
raise_error = true
|
373
374
|
ensure
|
374
375
|
vi_client.close_connection if vi_client
|
376
|
+
raise if raise_error
|
375
377
|
end
|
376
378
|
end
|
377
379
|
|
data/lib/virtual_machine.rb
CHANGED
@@ -1090,14 +1090,22 @@ end
|
|
1090
1090
|
#
|
1091
1091
|
# @return [Hash ("String" => self.Nic)] Model representation of nics
|
1092
1092
|
def info_nics
|
1093
|
+
keep_mac_on_imported = false
|
1094
|
+
keep_mac_on_imported = CONFIG[:keep_mac_on_imported] \
|
1095
|
+
unless CONFIG[:keep_mac_on_imported].nil?
|
1096
|
+
|
1093
1097
|
@nics = { :macs => {} }
|
1094
1098
|
|
1095
1099
|
vc_nics = vcenter_nics_list
|
1096
1100
|
one_nics = one_nics_get
|
1097
1101
|
|
1098
1102
|
one_nics.each do |one_nic|
|
1099
|
-
index
|
1100
|
-
|
1103
|
+
index = one_nic['NIC_ID']
|
1104
|
+
if keep_mac_on_imported && one_nic['MAC_IMPORTED']
|
1105
|
+
mac = one_nic['MAC_IMPORTED']
|
1106
|
+
else
|
1107
|
+
mac = one_nic['MAC']
|
1108
|
+
end
|
1101
1109
|
vc_dev = query_nic(mac, vc_nics)
|
1102
1110
|
|
1103
1111
|
if vc_dev
|
@@ -2419,7 +2427,7 @@ end
|
|
2419
2427
|
# automatically cleans all system snapshots
|
2420
2428
|
# https://github.com/OpenNebula/one/issues/5409
|
2421
2429
|
if snapshots? || one_snapshots?
|
2422
|
-
error_msg = 'Existing
|
2430
|
+
error_msg = 'Existing sytem snapshots, cannot change disks. '
|
2423
2431
|
error_msg << 'Please remove all snapshots and try again.'
|
2424
2432
|
raise error_message
|
2425
2433
|
end
|
@@ -2606,9 +2614,8 @@ end
|
|
2606
2614
|
return unless disk.exists?
|
2607
2615
|
|
2608
2616
|
if snapshots? || one_snapshots?
|
2609
|
-
error_message = 'Existing
|
2610
|
-
error_message << '
|
2611
|
-
error_message << 'try again.'
|
2617
|
+
error_message = 'Existing sytem snapshots, cannot change disks'
|
2618
|
+
error_message << '. Please remove all snapshots and try again.'
|
2612
2619
|
raise error_message
|
2613
2620
|
end
|
2614
2621
|
|
data/lib/vm_template.rb
CHANGED
@@ -733,6 +733,9 @@ module VCenterDriver
|
|
733
733
|
nic, true)
|
734
734
|
network_found.info
|
735
735
|
|
736
|
+
if nic[:mac]
|
737
|
+
nic_tmp << "MAC_IMPORTED=\"#{nic[:mac]}\",\n"
|
738
|
+
end
|
736
739
|
# This is the existing nic info
|
737
740
|
if nic[:mac] && ipv4.empty? && ipv6.empty?
|
738
741
|
nic_tmp << "MAC=\"#{nic[:mac]}\",\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: 6.
|
4
|
+
version: 6.1.80.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenNebula
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -126,6 +126,7 @@ files:
|
|
126
126
|
- lib/vcenter_importer.rb
|
127
127
|
- lib/vi_client.rb
|
128
128
|
- lib/vi_helper.rb
|
129
|
+
- lib/virtual_machine.rb
|
129
130
|
- lib/vm_device.rb
|
130
131
|
- lib/vm_disk.rb
|
131
132
|
- lib/vm_nic.rb
|
@@ -134,7 +135,6 @@ files:
|
|
134
135
|
- lib/vm_folder.rb
|
135
136
|
- lib/vm_template.rb
|
136
137
|
- lib/vmm_importer.rb
|
137
|
-
- lib/virtual_machine.rb
|
138
138
|
- lib/nsx_driver.rb
|
139
139
|
- lib/distributed_firewall.rb
|
140
140
|
- lib/logical_port.rb
|
@@ -164,8 +164,8 @@ files:
|
|
164
164
|
- lib/DriverExecHelper.rb
|
165
165
|
- lib/scripts_common.rb
|
166
166
|
- lib/models.rb
|
167
|
-
- lib/models/service.rb
|
168
167
|
- lib/models/role.rb
|
168
|
+
- lib/models/service.rb
|
169
169
|
- lib/opennebula/acl.rb
|
170
170
|
- lib/opennebula/acl_pool.rb
|
171
171
|
- lib/opennebula/client.rb
|
@@ -208,6 +208,7 @@ files:
|
|
208
208
|
- lib/opennebula/utils.rb
|
209
209
|
- lib/opennebula/vdc.rb
|
210
210
|
- lib/opennebula/vdc_pool.rb
|
211
|
+
- lib/opennebula/virtual_machine.rb
|
211
212
|
- lib/opennebula/virtual_machine_ext.rb
|
212
213
|
- lib/opennebula/virtual_machine_pool.rb
|
213
214
|
- lib/opennebula/virtual_network.rb
|
@@ -222,9 +223,8 @@ files:
|
|
222
223
|
- lib/opennebula/xml_element.rb
|
223
224
|
- lib/opennebula/xml_pool.rb
|
224
225
|
- lib/opennebula/xml_utils.rb
|
225
|
-
- lib/opennebula/zone_pool.rb
|
226
|
-
- lib/opennebula/virtual_machine.rb
|
227
226
|
- lib/opennebula/zone.rb
|
227
|
+
- lib/opennebula/zone_pool.rb
|
228
228
|
- lib/opennebula/flow/grammar.rb
|
229
229
|
- lib/opennebula/flow/service_pool.rb
|
230
230
|
- lib/opennebula/flow/service_template.rb
|
@@ -255,9 +255,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
255
255
|
version: '0'
|
256
256
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
257
257
|
requirements:
|
258
|
-
- - '
|
258
|
+
- - '>'
|
259
259
|
- !ruby/object:Gem::Version
|
260
|
-
version:
|
260
|
+
version: 1.3.1
|
261
261
|
requirements: []
|
262
262
|
rubyforge_project:
|
263
263
|
rubygems_version: 2.0.14.1
|