opennebula 5.13.80.pre → 6.0.0.2
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/lib/cloud/CloudClient.rb +1 -1
- data/lib/datacenter.rb +69 -34
- data/lib/datastore.rb +2 -2
- data/lib/distributed_firewall.rb +17 -4
- data/lib/network.rb +74 -4
- data/lib/nsx_client.rb +17 -4
- data/lib/nsx_constants.rb +18 -5
- data/lib/nsx_driver.rb +15 -2
- data/lib/nsx_rule.rb +17 -4
- data/lib/nsxt_client.rb +17 -4
- data/lib/nsxv_client.rb +17 -4
- data/lib/opennebula.rb +1 -1
- data/lib/opennebula/client.rb +9 -1
- data/lib/opennebula/flow/service_template.rb +37 -1
- data/lib/opennebula/image.rb +2 -0
- data/lib/opennebula/marketplaceapp_ext.rb +77 -13
- data/lib/opennebula/pool.rb +2 -0
- data/lib/opennebula/template_ext.rb +19 -2
- data/lib/opennebula/virtual_machine.rb +2 -0
- data/lib/opennebula/virtual_machine_ext.rb +35 -17
- data/lib/opennebula/wait_ext.rb +120 -85
- data/lib/scripts_common.rb +3 -0
- data/lib/vcenter_driver.rb +13 -2
- data/lib/vcenter_importer.rb +2 -2
- data/lib/vi_helper.rb +2 -1
- data/lib/virtual_machine.rb +50 -12
- data/lib/vm_template.rb +17 -16
- data/lib/vmm_importer.rb +8 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f022212cfa3668cae363f0592a9423a77f3f0a63
|
4
|
+
data.tar.gz: f1aa5e2a2d9c2f7d06f8c63defc79b004fdd21a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb414c6b219cdbcd4217d69219ba161273a1e7ba802fd4c94936a83aba776d2f781661fa684372e77c86fd18d707823cc7f172bc23f2b794dcbb8984cab63b93
|
7
|
+
data.tar.gz: 9d6c490f638e47dcb1f4aa558853806a92b835a9c0217a1bb2a6c84207bd375b4406e13702a4423d733ee4f8294d796a50ecd40045a2f5ca66c046d8eb1a2ede
|
data/lib/cloud/CloudClient.rb
CHANGED
data/lib/datacenter.rb
CHANGED
@@ -500,7 +500,7 @@ module VCenterDriver
|
|
500
500
|
end
|
501
501
|
|
502
502
|
# Determine if a network must be excluded from the list
|
503
|
-
def exclude_network?(
|
503
|
+
def exclude_network?(one_host, args, vc_network_hash, network_type)
|
504
504
|
vc_network_name = vc_network_hash[:vc_network_name]
|
505
505
|
vc_network_host = vc_network_hash[:vc_network_host]
|
506
506
|
vc_network_tag = vc_network_hash[:vc_network_tag]
|
@@ -514,12 +514,6 @@ module VCenterDriver
|
|
514
514
|
]
|
515
515
|
|
516
516
|
# Only NSX-V and NSX-T can be excluded
|
517
|
-
network_type = VCenterDriver::Network
|
518
|
-
.get_network_type(
|
519
|
-
vc_network,
|
520
|
-
vc_network_name
|
521
|
-
)
|
522
|
-
|
523
517
|
return true if network_types.include? network_type
|
524
518
|
end
|
525
519
|
# Exclude networks without hosts
|
@@ -533,7 +527,7 @@ module VCenterDriver
|
|
533
527
|
return true
|
534
528
|
end
|
535
529
|
# Exclude portgroup used for VXLAN communication in NSX
|
536
|
-
if
|
530
|
+
if vc_network_name.match(/^vxw-vmknicPg-dvs-(.*)/)
|
537
531
|
return true
|
538
532
|
end
|
539
533
|
|
@@ -543,7 +537,7 @@ module VCenterDriver
|
|
543
537
|
end
|
544
538
|
|
545
539
|
# Proccess each network
|
546
|
-
def process_network(params)
|
540
|
+
def process_network(params, networks_type, hosts_list, host_list_object)
|
547
541
|
vc_network = params[:vc_network]
|
548
542
|
vcenter_instance_name = params[:vcenter_instance_name]
|
549
543
|
vcenter_uuid = params[:vcenter_uuid]
|
@@ -576,25 +570,32 @@ module VCenterDriver
|
|
576
570
|
# Initialize opts hash used to inject data into one template
|
577
571
|
opts = {}
|
578
572
|
|
579
|
-
|
580
|
-
|
581
|
-
network_type =
|
573
|
+
# Add network type to network hash
|
574
|
+
if networks_type.key?(vc_network_hash[:vc_network_ref])
|
575
|
+
network_type = networks_type[vc_network_hash[:vc_network_ref]]
|
576
|
+
else
|
577
|
+
network_type =
|
582
578
|
VCenterDriver::Network.get_network_type(
|
583
579
|
vc_network,
|
584
580
|
vc_network_name
|
585
581
|
)
|
586
|
-
|
582
|
+
networks_type[vc_network_hash[:vc_network_ref]] = network_type
|
587
583
|
end
|
588
584
|
|
585
|
+
network[vc_network_ref][:network_type] = network_type
|
586
|
+
network[vc_network_ref][:type] = network_type
|
587
|
+
|
589
588
|
# Determine if the network must be excluded
|
590
589
|
network[vc_network_ref][:excluded] = exclude_network?(
|
591
|
-
vc_network,
|
592
590
|
one_host,
|
593
591
|
args,
|
594
|
-
vc_network_hash
|
592
|
+
vc_network_hash,
|
593
|
+
network_type
|
595
594
|
)
|
596
595
|
|
597
|
-
|
596
|
+
if network[vc_network_ref][:excluded] == true
|
597
|
+
return [nil, networks_type, hosts_list, host_list_object]
|
598
|
+
end
|
598
599
|
|
599
600
|
if full_process
|
600
601
|
case network[vc_network_ref][:network_type]
|
@@ -652,31 +653,50 @@ module VCenterDriver
|
|
652
653
|
vc_hosts = vc_network.host
|
653
654
|
vc_hosts.each do |vc_host|
|
654
655
|
# Get vCenter Cluster
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
656
|
+
vc_host_ref = vc_host._ref
|
657
|
+
if !host_list_object.key?(vc_host_ref)
|
658
|
+
vc_cluster = vc_host.parent
|
659
|
+
vc_cluster_ref = vc_cluster._ref
|
660
|
+
vc_cluster_name = vc_cluster.name
|
661
|
+
host_list_object[vc_host_ref] = {
|
662
|
+
:vc_cluster_ref => vc_cluster_ref,
|
663
|
+
:vc_cluster_name => vc_cluster_name
|
664
|
+
}
|
665
|
+
end
|
666
|
+
|
667
|
+
vc_cluster = host_list_object[vc_host_ref]
|
668
|
+
|
669
|
+
if hosts_list.key? vc_cluster[:vc_cluster_ref]
|
670
|
+
one_host = hosts_list[vc_cluster[:vc_cluster_ref]]
|
671
|
+
else
|
672
|
+
one_host = VCenterDriver::VIHelper
|
673
|
+
.find_by_ref(OpenNebula::HostPool,
|
674
|
+
'TEMPLATE/VCENTER_CCR_REF',
|
675
|
+
vc_cluster[:vc_cluster_ref],
|
676
|
+
vcenter_uuid)
|
677
|
+
hosts_list[vc_cluster[:vc_cluster_ref]] = one_host
|
678
|
+
end
|
664
679
|
# Check if network is excluded from each host
|
665
680
|
next if exclude_network?(
|
666
|
-
vc_network,
|
667
681
|
one_host,
|
668
682
|
args,
|
669
|
-
vc_network_hash
|
683
|
+
vc_network_hash,
|
684
|
+
network_type
|
670
685
|
)
|
671
686
|
|
672
687
|
# Insert vCenter cluster ref
|
673
|
-
network[vc_network_ref][:clusters][:refs] <<
|
688
|
+
network[vc_network_ref][:clusters][:refs] <<
|
689
|
+
vc_cluster[:vc_cluster_ref]
|
690
|
+
|
674
691
|
# Insert OpenNebula cluster id
|
675
692
|
cluster_id = one_cluster_id(one_host)
|
676
|
-
network[vc_network_ref][:clusters][:one_ids] <<
|
693
|
+
network[vc_network_ref][:clusters][:one_ids] <<
|
694
|
+
cluster_id
|
695
|
+
|
677
696
|
# Insert vCenter cluster name
|
678
|
-
network[vc_network_ref][:clusters][:names] <<
|
679
|
-
|
697
|
+
network[vc_network_ref][:clusters][:names] <<
|
698
|
+
vc_cluster[:vc_cluster_name]
|
699
|
+
opts[:dc_name] = vc_cluster[:vc_cluster_name]
|
680
700
|
end
|
681
701
|
|
682
702
|
# Remove duplicate entries
|
@@ -707,7 +727,7 @@ module VCenterDriver
|
|
707
727
|
network[vc_network_ref]['name']
|
708
728
|
end
|
709
729
|
|
710
|
-
network
|
730
|
+
[network, networks_type, hosts_list, host_list_object]
|
711
731
|
end
|
712
732
|
|
713
733
|
# rubocop:disable Style/GlobalVars
|
@@ -724,13 +744,15 @@ module VCenterDriver
|
|
724
744
|
$conf[:one_xmlrpc]
|
725
745
|
)
|
726
746
|
end
|
727
|
-
|
728
747
|
one_host = OpenNebula::Host.new_with_id(args[:host], one_client)
|
729
748
|
rc = one_host.info
|
730
749
|
raise rc.message if OpenNebula.is_error? rc
|
731
750
|
|
732
751
|
# Get all networks in vcenter cluster (one_host)
|
733
752
|
vc_cluster_networks = cluster_networks(one_host)
|
753
|
+
networks_type = {}
|
754
|
+
hosts_list = {}
|
755
|
+
host_list_object = {}
|
734
756
|
|
735
757
|
# Iterate over vcenter networks
|
736
758
|
vc_cluster_networks.each do |vc_cluster_network|
|
@@ -752,7 +774,20 @@ module VCenterDriver
|
|
752
774
|
params[:one_host]= one_host
|
753
775
|
params[:args] = args
|
754
776
|
|
755
|
-
network
|
777
|
+
network,
|
778
|
+
networks_type_new,
|
779
|
+
hosts_list_new,
|
780
|
+
host_list_object_new =
|
781
|
+
process_network(
|
782
|
+
params,
|
783
|
+
networks_type,
|
784
|
+
hosts_list,
|
785
|
+
host_list_object
|
786
|
+
)
|
787
|
+
|
788
|
+
networks_type = networks_type_new
|
789
|
+
hosts_list = hosts_list_new
|
790
|
+
host_list_object = host_list_object_new
|
756
791
|
|
757
792
|
networks.merge!(network) unless network.nil?
|
758
793
|
end
|
data/lib/datastore.rb
CHANGED
@@ -653,8 +653,8 @@ module VCenterDriver
|
|
653
653
|
|
654
654
|
wout.close
|
655
655
|
size = rout.readlines.select do |l|
|
656
|
-
l.start_with?('
|
657
|
-
end[0].sub('
|
656
|
+
l.downcase.start_with?('content-length')
|
657
|
+
end[0].downcase.sub('content-length: ', '')
|
658
658
|
rout.close
|
659
659
|
size.chomp.to_i < 4096 # If <4k, then is a descriptor
|
660
660
|
end
|
data/lib/distributed_firewall.rb
CHANGED
@@ -29,14 +29,27 @@ module NSXDriver
|
|
29
29
|
unless defined?(GEMS_LOCATION)
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
# rubocop: disable all
|
33
|
+
# %%RUBYGEMS_SETUP_BEGIN%%
|
34
|
+
if File.directory?(GEMS_LOCATION)
|
35
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
36
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
37
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
38
|
+
|
39
|
+
# Suppress warnings from Rubygems
|
40
|
+
# https://github.com/OpenNebula/one/issues/5379
|
41
|
+
begin
|
42
|
+
verb = $VERBOSE
|
43
|
+
$VERBOSE = nil
|
36
44
|
require 'rubygems'
|
37
45
|
Gem.use_paths(real_gems_path)
|
46
|
+
ensure
|
47
|
+
$VERBOSE = verb
|
38
48
|
end
|
39
49
|
end
|
50
|
+
end
|
51
|
+
# %%RUBYGEMS_SETUP_END%%
|
52
|
+
# rubocop: enable all
|
40
53
|
|
41
54
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
42
55
|
|
data/lib/network.rb
CHANGED
@@ -486,6 +486,76 @@ module VCenterDriver
|
|
486
486
|
@defaults = { :size => '255', :type => 'ether' }
|
487
487
|
end
|
488
488
|
|
489
|
+
def process_import(indexes, opts = {}, &_block)
|
490
|
+
indexes = indexes.gsub(/\s*\,\s*/, ',').strip.split(',')
|
491
|
+
|
492
|
+
dc_folder = VCenterDriver::DatacenterFolder.new(@vi_client)
|
493
|
+
vcenter_instance_name = @vi_client.vc_name
|
494
|
+
vcenter_uuid = @vi_client.vim.serviceContent.about.instanceUuid
|
495
|
+
hpool = VCenterDriver::VIHelper.one_pool(
|
496
|
+
OpenNebula::HostPool,
|
497
|
+
false
|
498
|
+
)
|
499
|
+
|
500
|
+
one_client = OpenNebula::Client.new
|
501
|
+
one_host = OpenNebula::Host.new_with_id(opts[:host], one_client)
|
502
|
+
|
503
|
+
rc = one_host.info
|
504
|
+
raise rc.message if OpenNebula.is_error? rc
|
505
|
+
|
506
|
+
# Get all networks in vcenter cluster (one_host)
|
507
|
+
vc_cluster_networks = dc_folder.cluster_networks(one_host)
|
508
|
+
|
509
|
+
vc_cluster_networks_map_ref = {}
|
510
|
+
|
511
|
+
# Iterate over vcenter networks
|
512
|
+
vc_cluster_networks.each do |vc_cluster_network|
|
513
|
+
vc_cluster_networks_map_ref[vc_cluster_network._ref] =
|
514
|
+
vc_cluster_network
|
515
|
+
end
|
516
|
+
|
517
|
+
indexes.each do |index|
|
518
|
+
begin
|
519
|
+
@rollback = []
|
520
|
+
@info[index] = {}
|
521
|
+
|
522
|
+
vc_cluster_network = vc_cluster_networks_map_ref[index]
|
523
|
+
|
524
|
+
if hpool.respond_to?(:message)
|
525
|
+
raise 'Could not get OpenNebula HostPool: ' \
|
526
|
+
"#{hpool.message}"
|
527
|
+
end
|
528
|
+
|
529
|
+
params = {}
|
530
|
+
params[:vc_network] = vc_cluster_network
|
531
|
+
params[:vcenter_instance_name] = vcenter_instance_name
|
532
|
+
params[:vcenter_uuid] = vcenter_uuid
|
533
|
+
params[:_hpool] = hpool
|
534
|
+
params[:one_host] = one_host
|
535
|
+
params[:args] = {}
|
536
|
+
|
537
|
+
selected, _networks_type, _hosts_list, _clusters_list =
|
538
|
+
dc_folder.process_network(
|
539
|
+
params,
|
540
|
+
{},
|
541
|
+
{},
|
542
|
+
{}
|
543
|
+
)
|
544
|
+
|
545
|
+
selected = selected[index]
|
546
|
+
|
547
|
+
# import the object
|
548
|
+
opts[index] ||= @defaults
|
549
|
+
@info[:success] << import(selected, opts[index])
|
550
|
+
rescue StandardError => e
|
551
|
+
@info[:error] << { index => e.message }
|
552
|
+
@info[index][:e] = e
|
553
|
+
|
554
|
+
apply_rollback
|
555
|
+
end
|
556
|
+
end
|
557
|
+
end
|
558
|
+
|
489
559
|
def get_list(args = {})
|
490
560
|
dc_folder = VCenterDriver::DatacenterFolder.new(@vi_client)
|
491
561
|
|
@@ -496,8 +566,8 @@ module VCenterDriver
|
|
496
566
|
false
|
497
567
|
)
|
498
568
|
if npool.respond_to?(:message)
|
499
|
-
raise
|
500
|
-
OpenNebula VirtualNetworkPool: #{npool.message}"
|
569
|
+
raise 'Could not get ' \
|
570
|
+
"OpenNebula VirtualNetworkPool: #{npool.message}"
|
501
571
|
end
|
502
572
|
|
503
573
|
# Get OpenNebula's host pool
|
@@ -572,8 +642,8 @@ module VCenterDriver
|
|
572
642
|
str
|
573
643
|
end
|
574
644
|
|
575
|
-
def import(selected)
|
576
|
-
opts = @info[selected[:ref]][:opts]
|
645
|
+
def import(selected, opts = nil)
|
646
|
+
opts = @info[selected[:ref]][:opts] if opts.nil?
|
577
647
|
|
578
648
|
net = VCenterDriver::Network
|
579
649
|
.new_from_ref(selected[:ref], @vi_client)
|
data/lib/nsx_client.rb
CHANGED
@@ -29,14 +29,27 @@ module NSXDriver
|
|
29
29
|
unless defined?(GEMS_LOCATION)
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
# rubocop: disable all
|
33
|
+
# %%RUBYGEMS_SETUP_BEGIN%%
|
34
|
+
if File.directory?(GEMS_LOCATION)
|
35
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
36
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
37
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
38
|
+
|
39
|
+
# Suppress warnings from Rubygems
|
40
|
+
# https://github.com/OpenNebula/one/issues/5379
|
41
|
+
begin
|
42
|
+
verb = $VERBOSE
|
43
|
+
$VERBOSE = nil
|
36
44
|
require 'rubygems'
|
37
45
|
Gem.use_paths(real_gems_path)
|
46
|
+
ensure
|
47
|
+
$VERBOSE = verb
|
38
48
|
end
|
39
49
|
end
|
50
|
+
end
|
51
|
+
# %%RUBYGEMS_SETUP_END%%
|
52
|
+
# rubocop: enable all
|
40
53
|
|
41
54
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
42
55
|
|
data/lib/nsx_constants.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# a copy of the License at #
|
7
7
|
# #
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
9
|
-
#
|
9
|
+
# #
|
10
10
|
# Unless required by applicable law or agreed to in writing, software #
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
@@ -29,14 +29,27 @@ module NSXDriver
|
|
29
29
|
unless defined?(GEMS_LOCATION)
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
# rubocop: disable all
|
33
|
+
# %%RUBYGEMS_SETUP_BEGIN%%
|
34
|
+
if File.directory?(GEMS_LOCATION)
|
35
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
36
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
37
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
38
|
+
|
39
|
+
# Suppress warnings from Rubygems
|
40
|
+
# https://github.com/OpenNebula/one/issues/5379
|
41
|
+
begin
|
42
|
+
verb = $VERBOSE
|
43
|
+
$VERBOSE = nil
|
36
44
|
require 'rubygems'
|
37
45
|
Gem.use_paths(real_gems_path)
|
46
|
+
ensure
|
47
|
+
$VERBOSE = verb
|
38
48
|
end
|
39
49
|
end
|
50
|
+
end
|
51
|
+
# %%RUBYGEMS_SETUP_END%%
|
52
|
+
# rubocop: enable all
|
40
53
|
|
41
54
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
42
55
|
|
data/lib/nsx_driver.rb
CHANGED
@@ -36,14 +36,27 @@ end
|
|
36
36
|
|
37
37
|
ENV['LANG'] = 'C'
|
38
38
|
|
39
|
+
# rubocop: disable all
|
40
|
+
# %%RUBYGEMS_SETUP_BEGIN%%
|
39
41
|
if File.directory?(GEMS_LOCATION)
|
40
42
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
41
43
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
42
44
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
43
|
-
|
44
|
-
|
45
|
+
|
46
|
+
# Suppress warnings from Rubygems
|
47
|
+
# https://github.com/OpenNebula/one/issues/5379
|
48
|
+
begin
|
49
|
+
verb = $VERBOSE
|
50
|
+
$VERBOSE = nil
|
51
|
+
require 'rubygems'
|
52
|
+
Gem.use_paths(real_gems_path)
|
53
|
+
ensure
|
54
|
+
$VERBOSE = verb
|
55
|
+
end
|
45
56
|
end
|
46
57
|
end
|
58
|
+
# %%RUBYGEMS_SETUP_END%%
|
59
|
+
# rubocop: enable all
|
47
60
|
|
48
61
|
$LOAD_PATH << LIB_LOCATION + '/ruby'
|
49
62
|
$LOAD_PATH << LIB_LOCATION + '/ruby/nsx_driver'
|