opennebula-cli 6.8.2 → 6.9.80.pre

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15c54d3ad1c7f151f8f8c85761c9e7d807ebaf3b60e11c8ba722f9efa55b5e36
4
- data.tar.gz: 2162024e4c15e1fe2fcd811adb3a10d84e33943f5f6a67d930a93d2b3734b859
3
+ metadata.gz: 38482e5c20e3b6bd22fe7b91b7d24bf7d7663fc1c43d8ea53d592c36395c652c
4
+ data.tar.gz: 143fa13eee00b3e666b0a8105e021c71062d668db57630b39d9c3b221e329101
5
5
  SHA512:
6
- metadata.gz: ca211f3593bc2262afaacf6ee1872c00335f7edb86ca52d532fe2abbdfd16d89ba8d4f1b26607c3e44e3bb31e0ed14f33aeefb0cd9cf62b986c0fc8429eb870c
7
- data.tar.gz: 708bf45d47a6755eb71bba7df087025ee4c2ff016a4d0cb4acff390ff7d3373b3695045e9c63ed5d880011c9520bde7ddc5fc00d20b04d0f8ab3402fb4e96c87
6
+ metadata.gz: b5b689b4788e3122e7a80407ff2846c87d56ba903e9254c4e70add4dae6f8c55e573996e75867c8f9de1aa64a592aa133861edee4e009205b46f700bdec7eb8a
7
+ data.tar.gz: 9704f4990ac5c7243cad58ffbe59e9f3f323acd8ea23b142059bdb21c6fe510587f8ad5eab05514e8abae6c1ce55c6bf713e7c1acc316c8b4cfe81b62c6137da
data/bin/oneflow CHANGED
@@ -61,6 +61,21 @@ USER_AGENT = 'CLI'
61
61
  # Base Path representing the resource to be used in the requests
62
62
  RESOURCE_PATH = '/service'
63
63
 
64
+ RESOURCE_DOCUMENT_TYPE = '100'
65
+
66
+ def check_document_type(response)
67
+ if CloudClient.is_error?(response)
68
+ return if response.code == '500' # could be wrong document_type; skip this id
69
+
70
+ exit_with_code response.code.to_i, response.to_s
71
+ else
72
+ document_type = JSON.parse(response.body)['DOCUMENT']['TYPE']
73
+ if document_type == RESOURCE_DOCUMENT_TYPE
74
+ yield
75
+ end
76
+ end
77
+ end
78
+
64
79
  CommandParser::CmdParser.new(ARGV) do
65
80
  usage '`oneflow` <command> [<args>] [<options>]'
66
81
  version OpenNebulaHelper::ONE_VERSION
@@ -168,9 +183,11 @@ CommandParser::CmdParser.new(ARGV) do
168
183
 
169
184
  command :delete, delete_desc, [:range, :service_id_list] do
170
185
  client = helper.client(options)
171
-
172
186
  Service.perform_actions(args[0]) do |service_id|
173
- client.delete("#{RESOURCE_PATH}/#{service_id}")
187
+ response = client.get("#{RESOURCE_PATH}/#{service_id}")
188
+ check_document_type response do
189
+ client.delete("#{RESOURCE_PATH}/#{service_id}")
190
+ end
174
191
  end
175
192
  end
176
193
 
@@ -197,7 +214,10 @@ CommandParser::CmdParser.new(ARGV) do
197
214
 
198
215
  json = Service.build_json_action('recover', params)
199
216
 
200
- client.post("#{RESOURCE_PATH}/#{service_id}/action", json)
217
+ response = client.get("#{RESOURCE_PATH}/#{service_id}")
218
+ check_document_type response do
219
+ client.post("#{RESOURCE_PATH}/#{service_id}/action", json)
220
+ end
201
221
  end
202
222
  end
203
223
 
data/bin/oneflow-template CHANGED
@@ -68,6 +68,21 @@ USER_AGENT = 'CLI'
68
68
  # Base Path representing the resource to be used in the requests
69
69
  RESOURCE_PATH = '/service_template'
70
70
 
71
+ RESOURCE_DOCUMENT_TYPE = '101'
72
+
73
+ def check_document_type(response)
74
+ if CloudClient.is_error?(response)
75
+ return if response.code == '500' # could be wrong document_type; skip this id
76
+
77
+ exit_with_code response.code.to_i, response.to_s
78
+ else
79
+ document_type = JSON.parse(response.body)['DOCUMENT']['TYPE']
80
+ if document_type == RESOURCE_DOCUMENT_TYPE
81
+ yield
82
+ end
83
+ end
84
+ end
85
+
71
86
  CommandParser::CmdParser.new(ARGV) do
72
87
  MULTIPLE = {
73
88
  :name => 'multiple',
@@ -240,7 +255,10 @@ CommandParser::CmdParser.new(ARGV) do
240
255
  body['delete_type'] = delete
241
256
 
242
257
  Service.perform_actions(args[0]) do |template_id|
243
- client.delete("#{RESOURCE_PATH}/#{template_id}", body.to_json)
258
+ response = client.get("#{RESOURCE_PATH}/#{template_id}")
259
+ check_document_type response do
260
+ client.delete("#{RESOURCE_PATH}/#{template_id}", body.to_json)
261
+ end
244
262
  end
245
263
  end
246
264
 
data/bin/oneimage CHANGED
@@ -88,12 +88,6 @@ CommandParser::CmdParser.new(ARGV) do
88
88
  :description => 'lock all actions'
89
89
  }
90
90
 
91
- NO_CONTEXT = {
92
- :name => 'no_context',
93
- :large => '--no-context',
94
- :description => 'Do not add context when building from Dockerfile'
95
- }
96
-
97
91
  NO_IP = {
98
92
  :name => 'no_ip',
99
93
  :large => '--no_ip',
@@ -121,6 +115,13 @@ CommandParser::CmdParser.new(ARGV) do
121
115
  :description => 'Name of the new image'
122
116
  }
123
117
 
118
+ DISK_ID = {
119
+ :name => 'disk_id',
120
+ :large => '--disk-id disk_id',
121
+ :format => Integer,
122
+ :description => 'Restore only selected disk ID'
123
+ }
124
+
124
125
  ########################################################################
125
126
  # Global Options
126
127
  ########################################################################
@@ -134,8 +135,7 @@ CommandParser::CmdParser.new(ARGV) do
134
135
 
135
136
  CREATE_OPTIONS = [OneDatastoreHelper::DATASTORE,
136
137
  OneImageHelper::IMAGE,
137
- NAME,
138
- NO_CONTEXT]
138
+ NAME]
139
139
 
140
140
  ########################################################################
141
141
  # Formatters for arguments
@@ -210,11 +210,7 @@ CommandParser::CmdParser.new(ARGV) do
210
210
  exit(-1)
211
211
  end
212
212
 
213
- if options[:no_check_capacity].nil?
214
- check_capacity = false
215
- else
216
- check_capacity = true
217
- end
213
+ no_check_capacity = !options[:no_check_capacity].nil?
218
214
 
219
215
  conflicting_opts = []
220
216
  if (args[0] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
@@ -226,15 +222,6 @@ CommandParser::CmdParser.new(ARGV) do
226
222
  next -1
227
223
  end
228
224
 
229
- # Add context information when building image (just working on Docker)
230
- if (options.key? :no_context) && options[:path]
231
- if options[:path].include?('?')
232
- options[:path] << '&context=no'
233
- else
234
- options[:path] << '?context=no'
235
- end
236
- end
237
-
238
225
  helper.create_resource(options) do |image|
239
226
  begin
240
227
  if args[0]
@@ -257,7 +244,7 @@ CommandParser::CmdParser.new(ARGV) do
257
244
  exit 0
258
245
  end
259
246
 
260
- image.allocate(template, options[:datastore], check_capacity)
247
+ image.allocate(template, options[:datastore], no_check_capacity)
261
248
  rescue StandardError => e
262
249
  STDERR.puts e.message
263
250
  exit(-1)
@@ -457,7 +444,7 @@ CommandParser::CmdParser.new(ARGV) do
457
444
  command :restore,
458
445
  restore_desc,
459
446
  :imageid,
460
- :options => [OneDatastoreHelper::DATASTORE, NO_NIC, NO_IP, NAME, INCREMENT] do
447
+ :options => [OneDatastoreHelper::DATASTORE, NO_NIC, NO_IP, NAME, INCREMENT, DISK_ID] do
461
448
  helper.perform_action(args[0], options, 'vm backup restored') do |o|
462
449
  if options[:datastore].nil?
463
450
  STDERR.puts 'Datastore to restore the backup is mandatory: '
@@ -471,13 +458,14 @@ CommandParser::CmdParser.new(ARGV) do
471
458
  restore_opts << "NO_IP=\"YES\"\n" if options[:no_ip]
472
459
  restore_opts << "NAME=\"#{options[:name]}\"\n" if options[:name]
473
460
  restore_opts << "INCREMENT_ID=\"#{options[:increment]}\"\n" if options[:increment]
461
+ restore_opts << "DISK_ID=\"#{options[:disk_id]}\"\n" if options[:disk_id]
474
462
 
475
463
  rc = o.restore(options[:datastore].to_i, restore_opts)
476
464
 
477
465
  if !OpenNebula.is_error?(rc)
478
466
  ids = rc.split(' ')
479
467
 
480
- puts "VM Template: #{ids[0]}" if ids[0]
468
+ puts "VM Template: #{ids[0]}" if ids[0] && ids[0] != '-1'
481
469
  puts "Images: #{ids[1..-1].join(' ')}" if ids.length > 1
482
470
  else
483
471
  puts rc.message
@@ -569,73 +557,4 @@ CommandParser::CmdParser.new(ARGV) do
569
557
 
570
558
  return 0
571
559
  end
572
-
573
- dockerfile_desc = <<-EOT.unindent
574
- Create an image based on a Dockerfile
575
- EOT
576
-
577
- command :dockerfile,
578
- dockerfile_desc,
579
- :options => CREATE_OPTIONS +
580
- OneImageHelper::TEMPLATE_OPTIONS do
581
- # Check user options
582
- unless options[:datastore]
583
- STDERR.puts 'Datastore to save the image is mandatory: '
584
- STDERR.puts "\t -d datastore_id"
585
- exit(-1)
586
- end
587
-
588
- unless options[:name]
589
- STDERR.puts 'No name provided'
590
- exit(-1)
591
- end
592
-
593
- unless options[:size]
594
- STDERR.puts 'No size given'
595
- exit(-1)
596
- end
597
-
598
- # Prepare editor
599
- tmp = Tempfile.new('dockerfile')
600
-
601
- if ENV['EDITOR']
602
- editor_path = ENV['EDITOR']
603
- else
604
- editor_path = EDITOR_PATH
605
- end
606
-
607
- system("#{editor_path} #{tmp.path}")
608
-
609
- unless $CHILD_STATUS.exitstatus.zero?
610
- STDERR.puts('Editor not defined')
611
- exit(-1)
612
- end
613
-
614
- tmp.close
615
-
616
- # Create image
617
- helper.create_resource(options) do |image|
618
- begin
619
- b64 = Base64.strict_encode64(File.read(tmp.path))
620
- options[:path] = "dockerfile:///?fileb64=#{b64}&" \
621
- "size=#{options[:size]}"
622
-
623
- options[:path] << '&context=no' if options.key?(:no_context)
624
-
625
- res = OneImageHelper.create_image_template(options)
626
-
627
- if res.first != 0
628
- STDERR.puts res.last
629
- next -1
630
- end
631
-
632
- template = res.last
633
-
634
- image.allocate(template, options[:datastore], false)
635
- rescue StandardError => e
636
- STDERR.puts e.message
637
- exit(-1)
638
- end
639
- end
640
- end
641
560
  end
data/bin/onemarketapp CHANGED
@@ -90,13 +90,6 @@ CommandParser::CmdParser.new(ARGV) do
90
90
  :description => 'lock all actions'
91
91
  }
92
92
 
93
- TAG = {
94
- :name => 'tag',
95
- :large => '--tag tag',
96
- :format => String,
97
- :description => 'DockerHub image tag (default latest)'
98
- }
99
-
100
93
  YES = {
101
94
  :name => 'yes',
102
95
  :large => '--yes',
@@ -143,7 +136,6 @@ CommandParser::CmdParser.new(ARGV) do
143
136
  EXPORT_OPTIONS = [OneDatastoreHelper::DATASTORE,
144
137
  OneDatastoreHelper::FILE_DATASTORE,
145
138
  OneMarketPlaceAppHelper::VMNAME,
146
- TAG,
147
139
  NO,
148
140
  TEMPLATE]
149
141
  IMPORT_OPTIONS = [YES, NO, MARKET, OneMarketPlaceAppHelper::VMNAME]
@@ -291,17 +283,14 @@ CommandParser::CmdParser.new(ARGV) do
291
283
 
292
284
  command :export, export_desc, :appid, :name, :options => EXPORT_OPTIONS do
293
285
  helper.perform_action(args[0], options, 'exporting') do |obj|
294
- tag ="tag=#{options[:tag]}" if options[:tag]
295
-
296
286
  obj.extend(MarketPlaceAppExt)
297
287
 
298
288
  rc = obj.export(
299
289
  :dsid => options[:datastore],
300
290
  :name => args[1],
301
291
  :vmtemplate_name => options[:vmname],
302
- :url_args => tag,
303
- :notemplate => options[:no] == 'no',
304
- :template => options[:template]
292
+ :notemplate => options[:no] == 'no',
293
+ :template => options[:template]
305
294
  )
306
295
 
307
296
  if OpenNebula.is_error?(rc)
data/bin/onevm CHANGED
@@ -257,6 +257,21 @@ CommandParser::CmdParser.new(ARGV) do
257
257
  :description => 'Creates a new backup image, from a new full backup (only for incremental)'
258
258
  }
259
259
 
260
+ INCREMENT = {
261
+ :name => 'increment',
262
+ :large => '--increment increment_id',
263
+ :format => Integer,
264
+ :description => 'Use the given increment ID to restore the backup.'\
265
+ ' If not provided the last one will be used'
266
+ }
267
+
268
+ DISK_ID = {
269
+ :name => 'disk_id',
270
+ :large => '--disk-id disk_id',
271
+ :format => Integer,
272
+ :description => 'Use only selected disk ID'
273
+ }
274
+
260
275
  OpenNebulaHelper::TEMPLATE_OPTIONS_VM.delete_if do |v|
261
276
  ['as_gid', 'as_uid'].include?(v[:name])
262
277
  end
@@ -281,6 +296,10 @@ CommandParser::CmdParser.new(ARGV) do
281
296
  OpenNebulaHelper.rname_to_id(arg, 'USER')
282
297
  end
283
298
 
299
+ set :format, :imageid, OpenNebulaHelper.rname_to_id_desc('IMAGE') do |arg|
300
+ OpenNebulaHelper.rname_to_id(arg, 'IMAGE')
301
+ end
302
+
284
303
  set :format,
285
304
  :datastoreid,
286
305
  OpenNebulaHelper.rname_to_id_desc('DATASTORE') do |arg|
@@ -720,7 +739,7 @@ CommandParser::CmdParser.new(ARGV) do
720
739
  States for success/failure recovers: Any ACTIVE state.
721
740
  States for a retry recover: Any *FAILURE state
722
741
  States for delete: Any
723
- States for recreate: Any but DONE/POWEROFF/SUSPENDED
742
+ States for recreate: Any but DONE
724
743
  States for delete-db: Any
725
744
  EOT
726
745
 
@@ -1240,6 +1259,10 @@ CommandParser::CmdParser.new(ARGV) do
1240
1259
 
1241
1260
  if options[:xml]
1242
1261
  puts pool.to_xml
1262
+ elsif options[:json]
1263
+ puts JSON.pretty_generate(pool.to_hash)
1264
+ elsif options[:yaml]
1265
+ puts pool.to_hash.to_yaml
1243
1266
  else
1244
1267
  table.show(pool.to_hash, options)
1245
1268
  end
@@ -1357,15 +1380,15 @@ CommandParser::CmdParser.new(ARGV) do
1357
1380
 
1358
1381
  The full list of configuration attributes are:
1359
1382
 
1360
- OS = ["ARCH", "MACHINE", "KERNEL", "INITRD", "BOOTLOADER", "BOOT", "UUID"]
1383
+ OS = ["ARCH", "MACHINE", "KERNEL", "INITRD", "BOOTLOADER", "BOOT", "KERNEL_CMD", "ROOT", "SD_DISK_BUS", "UUID", "FIRMWARE"]
1361
1384
  FEATURES = ["ACPI", "PAE", "APIC", "LOCALTIME", "HYPERV", "GUEST_AGENT", "VIRTIO_SCSI_QUEUES", "VIRTIO_BLK_QUEUES", "IOTHREADS"]
1362
1385
  INPUT = ["TYPE", "BUS"]
1363
- GRAPHICS = ["TYPE", "LISTEN", "PASSWD", "KEYMAP" ]
1386
+ GRAPHICS = ["TYPE", "LISTEN", "PASSWD", "KEYMAP", "COMMAND"]
1364
1387
  VIDEO = ["TYPE", "IOMMU", "ATS", "VRAM", "RESOLUTION"]
1365
1388
  RAW = ["DATA", "DATA_VMX", "TYPE", "VALIDATE"]
1366
1389
  CPU_MODEL = ["MODEL"]
1367
1390
  BACKUP_CONFIG = ["FS_FREEZE", "KEEP_LAST", "BACKUP_VOLATILE", "MODE", "INCREMENT_MODE"]
1368
- CONTEXT (any value, **variable substitution will be made**)
1391
+ CONTEXT (any value, except ETH*, **variable substitution will be made**)
1369
1392
  EOT
1370
1393
 
1371
1394
  command :updateconf, updateconf_desc, :vmid, [:file, nil],
@@ -1767,6 +1790,27 @@ CommandParser::CmdParser.new(ARGV) do
1767
1790
  end
1768
1791
  end
1769
1792
 
1793
+ restore_desc = <<-EOT.unindent
1794
+ Restore the Virtual Machine from the backup Image. The VM must be in poweroff state.
1795
+ EOT
1796
+
1797
+ command :restore, restore_desc, :vmid, :imageid, :options => [DISK_ID, INCREMENT] do
1798
+ helper.perform_action(args[0], options, 'Restoring VM from backup') do |vm|
1799
+ disk_id = options[:disk_id]
1800
+ disk_id ||= -1 # All disks by default
1801
+
1802
+ inc_id = options[:increment]
1803
+ inc_id ||= -1 # Last increment by default
1804
+
1805
+ rc = vm.restore(args[1], inc_id, disk_id)
1806
+
1807
+ if OpenNebula.is_error?(rc)
1808
+ STDERR.puts "Error restoring: #{rc.message}"
1809
+ exit(-1)
1810
+ end
1811
+ end
1812
+ end
1813
+
1770
1814
  # Deprecated commands, remove these commands in release 8.x
1771
1815
 
1772
1816
  deprecated_command(:'delete-chart', 'sched-delete')
data/bin/onezone CHANGED
@@ -253,15 +253,11 @@ CommandParser::CmdParser.new(ARGV) do
253
253
 
254
254
  command :serversync, sync_desc, :server, :options => [DATABASE] do
255
255
  begin
256
- # Suppress augeas require warning message
257
- $VERBOSE = nil
258
-
259
- gem 'augeas', '~> 0.6'
260
256
  require 'augeas'
261
257
  rescue Gem::LoadError
262
258
  STDERR.puts(
263
259
  'Augeas gem is not installed, run `gem install ' \
264
- 'augeas -v \'0.6\'` to install it'
260
+ 'opennebula-augeas` to install it'
265
261
  )
266
262
  exit(-1)
267
263
  end
@@ -328,7 +328,7 @@ class OneGroupHelper < OpenNebulaHelper::OneHelper
328
328
  default_quotas = elem
329
329
  }
330
330
 
331
- helper = OneQuotaHelper.new
331
+ helper = OneQuotaHelper.new(@client)
332
332
  helper.format_quota(group_hash['GROUP'], default_quotas, group.id)
333
333
  end
334
334
  end
@@ -22,7 +22,7 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
22
22
 
23
23
  # This list contains prefixes that should skip adding user home to the path
24
24
  # This must have the same content as the case $FROM in downloader.sh
25
- PREFIXES = ['http', 'https', 'ssh', 's3', 'rbd', 'vcenter', 'lxd', 'docker', 'dockerfile']
25
+ PREFIXES = ['http', 'https', 'ssh', 's3', 'rbd', 'vcenter', 'lxd']
26
26
 
27
27
  TEMPLATE_OPTIONS=[
28
28
  {
@@ -169,8 +169,7 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
169
169
  :name => 'no_check_capacity',
170
170
  :large => '--no_check_capacity',
171
171
  :description =>
172
- 'Check Datastore capacity. By Default YES',
173
- :format => String
172
+ 'Do not check Datastore capacity, only for admins.'
174
173
  }
175
174
 
176
175
  FILTERS = [
@@ -75,6 +75,10 @@ class OneQuotaHelper
75
75
  #-----------------------------------------------------------------------
76
76
  EOT
77
77
 
78
+ def initialize(client = nil)
79
+ @client=client
80
+ end
81
+
78
82
  # Edits the quota template of a resource
79
83
  # @param [XMLElement] resource to get the current info from
80
84
  # @param [String] path to the new contents. If nil a editor will be
@@ -207,6 +211,8 @@ class OneQuotaHelper
207
211
 
208
212
  vm_quotas = [qh['VM_QUOTA']['VM']].flatten
209
213
 
214
+ generic_quotas = get_generic_quotas
215
+
210
216
  # This initializes the VM quotas for users/groups that don't have any
211
217
  # resource usage yet. It not applied to oneamdin
212
218
  if vm_quotas[0].nil? && resource_id.to_i != 0
@@ -228,6 +234,13 @@ class OneQuotaHelper
228
234
  "SYSTEM_DISK_SIZE" => limit,
229
235
  "SYSTEM_DISK_SIZE_USED" => "0"
230
236
  }]
237
+
238
+ generic_quotas.each do |q|
239
+ vm_quotas[0][q] = limit
240
+ vm_quotas[0]["#{q}_USED"] = "0"
241
+ vm_quotas[0]["RUNNING_#{q}"] = limit
242
+ vm_quotas[0]["RUNNING_#{q}_USED"] = "0"
243
+ end
231
244
  end
232
245
 
233
246
  if !vm_quotas[0].nil?
@@ -378,6 +391,55 @@ class OneQuotaHelper
378
391
  puts
379
392
  end
380
393
 
394
+ if !generic_quotas.empty? && !vm_quotas[0].nil?
395
+ CLIHelper.print_header(str_h1 % "VMS GENERIC QUOTAS",false)
396
+ size = [80 / generic_quotas.length - 1, 18].min
397
+
398
+ CLIHelper::ShowTable.new(nil, self) do
399
+ generic_quotas.each do |elem|
400
+ column elem.to_sym, "", :right, :size=>size do |d|
401
+ if !d.nil?
402
+ limit = d[elem]
403
+ limit = helper.get_default_limit(
404
+ limit, "VM_QUOTA/VM/#{elem}")
405
+
406
+ if limit == LIMIT_UNLIMITED
407
+ "%6s / -" % [d["#{elem}_USED"]]
408
+ else
409
+ "%6s / %6s" % [d["#{elem}_USED"], limit]
410
+ end
411
+ end
412
+ end
413
+ end
414
+ end.show(vm_quotas, {})
415
+
416
+ puts
417
+
418
+ CLIHelper.print_header(str_h1 % "VMS GENERIC RUNNING QUOTAS",false)
419
+ size = [80 / generic_quotas.length - 1, 18].min
420
+
421
+ CLIHelper::ShowTable.new(nil, self) do
422
+ generic_quotas.each do |q|
423
+ elem = "RUNNING_#{q}"
424
+ column elem.to_sym, "", :right, :size=>size do |d|
425
+ if !d.nil?
426
+ limit = d[elem]
427
+ limit = helper.get_default_limit(
428
+ limit, "VM_QUOTA/VM/#{elem}")
429
+
430
+ if limit == LIMIT_UNLIMITED
431
+ "%6s / -" % [d["#{elem}_USED"]]
432
+ else
433
+ "%6s / %6s" % [d["#{elem}_USED"], limit]
434
+ end
435
+ end
436
+ end
437
+ end
438
+ end.show(vm_quotas, {})
439
+
440
+ puts
441
+ end
442
+
381
443
  CLIHelper.print_header(str_h1 % "DATASTORE USAGE & QUOTAS",false)
382
444
 
383
445
  puts
@@ -503,4 +565,17 @@ class OneQuotaHelper
503
565
 
504
566
  return limit
505
567
  end
568
+
569
+ private
570
+
571
+ def get_generic_quotas
572
+ conf = OpenNebula::System.new(@client).get_configuration
573
+
574
+ return [] if OpenNebula.is_error?(conf)
575
+
576
+ conf.retrieve_elements('/OPENNEBULA_CONFIGURATION/QUOTA_VM_ATTRIBUTE') || []
577
+ rescue StandardError
578
+ []
579
+ end
580
+
506
581
  end
@@ -613,7 +613,7 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
613
613
  default_quotas = elem
614
614
  }
615
615
 
616
- helper = OneQuotaHelper.new
616
+ helper = OneQuotaHelper.new(@client)
617
617
  helper.format_quota(user_hash['USER'], default_quotas, user.id)
618
618
  end
619
619
 
@@ -160,7 +160,8 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
160
160
  SEARCH = {
161
161
  :name => 'search',
162
162
  :large => '--search search',
163
- :description => 'query in KEY=VALUE format',
163
+ :description => 'Query in PATH=VALUE format. For example: ' \
164
+ 'onevm list --search "VM.NAME=abc&VM.TEMPLATE.DISK[*].IMAGE=db1"',
164
165
  :format => String
165
166
  }
166
167
 
@@ -135,7 +135,7 @@ class Replicator
135
135
  def fetch_db_config(configs)
136
136
  configs.store(:backend, configs[:raw]['/OPENNEBULA_CONFIGURATION/DB/BACKEND'])
137
137
 
138
- if configs[:backend] == 'mysql' || configs[:backend] == 'postgresql'
138
+ if configs[:backend] == 'mysql'
139
139
  configs.store(:server, configs[:raw]['/OPENNEBULA_CONFIGURATION/DB/SERVER'])
140
140
  configs.store(:user, configs[:raw]['/OPENNEBULA_CONFIGURATION/DB/USER'])
141
141
  configs.store(:password, configs[:raw]['/OPENNEBULA_CONFIGURATION/DB/PASSWD'])
@@ -143,7 +143,7 @@ class Replicator
143
143
  configs.store(:port, configs[:raw]['/OPENNEBULA_CONFIGURATION/DB/PORT'])
144
144
  configs[:port] = '3306' if configs[:port] == '0'
145
145
  else
146
- STDERR.puts 'No mysql or postgresql backend configuration found'
146
+ STDERR.puts 'No mysql backend configuration found'
147
147
  exit(-1)
148
148
  end
149
149
  end
data/lib/one_helper.rb CHANGED
@@ -379,7 +379,7 @@ Bash symbols must be escaped on STDIN passing'
379
379
  :name => 'context',
380
380
  :large => '--context line1,line2,line3',
381
381
  :format => Array,
382
- :description => 'Lines to add to the context section'
382
+ :description => 'Replaces the context section with the specified lines'
383
383
  },
384
384
  {
385
385
  :name => 'boot',
@@ -1078,12 +1078,12 @@ Bash symbols must be escaped on STDIN passing'
1078
1078
  elsif options[:xml]
1079
1079
  return list_pool_xml(pool, options, filter_flag)
1080
1080
  elsif options[:json]
1081
- list_pool_format(pool, options, filter_flag) do |pool|
1081
+ return list_pool_format(pool, options, filter_flag) do |pool|
1082
1082
  hash = check_resource_xsd(pool, pname)
1083
1083
  puts ::JSON.pretty_generate(hash)
1084
1084
  end
1085
1085
  elsif options[:yaml]
1086
- list_pool_format(pool, options, filter_flag) do |pool|
1086
+ return list_pool_format(pool, options, filter_flag) do |pool|
1087
1087
  hash = check_resource_xsd(pool, pname)
1088
1088
  puts hash.to_yaml(:indent => 4)
1089
1089
  end
@@ -42,12 +42,25 @@
42
42
  <xs:element name="VMS_THREAD" type="xs:integer"/>
43
43
  <xs:element name="DATASTORES">
44
44
  <xs:complexType>
45
- <xs:all>
45
+ <xs:sequence>
46
46
  <xs:element name="DISK_USAGE" type="xs:integer"/>
47
+ <xs:element name="DS" minOccurs="0" maxOccurs="unbounded">
48
+ <xs:complexType>
49
+ <xs:sequence>
50
+ <xs:element name="FREE_MB" type="xs:integer"/>
51
+ <xs:element name="ID" type="xs:integer"/>
52
+ <xs:element name="TOTAL_MB" type="xs:integer"/>
53
+ <xs:element name="USED_MB" type="xs:integer"/>
54
+ <xs:element name="REPLICA_CACHE" type="xs:string" minOccurs="0" maxOccurs="1"/>
55
+ <xs:element name="REPLICA_CACHE_SIZE" type="xs:string" minOccurs="0" maxOccurs="1"/>
56
+ <xs:element name="REPLICA_IMAGES" type="xs:integer" minOccurs="0" maxOccurs="1"/>
57
+ </xs:sequence>
58
+ </xs:complexType>
59
+ </xs:element>
47
60
  <xs:element name="FREE_DISK" type="xs:integer"/>
48
61
  <xs:element name="MAX_DISK" type="xs:integer"/>
49
62
  <xs:element name="USED_DISK" type="xs:integer"/>
50
- </xs:all>
63
+ </xs:sequence>
51
64
  </xs:complexType>
52
65
  </xs:element>
53
66
  <xs:element name="PCI_DEVICES">
@@ -1,5 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://opennebula.org/XMLSchema" elementFormDefault="qualified" targetNamespace="http://opennebula.org/XMLSchema">
3
+ <xs:include schemaLocation="shared.xsd"/>
3
4
  <xs:element name="IMAGE">
4
5
  <xs:complexType>
5
6
  <xs:sequence>
@@ -65,27 +66,9 @@
65
66
  <xs:element name="TARGET_SNAPSHOT" type="xs:integer"/>
66
67
  <xs:element name="DATASTORE_ID" type="xs:integer"/>
67
68
  <xs:element name="DATASTORE" type="xs:string"/>
68
- <xs:element name="VMS">
69
- <xs:complexType>
70
- <xs:sequence>
71
- <xs:element name="ID" type="xs:integer" minOccurs="0" maxOccurs="unbounded"/>
72
- </xs:sequence>
73
- </xs:complexType>
74
- </xs:element>
75
- <xs:element name="CLONES">
76
- <xs:complexType>
77
- <xs:sequence>
78
- <xs:element name="ID" type="xs:integer" minOccurs="0" maxOccurs="unbounded"/>
79
- </xs:sequence>
80
- </xs:complexType>
81
- </xs:element>
82
- <xs:element name="APP_CLONES">
83
- <xs:complexType>
84
- <xs:sequence>
85
- <xs:element name="ID" type="xs:integer" minOccurs="0" maxOccurs="unbounded"/>
86
- </xs:sequence>
87
- </xs:complexType>
88
- </xs:element>
69
+ <xs:element name="VMS" type="IDS"/>
70
+ <xs:element name="CLONES" type="IDS"/>
71
+ <xs:element name="APP_CLONES" type="IDS"/>
89
72
  <xs:element name="TEMPLATE">
90
73
  <xs:complexType>
91
74
  <xs:sequence>
@@ -135,6 +118,7 @@
135
118
  </xs:sequence>
136
119
  </xs:complexType>
137
120
  </xs:element>
121
+ <xs:element name="BACKUP_DISK_IDS" type="IDS" minOccurs="0" maxOccurs="1"/>
138
122
  </xs:sequence>
139
123
  </xs:complexType>
140
124
  </xs:element>
@@ -50,7 +50,6 @@
50
50
  <xs:element name="BACKEND" minOccurs="0" maxOccurs="1" >
51
51
  <xs:simpleType>
52
52
  <xs:restriction base="xs:string">
53
- <xs:enumeration value="postgresql"/>
54
53
  <xs:enumeration value="mysql"/>
55
54
  <xs:enumeration value="sqlite"/>
56
55
  </xs:restriction>
@@ -250,7 +249,6 @@
250
249
  <xs:element name="MAX_CONN_BACKLOG" type="xs:integer" minOccurs="0" maxOccurs="1"/>
251
250
  <xs:element name="MESSAGE_SIZE" type="xs:integer" minOccurs="0" maxOccurs="1"/>
252
251
  <xs:element name="MONITORING_INTERVAL_DATASTORE" type="xs:integer" minOccurs="0" maxOccurs="1"/>
253
- <xs:element name="MONITORING_INTERVAL_DB_UPDATE" type="xs:integer" minOccurs="0" maxOccurs="1"/>
254
252
  <xs:element name="MONITORING_INTERVAL_HOST" type="xs:integer" minOccurs="0" maxOccurs="1"/>
255
253
  <xs:element name="MONITORING_INTERVAL_MARKET" type="xs:integer" minOccurs="0" maxOccurs="1"/>
256
254
  <xs:element name="MONITORING_INTERVAL_VM" type="xs:integer" minOccurs="0" maxOccurs="1"/>
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
3
- targetNamespace="http://opennebula.org/XMLSchema" xmlns="http://opennebula.org/XMLSchema">
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://opennebula.org/XMLSchema"
3
+ xmlns="http://opennebula.org/XMLSchema">
4
4
  <xs:element name="VM_POOL">
5
5
  <xs:complexType>
6
6
  <xs:sequence>
@@ -60,6 +60,28 @@
60
60
  <xs:element name="USER_TEMPLATE">
61
61
  <xs:complexType>
62
62
  <xs:sequence>
63
+ <xs:element name="LABELS" type="xs:string" minOccurs="0"/>
64
+ <xs:element name="ERROR" type="xs:string" minOccurs="0"/>
65
+ <xs:element name="SCHED_MESSAGE" type="xs:string" minOccurs="0"/>
66
+ <xs:element name="SCHED_RANK" type="xs:string" minOccurs="0"/>
67
+ <xs:element name="SCHED_DS_RANK" type="xs:string" minOccurs="0"/>
68
+ <xs:element name="SCHED_REQUIREMENTS" type="xs:string" minOccurs="0"/>
69
+ <xs:element name="SCHED_DS_REQUIREMENTS" type="xs:string" minOccurs="0"/>
70
+ <xs:element name="USER_PRIORITY" type="xs:string" minOccurs="0"/>
71
+ <xs:element name="PUBLIC_CLOUD" minOccurs="0" maxOccurs="unbounded">
72
+ <xs:complexType>
73
+ <xs:sequence>
74
+ <xs:any processContents="skip"/>
75
+ </xs:sequence>
76
+ </xs:complexType>
77
+ </xs:element>
78
+ <xs:element name="SCHED_ACTION" minOccurs="0" maxOccurs="unbounded">
79
+ <xs:complexType>
80
+ <xs:sequence>
81
+ <xs:any processContents="skip"/>
82
+ </xs:sequence>
83
+ </xs:complexType>
84
+ </xs:element>
63
85
  <xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
64
86
  </xs:sequence>
65
87
  </xs:complexType>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opennebula-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.8.2
4
+ version: 6.9.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: 2024-02-20 00:00:00.000000000 Z
11
+ date: 2024-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opennebula
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 6.8.2
19
+ version: 6.9.80.pre
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 6.8.2
26
+ version: 6.9.80.pre
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -41,33 +41,33 @@ dependencies:
41
41
  description: Commands used to talk to OpenNebula
42
42
  email: contact@opennebula.io
43
43
  executables:
44
- - onezone
45
- - onevcenter
46
- - oneimage
47
- - onevmgroup
48
- - onehost
44
+ - oneacct
45
+ - oneacl
46
+ - onebackupjob
47
+ - onecluster
48
+ - onedatastore
49
+ - oneflow
50
+ - oneflow-template
49
51
  - onegroup
50
52
  - onehook
51
- - onevdc
52
- - oneacl
53
+ - onehost
54
+ - oneimage
53
55
  - oneirb
54
- - oneflow-template
55
- - onevrouter
56
- - oneshowback
57
- - oneuser
58
- - oneacct
59
- - onesecgroup
60
- - onecluster
61
56
  - onelog
57
+ - onemarket
62
58
  - onemarketapp
59
+ - onesecgroup
60
+ - oneshowback
63
61
  - onetemplate
64
- - onemarket
65
- - onevntemplate
66
- - onevnet
67
- - oneflow
68
- - onedatastore
69
- - onebackupjob
62
+ - oneuser
63
+ - onevcenter
64
+ - onevdc
70
65
  - onevm
66
+ - onevmgroup
67
+ - onevnet
68
+ - onevntemplate
69
+ - onevrouter
70
+ - onezone
71
71
  extensions: []
72
72
  extra_rdoc_files: []
73
73
  files:
@@ -195,11 +195,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
195
195
  version: '0'
196
196
  required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  requirements:
198
- - - ">="
198
+ - - ">"
199
199
  - !ruby/object:Gem::Version
200
- version: '0'
200
+ version: 1.3.1
201
201
  requirements: []
202
- rubygems_version: 3.1.2
202
+ rubygems_version: 3.3.5
203
203
  signing_key:
204
204
  specification_version: 4
205
205
  summary: OpenNebula Command Line Interface