opennebula-cli 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.
data/bin/oneacct CHANGED
@@ -44,7 +44,7 @@ cmd = CommandParser::CmdParser.new(ARGV) do
44
44
  end
45
45
 
46
46
  option AcctHelper::ACCT_OPTIONS + CommandParser::OPTIONS +
47
- [OpenNebulaHelper::DESCRIBE, CLIHelper::LIST, CLIHelper::CSV] +
47
+ [OpenNebulaHelper::DESCRIBE, CLIHelper::LIST, CLIHelper::CSV_OPT] +
48
48
  OpenNebulaHelper::CLIENT_OPTIONS
49
49
 
50
50
  main do
data/bin/onegroup CHANGED
@@ -79,17 +79,13 @@ cmd=CommandParser::CmdParser.new(ARGV) do
79
79
 
80
80
  Examples:
81
81
 
82
- - using a template description file:
83
-
84
- onegroup create group_description.tmpl
85
-
86
- - create a group with admin group, admin user and allow group users
87
- to only create new templates and VMs, and group admins to manage
82
+ - create a group with admin user and allow group users
83
+ to only create new templates and VMs, and group admin to manage
88
84
  templates, vms, images and virtual networks
89
85
 
90
- onegroup create --name groupA --admin_group admin_groupA
86
+ onegroup create --name groupA
91
87
  --admin_user admin_userA --admin_password somestr
92
- --resource TEMPLATE+VM
88
+ --resources TEMPLATE+VM
93
89
  --admin_resources TEMPLATE+VM+IMAGE+NET
94
90
 
95
91
  EOT
@@ -110,12 +106,12 @@ cmd=CommandParser::CmdParser.new(ARGV) do
110
106
  end
111
107
 
112
108
  admin_user=Hash.new
113
- admin_user[:name] = options[:admin_user]
114
- admin_user[:password] = options[:admin_password]
115
- if options[:admin_driver]
116
- admin_user[:auth_driver] = options[:admin_driver]
117
- end
118
- options[:user] = admin_user
109
+ admin_user[:name] = options[:admin_user]
110
+ admin_user[:password] = options[:admin_password]
111
+ admin_user[:auth_driver]= options[:admin_driver] if options[:admin_driver]
112
+ admin_user[:resources] = options[:admin_resources] if options[:admin_resources]
113
+
114
+ options[:group_admin] = admin_user
119
115
  end
120
116
 
121
117
  if !options.empty?
@@ -142,7 +138,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
142
138
 
143
139
  obj.update(str, options[:append])
144
140
  end
145
- end
141
+ end
146
142
 
147
143
  delete_desc = <<-EOT.unindent
148
144
  Deletes the given Group
@@ -193,7 +189,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
193
189
  exit -1
194
190
  end
195
191
  end
196
- end
192
+ end
197
193
 
198
194
  batchquota_desc = <<-EOT.unindent
199
195
  Sets the quota limits in batch for various groups. If a path is not
@@ -232,7 +228,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
232
228
  exit(-1)
233
229
  end
234
230
 
235
- str = OneQuotaHelper.set_quota(default_quotas, args[0])
231
+ str = OneQuotaHelper.set_quota(default_quotas, args[0], true)
236
232
 
237
233
  rc = system.set_group_quotas(str)
238
234
 
data/bin/oneuser CHANGED
@@ -265,7 +265,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
265
265
  exit(-1)
266
266
  end
267
267
 
268
- str = OneQuotaHelper.set_quota(default_quotas, args[0])
268
+ str = OneQuotaHelper.set_quota(default_quotas, args[0], true)
269
269
 
270
270
  rc = system.set_user_quotas(str)
271
271
 
data/bin/onevm CHANGED
@@ -91,6 +91,13 @@ cmd=CommandParser::CmdParser.new(ARGV) do
91
91
  :description => "Recover a VM by failing the pending action"
92
92
  }
93
93
 
94
+ CLONETEMPLATE={
95
+ :name => "clonetemplate",
96
+ :short => "-c",
97
+ :large => "--clonetemplate",
98
+ :description => "Clone original VM Template and replace disk with saved one"
99
+ }
100
+
94
101
  ########################################################################
95
102
  # Global Options
96
103
  ########################################################################
@@ -297,7 +304,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
297
304
  EOT
298
305
 
299
306
  command :"disk-snapshot", disk_snapshot_desc, :vmid, :diskid, :img_name,
300
- :options=>[TYPE, OneVMHelper::LIVE] do
307
+ :options=>[TYPE, OneVMHelper::LIVE, CLONETEMPLATE] do
301
308
  disk_id = args[1].to_i
302
309
  image_name = args[2]
303
310
  image_type = options[:type] || ""
@@ -307,7 +314,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
307
314
 
308
315
  helper.perform_action(args[0],options,verbose) do |vm|
309
316
  res = vm.disk_snapshot(disk_id, image_name, image_type,
310
- options[:live]==true)
317
+ options[:live]==true, options[:clonetemplate]==true)
311
318
 
312
319
  if !OpenNebula.is_error?(res)
313
320
  puts "Image ID: #{res}"
@@ -417,7 +424,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
417
424
  States: PENDING
418
425
  EOT
419
426
 
420
- command :deploy, deploy_desc, [:range,:vmid_list], :hostid, [:datastoreid,nil],
427
+ command :deploy, deploy_desc, [:range,:vmid_list], :hostid, [:datastoreid,nil],
421
428
  :options=>[ENFORCE] do
422
429
  host_id = args[1]
423
430
  verbose = "deploying in host #{host_id}"
data/lib/cli_helper.rb CHANGED
@@ -25,7 +25,7 @@ module CLIHelper
25
25
  :description => "Selects columns to display with list command"
26
26
  }
27
27
 
28
- CSV = {
28
+ CSV_OPT = {
29
29
  :name => "csv",
30
30
  :large => "--csv",
31
31
  :description => "Write table in csv format"
@@ -64,7 +64,7 @@ module CLIHelper
64
64
  }
65
65
 
66
66
  #OPTIONS = [LIST, ORDER, FILTER, HEADER, DELAY]
67
- OPTIONS = [LIST, DELAY, FILTER, CSV]
67
+ OPTIONS = [LIST, DELAY, FILTER, CSV_OPT]
68
68
 
69
69
  # Sets bold font
70
70
  def CLIHelper.scr_bold
@@ -268,10 +268,8 @@ module CLIHelper
268
268
 
269
269
  begin
270
270
  if options[:csv]
271
- CSV($stdout, :write_headers => true,
272
- :headers => @default_columns) do |csv|
273
- res_data.each {|l| csv << l }
274
- end
271
+ puts CSV.generate_line(@default_columns)
272
+ res_data.each {|l| puts CSV.generate_line(l) }
275
273
  else
276
274
  res_data.each{|l|
277
275
  puts (0..ncolumns-1).collect{ |i|
data/lib/one_helper.rb CHANGED
@@ -137,14 +137,6 @@ EOT
137
137
  'Name for the new group',
138
138
  :format => String
139
139
  },
140
- {
141
- :name => 'admin_group',
142
- :large => '--admin_group name',
143
- :short => "-a",
144
- :description =>
145
- 'Creates an admin group with name',
146
- :format => String
147
- },
148
140
  {
149
141
  :name => 'admin_user',
150
142
  :large => '--admin_user name',
@@ -155,7 +147,7 @@ EOT
155
147
  },
156
148
  {
157
149
  :name => 'admin_password',
158
- :large => '--admin_password password',
150
+ :large => '--admin_password pass',
159
151
  :short => "-p",
160
152
  :description =>
161
153
  'Password for the admin user of the group',
@@ -163,7 +155,7 @@ EOT
163
155
  },
164
156
  {
165
157
  :name => 'admin_driver',
166
- :large => '--admin_driver auth_driver',
158
+ :large => '--admin_driver driver',
167
159
  :short => "-d",
168
160
  :description =>
169
161
  'Auth driver for the admin user of the group',
@@ -171,20 +163,20 @@ EOT
171
163
  },
172
164
  {
173
165
  :name => 'resources',
174
- :large => '--resources resources_str',
166
+ :large => '--resources res_str',
175
167
  :short => "-r",
176
168
  :description =>
177
- 'Which resources can be created by group users "\
178
- "(VM+NET+IMAGE+TEMPLATE by default)',
169
+ "Which resources can be created by group users "<<
170
+ "(VM+NET+IMAGE+TEMPLATE by default)",
179
171
  :format => String
180
172
  },
181
173
  {
182
174
  :name => 'admin_resources',
183
- :large => '--admin_resources resources_str',
175
+ :large => '--admin_resources res_str',
184
176
  :short => "-o",
185
177
  :description =>
186
- 'Which resources can be created by group users "\
187
- "(VM+NET+IMAGE+TEMPLATE by default)',
178
+ "Which resources can be created by the admin user "<<
179
+ "(VM+NET+IMAGE+TEMPLATE by default)",
188
180
  :format => String
189
181
  }
190
182
  ]
@@ -482,9 +474,10 @@ EOT
482
474
  array=pool.get_hash
483
475
  return -1, array.message if OpenNebula.is_error?(array)
484
476
 
485
- if options[:ids]
486
- rname=self.class.rname
487
- array["#{rname}_POOL"][rname].reject! do |element|
477
+ rname=self.class.rname
478
+ elements=array["#{rname}_POOL"][rname]
479
+ if options[:ids] && elements
480
+ elements.reject! do |element|
488
481
  !options[:ids].include?(element['ID'].to_i)
489
482
  end
490
483
  end
@@ -50,17 +50,14 @@ class OneGroupHelper < OpenNebulaHelper::OneHelper
50
50
 
51
51
  def create_complete_resource(group_hash)
52
52
  group = factory
53
- exit_code , msg = group.create(group_hash)
53
+ rc = group.create(group_hash)
54
54
 
55
- puts msg if msg && !msg.empty?
56
-
57
- if (exit_code.class==Fixnum and exit_code < 0) or OpenNebula.is_error?(exit_code)
58
- puts exit_code.message if OpenNebula.is_error?(exit_code) && exit_code.message
59
- return -1
60
- else
61
- puts "ID: #{group.id}"
62
- return 0
55
+ if OpenNebula.is_error?(rc)
56
+ return -1, rc.message
63
57
  end
58
+
59
+ puts "ID: #{group.id}"
60
+ return 0
64
61
  end
65
62
 
66
63
  def format_pool(options)
@@ -46,9 +46,12 @@ class OneQuotaHelper
46
46
  # ID = <ID of the image>
47
47
  # RVMS = <Max. number of VMs using the image>
48
48
  # ]
49
+ EOT
50
+
51
+ HELP_QUOTA_FOOTER = <<-EOT.unindent
49
52
  #
50
53
  # In any quota:
51
- # -1 means use the default limit ('defaultquota' command)
54
+ # -1 means use the default limit (set with the 'defaultquota' command)
52
55
  # 0 means unlimited.
53
56
  #
54
57
  # The usage counters "*_USED" are shown for information
@@ -56,12 +59,23 @@ class OneQuotaHelper
56
59
  #-----------------------------------------------------------------------
57
60
  EOT
58
61
 
62
+ HELP_DEFAULT_QUOTA_FOOTER = <<-EOT.unindent
63
+ #
64
+ # In any quota:
65
+ # 0 means unlimited.
66
+ #
67
+ # The usage counters "*_USED" will always be 0 for the default
68
+ # quotas, and can be ignored.
69
+ #-----------------------------------------------------------------------
70
+ EOT
71
+
59
72
  # Edits the quota template of a resource
60
73
  # @param [XMLElement] resource to get the current info from
61
74
  # @param [String] path to the new contents. If nil a editor will be
62
75
  # used
76
+ # @param [True|False] is_default To change the help text
63
77
  # @return [String] contents of the new quotas
64
- def self.set_quota(resource, path)
78
+ def self.set_quota(resource, path, is_default=false)
65
79
  str = ""
66
80
 
67
81
  if path.nil?
@@ -71,6 +85,13 @@ class OneQuotaHelper
71
85
  path = tmp.path
72
86
 
73
87
  tmp << HELP_QUOTA
88
+
89
+ if (is_default)
90
+ tmp << HELP_DEFAULT_QUOTA_FOOTER
91
+ else
92
+ tmp << HELP_QUOTA_FOOTER
93
+ end
94
+
74
95
  tmp << resource.template_like_str("DATASTORE_QUOTA") << "\n"
75
96
  tmp << resource.template_like_str("VM_QUOTA") << "\n"
76
97
  tmp << resource.template_like_str("NETWORK_QUOTA") << "\n"
metadata CHANGED
@@ -1,103 +1,107 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opennebula-cli
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: opennebula
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - '='
18
20
  - !ruby/object:Gem::Version
19
- version: 4.5.80.beta
21
+ version: 4.5.85.rc1
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
- version: 4.5.80.beta
29
+ version: 4.5.85.rc1
27
30
  description: Commands used to talk to OpenNebula
28
31
  email: contact@opennebula.org
29
32
  executables:
30
- - oneacct
31
33
  - oneacl
32
- - onecluster
33
- - onedatastore
34
- - oneflow
35
- - oneflow-template
36
- - onegroup
37
34
  - onehost
35
+ - oneflow-template
36
+ - onevnet
38
37
  - oneimage
38
+ - onedatastore
39
+ - onevm
40
+ - onegroup
41
+ - onecluster
39
42
  - onetemplate
43
+ - oneflow
40
44
  - oneuser
41
- - onevm
42
- - onevnet
43
45
  - onezone
46
+ - oneacct
44
47
  extensions: []
45
48
  extra_rdoc_files: []
46
49
  files:
47
- - LICENSE
48
- - NOTICE
49
- - bin/oneacct
50
50
  - bin/oneacl
51
- - bin/onecluster
52
- - bin/onedatastore
53
- - bin/oneflow
54
- - bin/oneflow-template
55
- - bin/onegroup
56
51
  - bin/onehost
52
+ - bin/oneflow-template
53
+ - bin/onevnet
57
54
  - bin/oneimage
55
+ - bin/onedatastore
56
+ - bin/onevm
57
+ - bin/onegroup
58
+ - bin/onecluster
58
59
  - bin/onetemplate
60
+ - bin/oneflow
59
61
  - bin/oneuser
60
- - bin/onevm
61
- - bin/onevnet
62
62
  - bin/onezone
63
- - lib/cli_helper.rb
64
- - lib/command_parser.rb
63
+ - bin/oneacct
65
64
  - lib/one_helper.rb
66
- - lib/one_helper/oneacct_helper.rb
67
- - lib/one_helper/oneacl_helper.rb
68
- - lib/one_helper/onecluster_helper.rb
69
- - lib/one_helper/onedatastore_helper.rb
70
- - lib/one_helper/onegroup_helper.rb
71
- - lib/one_helper/onehost_helper.rb
72
- - lib/one_helper/oneimage_helper.rb
65
+ - lib/command_parser.rb
66
+ - lib/cli_helper.rb
73
67
  - lib/one_helper/onequota_helper.rb
74
68
  - lib/one_helper/onetemplate_helper.rb
75
- - lib/one_helper/oneuser_helper.rb
76
- - lib/one_helper/onevm_helper.rb
77
- - lib/one_helper/onevnet_helper.rb
69
+ - lib/one_helper/onegroup_helper.rb
78
70
  - lib/one_helper/onezone_helper.rb
71
+ - lib/one_helper/onevnet_helper.rb
72
+ - lib/one_helper/onevm_helper.rb
73
+ - lib/one_helper/oneuser_helper.rb
74
+ - lib/one_helper/onedatastore_helper.rb
75
+ - lib/one_helper/onecluster_helper.rb
76
+ - lib/one_helper/oneimage_helper.rb
77
+ - lib/one_helper/oneacl_helper.rb
78
+ - lib/one_helper/oneacct_helper.rb
79
+ - lib/one_helper/onehost_helper.rb
80
+ - NOTICE
81
+ - LICENSE
79
82
  homepage: http://opennebula.org
80
83
  licenses: []
81
- metadata: {}
82
84
  post_install_message:
83
85
  rdoc_options: []
84
86
  require_paths:
85
87
  - lib
86
88
  required_ruby_version: !ruby/object:Gem::Requirement
89
+ none: false
87
90
  requirements:
88
- - - ">="
91
+ - - ! '>='
89
92
  - !ruby/object:Gem::Version
90
93
  version: '0'
91
94
  required_rubygems_version: !ruby/object:Gem::Requirement
95
+ none: false
92
96
  requirements:
93
- - - ">"
97
+ - - ! '>'
94
98
  - !ruby/object:Gem::Version
95
99
  version: 1.3.1
96
100
  requirements: []
97
101
  rubyforge_project:
98
- rubygems_version: 2.2.0
102
+ rubygems_version: 1.8.23
99
103
  signing_key:
100
- specification_version: 4
104
+ specification_version: 3
101
105
  summary: OpenNebula Command Line Interface
102
106
  test_files: []
103
107
  has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 0d0a7a6d4a5861896dcea19d5bd0901864e93cf8
4
- data.tar.gz: 3348c3fbf038afce1e154ed5d17cf94819c663a1
5
- SHA512:
6
- metadata.gz: 30d8c96ff0feaffd28f8c13a180d4118e40e12c95f994d4336d72efff7a6fb2f58cd69aa28bb9955c17bba52d51e8c2a95386d33f2777e5997151279c2c94c89
7
- data.tar.gz: 3f283c2538ee84ff6f5d4341f8b9f0ff854731de9e358489f73a9be7ba7a6a69dc7573b3340101ea12ae4ed3810c21944d4510a0863db77a1ad0193a89daf3c5