opennebula 4.5.80.beta → 4.5.85.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -56,5 +56,5 @@ require 'opennebula/system'
56
56
  module OpenNebula
57
57
 
58
58
  # OpenNebula version
59
- VERSION = '4.5.80'
59
+ VERSION = '4.5.85'
60
60
  end
@@ -37,7 +37,7 @@ module OpenNebula
37
37
  SELF = -1
38
38
 
39
39
  # Default resource ACL's for group users (create)
40
- GROUP_DEFAULT_ACLS = "VM+IMAGE+NET+TEMPLATE+DOCUMENT"
40
+ GROUP_DEFAULT_ACLS = "VM+IMAGE+TEMPLATE+DOCUMENT"
41
41
  ALL_CLUSTERS_IN_ZONE = 10
42
42
 
43
43
  # The default view for group and group admins, must be defined in
@@ -79,34 +79,29 @@ module OpenNebula
79
79
  alias_method :info!, :info
80
80
 
81
81
  # Creates a group based in a group definition hash
82
- # group_hash[:name]
83
- # group_hash[:admin_group]
84
- # group_hash[:user][:name]
85
- # group_hash[:user][:password]
82
+ # group_hash[:name] the group name
83
+ # group_hash[:group_admin] the admin user definition hash, see def
84
+ # create_admin_user function description for details.
86
85
  # group_hash[:resource_providers]
87
86
  # group_hash[:resource_providers][:zone_id]
88
87
  # group_hash[:resource_providers][:cluster_id]
89
88
  #
90
89
  def create(group_hash)
91
90
  # Check arguments
92
- return -1, "Group name not defined" if !group_hash[:name]
93
-
94
- if group_hash[:user]
95
- if group_hash[:user][:name] and !group_hash[:admin_group]
96
- return -1, "Admin user defined but not admin group"
97
- end
91
+ if !group_hash[:name]
92
+ return OpenNebula::Error.new("Group name not defined")
93
+ end
98
94
 
99
- if group_hash[:user][:name] and !group_hash[:user][:password]
100
- return -1, "Admin user password not defined"
95
+ if group_hash[:group_admin]
96
+ if group_hash[:group_admin][:name] && !group_hash[:group_admin][:password]
97
+ error_msg = "Admin user password not defined"
98
+ return OpenNebula::Error.new(error_msg)
101
99
  end
102
100
  end
103
101
 
104
102
  # Allocate group
105
103
  rc = self.allocate(group_hash[:name])
106
-
107
- if OpenNebula.is_error?(rc)
108
- return -1, "Error allocating group: #{rc.message}"
109
- end
104
+ return rc if OpenNebula.is_error?(rc)
110
105
 
111
106
  # Handle resource providers
112
107
  group_hash[:resource_providers].each { |rp|
@@ -123,24 +118,26 @@ module OpenNebula
123
118
  rc, msg = create_default_acls(group_hash[:resources])
124
119
 
125
120
  if OpenNebula.is_error?(rc)
126
- self.delete
127
- return -1, "Error creating group ACL's: #{rc.message}"
121
+ error_msg = "Error creating group ACL's: #{rc.message}"
122
+ return OpenNebula::Error.new(error_msg)
128
123
  end
129
124
 
130
- # Create associated admin group if needed
131
- rc = create_group_admin(group_hash)
125
+ # Create associated group admin if needed
126
+ rc = create_admin_user(group_hash)
132
127
 
133
128
  if OpenNebula.is_error?(rc)
134
129
  self.delete
135
- return -1, "Error creating admin group: #{rc.message}"
130
+ error_msg = "Error creating admin group: #{rc.message}"
131
+ return OpenNebula::Error.new(error_msg)
136
132
  end
137
133
 
138
134
  # Add default Sunstone views for the group
139
135
  if group_hash[:views]
140
- self.update("SUNSTONE_VIEWS=\"#{group_hash[:views].join(",")}\"\n")
136
+ str = "SUNSTONE_VIEWS=\"#{group_hash[:views].join(",")}\"\n"
137
+ self.update(str, true)
141
138
  end
142
139
 
143
- return 0, ""
140
+ return 0
144
141
  end
145
142
 
146
143
  # Allocates a new Group in OpenNebula
@@ -264,81 +261,76 @@ module OpenNebula
264
261
 
265
262
  # Creates a group admin and user based on the group definition hash
266
263
  # @param gdef [Hash] keys are ruby sumbols
267
- # gdef[:admin_group] the group name
268
- # gdef[:user][:name] of admin user for the admin group
269
- # gdef[:user][:password] of admin user
270
- # gdef[:user][:auth_driver] of the admin user
271
- # gdef[:admin_resources]
272
- # gdef[:resources]
273
- #
264
+ # gdef[:group_admin] the group admin hash
265
+ # gdef[:group_admin][:name] username for group admin
266
+ # gdef[:group_admin][:password] password for group admin
267
+ # gdef[:group_admin][:auth_driver] auth driver for group admin
268
+ # gdef[:group_admin][:resources] resources that group admin manage
269
+ # gdef[:group_admin][:manage_resources] whether group admin manages
270
+ # group users
271
+ # gdef[:resources] resources that group users manage
274
272
  #
275
273
  # @return [nil, OpenNebula::Error] nil in case of success, Error
276
- def create_group_admin(gdef)
274
+ def create_admin_user(gdef)
277
275
 
278
- return nil if gdef[:admin_group].nil?
276
+ return nil if gdef[:group_admin].nil? || gdef[:group_admin][:name].nil?
279
277
 
280
- # Create the admin group
281
- gadmin = Group.new(Group.build_xml, @client)
282
- rc = gadmin.allocate(gdef[:admin_group])
283
-
284
- return rc if OpenNebula.is_error?(rc)
285
-
286
- # Create group admin user
287
- uadmin = gdef[:user][:name] if gdef[:user]
288
- upasswd = gdef[:user][:password] if gdef[:user]
289
- udriver = gdef[:user][:auth_driver] if gdef[:user]
278
+ # Create group admin
279
+ uadmin = gdef[:group_admin][:name]
280
+ upasswd = gdef[:group_admin][:password]
281
+ udriver = gdef[:group_admin][:auth_driver]
290
282
 
291
283
  if !uadmin.nil? && !upasswd.nil?
292
284
 
293
- user = OpenNebula::User.new(OpenNebula::User.build_xml,
294
- @client)
285
+ group_admin = OpenNebula::User.new(OpenNebula::User.build_xml,
286
+ @client)
295
287
 
296
288
  if udriver
297
- rc = user.allocate(uadmin, upasswd, udriver)
289
+ rc = group_admin.allocate(uadmin, upasswd, udriver)
298
290
  else
299
- rc = user.allocate(uadmin, upasswd)
291
+ rc = group_admin.allocate(uadmin, upasswd)
300
292
  end
301
293
 
302
294
  if OpenNebula.is_error?(rc)
303
- gadmin.delete
304
295
  return rc
305
296
  end
297
+ end
306
298
 
307
- # Set admin user groups to admin group and self
308
- rc = user.chgrp(self.id)
309
- rc = user.addgroup(gadmin.id) if !OpenNebula.is_error?(rc)
299
+ # Set admin user groups to self
300
+ rc = group_admin.chgrp(self.id)
310
301
 
311
- if OpenNebula.is_error?(rc)
312
- user.delete
313
- gadmin.delete
314
- return rc
315
- end
302
+ if OpenNebula.is_error?(rc)
303
+ group_admin.delete
304
+ return rc
316
305
  end
317
306
 
318
307
  #Create admin group acls
319
308
  acls = Array.new
320
309
 
321
- acls_str = gdef[:admin_resources] || gdef[:resources] || GROUP_DEFAULT_ACLS
310
+ acls_str = (gdef[:group_admin][:resources] || \
311
+ gdef[:resources] || GROUP_DEFAULT_ACLS)
322
312
 
323
- manage_users = gdef[:admin_manage_users] || "YES"
313
+ manage_users = gdef[:group_admin][:manage_users] || "YES"
324
314
 
325
315
  if manage_users.upcase == "YES"
326
- acls << "@#{gadmin.id} USER/* CREATE"
327
- acls << "@#{gadmin.id} USER/@#{self.id} USE+MANAGE+ADMIN"
316
+ acls << "##{group_admin.id} USER/@#{self.id} CREATE+USE+MANAGE+ADMIN"
328
317
  end
329
318
 
330
- acls << "@#{gadmin.id} #{acls_str}/@#{self.id} CREATE+USE+MANAGE"
319
+ acls << "##{group_admin.id} #{acls_str}/@#{self.id} " +
320
+ "CREATE+USE+MANAGE"
331
321
 
332
322
  rc, tmp = create_group_acls(acls)
333
323
 
334
324
  if OpenNebula.is_error?(rc)
335
- user.delete
336
- gadmin.delete
325
+ group_admin.delete
337
326
  return rc
338
327
  end
339
328
 
340
329
  #Set Sunstone Views for the group
341
- gadmin.update("SUNSTONE_VIEWS=#{GROUP_ADMIN_SUNSTONE_VIEWS}\n")
330
+ gtmpl = "GROUP_ADMINS=#{gdef[:group_admin][:name]}\n"
331
+ gtmpl << "GROUP_ADMIN_VIEWS=#{GROUP_ADMIN_SUNSTONE_VIEWS}\n"
332
+
333
+ self.update(gtmpl, true)
342
334
 
343
335
  return nil
344
336
  end
@@ -391,10 +391,13 @@ module OpenNebula
391
391
  # to use the default type
392
392
  # @param hot [true|false] True to save the disk immediately, false will
393
393
  # perform the operation when the VM shuts down
394
+ # @param do_template [true|false] True to clone also the VM originating
395
+ # template and replace the disk with the saved image
394
396
  #
395
397
  # @return [Integer, OpenNebula::Error] the new Image ID in case of
396
398
  # success, error otherwise
397
- def disk_snapshot(disk_id, image_name, image_type="", hot=false)
399
+ def disk_snapshot(disk_id, image_name, image_type="", hot=false,
400
+ do_template=false)
398
401
  return Error.new('ID not defined') if !@pe_id
399
402
 
400
403
  rc = @client.call(VM_METHODS[:savedisk],
@@ -402,8 +405,8 @@ module OpenNebula
402
405
  disk_id,
403
406
  image_name,
404
407
  image_type,
405
- hot)
406
-
408
+ hot,
409
+ do_template)
407
410
  return rc
408
411
  end
409
412
 
metadata CHANGED
@@ -1,41 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opennebula
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.80.beta
4
+ version: 4.5.85.rc1
5
+ prerelease: 7
5
6
  platform: ruby
6
7
  authors:
7
8
  - OpenNebula
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-03-14 00:00:00.000000000 Z
12
+ date: 2014-04-11 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: nokogiri
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - ">="
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - ">="
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0'
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: json
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - ">="
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: '0'
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - ">="
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: '0'
41
46
  description: Libraries needed to talk to OpenNebula
@@ -44,72 +49,73 @@ executables: []
44
49
  extensions: []
45
50
  extra_rdoc_files: []
46
51
  files:
47
- - LICENSE
48
- - NOTICE
49
52
  - lib/opennebula.rb
50
- - lib/opennebula/acl.rb
51
- - lib/opennebula/acl_pool.rb
52
- - lib/opennebula/client.rb
53
- - lib/opennebula/cluster.rb
53
+ - lib/opennebula/document_json.rb
54
+ - lib/opennebula/host.rb
55
+ - lib/opennebula/group_pool.rb
56
+ - lib/opennebula/user_pool.rb
57
+ - lib/opennebula/pool.rb
54
58
  - lib/opennebula/cluster_pool.rb
59
+ - lib/opennebula/template_pool.rb
60
+ - lib/opennebula/document_pool.rb
55
61
  - lib/opennebula/datastore.rb
56
62
  - lib/opennebula/datastore_pool.rb
57
- - lib/opennebula/document.rb
58
- - lib/opennebula/document_json.rb
59
- - lib/opennebula/document_pool.rb
63
+ - lib/opennebula/xml_pool.rb
64
+ - lib/opennebula/xml_utils.rb
60
65
  - 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
61
74
  - lib/opennebula/error.rb
62
- - lib/opennebula/group.rb
63
- - lib/opennebula/group_pool.rb
64
- - lib/opennebula/host.rb
65
- - lib/opennebula/host_pool.rb
66
75
  - lib/opennebula/image.rb
67
- - lib/opennebula/image_pool.rb
68
- - lib/opennebula/ldap_auth.rb
69
- - lib/opennebula/ldap_auth_spec.rb
76
+ - lib/opennebula/host_pool.rb
77
+ - lib/opennebula/document.rb
78
+ - lib/opennebula/xml_element.rb
70
79
  - lib/opennebula/oneflow_client.rb
71
- - lib/opennebula/pool.rb
72
- - lib/opennebula/pool_element.rb
73
- - lib/opennebula/server_cipher_auth.rb
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
80
  - lib/opennebula/virtual_network.rb
81
+ - lib/opennebula/image_pool.rb
84
82
  - 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
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
+ - lib/opennebula/ldap_auth.rb
89
+ - lib/opennebula/ldap_auth_spec.rb
90
+ - lib/opennebula/x509_auth.rb
91
+ - lib/opennebula/ssh_auth.rb
92
+ - lib/opennebula/server_x509_auth.rb
93
+ - lib/opennebula/server_cipher_auth.rb
94
+ - NOTICE
95
+ - LICENSE
91
96
  homepage: http://opennebula.org
92
97
  licenses: []
93
- metadata: {}
94
98
  post_install_message:
95
99
  rdoc_options: []
96
100
  require_paths:
97
101
  - lib
98
102
  required_ruby_version: !ruby/object:Gem::Requirement
103
+ none: false
99
104
  requirements:
100
- - - ">="
105
+ - - ! '>='
101
106
  - !ruby/object:Gem::Version
102
107
  version: '0'
103
108
  required_rubygems_version: !ruby/object:Gem::Requirement
109
+ none: false
104
110
  requirements:
105
- - - ">"
111
+ - - ! '>'
106
112
  - !ruby/object:Gem::Version
107
113
  version: 1.3.1
108
114
  requirements: []
109
115
  rubyforge_project:
110
- rubygems_version: 2.2.0
116
+ rubygems_version: 1.8.23
111
117
  signing_key:
112
- specification_version: 4
118
+ specification_version: 3
113
119
  summary: OpenNebula Client API
114
120
  test_files: []
115
121
  has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 5feec17aea93ff26ef9c4ca5d190709ba5b12c3b
4
- data.tar.gz: 218fa42198d3b3165ec54bd43fa20028402c8b7f
5
- SHA512:
6
- metadata.gz: 4ed7c74a0a4e33a5f23075db69be3d5d8c947f24b1257389ffd8f388fd4463c78f80bdb9dd9d921668a3b02a3647ae8074103b74a6f35553617dbfeffdc3f05a
7
- data.tar.gz: 11736f325b3b49d35916d0a000a2519de8ea1b925720897914890bd0d9b8d35812bf7634d35b1e6333017106585e00f5ad59526fbb48fafeb4b7ee0e101c03f8