opennebula 6.3.85.pre → 6.3.90.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/models/role.rb +73 -2
- data/lib/models/service.rb +25 -1
- data/lib/opennebula/flow/service_template.rb +8 -0
- data/lib/opennebula/oneflow_client.rb +6 -10
- data/lib/opennebula.rb +1 -1
- data/lib/virtual_machine.rb +3 -0
- data/lib/vm_template.rb +31 -21
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce0ca66d3a7fc700e855f98615b22498966c4efb6321770afc9e5852d29359c2
|
4
|
+
data.tar.gz: 7879f4859708352f9d1a69edd76ed6131ec8c3a26470ebea6933fb02317f948f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff3757f8da05cd268b1fcdd153e9e1dabb502ac3269567d2d66c1161e0d5014641d0ccd2776a8cb6b924a6d076d01b28730a38d4095c3655d14728805120450a
|
7
|
+
data.tar.gz: ede0e55b1b5b3423e22dc73832ead4e300857c41551f79cd921d427aaba9e1a331f1f8763ef8fecbe3bdcad8cc8a122ba8ba1b4aec0f4c51bd3c0486178c06c8
|
data/lib/cloud/CloudClient.rb
CHANGED
data/lib/models/role.rb
CHANGED
@@ -65,7 +65,8 @@ module OpenNebula
|
|
65
65
|
'FAILED_DEPLOYING' => 7,
|
66
66
|
'SCALING' => 8,
|
67
67
|
'FAILED_SCALING' => 9,
|
68
|
-
'COOLDOWN' => 10
|
68
|
+
'COOLDOWN' => 10,
|
69
|
+
'HOLD' => 11
|
69
70
|
}
|
70
71
|
|
71
72
|
STATE_STR = %w[
|
@@ -80,6 +81,7 @@ module OpenNebula
|
|
80
81
|
SCALING
|
81
82
|
FAILED_SCALING
|
82
83
|
COOLDOWN
|
84
|
+
HOLD
|
83
85
|
]
|
84
86
|
|
85
87
|
RECOVER_DEPLOY_STATES = %w[
|
@@ -147,6 +149,7 @@ module OpenNebula
|
|
147
149
|
|
148
150
|
@body['cooldown'] = @@default_cooldown if @body['cooldown'].nil?
|
149
151
|
@body['nodes'] ||= []
|
152
|
+
@body['on_hold'] = false if @body['on_hold'].nil?
|
150
153
|
end
|
151
154
|
|
152
155
|
def name
|
@@ -195,12 +198,25 @@ module OpenNebula
|
|
195
198
|
true
|
196
199
|
end
|
197
200
|
|
201
|
+
def can_release?
|
202
|
+
state == STATE['HOLD']
|
203
|
+
end
|
204
|
+
|
198
205
|
# Returns the role parents
|
199
206
|
# @return [Array] the role parents
|
200
207
|
def parents
|
201
208
|
@body['parents'] || []
|
202
209
|
end
|
203
210
|
|
211
|
+
def any_parent_on_hold?
|
212
|
+
parents.each do |parent|
|
213
|
+
next unless @service.roles[parent]
|
214
|
+
|
215
|
+
return true if @service.roles[parent].on_hold?
|
216
|
+
end
|
217
|
+
false
|
218
|
+
end
|
219
|
+
|
204
220
|
# Returns the role cardinality
|
205
221
|
# @return [Integer] the role cardinality
|
206
222
|
def cardinality
|
@@ -357,6 +373,23 @@ module OpenNebula
|
|
357
373
|
@body.delete('scale_way')
|
358
374
|
end
|
359
375
|
|
376
|
+
# Returns the on_hold role option
|
377
|
+
# @return [true, false] true if the on_hold option is enabled
|
378
|
+
def on_hold?
|
379
|
+
@body['on_hold']
|
380
|
+
end
|
381
|
+
|
382
|
+
# Returns the on_hold service option
|
383
|
+
# @return [true, false] true if the on_hold option is enabled
|
384
|
+
def service_on_hold?
|
385
|
+
@service.on_hold?
|
386
|
+
end
|
387
|
+
|
388
|
+
# Set the on_hold vm option to true
|
389
|
+
def hold(hold)
|
390
|
+
@body['on_hold'] = hold
|
391
|
+
end
|
392
|
+
|
360
393
|
# Retrieves the VM information for each Node in this Role. If a Node
|
361
394
|
# is to be disposed and it is found in DONE, it will be cleaned
|
362
395
|
#
|
@@ -436,7 +469,7 @@ module OpenNebula
|
|
436
469
|
"template #{template_id}, with name #{vm_name}",
|
437
470
|
@service.id
|
438
471
|
|
439
|
-
vm_id = template.instantiate(vm_name,
|
472
|
+
vm_id = template.instantiate(vm_name, on_hold?, extra_template)
|
440
473
|
|
441
474
|
deployed_nodes << vm_id
|
442
475
|
|
@@ -546,6 +579,44 @@ module OpenNebula
|
|
546
579
|
[true, nil]
|
547
580
|
end
|
548
581
|
|
582
|
+
# Release all the nodes in this role
|
583
|
+
# @return [Array, Bool] true if all the VMs
|
584
|
+
# were released, false otherwise and Array with VMs released
|
585
|
+
def release
|
586
|
+
release_nodes = []
|
587
|
+
success = true
|
588
|
+
|
589
|
+
# Release all vms in the role
|
590
|
+
nodes.each do |node|
|
591
|
+
vm_id = node['deploy_id']
|
592
|
+
|
593
|
+
Log.debug(LOG_COMP,
|
594
|
+
"Role #{name}: Releasing VM #{vm_id}",
|
595
|
+
@service.id)
|
596
|
+
|
597
|
+
vm = OpenNebula::VirtualMachine.new_with_id(vm_id,
|
598
|
+
@service.client)
|
599
|
+
rc = vm.release
|
600
|
+
|
601
|
+
if OpenNebula.is_error?(rc)
|
602
|
+
msg = "Role #{name}: Release failed for VM #{vm_id}, " \
|
603
|
+
"#{rc.message}"
|
604
|
+
|
605
|
+
Log.error(LOG_COMP, msg, @service.id)
|
606
|
+
@service.log_error(msg)
|
607
|
+
success = false
|
608
|
+
else
|
609
|
+
Log.debug(LOG_COMP,
|
610
|
+
"Role #{name}: Release success for VM #{vm_id}",
|
611
|
+
@service.id)
|
612
|
+
|
613
|
+
release_nodes << vm_id
|
614
|
+
end
|
615
|
+
end
|
616
|
+
|
617
|
+
[release_nodes, success]
|
618
|
+
end
|
619
|
+
|
549
620
|
# Schedule the given action on all the VMs that belong to the Role
|
550
621
|
# @param [String] action one of the available SCHEDULE_ACTIONS
|
551
622
|
# @param [Integer] period
|
data/lib/models/service.rb
CHANGED
@@ -38,7 +38,8 @@ module OpenNebula
|
|
38
38
|
'DEPLOYING_NETS' => 11,
|
39
39
|
'UNDEPLOYING_NETS' => 12,
|
40
40
|
'FAILED_DEPLOYING_NETS' => 13,
|
41
|
-
'FAILED_UNDEPLOYING_NETS' => 14
|
41
|
+
'FAILED_UNDEPLOYING_NETS' => 14,
|
42
|
+
'HOLD' => 15
|
42
43
|
}
|
43
44
|
|
44
45
|
STATE_STR = %w[
|
@@ -57,6 +58,7 @@ module OpenNebula
|
|
57
58
|
UNDEPLOYING_NETS
|
58
59
|
FAILED_DEPLOYING_NETS
|
59
60
|
FAILED_UNDEPLOYING_NETS
|
61
|
+
HOLD
|
60
62
|
]
|
61
63
|
|
62
64
|
TRANSIENT_STATES = %w[
|
@@ -216,6 +218,16 @@ module OpenNebula
|
|
216
218
|
self['GID'].to_i
|
217
219
|
end
|
218
220
|
|
221
|
+
# Returns the on_hold service option
|
222
|
+
# @return [true, false] true if the on_hold option is enabled
|
223
|
+
def on_hold?
|
224
|
+
@body['on_hold']
|
225
|
+
end
|
226
|
+
|
227
|
+
def hold?
|
228
|
+
state_str == 'HOLD'
|
229
|
+
end
|
230
|
+
|
219
231
|
# Replaces this object's client with a new one
|
220
232
|
# @param [OpenNebula::Client] owner_client the new client
|
221
233
|
def replace_client(owner_client)
|
@@ -265,6 +277,18 @@ module OpenNebula
|
|
265
277
|
true
|
266
278
|
end
|
267
279
|
|
280
|
+
# Returns true if all the nodes are in hold state
|
281
|
+
# @return [true, false] true if all the nodes are in hold state
|
282
|
+
def all_roles_hold?
|
283
|
+
@roles.each do |_name, role|
|
284
|
+
if role.state != Role::STATE['HOLD']
|
285
|
+
return false
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
true
|
290
|
+
end
|
291
|
+
|
268
292
|
# Returns virtual networks IDs
|
269
293
|
# @return [Array] Array of integers containing the IDs
|
270
294
|
def networks(deploy)
|
@@ -73,6 +73,10 @@ module OpenNebula
|
|
73
73
|
:required => false,
|
74
74
|
:minimum => 0
|
75
75
|
},
|
76
|
+
'on_hold' => {
|
77
|
+
:type => :boolean,
|
78
|
+
:required => false
|
79
|
+
},
|
76
80
|
'elasticity_policies' => {
|
77
81
|
:type => :array,
|
78
82
|
:items => {
|
@@ -220,6 +224,10 @@ module OpenNebula
|
|
220
224
|
:properties => {}
|
221
225
|
},
|
222
226
|
:required => false
|
227
|
+
},
|
228
|
+
'on_hold' => {
|
229
|
+
:type => :boolean,
|
230
|
+
:required => false
|
223
231
|
}
|
224
232
|
}
|
225
233
|
}
|
@@ -56,10 +56,7 @@ module Role
|
|
56
56
|
'SCALING' => 8,
|
57
57
|
'FAILED_SCALING' => 9,
|
58
58
|
'COOLDOWN' => 10,
|
59
|
-
'
|
60
|
-
'UNDEPLOYING_NETS' => 12,
|
61
|
-
'FAILED_DEPLOYING_NETS' => 13,
|
62
|
-
'FAILED_UNDEPLOYING_NETS' => 14
|
59
|
+
'HOLD' => 11
|
63
60
|
}
|
64
61
|
|
65
62
|
STATE_STR = [
|
@@ -74,10 +71,7 @@ module Role
|
|
74
71
|
'SCALING',
|
75
72
|
'FAILED_SCALING',
|
76
73
|
'COOLDOWN',
|
77
|
-
'
|
78
|
-
'UNDEPLOYING_NETS',
|
79
|
-
'FAILED_DEPLOYING_NETS',
|
80
|
-
'FAILED_UNDEPLOYING_NETS'
|
74
|
+
'HOLD'
|
81
75
|
]
|
82
76
|
|
83
77
|
# Returns the string representation of the role state
|
@@ -105,7 +99,8 @@ module Service
|
|
105
99
|
'DEPLOYING_NETS' => 11,
|
106
100
|
'UNDEPLOYING_NETS' => 12,
|
107
101
|
'FAILED_DEPLOYING_NETS' => 13,
|
108
|
-
'FAILED_UNDEPLOYING_NETS' => 14
|
102
|
+
'FAILED_UNDEPLOYING_NETS' => 14,
|
103
|
+
'HOLD' => 15
|
109
104
|
}
|
110
105
|
|
111
106
|
STATE_STR = [
|
@@ -123,7 +118,8 @@ module Service
|
|
123
118
|
'DEPLOYING_NETS',
|
124
119
|
'UNDEPLOYING_NETS',
|
125
120
|
'FAILED_DEPLOYING_NETS',
|
126
|
-
'FAILED_UNDEPLOYING_NETS'
|
121
|
+
'FAILED_UNDEPLOYING_NETS',
|
122
|
+
'HOLD'
|
127
123
|
]
|
128
124
|
|
129
125
|
# Returns the string representation of the service state
|
data/lib/opennebula.rb
CHANGED
data/lib/virtual_machine.rb
CHANGED
data/lib/vm_template.rb
CHANGED
@@ -975,23 +975,14 @@ module VCenterDriver
|
|
975
975
|
host_id = vi_client.instance_variable_get '@host_id'
|
976
976
|
|
977
977
|
begin
|
978
|
-
nsx_client =
|
979
|
-
NSXDriver::NSXClient
|
980
|
-
.new_from_id(
|
981
|
-
host_id
|
982
|
-
)
|
978
|
+
nsx_client = NSXDriver::NSXClient.new_from_id(host_id)
|
983
979
|
rescue StandardError
|
984
980
|
nsx_client = nil
|
985
981
|
end
|
986
982
|
|
987
983
|
if !nsx_client.nil?
|
988
|
-
nsx_net =
|
989
|
-
|
990
|
-
.new_from_name(
|
991
|
-
nsx_client,
|
992
|
-
nic[:net_name]
|
993
|
-
)
|
994
|
-
|
984
|
+
nsx_net = NSXDriver::VirtualWire
|
985
|
+
.new_from_name(nsx_client, nic[:net_name])
|
995
986
|
config[:nsx_id] = nsx_net.ls_id
|
996
987
|
config[:nsx_vni] = nsx_net.ls_vni
|
997
988
|
config[:nsx_tz_id] = nsx_net.tz_id
|
@@ -1002,11 +993,8 @@ module VCenterDriver
|
|
1002
993
|
# so all Standard
|
1003
994
|
# PortGroups are networks and no uplinks
|
1004
995
|
config[:uplink] = false
|
1005
|
-
config[:sw_name] =
|
1006
|
-
|
1007
|
-
.virtual_switch(
|
1008
|
-
nic[:network]
|
1009
|
-
)
|
996
|
+
config[:sw_name] = VCenterDriver::Network
|
997
|
+
.virtual_switch(nic[:network])
|
1010
998
|
# NSX-T PortGroups
|
1011
999
|
when VCenterDriver::Network::NETWORK_TYPE_NSXT
|
1012
1000
|
config[:sw_name] = \
|
@@ -1027,10 +1015,7 @@ module VCenterDriver
|
|
1027
1015
|
if !nsx_client.nil?
|
1028
1016
|
nsx_net =
|
1029
1017
|
NSXDriver::OpaqueNetwork
|
1030
|
-
.new_from_name(
|
1031
|
-
nsx_client,
|
1032
|
-
nic[:net_name]
|
1033
|
-
)
|
1018
|
+
.new_from_name(nsx_client, nic[:net_name])
|
1034
1019
|
|
1035
1020
|
config[:nsx_id] = nsx_net.ls_id
|
1036
1021
|
config[:nsx_vni] = nsx_net.ls_vni
|
@@ -1104,6 +1089,31 @@ module VCenterDriver
|
|
1104
1089
|
VCenterDriver::VIHelper.clean_ref_hash
|
1105
1090
|
one_vn.info
|
1106
1091
|
|
1092
|
+
# Wait until the virtual network is in ready state
|
1093
|
+
t_start = Time.now
|
1094
|
+
error = false
|
1095
|
+
timeout = 30
|
1096
|
+
|
1097
|
+
while Time.now - t_start < timeout
|
1098
|
+
begin
|
1099
|
+
if one_vn.short_state_str == 'rdy'
|
1100
|
+
error = false
|
1101
|
+
break
|
1102
|
+
end
|
1103
|
+
rescue StandardError
|
1104
|
+
error = true
|
1105
|
+
end
|
1106
|
+
|
1107
|
+
sleep 1
|
1108
|
+
one_vn.info
|
1109
|
+
end
|
1110
|
+
|
1111
|
+
if error
|
1112
|
+
error_msg = "VNET #{one_vn.id} in state "
|
1113
|
+
error_msg += "#{one_vn.short_state_str}, aborting import"
|
1114
|
+
raise error_msg
|
1115
|
+
end
|
1116
|
+
|
1107
1117
|
one_vn
|
1108
1118
|
end
|
1109
1119
|
|
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.3.
|
4
|
+
version: 6.3.90.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenNebula
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|