opennebula-cli 7.1.80.pre → 7.2.1
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 +4 -4
- data/bin/oneacct +1 -1
- data/bin/oneacl +1 -1
- data/bin/onebackupjob +1 -1
- data/bin/onecluster +1 -1
- data/bin/onedatastore +1 -1
- data/bin/oneflow +1 -1
- data/bin/oneflow-template +1 -1
- data/bin/oneform +1 -1
- data/bin/onegroup +1 -1
- data/bin/onehook +1 -1
- data/bin/onehost +1 -1
- data/bin/oneimage +1 -1
- data/bin/oneirb +1 -1
- data/bin/onelog +1 -1
- data/bin/onemarket +1 -1
- data/bin/onemarketapp +1 -1
- data/bin/onesecgroup +1 -1
- data/bin/oneshowback +1 -1
- data/bin/onetemplate +1 -1
- data/bin/oneuser +1 -1
- data/bin/onevdc +1 -1
- data/bin/onevm +2 -2
- data/bin/onevmgroup +1 -1
- data/bin/onevnet +1 -1
- data/bin/onevntemplate +1 -1
- data/bin/onevrouter +1 -1
- data/bin/onezone +1 -1
- data/lib/cli_helper.rb +1 -1
- data/lib/command_parser.rb +135 -126
- data/lib/load_opennebula_paths.rb +5 -0
- data/lib/ods_helper.rb +541 -0
- data/lib/one_helper/oneacct_helper.rb +117 -109
- data/lib/one_helper/oneacl_helper.rb +1 -1
- data/lib/one_helper/onebackupjob_helper.rb +1 -1
- data/lib/one_helper/onecluster_helper.rb +1 -1
- data/lib/one_helper/onedatastore_helper.rb +87 -80
- data/lib/one_helper/oneflow_helper.rb +1 -1
- data/lib/one_helper/oneflowtemplate_helper.rb +1 -1
- data/lib/one_helper/oneform_helper.rb +1 -1
- data/lib/one_helper/onegroup_helper.rb +1 -1
- data/lib/one_helper/onehook_helper.rb +1 -1
- data/lib/one_helper/onehost_helper.rb +1 -1
- data/lib/one_helper/oneimage_helper.rb +1 -1
- data/lib/one_helper/onemarket_helper.rb +59 -58
- data/lib/one_helper/onemarketapp_helper.rb +1 -1
- data/lib/one_helper/onequota_helper.rb +240 -190
- data/lib/one_helper/onesecgroup_helper.rb +87 -85
- data/lib/one_helper/onetemplate_helper.rb +64 -64
- data/lib/one_helper/oneuser_helper.rb +2 -2
- data/lib/one_helper/onevdc_helper.rb +45 -45
- data/lib/one_helper/onevm_helper.rb +6 -8
- data/lib/one_helper/onevmgroup_helper.rb +65 -63
- data/lib/one_helper/onevnet_helper.rb +1 -1
- data/lib/one_helper/onevntemplate_helper.rb +43 -40
- data/lib/one_helper/onevrouter_helper.rb +86 -87
- data/lib/one_helper/onezone_helper.rb +98 -101
- data/lib/one_helper.rb +90 -71
- data/share/schemas/xsd/acct.xsd +3 -104
- data/share/schemas/xsd/cluster.xsd +4 -21
- data/share/schemas/xsd/datastore.xsd +4 -29
- data/share/schemas/xsd/document.xsd +3 -25
- data/share/schemas/xsd/group.xsd +2 -14
- data/share/schemas/xsd/group_pool.xsd +2 -14
- data/share/schemas/xsd/hook.xsd +2 -0
- data/share/schemas/xsd/host.xsd +5 -7
- data/share/schemas/xsd/image.xsd +2 -25
- data/share/schemas/xsd/marketplace.xsd +3 -22
- data/share/schemas/xsd/marketplaceapp.xsd +3 -25
- data/share/schemas/xsd/opennebula_configuration.xsd +3 -2
- data/share/schemas/xsd/requirements.xsd +3 -21
- data/share/schemas/xsd/security_group.xsd +6 -43
- data/share/schemas/xsd/shared.xsd +3 -3
- data/share/schemas/xsd/vdc.xsd +2 -7
- data/share/schemas/xsd/vm_group.xsd +3 -25
- data/share/schemas/xsd/vm_pool.xsd +2 -0
- data/share/schemas/xsd/vmtemplate.xsd +3 -25
- data/share/schemas/xsd/vnet.xsd +9 -67
- data/share/schemas/xsd/vnet_pool.xsd +8 -57
- data/share/schemas/xsd/vntemplate.xsd +3 -25
- data/share/schemas/xsd/vrouter.xsd +4 -32
- metadata +8 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2026, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -28,7 +28,7 @@ class Replicator
|
|
|
28
28
|
|
|
29
29
|
SSH_OPTIONS = '-o stricthostkeychecking=no -o passwordauthentication=no'
|
|
30
30
|
ONE_AUTH = '/var/lib/one/.one/one_auth'
|
|
31
|
-
FED_ATTRS =
|
|
31
|
+
FED_ATTRS = ['MODE', 'ZONE_ID', 'SERVER_ID', 'MASTER_ONED']
|
|
32
32
|
|
|
33
33
|
FILES = [
|
|
34
34
|
{ :name => 'monitord.conf',
|
|
@@ -64,7 +64,7 @@ class Replicator
|
|
|
64
64
|
@l_fed_elements = { :raw => @l_config }
|
|
65
65
|
|
|
66
66
|
if OpenNebula.is_error?(@l_config)
|
|
67
|
-
STDERR.puts 'Unable to read OpenNebula configuration. ' \
|
|
67
|
+
STDERR.puts 'Unable to read local OpenNebula configuration. ' \
|
|
68
68
|
'Is OpenNebula running?'
|
|
69
69
|
exit(-1)
|
|
70
70
|
end
|
|
@@ -81,6 +81,12 @@ class Replicator
|
|
|
81
81
|
@r_config_elements = { :raw => @r_config }
|
|
82
82
|
@r_fed_elements = { :raw => @r_config }
|
|
83
83
|
|
|
84
|
+
if OpenNebula.is_error?(@r_config)
|
|
85
|
+
STDERR.puts 'Unable to read remote OpenNebula configuration. ' \
|
|
86
|
+
"Is OpenNebula running on #{@remote_server}?"
|
|
87
|
+
exit(-1)
|
|
88
|
+
end
|
|
89
|
+
|
|
84
90
|
fetch_db_config(@r_config_elements)
|
|
85
91
|
fetch_fed_config(@r_fed_elements)
|
|
86
92
|
|
|
@@ -185,14 +191,12 @@ class Replicator
|
|
|
185
191
|
"/etc/one/#{folder}/"
|
|
186
192
|
)
|
|
187
193
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
"rsync -ai\
|
|
194
|
+
rc ||= run_command(
|
|
195
|
+
"rsync -ai\
|
|
191
196
|
-e \"ssh #{SSH_OPTIONS} -i #{@oneadmin_identity_file}\" " \
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
end
|
|
197
|
+
"oneadmin@#{@remote_server}:/etc/one/#{folder}/ " \
|
|
198
|
+
"/etc/one/#{folder}/"
|
|
199
|
+
)
|
|
196
200
|
|
|
197
201
|
unless rc
|
|
198
202
|
STDERR.puts 'ERROR'
|
|
@@ -361,13 +365,11 @@ class Replicator
|
|
|
361
365
|
)
|
|
362
366
|
|
|
363
367
|
# if default users doesn't work, try with oneadmin
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
)
|
|
370
|
-
end
|
|
368
|
+
rc ||= run_command(
|
|
369
|
+
"ssh -i #{@oneadmin_identity_file} " \
|
|
370
|
+
"#{SSH_OPTIONS} oneadmin@#{@remote_server} " \
|
|
371
|
+
"#{cmd}"
|
|
372
|
+
)
|
|
371
373
|
|
|
372
374
|
# if oneadmin doesn't work neither, fail
|
|
373
375
|
unless rc
|
|
@@ -390,12 +392,10 @@ class Replicator
|
|
|
390
392
|
)
|
|
391
393
|
|
|
392
394
|
# if default users doesn't work, try with oneadmin
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
)
|
|
398
|
-
end
|
|
395
|
+
rc ||= run_command(
|
|
396
|
+
"scp -i #{@oneadmin_identity_file} " \
|
|
397
|
+
"#{SSH_OPTIONS} oneadmin@#{@remote_server}:#{src} #{dest}"
|
|
398
|
+
)
|
|
399
399
|
|
|
400
400
|
# if oneadmin doesn't work neither, fail
|
|
401
401
|
unless rc
|
|
@@ -438,30 +438,31 @@ class Replicator
|
|
|
438
438
|
|
|
439
439
|
end
|
|
440
440
|
|
|
441
|
+
# Helper class for Zone commands
|
|
441
442
|
class OneZoneHelper < OpenNebulaHelper::OneHelper
|
|
442
443
|
|
|
443
444
|
SERVER_NAME={
|
|
444
|
-
:name =>
|
|
445
|
-
:short =>
|
|
446
|
-
:large =>
|
|
445
|
+
:name => 'server_name',
|
|
446
|
+
:short => '-n server_name',
|
|
447
|
+
:large => '--name',
|
|
447
448
|
:format => String,
|
|
448
|
-
:description =>
|
|
449
|
+
:description => 'Zone server name'
|
|
449
450
|
}
|
|
450
451
|
|
|
451
452
|
SERVER_ENDPOINT={
|
|
452
|
-
:name =>
|
|
453
|
-
:short =>
|
|
454
|
-
:large =>
|
|
453
|
+
:name => 'server_rpc',
|
|
454
|
+
:short => '-r xml-rpc endpoint',
|
|
455
|
+
:large => '--rpc',
|
|
455
456
|
:format => String,
|
|
456
|
-
:description =>
|
|
457
|
+
:description => 'Zone server XML-RPC endpoint'
|
|
457
458
|
}
|
|
458
459
|
|
|
459
460
|
SERVER_ENDPOINT_GRPC={
|
|
460
|
-
:name =>
|
|
461
|
-
:short =>
|
|
462
|
-
:large =>
|
|
461
|
+
:name => 'server_grpc',
|
|
462
|
+
:short => '-g gRPC endpoint',
|
|
463
|
+
:large => '--grpc-endpoint',
|
|
463
464
|
:format => String,
|
|
464
|
-
:description =>
|
|
465
|
+
:description => 'Zone server gRPC endpoint'
|
|
465
466
|
}
|
|
466
467
|
|
|
467
468
|
def show_resource(id, options)
|
|
@@ -490,11 +491,11 @@ class OneZoneHelper < OpenNebulaHelper::OneHelper
|
|
|
490
491
|
end
|
|
491
492
|
|
|
492
493
|
def self.rname
|
|
493
|
-
|
|
494
|
+
'ZONE'
|
|
494
495
|
end
|
|
495
496
|
|
|
496
497
|
def self.conf_file
|
|
497
|
-
|
|
498
|
+
'onezone.yaml'
|
|
498
499
|
end
|
|
499
500
|
|
|
500
501
|
def self.state_to_str(id)
|
|
@@ -520,29 +521,29 @@ class OneZoneHelper < OpenNebulaHelper::OneHelper
|
|
|
520
521
|
[0, ids[0].to_i]
|
|
521
522
|
end
|
|
522
523
|
|
|
523
|
-
def format_pool(
|
|
524
|
+
def format_pool(_options)
|
|
524
525
|
config_file = self.class.table_conf
|
|
525
526
|
|
|
526
|
-
|
|
527
|
-
column :CURRENT,
|
|
528
|
-
|
|
529
|
-
d[
|
|
527
|
+
CLIHelper::ShowTable.new(config_file, self) do
|
|
528
|
+
column :CURRENT, 'Active Zone', :size=>1 do |d|
|
|
529
|
+
'*' if helper.client.one_endpoint.strip ==
|
|
530
|
+
d['TEMPLATE']['ENDPOINT'].strip
|
|
530
531
|
end
|
|
531
532
|
|
|
532
|
-
column :ID,
|
|
533
|
-
d[
|
|
533
|
+
column :ID, 'ONE identifier for the Zone', :size=>5 do |d|
|
|
534
|
+
d['ID']
|
|
534
535
|
end
|
|
535
536
|
|
|
536
|
-
column :NAME,
|
|
537
|
-
d[
|
|
537
|
+
column :NAME, 'Name of the Zone', :left, :size=>25 do |d|
|
|
538
|
+
d['NAME']
|
|
538
539
|
end
|
|
539
540
|
|
|
540
|
-
column :ENDPOINT,
|
|
541
|
-
d[
|
|
541
|
+
column :ENDPOINT, 'Endpoint of the Zone', :left, :size=>45 do |d|
|
|
542
|
+
d['TEMPLATE']['ENDPOINT']
|
|
542
543
|
end
|
|
543
544
|
|
|
544
|
-
column :FED_INDEX,
|
|
545
|
-
helper.get_fed_index(d[
|
|
545
|
+
column :FED_INDEX, 'Federation index', :left, :size=>10 do |d|
|
|
546
|
+
helper.get_fed_index(d['TEMPLATE']['ENDPOINT'])
|
|
546
547
|
end
|
|
547
548
|
|
|
548
549
|
column :STAT, 'Zone status', :left, :size => 6 do |d|
|
|
@@ -551,8 +552,6 @@ class OneZoneHelper < OpenNebulaHelper::OneHelper
|
|
|
551
552
|
|
|
552
553
|
default :CURRENT, :ID, :NAME, :ENDPOINT, :FED_INDEX, :STAT
|
|
553
554
|
end
|
|
554
|
-
|
|
555
|
-
table
|
|
556
555
|
end
|
|
557
556
|
|
|
558
557
|
def get_fed_index(endpoint)
|
|
@@ -585,11 +584,11 @@ class OneZoneHelper < OpenNebulaHelper::OneHelper
|
|
|
585
584
|
if temporary_zone
|
|
586
585
|
puts "Type: export ONE_XMLRPC=#{zone['TEMPLATE/ENDPOINT']}"
|
|
587
586
|
else
|
|
588
|
-
File.open(
|
|
587
|
+
File.open(Dir.home+'/.one/one_endpoint', 'w') do |f|
|
|
589
588
|
f.puts zone['TEMPLATE/ENDPOINT']
|
|
590
|
-
|
|
589
|
+
end
|
|
591
590
|
puts "Endpoint changed to \"#{zone['TEMPLATE/ENDPOINT']}\" in " <<
|
|
592
|
-
"#{
|
|
591
|
+
"#{Dir.home}/.one/one_endpoint"
|
|
593
592
|
end
|
|
594
593
|
|
|
595
594
|
return 0 unless zone['TEMPLATE/ONEFLOW_ENDPOINT']
|
|
@@ -598,13 +597,13 @@ class OneZoneHelper < OpenNebulaHelper::OneHelper
|
|
|
598
597
|
if temporary_zone
|
|
599
598
|
puts "Type: export ONEFLOW_URL=#{zone['TEMPLATE/ONEFLOW_ENDPOINT']}"
|
|
600
599
|
else
|
|
601
|
-
File.open(
|
|
600
|
+
File.open(Dir.home + '/.one/oneflow_endpoint', 'w') do |f|
|
|
602
601
|
f.puts zone['TEMPLATE/ONEFLOW_ENDPOINT']
|
|
603
602
|
end
|
|
604
603
|
|
|
605
604
|
puts 'OneFlow Endpoint changed to ' \
|
|
606
605
|
"\"#{zone['TEMPLATE/ONEFLOW_ENDPOINT']}\" in " <<
|
|
607
|
-
"#{
|
|
606
|
+
"#{Dir.home}/.one/oneflow_endpoint"
|
|
608
607
|
end
|
|
609
608
|
|
|
610
609
|
0
|
|
@@ -612,7 +611,7 @@ class OneZoneHelper < OpenNebulaHelper::OneHelper
|
|
|
612
611
|
|
|
613
612
|
private
|
|
614
613
|
|
|
615
|
-
def factory(id=nil)
|
|
614
|
+
def factory(id = nil)
|
|
616
615
|
if id
|
|
617
616
|
OpenNebula::Zone.new_with_id(id, @client)
|
|
618
617
|
else
|
|
@@ -621,92 +620,90 @@ class OneZoneHelper < OpenNebulaHelper::OneHelper
|
|
|
621
620
|
end
|
|
622
621
|
end
|
|
623
622
|
|
|
624
|
-
def factory_pool(
|
|
623
|
+
def factory_pool(_user_flag = -2)
|
|
625
624
|
OpenNebula::ZonePool.new(@client)
|
|
626
625
|
end
|
|
627
626
|
|
|
628
|
-
def format_resource(zone,
|
|
629
|
-
str=
|
|
630
|
-
str_h1=
|
|
627
|
+
def format_resource(zone, _options = {})
|
|
628
|
+
str='%-18s: %-20s'
|
|
629
|
+
str_h1='%-80s'
|
|
631
630
|
|
|
632
631
|
CLIHelper.print_header(str_h1 % "ZONE #{zone['ID']} INFORMATION")
|
|
633
|
-
puts str
|
|
634
|
-
puts str
|
|
635
|
-
puts str
|
|
632
|
+
puts format(str, 'ID', zone.id.to_s)
|
|
633
|
+
puts format(str, 'NAME', zone.name)
|
|
634
|
+
puts format(str, 'STATE', zone.state_str)
|
|
636
635
|
puts
|
|
637
636
|
|
|
638
637
|
zone_hash=zone.to_hash
|
|
639
638
|
|
|
640
|
-
if zone.has_elements?(
|
|
639
|
+
if zone.has_elements?('/ZONE/SERVER_POOL/SERVER')
|
|
641
640
|
|
|
642
641
|
puts
|
|
643
|
-
CLIHelper.print_header(str_h1 %
|
|
642
|
+
CLIHelper.print_header(str_h1 % 'ZONE SERVERS', false)
|
|
644
643
|
|
|
645
644
|
CLIHelper::ShowTable.new(nil, self) do
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
d["ID"] if !d.nil?
|
|
645
|
+
column :ID, '', :size=>2 do |d|
|
|
646
|
+
d['ID'] unless d.nil?
|
|
649
647
|
end
|
|
650
648
|
|
|
651
|
-
column :
|
|
652
|
-
d[
|
|
649
|
+
column :NAME, '', :left, :size=>15 do |d|
|
|
650
|
+
d['NAME'] unless d.nil?
|
|
653
651
|
end
|
|
654
652
|
|
|
655
|
-
column :
|
|
656
|
-
d[
|
|
653
|
+
column :ENDPOINT, '', :left, :size=>63 do |d|
|
|
654
|
+
d['ENDPOINT'] unless d.nil?
|
|
657
655
|
end
|
|
658
656
|
end.show([zone_hash['ZONE']['SERVER_POOL']['SERVER']].flatten, {})
|
|
659
657
|
|
|
660
658
|
puts
|
|
661
|
-
CLIHelper.print_header(str_h1 %
|
|
659
|
+
CLIHelper.print_header(str_h1 % 'HA & FEDERATION SYNC STATUS', false)
|
|
662
660
|
|
|
663
661
|
CLIHelper::ShowTable.new(nil, self) do
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
d["ID"] if !d.nil?
|
|
662
|
+
column :ID, '', :size=>2 do |d|
|
|
663
|
+
d['ID'] unless d.nil?
|
|
667
664
|
end
|
|
668
665
|
|
|
669
|
-
column :
|
|
670
|
-
d[
|
|
666
|
+
column :NAME, '', :left, :size=>15 do |d|
|
|
667
|
+
d['NAME'] unless d.nil?
|
|
671
668
|
end
|
|
672
669
|
|
|
673
|
-
column :
|
|
674
|
-
d[
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
d[
|
|
670
|
+
column :STATE, '', :left, :size=>10 do |d|
|
|
671
|
+
d['STATE'] = case d['STATE']
|
|
672
|
+
when '0' then 'solo'
|
|
673
|
+
when '1' then 'candidate'
|
|
674
|
+
when '2' then 'follower'
|
|
675
|
+
when '3' then 'leader'
|
|
676
|
+
else 'error'
|
|
677
|
+
end
|
|
678
|
+
d['STATE'] unless d.nil?
|
|
682
679
|
end
|
|
683
680
|
|
|
684
|
-
column :
|
|
685
|
-
d[
|
|
681
|
+
column :TERM, '', :left, :size=>10 do |d|
|
|
682
|
+
d['TERM'] unless d.nil?
|
|
686
683
|
end
|
|
687
684
|
|
|
688
|
-
column :
|
|
689
|
-
d[
|
|
685
|
+
column :INDEX, '', :left, :size=>10 do |d|
|
|
686
|
+
d['LOG_INDEX'] unless d.nil?
|
|
690
687
|
end
|
|
691
688
|
|
|
692
|
-
column :
|
|
693
|
-
d[
|
|
689
|
+
column :COMMIT, '', :left, :size=>10 do |d|
|
|
690
|
+
d['COMMIT'] unless d.nil?
|
|
694
691
|
end
|
|
695
692
|
|
|
696
|
-
column :
|
|
697
|
-
d[
|
|
693
|
+
column :VOTE, '', :left, :size=>5 do |d|
|
|
694
|
+
d['VOTEDFOR'] unless d.nil?
|
|
698
695
|
end
|
|
699
696
|
|
|
700
|
-
column :
|
|
701
|
-
d[
|
|
697
|
+
column :FED_INDEX, '', :left, :size=>10 do |d|
|
|
698
|
+
d['FEDLOG_INDEX'] unless d.nil?
|
|
702
699
|
end
|
|
703
|
-
|
|
704
700
|
end.show([zone_hash['ZONE']['SERVER_POOL']['SERVER']].flatten, {})
|
|
705
701
|
end
|
|
706
702
|
|
|
707
703
|
puts
|
|
708
704
|
|
|
709
|
-
CLIHelper.print_header(str_h1 %
|
|
705
|
+
CLIHelper.print_header(str_h1 % 'ZONE TEMPLATE', false)
|
|
710
706
|
puts zone.template_str
|
|
711
707
|
end
|
|
708
|
+
|
|
712
709
|
end
|