opennebula-cli 6.0.3 → 6.1.80.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d71d6197859d846259af7cb730330d8d29a03e89
4
- data.tar.gz: 515adb9afa80cf52f7ab93ac9a582af9bc38afc8
3
+ metadata.gz: 2306988d8afeaa179ef65f89fbb07a27746a370b
4
+ data.tar.gz: 443a4f8d1aa6fcbfb886c14c2fe3228e3d67bff8
5
5
  SHA512:
6
- metadata.gz: 02cfddcd26f6d496448f69653ad05f463eebf60cb5d40a956319faaed2f9b4829db13e75b9154168e3a0597a3cf2f20739229ce9758b2ce537f535c9f5a5e644
7
- data.tar.gz: 8409cabd907844035d833f9d37b37dc08c15bf0afd276a1772c303ffa6d1a6e004985f4eefa5d440590d93f5910f209fee68bef5238aa8e206c6f806d82865e4
6
+ metadata.gz: c1df610ba16fd464d6429e9ebf26fcecb1872319ff6795cca452917c6258df631b688f59fb8cd416143da7cf40e16c4bdbd73db052f4c2faa9b4da4b011fb920
7
+ data.tar.gz: 8bfc858b932ec71fdc86e6bef789957d55401190bc780f90c1630b6808651cbdd2a02dc970bf79f2bf17d406422268804ff1954be9ae46a0087bb88d28fc518d
data/bin/oneflow CHANGED
@@ -82,6 +82,8 @@ CommandParser::CmdParser.new(ARGV) do
82
82
  :description => 'Force flow necover delete'
83
83
  }
84
84
 
85
+ FORMAT = [OpenNebulaHelper::JSON, OpenNebulaHelper::YAML]
86
+
85
87
  # create helper object
86
88
  helper = OneFlowHelper.new
87
89
 
@@ -122,7 +124,7 @@ CommandParser::CmdParser.new(ARGV) do
122
124
  List the available services
123
125
  EOT
124
126
 
125
- command :list, list_desc, :options => OpenNebulaHelper::FORMAT do
127
+ command :list, list_desc, :options => FORMAT do
126
128
  helper.list_service_pool(helper.client(options), options)
127
129
  end
128
130
 
@@ -146,10 +148,7 @@ CommandParser::CmdParser.new(ARGV) do
146
148
  Show detailed information of a given service
147
149
  EOT
148
150
 
149
- command :show,
150
- show_desc,
151
- :service_id,
152
- :options => OpenNebulaHelper::FORMAT do
151
+ command :show, show_desc, :service_id, :options => FORMAT do
153
152
  helper.format_resource(helper.client(options), args[0], options)
154
153
  end
155
154
 
data/bin/oneflow-template CHANGED
@@ -104,6 +104,8 @@ CommandParser::CmdParser.new(ARGV) do
104
104
  'deleting service template'
105
105
  }
106
106
 
107
+ FORMAT = [OpenNebulaHelper::JSON, OpenNebulaHelper::YAML]
108
+
107
109
  usage '`oneflow-template` <command> [<args>] [<options>]'
108
110
  version OpenNebulaHelper::ONE_VERSION
109
111
 
@@ -141,7 +143,7 @@ CommandParser::CmdParser.new(ARGV) do
141
143
  List the available Service Templates
142
144
  EOT
143
145
 
144
- command :list, list_desc, :options => OpenNebulaHelper::FORMAT do
146
+ command :list, list_desc, :options => FORMAT do
145
147
  helper.list_service_template_pool(helper.client(options), options)
146
148
  end
147
149
 
@@ -169,10 +171,7 @@ CommandParser::CmdParser.new(ARGV) do
169
171
  Show detailed information of a given Service Template
170
172
  EOT
171
173
 
172
- command :show,
173
- show_desc,
174
- :templateid,
175
- :options => OpenNebulaHelper::FORMAT do
174
+ command :show, show_desc, :templateid, :options => FORMAT do
176
175
  helper.format_resource(helper.client(options), args[0], options)
177
176
  end
178
177
 
data/bin/oneimage CHANGED
@@ -160,8 +160,8 @@ CommandParser::CmdParser.new(ARGV) do
160
160
 
161
161
  oneimage create -d 1 --name ubuntu --path /tmp/ubuntu.qcow2 \\
162
162
  --prefix sd --type OS --driver qcow2 \\
163
- --description "A OS plain installation \\
164
- --persistent"
163
+ --description "A OS plain installation" \\
164
+ --persistent
165
165
 
166
166
  - a datablock image of 400MB:
167
167
 
data/bin/onevcenter CHANGED
@@ -165,7 +165,8 @@ CommandParser::CmdParser.new(ARGV) do
165
165
 
166
166
  command :list,
167
167
  list_desc,
168
- :options => [OBJECT, HOST, DATASTORE, VCENTER, USER, PASS] do
168
+ :options => [OBJECT, HOST, DATASTORE, VCENTER, USER, PASS,
169
+ CLIHelper::CSV_OPT] do
169
170
  begin
170
171
  args = helper.parse_opts(options)
171
172
  args[:filter] = true
@@ -178,7 +179,8 @@ CommandParser::CmdParser.new(ARGV) do
178
179
 
179
180
  helper.list_object(options, list)
180
181
  rescue StandardError => e
181
- puts e.message
182
+ STDERR.puts e.message
183
+ exit 1
182
184
  end
183
185
 
184
186
  exit 0
@@ -209,7 +211,8 @@ CommandParser::CmdParser.new(ARGV) do
209
211
 
210
212
  helper.list_object(options, list)
211
213
  rescue StandardError => e
212
- puts e.message
214
+ STDERR.puts e.message
215
+ exit 1
213
216
  end
214
217
 
215
218
  exit 0
@@ -256,7 +259,8 @@ CommandParser::CmdParser.new(ARGV) do
256
259
 
257
260
  importer.stdout
258
261
  rescue StandardError => e
259
- puts e.message
262
+ STDERR.puts e.message
263
+ exit 1
260
264
  end
261
265
 
262
266
  exit 0
@@ -283,7 +287,8 @@ CommandParser::CmdParser.new(ARGV) do
283
287
 
284
288
  importer.stdout
285
289
  rescue StandardError => e
286
- puts e.message
290
+ STDERR.puts e.message
291
+ exit 1
287
292
  end
288
293
 
289
294
  exit 0
@@ -305,7 +310,11 @@ CommandParser::CmdParser.new(ARGV) do
305
310
  :options => [VCENTER, USER, PASS, USE_DEFAULTS, PORT] do
306
311
  con_ops = helper.connection_options('Hosts', options)
307
312
 
308
- VCenterDriver::VcImporter.import_clusters(con_ops, options)
313
+ begin
314
+ VCenterDriver::VcImporter.import_clusters(con_ops, options)
315
+ rescue StandardError
316
+ exit 1
317
+ end
309
318
 
310
319
  exit 0
311
320
  end
data/bin/onevm CHANGED
@@ -1305,7 +1305,8 @@ CommandParser::CmdParser.new(ARGV) do
1305
1305
  CONTEXT (any value, **variable substitution will be made**)
1306
1306
  EOT
1307
1307
 
1308
- command :updateconf, updateconf_desc, :vmid, [:file, nil] do
1308
+ command :updateconf, updateconf_desc, :vmid, [:file, nil],
1309
+ :options => OpenNebulaHelper::APPEND do
1309
1310
  template = ''
1310
1311
 
1311
1312
  begin
@@ -1332,7 +1333,7 @@ CommandParser::CmdParser.new(ARGV) do
1332
1333
  template = OpenNebulaHelper.editor_input(template)
1333
1334
  end
1334
1335
 
1335
- vm.updateconf(template)
1336
+ vm.updateconf(template, options[:append])
1336
1337
  end
1337
1338
  end
1338
1339
 
@@ -1411,22 +1412,7 @@ CommandParser::CmdParser.new(ARGV) do
1411
1412
 
1412
1413
  command :'delete-chart', delete_chart_desc, :vmid, :sched_id do
1413
1414
  helper.perform_action(args[0], {}, 'Charter deleted') do |vm|
1414
- rc = vm.info
1415
-
1416
- if OpenNebula.is_error?(rc)
1417
- STDERR.puts "Error #{rc.message}"
1418
- exit(-1)
1419
- end
1420
-
1421
- xpath = "USER_TEMPLATE/SCHED_ACTION[ID=#{args[1]}]"
1422
-
1423
- unless vm.retrieve_elements(xpath)
1424
- STDERR.puts "Sched action #{args[1]} not found"
1425
- exit(-1)
1426
- end
1427
-
1428
- vm.delete_element(xpath)
1429
- rc = vm.update(vm.user_template_str)
1415
+ rc = vm.sched_action_delete(args[1])
1430
1416
 
1431
1417
  if OpenNebula.is_error?(rc)
1432
1418
  STDERR.puts "Error deleting: #{rc.message}"
@@ -1571,54 +1557,7 @@ CommandParser::CmdParser.new(ARGV) do
1571
1557
  :vmid,
1572
1558
  [:login, nil],
1573
1559
  :options => [NIC_ID, CMD, SSH_OPTS] do
1574
- helper.perform_action(args[0], options, 'SSH') do |vm|
1575
- rc = vm.info
1576
-
1577
- if OpenNebula.is_error?(rc)
1578
- STDERR.puts rc.message
1579
- exit(-1)
1580
- end
1581
-
1582
- # Get user to login
1583
- args[1].nil? ? login = 'root' : login = args[1]
1584
-
1585
- # Get CMD to run
1586
- options[:cmd].nil? ? cmd = '' : cmd = options[:cmd]
1587
-
1588
- # Get NIC to connect
1589
- if options[:nic_id]
1590
- nic = vm.retrieve_xmlelements(
1591
- "//TEMPLATE/NIC[NIC_ID=\"#{options[:nic_id]}\"]"
1592
- )[0]
1593
- else
1594
- nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[SSH="YES"]')[0]
1595
- end
1596
-
1597
- nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[1]')[0] if nic.nil?
1598
-
1599
- if nic.nil?
1600
- STDERR.puts 'No NIC found'
1601
- exit(-1)
1602
- end
1603
-
1604
- # If there is node port
1605
- if nic['EXTERNAL_PORT_RANGE']
1606
- ip = vm.to_hash['VM']['HISTORY_RECORDS']['HISTORY']
1607
- ip = [ip].flatten[-1]['HOSTNAME']
1608
- port = Integer(nic['EXTERNAL_PORT_RANGE'].split(':')[0]) + 21
1609
- else
1610
- ip = nic['IP']
1611
- port = 22
1612
- end
1613
-
1614
- options[:ssh_opts].nil? ? opts = '' : opts = options[:ssh_opts]
1615
-
1616
- system("ssh #{opts} #{login}@#{ip} -p #{port} #{cmd}")
1617
- end
1618
-
1619
- # rubocop:disable Style/SpecialGlobalVars
1620
- $?.exitstatus
1621
- # rubocop:enable Style/SpecialGlobalVars
1560
+ helper.ssh(args, options)
1622
1561
  end
1623
1562
 
1624
1563
  port_desc = <<-EOT.unindent
data/bin/onezone CHANGED
@@ -269,4 +269,24 @@ CommandParser::CmdParser.new(ARGV) do
269
269
 
270
270
  0
271
271
  end
272
+
273
+ enable_desc = <<-EOT.unindent
274
+ Enable zone
275
+ EOT
276
+
277
+ command :enable, enable_desc, [:range, :zoneid_list] do
278
+ helper.perform_actions(args[0], options, 'enable zone') do |o|
279
+ o.enable
280
+ end
281
+ end
282
+
283
+ disable_desc = <<-EOT.unindent
284
+ Disable zone, disabled zones can execute only readonly commands
285
+ EOT
286
+
287
+ command :disable, disable_desc, [:range, :zoneid_list] do
288
+ helper.perform_actions(args[0], options, 'disable zone') do |o|
289
+ o.disable
290
+ end
291
+ end
272
292
  end
@@ -188,14 +188,14 @@ class OneVcenterHelper < OpenNebulaHelper::OneHelper
188
188
 
189
189
  # This method will print a list for a vcenter_resource.
190
190
  #
191
- def list_object(_options, list)
191
+ def list_object(options, list)
192
192
  vcenter_host = list.keys[0]
193
193
  list = cli_format(list.values.first)
194
194
  table = format_list
195
195
 
196
196
  show_header(vcenter_host)
197
197
 
198
- table.show(list)
198
+ table.show(list, options)
199
199
  end
200
200
 
201
201
  # handles :cli section of TABLE
@@ -440,21 +440,6 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
440
440
  str_periodic << ', END_TYPE = 0'
441
441
  end
442
442
 
443
- rc = vm.info
444
-
445
- if OpenNebula.is_error?(rc)
446
- puts rc.message
447
- exit(-1)
448
- end
449
-
450
- ids = vm.retrieve_elements('USER_TEMPLATE/SCHED_ACTION/ID')
451
-
452
- id = 0
453
- if !ids.nil? && !ids.empty?
454
- ids.map! {|e| e.to_i }
455
- id = ids.max + 1
456
- end
457
-
458
443
  sched = options[:schedule]
459
444
 
460
445
  # If the action is set to be executed from VM start to an specific
@@ -464,16 +449,14 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
464
449
  sched = sched.to_i
465
450
  end
466
451
 
467
- tmp_str = vm.user_template_str
468
-
469
- tmp_str << "\nSCHED_ACTION = "
470
- tmp_str << "[ID = #{id}, ACTION = #{action}, "
452
+ tmp_str = "SCHED_ACTION = ["
453
+ tmp_str << "ACTION = #{action}, "
471
454
  tmp_str << "WARNING = #{warning}," if warning
472
455
  tmp_str << "ARGS = \"#{options[:args]}\"," if options[:args]
473
456
  tmp_str << "TIME = #{sched}"
474
457
  tmp_str << str_periodic << ']'
475
458
 
476
- vm.update(tmp_str)
459
+ vm.sched_action_add(tmp_str)
477
460
  end
478
461
  end
479
462
 
@@ -491,7 +474,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
491
474
  exit(-1)
492
475
  end
493
476
 
494
- xpath = "USER_TEMPLATE/SCHED_ACTION[ID=#{action_id}]"
477
+ xpath = "TEMPLATE/SCHED_ACTION[ID=#{action_id}]"
495
478
 
496
479
  unless vm.retrieve_elements(xpath)
497
480
  STDERR.puts "Sched action #{action_id} not found"
@@ -509,12 +492,11 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
509
492
  vm.delete_element(xpath)
510
493
 
511
494
  # Add the modified sched action
512
- tmp_str = vm.user_template_str
513
- tmp_str << "\nSCHED_ACTION = ["
495
+ tmp_str = "\nSCHED_ACTION = ["
514
496
  tmp_str << str.split("\n").join(',')
515
497
  tmp_str << ']'
516
498
 
517
- rc = vm.update(tmp_str)
499
+ rc = vm.sched_action_update(action_id, tmp_str)
518
500
 
519
501
  if OpenNebula.is_error?(rc)
520
502
  STDERR.puts "Error updating: #{rc.message}"
@@ -670,6 +652,78 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
670
652
  YAML.load_file(self.class.table_conf)[:charters]
671
653
  end
672
654
 
655
+ # SSH into a VM
656
+ #
657
+ # @param args [Array] CLI arguments
658
+ # @param options [Hash] CLI parameters
659
+ def ssh(args, options)
660
+ perform_action(args[0], options, 'SSH') do |vm|
661
+ rc = vm.info
662
+
663
+ if OpenNebula.is_error?(rc)
664
+ STDERR.puts rc.message
665
+ exit(-1)
666
+ end
667
+
668
+ if vm.lcm_state_str != 'RUNNING'
669
+ STDERR.puts 'VM is not RUNNING, cannot SSH to it'
670
+ exit(-1)
671
+ end
672
+
673
+ # Get user to login
674
+ username = vm.retrieve_xmlelements('//TEMPLATE/CONTEXT/USERNAME')[0]
675
+
676
+ if !username.nil?
677
+ login = username.text
678
+ elsif !args[1].nil?
679
+ login = args[1]
680
+ else
681
+ login = 'root'
682
+ end
683
+
684
+ # Get CMD to run
685
+ options[:cmd].nil? ? cmd = '' : cmd = options[:cmd]
686
+
687
+ # Get NIC to connect
688
+ if options[:nic_id]
689
+ nic = vm.retrieve_xmlelements(
690
+ "//TEMPLATE/NIC[NIC_ID=\"#{options[:nic_id]}\"]"
691
+ )[0]
692
+ else
693
+ nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[SSH="YES"]')[0]
694
+ end
695
+
696
+ nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[1]')[0] if nic.nil?
697
+
698
+ if nic.nil?
699
+ STDERR.puts 'No NIC found'
700
+ exit(-1)
701
+ end
702
+
703
+ # If there is node port
704
+ if nic['EXTERNAL_PORT_RANGE']
705
+ ip = vm.to_hash['VM']['HISTORY_RECORDS']['HISTORY']
706
+ ip = [ip].flatten[-1]['HOSTNAME']
707
+ port = Integer(nic['EXTERNAL_PORT_RANGE'].split(':')[0]) + 21
708
+ else
709
+ ip = nic['IP']
710
+ port = 22
711
+ end
712
+
713
+ options[:ssh_opts].nil? ? opts = '' : opts = options[:ssh_opts]
714
+
715
+ if opts.empty?
716
+ exec(*%W[ssh #{login}@#{ip} -p #{port} #{cmd}])
717
+ else
718
+ exec('ssh', *opts.split, *%W[#{login}@#{ip} -p #{port} #{cmd}])
719
+ end
720
+ end
721
+
722
+ # rubocop:disable Style/SpecialGlobalVars
723
+ $?.exitstatus
724
+ # rubocop:enable Style/SpecialGlobalVars
725
+ end
726
+
673
727
  private
674
728
 
675
729
  def factory(id = nil)
@@ -1228,7 +1282,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1228
1282
  format_history(vm)
1229
1283
  end
1230
1284
 
1231
- if vm.has_elements?('/VM/USER_TEMPLATE/SCHED_ACTION')
1285
+ if vm.has_elements?('/VM/TEMPLATE/SCHED_ACTION')
1232
1286
  puts
1233
1287
  CLIHelper.print_header(str_h1 % 'SCHEDULED ACTIONS', false)
1234
1288
 
@@ -1246,7 +1300,10 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1246
1300
  end
1247
1301
 
1248
1302
  column :SCHEDULED, '', :adjust => true do |d|
1249
- OpenNebulaHelper.time_to_str(d['TIME'], false) \
1303
+ t2 = d['TIME'].to_i
1304
+ t2 += vm['STIME'].to_i unless d['TIME'] =~ /^[0-9].*/
1305
+
1306
+ OpenNebulaHelper.time_to_str(t2, false) \
1250
1307
  unless d.nil?
1251
1308
  end
1252
1309
 
@@ -1297,7 +1354,10 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1297
1354
 
1298
1355
  column :CHARTER, '', :left, :adjust, :size => 15 do |d|
1299
1356
  t1 = Time.now
1300
- t2 = Time.at(vm['STIME'].to_i + d['TIME'].to_i)
1357
+ t2 = d['TIME'].to_i
1358
+ t2 += vm['STIME'].to_i unless d['TIME'] =~ /^[0-9].*/
1359
+
1360
+ t2 = Time.at(t2)
1301
1361
 
1302
1362
  days = ((t2 - t1) / (24 * 3600)).round(2)
1303
1363
  hours = ((t2 - t1) / 3600).round(2)
@@ -1305,7 +1365,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1305
1365
 
1306
1366
  if days > 1
1307
1367
  show = "In #{days} days"
1308
- elsif days < 1 && hours > 1
1368
+ elsif days <= 1 && hours > 1
1309
1369
  show = "In #{hours} hours"
1310
1370
  elsif minutes > 0
1311
1371
  show = "In #{minutes} minutes"
@@ -1313,18 +1373,19 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1313
1373
  show = 'Already done'
1314
1374
  end
1315
1375
 
1316
- if (t1 - vm['STIME'].to_i).to_i > d['WARNING'].to_i
1376
+ wrn = d['WARNING']
1377
+ if !wrn.nil? && (t1 - vm['STIME'].to_i).to_i > wrn.to_i
1317
1378
  "#{show} *"
1318
1379
  else
1319
1380
  show
1320
1381
  end
1321
1382
  end
1322
- end.show([vm_hash['VM']['USER_TEMPLATE']['SCHED_ACTION']].flatten,
1383
+ end.show([vm_hash['VM']['TEMPLATE']['SCHED_ACTION']].flatten,
1323
1384
  {})
1324
1385
  end
1325
1386
 
1326
1387
  if !options[:all]
1327
- vm.delete_element('/VM/USER_TEMPLATE/SCHED_ACTION')
1388
+ vm.delete_element('/VM/TEMPLATE/SCHED_ACTION')
1328
1389
  end
1329
1390
 
1330
1391
  if vm.has_elements?('/VM/USER_TEMPLATE')
@@ -499,6 +499,13 @@ class OneZoneHelper < OpenNebulaHelper::OneHelper
499
499
  "onezone.yaml"
500
500
  end
501
501
 
502
+ def self.state_to_str(id)
503
+ id = id.to_i
504
+ state_str = Zone::ZONE_STATES[id]
505
+
506
+ Zone::SHORT_ZONE_STATES[state_str]
507
+ end
508
+
502
509
  def format_pool(options)
503
510
  config_file = self.class.table_conf
504
511
 
@@ -524,7 +531,11 @@ class OneZoneHelper < OpenNebulaHelper::OneHelper
524
531
  helper.get_fed_index(d["TEMPLATE"]['ENDPOINT'])
525
532
  end
526
533
 
527
- default :CURRENT, :ID, :NAME, :ENDPOINT, :FED_INDEX
534
+ column :STAT, 'Zone status', :left, :size => 6 do |d|
535
+ OneZoneHelper.state_to_str(d['STATE'])
536
+ end
537
+
538
+ default :CURRENT, :ID, :NAME, :ENDPOINT, :FED_INDEX, :STAT
528
539
  end
529
540
 
530
541
  table
@@ -591,6 +602,7 @@ class OneZoneHelper < OpenNebulaHelper::OneHelper
591
602
  CLIHelper.print_header(str_h1 % "ZONE #{zone['ID']} INFORMATION")
592
603
  puts str % ["ID", zone.id.to_s]
593
604
  puts str % ["NAME", zone.name]
605
+ puts str % ["STATE",zone.state_str]
594
606
  puts
595
607
 
596
608
  zone_hash=zone.to_hash
data/lib/one_helper.rb CHANGED
@@ -576,6 +576,7 @@ EOT
576
576
  p_r, p_w = IO.pipe
577
577
 
578
578
  Signal.trap('PIPE', 'SIG_IGN')
579
+ Signal.trap('PIPE', 'EXIT')
579
580
 
580
581
  lpid = fork do
581
582
  $stdin.reopen(p_r)
@@ -899,6 +900,9 @@ EOT
899
900
 
900
901
 
901
902
  def list_pool(options, top=false, filter_flag=nil)
903
+ # Capture Broken pipe
904
+ Signal.trap('PIPE', 'EXIT')
905
+
902
906
  table = format_pool(options)
903
907
 
904
908
  if options[:describe]
@@ -920,15 +924,11 @@ EOT
920
924
  elsif options[:json]
921
925
  list_pool_format(pool, options, filter_flag) do |pool|
922
926
  hash = check_resource_xsd(pool, pname)
923
- hash[pname] = check_resource_xsd(hash[pname], ename)
924
-
925
927
  puts ::JSON.pretty_generate(hash)
926
928
  end
927
929
  elsif options[:yaml]
928
930
  list_pool_format(pool, options, filter_flag) do |pool|
929
931
  hash = check_resource_xsd(pool, pname)
930
- hash[pname] = check_resource_xsd(hash[pname], ename)
931
-
932
932
  puts hash.to_yaml(:indent => 4)
933
933
  end
934
934
  else
@@ -936,6 +936,9 @@ EOT
936
936
  end
937
937
 
938
938
  return 0
939
+ rescue SystemExit, Interrupt
940
+ # Rescue ctrl + c when paginated
941
+ 0
939
942
  end
940
943
 
941
944
  # Check if a resource defined by attributes is referenced in pool
@@ -1223,11 +1226,41 @@ EOT
1223
1226
 
1224
1227
  return hash unless xsd
1225
1228
 
1226
- hash[ename] = check_xsd(hash[ename], nil, ename, xsd)
1229
+ if xsd.keys.include?('complexType')
1230
+ xsd = xsd['complexType']['sequence']['element']
1231
+ else
1232
+ xsd = xsd['element']
1233
+ end
1234
+
1235
+ xsd = [ xsd ] unless xsd.is_a? Array
1236
+
1237
+ check_xsd(hash[ename], xsd)
1227
1238
 
1228
1239
  hash
1229
1240
  end
1230
1241
 
1242
+
1243
+ # Replaces refs in xsd definition
1244
+ # limited func: only traverse hashes (not arrays), but works well for pools
1245
+ #
1246
+ # @param h [Hash] XSD in hash format
1247
+ #
1248
+ # @return [Object] XSD but where ref were, there inner XSD is loaded
1249
+ def replace_refs(h)
1250
+ return h unless h.is_a? Hash
1251
+
1252
+ if h.keys.include? 'ref'
1253
+ ref_xsd = read_xsd(h['ref'])
1254
+ return ref_xsd unless ref_xsd.nil?
1255
+ return h
1256
+ else
1257
+ h.each do |k,v|
1258
+ h[k] = replace_refs(v)
1259
+ end
1260
+ end
1261
+ end
1262
+
1263
+
1231
1264
  # Read XSD file and parse to XML
1232
1265
  #
1233
1266
  # @param ename [String] Element name to read XSD
@@ -1250,141 +1283,95 @@ EOT
1250
1283
  end
1251
1284
 
1252
1285
  hash = Hash.from_xml(Nokogiri::XML(File.read(file)).to_s)
1286
+
1253
1287
  hash = hash['schema']['element']
1254
1288
 
1255
- if hash.keys.include?('complexType')
1256
- hash['complexType']['sequence']['element']
1257
- else
1258
- hash['element']
1259
- end
1289
+ hash = replace_refs(hash)
1290
+
1291
+ hash
1260
1292
  end
1261
1293
 
1262
- # Check values XSD
1294
+ # Decides if given xsd definiton should be array in xml
1295
+ # Must be hash and contain either 'maxOccurs' => unbounded'
1296
+ # or 'maxOccurs' => >1
1263
1297
  #
1264
- # @param hash [Object] Resource information in hash format
1265
- # @param elements [Array] Keys to check
1266
- # @param ename [String] Element name to take XSD
1267
- # @param xsd [Hash] XSD file content
1268
- # @param parents [Array] Parent keys of current hash
1269
- def check_xsd(hash, elements, ename, xsd, parents = [])
1270
- return unless hash
1271
-
1272
- if (hash.is_a? Hash) && !hash.empty?
1273
- hash.map do |ki, vi|
1274
- vi = [vi].flatten if is_array?(xsd, [ki])
1275
-
1276
- if (vi.is_a? Hash) && !vi.empty?
1277
- parents << ki
1278
-
1279
- vi.map do |kj, vj|
1280
- parents << kj
1281
-
1282
- path = (parents + [ki, kj]).uniq
1283
- vj = [vj].flatten if is_array?(xsd, path)
1284
-
1285
- hash[ki][kj] = check_xsd(vj,
1286
- [ki, kj],
1287
- ename,
1288
- xsd,
1289
- parents)
1290
- end
1291
-
1292
- parents.clear
1293
- elsif vi.is_a? Array
1294
- hash[ki] = check_xsd(vi, [ki], ename, xsd, parents)
1295
- else
1296
- hash[ki] = check_xsd(vi, [ki], ename, xsd, parents)
1297
- end
1298
- end
1299
-
1300
- hash
1301
- elsif hash.is_a? Array
1302
- ret = []
1303
-
1304
- hash.each do |v|
1305
- ret << check_xsd(v, elements, ename, xsd, parents)
1306
- end
1307
-
1308
- ret
1309
- else
1310
- check_type(hash) do
1311
- type = get_xsd_path(xsd, elements)
1312
- type['type'] unless type.nil?
1313
- end
1314
- end
1298
+ # @param e [Hash] XSD definition transfomred in hash
1299
+ #
1300
+ # @return [Boolean]
1301
+ #
1302
+ def is_array?(e)
1303
+ return false if e.nil?
1304
+ return false unless e.is_a? Hash
1305
+ e['maxOccurs'] == 'unbounded' || e['maxOccurs'].to_i > 1
1315
1306
  end
1316
1307
 
1317
- # Get xsd path value
1308
+ # Decides if given xsd definiton is complex type sequence
1309
+ # Must be hash and contain nested hash
1310
+ # ['complexType']['sequence']['element']
1318
1311
  #
1319
- # @param xsd [Hash] XSD information
1320
- # @param elements [Array] Path to get
1312
+ # @param [Hash] XSD definition transfomred in hash
1321
1313
  #
1322
- # @return [Hash] Path information
1323
- def get_xsd_path(xsd, elements)
1324
- return unless elements
1325
-
1326
- element = elements.shift
1327
-
1328
- # Return nil, because is an empty complexType
1329
- return unless element
1330
-
1331
- element = [xsd].flatten.find do |v|
1332
- v['name'] == element || v['ref'] == element
1333
- end
1334
-
1335
- # Return nil, because element was not find in XSD
1336
- return unless element
1337
-
1338
- if element.keys.include?('complexType') && !elements.empty?
1339
- if element['complexType']['all']
1340
- element = element['complexType']['all']['element']
1341
- else
1342
- element = element['complexType']['sequence']['element']
1343
- end
1344
-
1345
- get_xsd_path(element, elements)
1346
- else
1347
- element
1348
- end
1314
+ # @return [Boolean]
1315
+ #
1316
+ def xsd_complex_sequence?(x)
1317
+ x['complexType']['sequence']['element'] rescue return false
1318
+ true
1349
1319
  end
1350
1320
 
1351
- # CHeck if current element is an array
1321
+ # Decides if given xsd definiton is complex type all
1322
+ # Must be hash and contain nested hash
1323
+ # ['complexType']['all']['element']
1352
1324
  #
1353
- # @param xsd [Hash] XSD information
1354
- # @param elements [Array] Path to check
1325
+ # @param [Hash] XSD definition transfomred in hash
1355
1326
  #
1356
- # @return [Boolean] True if it's an array, false otherwise
1357
- def is_array?(xsd, elements)
1358
- max = get_xsd_path(xsd, elements)
1359
- max = max['maxOccurs'] if max
1360
-
1361
- max == 'unbounded' || max.to_i > 1
1327
+ # @return [Boolean]
1328
+ #
1329
+ def xsd_complex_all?(x)
1330
+ x['complexType']['all']['element'] rescue return false
1331
+ true
1362
1332
  end
1363
1333
 
1364
- # Check XSD type for especific value
1334
+ # Recursively traverse the OpenNebula resource (in Hash) and it's XSD
1335
+ # Where array is required in XSD, there encapsulate the entry into [ ]
1336
+ # Typically usefull for single disk, snapshots etc.
1365
1337
  #
1366
- # @param value [Object] Value to check
1338
+ # @param hash [Hash] Resource information in hash format
1339
+ # @param xsd [Hash] XSD of the resource, transformed into hash
1367
1340
  #
1368
- # @return [Object] nil if the type is not correct, value otherwise
1369
- def check_type(value)
1370
- type = yield if block_given?
1341
+ def check_xsd(hash, xsd)
1342
+ return unless hash or hash.empty?
1371
1343
 
1372
- # If there is no type, return current value
1373
- return value unless type
1344
+ hash.each do |k, v|
1374
1345
 
1375
- types = %w[string decimal integer boolean date time]
1376
- type = type.split(':')[1]
1346
+ # find the elem definition in xsd array
1347
+ xsd_elem = xsd.select { |e| e['name'] == k }.first unless xsd.nil?
1377
1348
 
1378
- if types.include?(type)
1379
- # If the current type is different, return string
1380
- # because this value doesn't respect the type
1381
- if (value.is_a? Hash) || (value.is_a? Array)
1382
- ''
1383
- else
1384
- value
1349
+ if xsd_complex_sequence?(xsd_elem) || xsd_complex_all?(xsd_elem)
1350
+
1351
+ # go deeper in xsd, xsd is ehter complex sequence or all
1352
+ begin
1353
+ inner_xsd = xsd_elem['complexType']['sequence']['element']
1354
+ rescue
1355
+ inner_xsd = xsd_elem['complexType']['all']['element']
1356
+ end
1357
+
1358
+ # recursively traverse resource - hash
1359
+ if v.is_a? Hash
1360
+ hash[k] = check_xsd(v, inner_xsd)
1361
+
1362
+ # recursively traverse resource - array
1363
+ elsif v.is_a? Array
1364
+ hash[k] = []
1365
+ v.each do |e|
1366
+ hash[k] << check_xsd(e, inner_xsd)
1367
+ end
1368
+ end
1369
+ end
1370
+
1371
+ # if XSD requires array, do so in resource if missing
1372
+ if is_array?(xsd_elem) && (! v.is_a? Array)
1373
+ hash[k] = [ v ]
1385
1374
  end
1386
- else
1387
- value
1388
1375
  end
1389
1376
  end
1390
1377
  end
@@ -53,7 +53,27 @@
53
53
  <xs:element name="PCI_DEVICES">
54
54
  <xs:complexType>
55
55
  <xs:sequence>
56
- <xs:element name="PCI" type="xs:anyType" minOccurs="0" maxOccurs="unbounded"/>
56
+ <xs:element name="PCI" minOccurs="0" maxOccurs="unbounded">
57
+ <xs:complexType>
58
+ <xs:sequence>
59
+ <xs:element name="ADDRESS" type="xs:string"/>
60
+ <xs:element name="BUS" type="xs:string"/>
61
+ <xs:element name="CLASS" type="xs:string"/>
62
+ <xs:element name="CLASS_NAME" type="xs:string"/>
63
+ <xs:element name="DEVICE" type="xs:string"/>
64
+ <xs:element name="DEVICE_NAME" type="xs:string"/>
65
+ <xs:element name="DOMAIN" type="xs:string"/>
66
+ <xs:element name="FUNCTION" type="xs:string"/>
67
+ <xs:element name="NUMA_NODE" type="xs:string"/>
68
+ <xs:element name="SHORT_ADDRESS" type="xs:string"/>
69
+ <xs:element name="SLOT" type="xs:string"/>
70
+ <xs:element name="TYPE" type="xs:string"/>
71
+ <xs:element name="VENDOR" type="xs:string"/>
72
+ <xs:element name="VENDOR_NAME" type="xs:string"/>
73
+ <xs:element name="VMID" type="xs:integer"/>
74
+ </xs:sequence>
75
+ </xs:complexType>
76
+ </xs:element>
57
77
  </xs:sequence>
58
78
  </xs:complexType>
59
79
  </xs:element>
@@ -6,17 +6,37 @@
6
6
  <xs:sequence>
7
7
  <xs:element name="MONITORING" minOccurs="0" maxOccurs="unbounded">
8
8
  <xs:complexType>
9
- <xs:all>
9
+ <xs:sequence>
10
+ <!-- Percentage of 1 CPU consumed (two fully consumed cpu is 2.0) -->
10
11
  <xs:element name="CPU" type="xs:decimal" minOccurs="0" maxOccurs="1"/>
12
+ <!-- Amount of bytes read from disk-->
11
13
  <xs:element name="DISKRDBYTES" type="xs:integer" minOccurs="0" maxOccurs="1"/>
14
+ <!-- Number of IO read operations -->
12
15
  <xs:element name="DISKRDIOPS" type="xs:integer" minOccurs="0" maxOccurs="1"/>
16
+ <!-- Amount of bytes written to disk -->
13
17
  <xs:element name="DISKWRBYTES" type="xs:integer" minOccurs="0" maxOccurs="1"/>
18
+ <!-- Number of IO write operations -->
14
19
  <xs:element name="DISKWRIOPS" type="xs:integer" minOccurs="0" maxOccurs="1"/>
20
+ <!-- Disk size details -->
21
+ <xs:element name="DISK_SIZE" minOccurs="0" maxOccurs="unbounded">
22
+ <xs:complexType>
23
+ <xs:sequence>
24
+ <xs:element name="ID" type="xs:integer"/>
25
+ <xs:element name="SIZE" type="xs:integer"/>
26
+ </xs:sequence>
27
+ </xs:complexType>
28
+ </xs:element>
29
+ <!-- ID of the VM -->
15
30
  <xs:element name="ID" type="xs:integer" minOccurs="0" maxOccurs="1"/>
31
+ <!-- Consumption in kilobytes -->
16
32
  <xs:element name="MEMORY" type="xs:integer" minOccurs="0" maxOccurs="1"/>
17
- <xs:element name="NETTX" type="xs:integer" minOccurs="0" maxOccurs="1"/>
33
+ <!-- Received bytes from the network -->
18
34
  <xs:element name="NETRX" type="xs:integer" minOccurs="0" maxOccurs="1"/>
35
+ <!-- Sent bytes to the network -->
36
+ <xs:element name="NETTX" type="xs:integer" minOccurs="0" maxOccurs="1"/>
37
+ <!-- Exact time when monitoring info were retieved -->
19
38
  <xs:element name="TIMESTAMP" type="xs:integer" minOccurs="0" maxOccurs="1"/>
39
+ <!-- vCetner information -->
20
40
  <xs:element name="VCENTER_ESX_HOST" type="xs:string" minOccurs="0" maxOccurs="1"/>
21
41
  <xs:element name="VCENTER_GUEST_STATE" type="xs:string" minOccurs="0" maxOccurs="1"/>
22
42
  <xs:element name="VCENTER_RP_NAME" type="xs:string" minOccurs="0" maxOccurs="1"/>
@@ -24,15 +44,7 @@
24
44
  <xs:element name="VCENTER_VMWARETOOLS_VERSION" type="xs:string" minOccurs="0" maxOccurs="1"/>
25
45
  <xs:element name="VCENTER_VMWARETOOLS_VERSION_STATUS" type="xs:string" minOccurs="0" maxOccurs="1"/>
26
46
  <xs:element name="VCENTER_VM_NAME" type="xs:string" minOccurs="0" maxOccurs="1"/>
27
- <xs:element name="DISK_SIZE" minOccurs="0" maxOccurs="unbounded">
28
- <xs:complexType>
29
- <xs:sequence>
30
- <xs:element name="ID" type="xs:integer"/>
31
- <xs:element name="SIZE" type="xs:integer"/>
32
- </xs:sequence>
33
- </xs:complexType>
34
- </xs:element>
35
- </xs:all>
47
+ </xs:sequence>
36
48
  </xs:complexType>
37
49
  </xs:element>
38
50
  </xs:sequence>
@@ -50,7 +50,7 @@
50
50
  </xs:element>
51
51
  <xs:element name="MONITORING">
52
52
  <xs:complexType>
53
- <xs:all>
53
+ <xs:sequence>
54
54
  <!-- Percentage of 1 CPU consumed (two fully consumed cpu is 2.0) -->
55
55
  <xs:element name="CPU" type="xs:decimal" minOccurs="0" maxOccurs="1"/>
56
56
  <!-- Amount of bytes read from disk-->
@@ -61,14 +61,23 @@
61
61
  <xs:element name="DISKWRBYTES" type="xs:integer" minOccurs="0" maxOccurs="1"/>
62
62
  <!-- Number of IO write operations -->
63
63
  <xs:element name="DISKWRIOPS" type="xs:integer" minOccurs="0" maxOccurs="1"/>
64
+ <!-- Disk size details -->
65
+ <xs:element name="DISK_SIZE" minOccurs="0" maxOccurs="unbounded">
66
+ <xs:complexType>
67
+ <xs:sequence>
68
+ <xs:element name="ID" type="xs:integer"/>
69
+ <xs:element name="SIZE" type="xs:integer"/>
70
+ </xs:sequence>
71
+ </xs:complexType>
72
+ </xs:element>
64
73
  <!-- ID of the VM -->
65
74
  <xs:element name="ID" type="xs:integer" minOccurs="0" maxOccurs="1"/>
66
75
  <!-- Consumption in kilobytes -->
67
76
  <xs:element name="MEMORY" type="xs:integer" minOccurs="0" maxOccurs="1"/>
68
- <!-- Sent bytes to the network -->
69
- <xs:element name="NETTX" type="xs:integer" minOccurs="0" maxOccurs="1"/>
70
77
  <!-- Received bytes from the network -->
71
78
  <xs:element name="NETRX" type="xs:integer" minOccurs="0" maxOccurs="1"/>
79
+ <!-- Sent bytes to the network -->
80
+ <xs:element name="NETTX" type="xs:integer" minOccurs="0" maxOccurs="1"/>
72
81
  <!-- Exact time when monitoring info were retieved -->
73
82
  <xs:element name="TIMESTAMP" type="xs:integer" minOccurs="0" maxOccurs="1"/>
74
83
  <!-- vCetner information -->
@@ -79,13 +88,19 @@
79
88
  <xs:element name="VCENTER_VMWARETOOLS_VERSION" type="xs:string" minOccurs="0" maxOccurs="1"/>
80
89
  <xs:element name="VCENTER_VMWARETOOLS_VERSION_STATUS" type="xs:string" minOccurs="0" maxOccurs="1"/>
81
90
  <xs:element name="VCENTER_VM_NAME" type="xs:string" minOccurs="0" maxOccurs="1"/>
82
- </xs:all>
91
+ </xs:sequence>
83
92
  </xs:complexType>
84
93
  </xs:element>
85
94
  <xs:element name="TEMPLATE">
86
95
  <xs:complexType>
87
96
  <xs:sequence>
88
- <xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
97
+ <xs:element name="AUTOMATIC_DS_REQUIREMENTS" type="xs:string" minOccurs="0" maxOccurs="1"/>
98
+ <xs:element name="AUTOMATIC_NIC_REQUIREMENTS" type="xs:string" minOccurs="0" maxOccurs="1"/>
99
+ <xs:element name="AUTOMATIC_REQUIREMENTS" type="xs:string" minOccurs="0" maxOccurs="1"/>
100
+ <xs:element name="CLONING_TEMPLATE_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
101
+ <xs:element name="CONTEXT" minOccurs="0" maxOccurs="1"/>
102
+ <xs:element name="CPU" type="xs:string" minOccurs="0" maxOccurs="1"/>
103
+ <xs:element name="CPU_COST" type="xs:string" minOccurs="0" maxOccurs="1"/>
89
104
  <xs:element name="DISK" minOccurs="0" maxOccurs="unbounded">
90
105
  <xs:complexType>
91
106
  <xs:sequence>
@@ -96,12 +111,20 @@
96
111
  </xs:sequence>
97
112
  </xs:complexType>
98
113
  </xs:element>
99
- <xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
114
+ <xs:element name="DISK_COST" type="xs:string" minOccurs="0" maxOccurs="1"/>
115
+ <xs:element name="EMULATOR" type="xs:string" minOccurs="0" maxOccurs="1"/>
116
+ <xs:element name="FEATURES" minOccurs="0" maxOccurs="1"/>
117
+ <xs:element name="HYPERV_OPTIONS" minOccurs="0" maxOccurs="1"/>
118
+ <xs:element name="GRAPHICS" minOccurs="0" maxOccurs="1"/>
119
+ <xs:element name="IMPORTED" type="xs:string" minOccurs="0" maxOccurs="1"/>
120
+ <xs:element name="INPUT" minOccurs="0" maxOccurs="1"/>
121
+ <xs:element name="MEMORY" type="xs:string" minOccurs="0" maxOccurs="1"/>
122
+ <xs:element name="MEMORY_COST" type="xs:string" minOccurs="0" maxOccurs="1"/>
123
+ <xs:element name="MEMORY_MAX" type="xs:string" minOccurs="0" maxOccurs="1"/>
124
+ <xs:element name="MEMORY_SLOTS" type="xs:string" minOccurs="0" maxOccurs="1"/>
100
125
  <xs:element name="NIC" minOccurs="0" maxOccurs="unbounded">
101
126
  <xs:complexType>
102
127
  <xs:sequence>
103
- <xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
104
- <xs:element name="BRIDGE_TYPE" type="xs:string"/>
105
128
  <xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
106
129
  <xs:element name="VCENTER_INSTANCE_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
107
130
  <xs:element name="VCENTER_NET_REF" type="xs:string" minOccurs="0" maxOccurs="1"/>
@@ -109,7 +132,6 @@
109
132
  </xs:sequence>
110
133
  </xs:complexType>
111
134
  </xs:element>
112
- <xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
113
135
  <xs:element name="NIC_ALIAS" minOccurs="0" maxOccurs="unbounded">
114
136
  <xs:complexType>
115
137
  <xs:sequence>
@@ -124,7 +146,39 @@
124
146
  </xs:sequence>
125
147
  </xs:complexType>
126
148
  </xs:element>
127
- <xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
149
+ <xs:element name="NIC_DEFAULT" minOccurs="0" maxOccurs="1"/>
150
+ <xs:element name="NUMA_NODE" minOccurs="0" maxOccurs="1"/>
151
+ <xs:element name="OS" minOccurs="0" maxOccurs="1"/>
152
+ <xs:element name="PCI" minOccurs="0" maxOccurs="1"/>
153
+ <xs:element name="RAW" minOccurs="0" maxOccurs="1"/>
154
+ <xs:element name="SCHED_ACTION" minOccurs="0" maxOccurs="unbounded">
155
+ <xs:complexType>
156
+ <xs:sequence>
157
+ <xs:element name="ACTION" type="xs:string"/>
158
+ <xs:element name="ARGS" type="xs:string" minOccurs="0" maxOccurs="1"/>
159
+ <xs:element name="DAYS" type="xs:string" minOccurs="0" maxOccurs="1"/>
160
+ <xs:element name="END_TYPE" type="xs:string" minOccurs="0" maxOccurs="1"/>
161
+ <xs:element name="END_VALUE" type="xs:string" minOccurs="0" maxOccurs="1"/>
162
+ <xs:element name="ID" type="xs:string"/>
163
+ <xs:element name="REPEAT" type="xs:string" minOccurs="0" maxOccurs="1"/>
164
+ <xs:element name="TIME" type="xs:string"/>
165
+ <xs:element name="WARNING" type="xs:string"/>
166
+ </xs:sequence>
167
+ </xs:complexType>
168
+ </xs:element>
169
+ <xs:element name="SECURITY_GROUP_RULE" minOccurs="0" maxOccurs="unbounded"/>
170
+ <xs:element name="SPICE_OPTIONS" minOccurs="0" maxOccurs="1"/>
171
+ <xs:element name="SUBMIT_ON_HOLD" type="xs:string" minOccurs="0" maxOccurs="1"/>
172
+ <xs:element name="TEMPLATE_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
173
+ <xs:element name="TM_MAD_SYSTEM" type="xs:string"/>
174
+ <xs:element name="TOPOLOGY" minOccurs="0" maxOccurs="1"/>
175
+ <xs:element name="VCPU" type="xs:string" minOccurs="0" maxOccurs="1"/>
176
+ <xs:element name="VCPU_MAX" type="xs:string" minOccurs="0" maxOccurs="1"/>
177
+ <xs:element name="VMGROUP" minOccurs="0" maxOccurs="unbounded"/>
178
+ <xs:element name="VMID" type="xs:string"/>
179
+ <xs:element name="VROUTER_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
180
+ <xs:element name="VROUTER_KEEPALIVED_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
181
+ <xs:element name="VROUTER_KEEPALIVED_PASSWORD" type="xs:string" minOccurs="0" maxOccurs="1"/>
128
182
  </xs:sequence>
129
183
  </xs:complexType>
130
184
  </xs:element>
@@ -23,7 +23,8 @@
23
23
  <xs:element name="TEMPLATE">
24
24
  <xs:complexType>
25
25
  <xs:sequence>
26
- <xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
26
+ <xs:element name="CPU" type="xs:string" minOccurs="0" maxOccurs="1"/>
27
+ <xs:element name="MEMORY" type="xs:string" minOccurs="0" maxOccurs="1"/>
27
28
  <xs:element name="DISK" minOccurs="0" maxOccurs="unbounded">
28
29
  <xs:complexType>
29
30
  <xs:sequence>
@@ -34,7 +35,6 @@
34
35
  </xs:sequence>
35
36
  </xs:complexType>
36
37
  </xs:element>
37
- <xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
38
38
  <xs:element name="NIC" minOccurs="0" maxOccurs="unbounded">
39
39
  <xs:complexType>
40
40
  <xs:sequence>
@@ -45,7 +45,7 @@
45
45
  </xs:sequence>
46
46
  </xs:complexType>
47
47
  </xs:element>
48
- <xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
48
+ <xs:element name="GRAPHICS" minOccurs="0" maxOccurs="1"/>
49
49
  </xs:sequence>
50
50
  </xs:complexType>
51
51
  </xs:element>
@@ -82,29 +82,6 @@
82
82
  </xs:sequence>
83
83
  </xs:complexType>
84
84
  </xs:element>
85
- <xs:element name="SNAPSHOTS" minOccurs="0" maxOccurs="unbounded">
86
- <xs:complexType>
87
- <xs:sequence>
88
- <xs:element name="ALLOW_ORPHANS" type="xs:string"/>
89
- <xs:element name="CURRENT_BASE" type="xs:integer"/>
90
- <xs:element name="DISK_ID" type="xs:integer"/>
91
- <xs:element name="NEXT_SNAPSHOT" type="xs:integer"/>
92
- <xs:element name="SNAPSHOT" minOccurs="0" maxOccurs="unbounded">
93
- <xs:complexType>
94
- <xs:sequence>
95
- <xs:element name="ACTIVE" type="xs:string" minOccurs="0" maxOccurs="1"/>
96
- <xs:element name="CHILDREN" type="xs:string" minOccurs="0" maxOccurs="1"/>
97
- <xs:element name="DATE" type="xs:integer"/>
98
- <xs:element name="ID" type="xs:integer"/>
99
- <xs:element name="NAME" type="xs:string" minOccurs="0" maxOccurs="1"/>
100
- <xs:element name="PARENT" type="xs:integer"/>
101
- <xs:element name="SIZE" type="xs:integer"/>
102
- </xs:sequence>
103
- </xs:complexType>
104
- </xs:element>
105
- </xs:sequence>
106
- </xs:complexType>
107
- </xs:element>
108
85
  </xs:sequence>
109
86
  </xs:complexType>
110
87
  </xs:element>
@@ -63,11 +63,14 @@
63
63
  <xs:complexType>
64
64
  <xs:sequence>
65
65
  <xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
66
- <xs:element name="CONTEXT_FORCE_IPV4" type="xs:string" minOccurs="0" maxOccurs="1"/>
67
66
  <xs:element name="DNS" type="xs:string" minOccurs="0" maxOccurs="1"/>
68
67
  <xs:element name="GATEWAY" type="xs:string" minOccurs="0" maxOccurs="1"/>
69
68
  <xs:element name="GATEWAY6" type="xs:string" minOccurs="0" maxOccurs="1"/>
70
69
  <xs:element name="GUEST_MTU" type="xs:int" minOccurs="0" maxOccurs="1"/>
70
+ <xs:element name="IP6_METHOD" type="xs:string" minOccurs="0" maxOccurs="1"/>
71
+ <xs:element name="IP6_METRIC" type="xs:string" minOccurs="0" maxOccurs="1"/>
72
+ <xs:element name="METHOD" type="xs:string" minOccurs="0" maxOccurs="1"/>
73
+ <xs:element name="METRIC" type="xs:string" minOccurs="0" maxOccurs="1"/>
71
74
  <xs:element name="NETWORK_ADDRESS" type="xs:string" minOccurs="0" maxOccurs="1"/>
72
75
  <xs:element name="NETWORK_MASK" type="xs:string" minOccurs="0" maxOccurs="1"/>
73
76
  <xs:element name="SEARCH_DOMAIN" type="xs:string" minOccurs="0" maxOccurs="1"/>
@@ -6,6 +6,7 @@
6
6
  <xs:sequence>
7
7
  <xs:element name="ID" type="xs:integer"/>
8
8
  <xs:element name="NAME" type="xs:string"/>
9
+ <xs:element name="STATE" type="xs:integer"/>
9
10
  <xs:element name="TEMPLATE">
10
11
  <xs:complexType>
11
12
  <xs:sequence>
@@ -7,6 +7,7 @@
7
7
  <xs:sequence>
8
8
  <xs:element name="ID" type="xs:integer"/>
9
9
  <xs:element name="NAME" type="xs:string"/>
10
+ <xs:element name="STATE" type="xs:integer"/>
10
11
  <xs:element name="TEMPLATE">
11
12
  <xs:complexType>
12
13
  <xs:sequence>
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.0.3
4
+ version: 6.1.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: 2021-07-19 00:00:00.000000000 Z
11
+ date: 2021-10-05 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.0.3
19
+ version: 6.1.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.0.3
26
+ version: 6.1.80.pre
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -59,11 +59,11 @@ executables:
59
59
  - oneuser
60
60
  - onevcenter
61
61
  - onevdc
62
+ - onevm
62
63
  - onevmgroup
63
64
  - onevnet
64
65
  - onevntemplate
65
66
  - onevrouter
66
- - onevm
67
67
  - onezone
68
68
  extensions: []
69
69
  extra_rdoc_files: []
@@ -93,6 +93,7 @@ files:
93
93
  - share/schemas/xsd/marketplace_pool.xsd
94
94
  - share/schemas/xsd/marketplaceapp.xsd
95
95
  - share/schemas/xsd/marketplaceapp_pool.xsd
96
+ - share/schemas/xsd/monitoring_data.xsd
96
97
  - share/schemas/xsd/opennebula_configuration.xsd
97
98
  - share/schemas/xsd/raftstatus.xsd
98
99
  - share/schemas/xsd/security_group.xsd
@@ -102,8 +103,10 @@ files:
102
103
  - share/schemas/xsd/user_pool.xsd
103
104
  - share/schemas/xsd/vdc.xsd
104
105
  - share/schemas/xsd/vdc_pool.xsd
106
+ - share/schemas/xsd/vm.xsd
105
107
  - share/schemas/xsd/vm_group.xsd
106
108
  - share/schemas/xsd/vm_group_pool.xsd
109
+ - share/schemas/xsd/vm_pool.xsd
107
110
  - share/schemas/xsd/vmtemplate.xsd
108
111
  - share/schemas/xsd/vmtemplate_pool.xsd
109
112
  - share/schemas/xsd/vnet.xsd
@@ -112,9 +115,6 @@ files:
112
115
  - share/schemas/xsd/vntemplate_pool.xsd
113
116
  - share/schemas/xsd/vrouter.xsd
114
117
  - share/schemas/xsd/vrouter_pool.xsd
115
- - share/schemas/xsd/monitoring_data.xsd
116
- - share/schemas/xsd/vm.xsd
117
- - share/schemas/xsd/vm_pool.xsd
118
118
  - share/schemas/xsd/zone.xsd
119
119
  - share/schemas/xsd/zone_pool.xsd
120
120
  - bin/oneacct
@@ -135,11 +135,11 @@ files:
135
135
  - bin/oneuser
136
136
  - bin/onevcenter
137
137
  - bin/onevdc
138
+ - bin/onevm
138
139
  - bin/onevmgroup
139
140
  - bin/onevnet
140
141
  - bin/onevntemplate
141
142
  - bin/onevrouter
142
- - bin/onevm
143
143
  - bin/onezone
144
144
  - lib/cli_helper.rb
145
145
  - lib/command_parser.rb
@@ -162,11 +162,11 @@ files:
162
162
  - lib/one_helper/oneuser_helper.rb
163
163
  - lib/one_helper/onevcenter_helper.rb
164
164
  - lib/one_helper/onevdc_helper.rb
165
+ - lib/one_helper/onevm_helper.rb
165
166
  - lib/one_helper/onevmgroup_helper.rb
166
167
  - lib/one_helper/onevnet_helper.rb
167
168
  - lib/one_helper/onevntemplate_helper.rb
168
169
  - lib/one_helper/onevrouter_helper.rb
169
- - lib/one_helper/onevm_helper.rb
170
170
  - lib/one_helper/onezone_helper.rb
171
171
  - NOTICE
172
172
  - LICENSE
@@ -185,9 +185,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
185
  version: '0'
186
186
  required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  requirements:
188
- - - '>='
188
+ - - '>'
189
189
  - !ruby/object:Gem::Version
190
- version: '0'
190
+ version: 1.3.1
191
191
  requirements: []
192
192
  rubyforge_project:
193
193
  rubygems_version: 2.0.14.1