opennebula 3.9.80.beta → 3.9.90.rc
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.
- data/lib/opennebula.rb +1 -1
- data/lib/opennebula/ldap_auth.rb +4 -2
- data/lib/opennebula/pool_element.rb +25 -0
- data/lib/opennebula/virtual_machine.rb +35 -17
- metadata +2 -2
data/lib/opennebula.rb
CHANGED
data/lib/opennebula/ldap_auth.rb
CHANGED
|
@@ -28,7 +28,8 @@ class OpenNebula::LdapAuth
|
|
|
28
28
|
:password => nil,
|
|
29
29
|
:base => nil,
|
|
30
30
|
:auth_method => :simple,
|
|
31
|
-
:user_field => 'cn'
|
|
31
|
+
:user_field => 'cn',
|
|
32
|
+
:group_field => 'member'
|
|
32
33
|
}.merge(options)
|
|
33
34
|
|
|
34
35
|
ops={}
|
|
@@ -71,7 +72,8 @@ class OpenNebula::LdapAuth
|
|
|
71
72
|
end
|
|
72
73
|
|
|
73
74
|
def is_in_group?(user, group)
|
|
74
|
-
result=@ldap.search(:base => group,
|
|
75
|
+
result=@ldap.search(:base => group,
|
|
76
|
+
:filter => "(#{@options[:group_field]}=#{user})")
|
|
75
77
|
|
|
76
78
|
if result && result.first
|
|
77
79
|
true
|
|
@@ -266,4 +266,29 @@ module OpenNebula
|
|
|
266
266
|
|
|
267
267
|
return hash
|
|
268
268
|
end
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
# Alternative method with better performance for huge number of timestamps.
|
|
272
|
+
# For reasonable amounts of data, the current method is quicker
|
|
273
|
+
=begin
|
|
274
|
+
def self.process_monitoring(xmldoc, root_elem, timestamp_elem, oid, xpath_expressions)
|
|
275
|
+
hash = {}
|
|
276
|
+
|
|
277
|
+
xpath_expressions.each { |xpath|
|
|
278
|
+
hash[xpath] = []
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
xmldoc.each("#{root_elem}[ID=#{oid}]") do |elem|
|
|
282
|
+
timestamp = elem[timestamp_elem]
|
|
283
|
+
|
|
284
|
+
xpath_expressions.each { |xpath|
|
|
285
|
+
xpath_value = elem[xpath]
|
|
286
|
+
|
|
287
|
+
hash[xpath] << [timestamp, xpath_value] if !xpath_value.nil?
|
|
288
|
+
}
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
return hash
|
|
292
|
+
end
|
|
293
|
+
=end
|
|
269
294
|
end
|
|
@@ -47,14 +47,15 @@ module OpenNebula
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
VM_STATE=%w{INIT PENDING HOLD ACTIVE STOPPED SUSPENDED DONE FAILED
|
|
50
|
-
POWEROFF}
|
|
50
|
+
POWEROFF UNDEPLOYED}
|
|
51
51
|
|
|
52
52
|
LCM_STATE=%w{LCM_INIT PROLOG BOOT RUNNING MIGRATE SAVE_STOP SAVE_SUSPEND
|
|
53
53
|
SAVE_MIGRATE PROLOG_MIGRATE PROLOG_RESUME EPILOG_STOP EPILOG
|
|
54
54
|
SHUTDOWN CANCEL FAILURE CLEANUP_RESUBMIT UNKNOWN HOTPLUG SHUTDOWN_POWEROFF
|
|
55
55
|
BOOT_UNKNOWN BOOT_POWEROFF BOOT_SUSPENDED BOOT_STOPPED CLEANUP_DELETE
|
|
56
56
|
HOTPLUG_SNAPSHOT HOTPLUG_NIC HOTPLUG_SAVEAS HOTPLUG_SAVEAS_POWEROFF
|
|
57
|
-
HOTPLUG_SAVEAS_SUSPENDED
|
|
57
|
+
HOTPLUG_SAVEAS_SUSPENDED SHUTDOWN_UNDEPLOY EPILOG_UNDEPLOY
|
|
58
|
+
PROLOG_UNDEPLOY BOOT_UNDEPLOY}
|
|
58
59
|
|
|
59
60
|
SHORT_VM_STATES={
|
|
60
61
|
"INIT" => "init",
|
|
@@ -65,7 +66,8 @@ module OpenNebula
|
|
|
65
66
|
"SUSPENDED" => "susp",
|
|
66
67
|
"DONE" => "done",
|
|
67
68
|
"FAILED" => "fail",
|
|
68
|
-
"POWEROFF" => "poff"
|
|
69
|
+
"POWEROFF" => "poff",
|
|
70
|
+
"UNDEPLOYED"=> "unde"
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
SHORT_LCM_STATES={
|
|
@@ -96,19 +98,26 @@ module OpenNebula
|
|
|
96
98
|
"HOTPLUG_NIC" => "hotp",
|
|
97
99
|
"HOTPLUG_SAVEAS" => "hotp",
|
|
98
100
|
"HOTPLUG_SAVEAS_POWEROFF" => "hotp",
|
|
99
|
-
"HOTPLUG_SAVEAS_SUSPENDED" => "hotp"
|
|
101
|
+
"HOTPLUG_SAVEAS_SUSPENDED" => "hotp",
|
|
102
|
+
"SHUTDOWN_UNDEPLOY" => "shut",
|
|
103
|
+
"EPILOG_UNDEPLOY" => "epil",
|
|
104
|
+
"PROLOG_UNDEPLOY" => "prol",
|
|
105
|
+
"BOOT_UNDEPLOY" => "boot"
|
|
100
106
|
}
|
|
101
107
|
|
|
102
|
-
MIGRATE_REASON=%w{NONE ERROR
|
|
108
|
+
MIGRATE_REASON=%w{NONE ERROR USER}
|
|
103
109
|
|
|
104
110
|
SHORT_MIGRATE_REASON={
|
|
105
111
|
"NONE" => "none",
|
|
106
112
|
"ERROR" => "erro",
|
|
107
|
-
"
|
|
108
|
-
"USER" => "user",
|
|
109
|
-
"CANCEL" => "canc"
|
|
113
|
+
"USER" => "user"
|
|
110
114
|
}
|
|
111
115
|
|
|
116
|
+
HISTORY_ACTION=%w{none migrate live-migrate shutdown shutdown-hard
|
|
117
|
+
undeploy undeploy-hard hold release stop suspend resume boot delete
|
|
118
|
+
delete-recreate reboot reboot-hard resched unresched poweroff
|
|
119
|
+
poweroff-hard}
|
|
120
|
+
|
|
112
121
|
# Creates a VirtualMachine description with just its identifier
|
|
113
122
|
# this method should be used to create plain VirtualMachine objects.
|
|
114
123
|
# +id+ the id of the vm
|
|
@@ -133,6 +142,10 @@ module OpenNebula
|
|
|
133
142
|
reason_str
|
|
134
143
|
end
|
|
135
144
|
|
|
145
|
+
def VirtualMachine.get_history_action(action)
|
|
146
|
+
return HISTORY_ACTION[action.to_i]
|
|
147
|
+
end
|
|
148
|
+
|
|
136
149
|
# Class constructor
|
|
137
150
|
def initialize(xml, client)
|
|
138
151
|
super(xml,client)
|
|
@@ -210,9 +223,14 @@ module OpenNebula
|
|
|
210
223
|
action(hard ? 'shutdown-hard' : 'shutdown')
|
|
211
224
|
end
|
|
212
225
|
|
|
226
|
+
# Shuts down an already deployed VM, saving its state in the system DS
|
|
227
|
+
def undeploy(hard=false)
|
|
228
|
+
action(hard ? 'undeploy-hard' : 'undeploy')
|
|
229
|
+
end
|
|
230
|
+
|
|
213
231
|
# Powers off a running VM
|
|
214
|
-
def poweroff
|
|
215
|
-
action('poweroff')
|
|
232
|
+
def poweroff(hard=false)
|
|
233
|
+
action(hard ? 'poweroff-hard' : 'poweroff')
|
|
216
234
|
end
|
|
217
235
|
|
|
218
236
|
# Reboots an already deployed VM
|
|
@@ -296,17 +314,17 @@ module OpenNebula
|
|
|
296
314
|
end
|
|
297
315
|
|
|
298
316
|
# Deletes a VM from the pool
|
|
299
|
-
def
|
|
317
|
+
def delete(recreate=false)
|
|
300
318
|
if recreate
|
|
301
|
-
action('
|
|
319
|
+
action('delete-recreate')
|
|
302
320
|
else
|
|
303
|
-
action('
|
|
321
|
+
action('delete')
|
|
304
322
|
end
|
|
305
323
|
end
|
|
306
324
|
|
|
307
|
-
# @deprecated use {#
|
|
325
|
+
# @deprecated use {#delete} instead
|
|
308
326
|
def finalize(recreate=false)
|
|
309
|
-
|
|
327
|
+
delete(recreate)
|
|
310
328
|
end
|
|
311
329
|
|
|
312
330
|
# Forces a re-deployment of a VM in UNKNOWN or BOOT state
|
|
@@ -316,9 +334,9 @@ module OpenNebula
|
|
|
316
334
|
|
|
317
335
|
alias_method :restart, :boot
|
|
318
336
|
|
|
319
|
-
# @deprecated use {#
|
|
337
|
+
# @deprecated use {#delete} instead
|
|
320
338
|
def resubmit
|
|
321
|
-
action('
|
|
339
|
+
action('delete-recreate')
|
|
322
340
|
end
|
|
323
341
|
|
|
324
342
|
# Sets the re-scheduling flag for the VM
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: opennebula
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.9.
|
|
4
|
+
version: 3.9.90.rc
|
|
5
5
|
prerelease: 7
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
12
|
+
date: 2013-04-19 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: nokogiri
|