opennebula 6.0.0.3 → 6.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cloud/CloudClient.rb +1 -1
- data/lib/datacenter.rb +35 -71
- data/lib/distributed_firewall.rb +4 -17
- data/lib/network.rb +1 -7
- data/lib/nsx_client.rb +4 -17
- data/lib/nsx_constants.rb +5 -18
- data/lib/nsx_driver.rb +2 -15
- data/lib/nsx_rule.rb +4 -17
- data/lib/nsxt_client.rb +4 -17
- data/lib/nsxv_client.rb +4 -17
- data/lib/opennebula/flow/service_template.rb +2 -2
- data/lib/opennebula/virtual_machine_ext.rb +17 -35
- data/lib/opennebula.rb +1 -1
- data/lib/vcenter_driver.rb +2 -13
- data/lib/vcenter_importer.rb +2 -2
- data/lib/virtual_machine.rb +9 -47
- data/lib/vm_template.rb +3 -2
- data/lib/vmm_importer.rb +0 -8
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f663dcec1594a07beb54bc3a4065b53818669846
|
4
|
+
data.tar.gz: 63d9ffe94c43fb81d6cc7e2a0563ed6d711ebc48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 905fbdea52975558d07f8720c64c5f37365672d487a1bb334c94e0e4ea5026be94468c3320b667c2d7acc6f31f312e0e58b951cbf136bf45ebfc1d4efaa7e857
|
7
|
+
data.tar.gz: ddb7dadb1c1d2df3454b11a4c7f91385049ee2b134de1d75c0c27b7e59b554b2f9db5ca6135e85a9d0e8ff3b0e0565f3f4e34dd121830c151a1f468347187ad6
|
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?(one_host, args, vc_network_hash
|
503
|
+
def exclude_network?(vc_network, one_host, args, vc_network_hash)
|
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,6 +514,12 @@ 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
|
+
|
517
523
|
return true if network_types.include? network_type
|
518
524
|
end
|
519
525
|
# Exclude networks without hosts
|
@@ -527,7 +533,7 @@ module VCenterDriver
|
|
527
533
|
return true
|
528
534
|
end
|
529
535
|
# Exclude portgroup used for VXLAN communication in NSX
|
530
|
-
if
|
536
|
+
if vc_network['name'].match(/^vxw-vmknicPg-dvs-(.*)/)
|
531
537
|
return true
|
532
538
|
end
|
533
539
|
|
@@ -537,7 +543,7 @@ module VCenterDriver
|
|
537
543
|
end
|
538
544
|
|
539
545
|
# Proccess each network
|
540
|
-
def process_network(params
|
546
|
+
def process_network(params)
|
541
547
|
vc_network = params[:vc_network]
|
542
548
|
vcenter_instance_name = params[:vcenter_instance_name]
|
543
549
|
vcenter_uuid = params[:vcenter_uuid]
|
@@ -571,31 +577,23 @@ module VCenterDriver
|
|
571
577
|
opts = {}
|
572
578
|
|
573
579
|
# Add network type to network hash
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
vc_network,
|
580
|
-
vc_network_name
|
581
|
-
)
|
582
|
-
networks_type[vc_network_hash[:vc_network_ref]] = network_type
|
583
|
-
end
|
584
|
-
|
580
|
+
network_type = \
|
581
|
+
VCenterDriver::Network.get_network_type(
|
582
|
+
vc_network,
|
583
|
+
vc_network_name
|
584
|
+
)
|
585
585
|
network[vc_network_ref][:network_type] = network_type
|
586
586
|
network[vc_network_ref][:type] = network_type
|
587
587
|
|
588
588
|
# Determine if the network must be excluded
|
589
589
|
network[vc_network_ref][:excluded] = exclude_network?(
|
590
|
+
vc_network,
|
590
591
|
one_host,
|
591
592
|
args,
|
592
|
-
vc_network_hash
|
593
|
-
network_type
|
593
|
+
vc_network_hash
|
594
594
|
)
|
595
595
|
|
596
|
-
if network[vc_network_ref][:excluded] == true
|
597
|
-
return [nil, networks_type, hosts_list, host_list_object]
|
598
|
-
end
|
596
|
+
return if network[vc_network_ref][:excluded] == true
|
599
597
|
|
600
598
|
if full_process
|
601
599
|
case network[vc_network_ref][:network_type]
|
@@ -653,50 +651,31 @@ module VCenterDriver
|
|
653
651
|
vc_hosts = vc_network.host
|
654
652
|
vc_hosts.each do |vc_host|
|
655
653
|
# Get vCenter Cluster
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
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
|
654
|
+
vc_cluster = vc_host.parent
|
655
|
+
vc_cluster_ref = vc_cluster._ref
|
656
|
+
vc_cluster_name = vc_cluster.name
|
657
|
+
# Get one host from each vCenter cluster
|
658
|
+
one_host = VCenterDriver::VIHelper
|
659
|
+
.find_by_ref(OpenNebula::HostPool,
|
660
|
+
'TEMPLATE/VCENTER_CCR_REF',
|
661
|
+
vc_cluster_ref,
|
662
|
+
vcenter_uuid)
|
679
663
|
# Check if network is excluded from each host
|
680
664
|
next if exclude_network?(
|
665
|
+
vc_network,
|
681
666
|
one_host,
|
682
667
|
args,
|
683
|
-
vc_network_hash
|
684
|
-
network_type
|
668
|
+
vc_network_hash
|
685
669
|
)
|
686
670
|
|
687
671
|
# Insert vCenter cluster ref
|
688
|
-
network[vc_network_ref][:clusters][:refs] <<
|
689
|
-
vc_cluster[:vc_cluster_ref]
|
690
|
-
|
672
|
+
network[vc_network_ref][:clusters][:refs] << vc_cluster_ref
|
691
673
|
# Insert OpenNebula cluster id
|
692
674
|
cluster_id = one_cluster_id(one_host)
|
693
|
-
network[vc_network_ref][:clusters][:one_ids] <<
|
694
|
-
cluster_id
|
695
|
-
|
675
|
+
network[vc_network_ref][:clusters][:one_ids] << cluster_id
|
696
676
|
# Insert vCenter cluster name
|
697
|
-
network[vc_network_ref][:clusters][:names] <<
|
698
|
-
|
699
|
-
opts[:dc_name] = vc_cluster[:vc_cluster_name]
|
677
|
+
network[vc_network_ref][:clusters][:names] << vc_cluster_name
|
678
|
+
opts[:dc_name] = vc_cluster_name
|
700
679
|
end
|
701
680
|
|
702
681
|
# Remove duplicate entries
|
@@ -727,7 +706,7 @@ module VCenterDriver
|
|
727
706
|
network[vc_network_ref]['name']
|
728
707
|
end
|
729
708
|
|
730
|
-
|
709
|
+
network
|
731
710
|
end
|
732
711
|
|
733
712
|
# rubocop:disable Style/GlobalVars
|
@@ -744,15 +723,13 @@ module VCenterDriver
|
|
744
723
|
$conf[:one_xmlrpc]
|
745
724
|
)
|
746
725
|
end
|
726
|
+
|
747
727
|
one_host = OpenNebula::Host.new_with_id(args[:host], one_client)
|
748
728
|
rc = one_host.info
|
749
729
|
raise rc.message if OpenNebula.is_error? rc
|
750
730
|
|
751
731
|
# Get all networks in vcenter cluster (one_host)
|
752
732
|
vc_cluster_networks = cluster_networks(one_host)
|
753
|
-
networks_type = {}
|
754
|
-
hosts_list = {}
|
755
|
-
host_list_object = {}
|
756
733
|
|
757
734
|
# Iterate over vcenter networks
|
758
735
|
vc_cluster_networks.each do |vc_cluster_network|
|
@@ -774,20 +751,7 @@ module VCenterDriver
|
|
774
751
|
params[:one_host]= one_host
|
775
752
|
params[:args] = args
|
776
753
|
|
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
|
754
|
+
network = process_network(params)
|
791
755
|
|
792
756
|
networks.merge!(network) unless network.nil?
|
793
757
|
end
|
data/lib/distributed_firewall.rb
CHANGED
@@ -29,27 +29,14 @@ module NSXDriver
|
|
29
29
|
unless defined?(GEMS_LOCATION)
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
if
|
35
|
-
|
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
|
32
|
+
if File.directory?(GEMS_LOCATION)
|
33
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
34
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
35
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
44
36
|
require 'rubygems'
|
45
37
|
Gem.use_paths(real_gems_path)
|
46
|
-
ensure
|
47
|
-
$VERBOSE = verb
|
48
38
|
end
|
49
39
|
end
|
50
|
-
end
|
51
|
-
# %%RUBYGEMS_SETUP_END%%
|
52
|
-
# rubocop: enable all
|
53
40
|
|
54
41
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
55
42
|
|
data/lib/network.rb
CHANGED
@@ -534,13 +534,7 @@ module VCenterDriver
|
|
534
534
|
params[:one_host] = one_host
|
535
535
|
params[:args] = {}
|
536
536
|
|
537
|
-
selected
|
538
|
-
dc_folder.process_network(
|
539
|
-
params,
|
540
|
-
{},
|
541
|
-
{},
|
542
|
-
{}
|
543
|
-
)
|
537
|
+
selected = dc_folder.process_network(params)
|
544
538
|
|
545
539
|
selected = selected[index]
|
546
540
|
|
data/lib/nsx_client.rb
CHANGED
@@ -29,27 +29,14 @@ module NSXDriver
|
|
29
29
|
unless defined?(GEMS_LOCATION)
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
if
|
35
|
-
|
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
|
32
|
+
if File.directory?(GEMS_LOCATION)
|
33
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
34
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
35
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
44
36
|
require 'rubygems'
|
45
37
|
Gem.use_paths(real_gems_path)
|
46
|
-
ensure
|
47
|
-
$VERBOSE = verb
|
48
38
|
end
|
49
39
|
end
|
50
|
-
end
|
51
|
-
# %%RUBYGEMS_SETUP_END%%
|
52
|
-
# rubocop: enable all
|
53
40
|
|
54
41
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
55
42
|
|
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,27 +29,14 @@ module NSXDriver
|
|
29
29
|
unless defined?(GEMS_LOCATION)
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
if
|
35
|
-
|
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
|
32
|
+
if File.directory?(GEMS_LOCATION)
|
33
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
34
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
35
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
44
36
|
require 'rubygems'
|
45
37
|
Gem.use_paths(real_gems_path)
|
46
|
-
ensure
|
47
|
-
$VERBOSE = verb
|
48
38
|
end
|
49
39
|
end
|
50
|
-
end
|
51
|
-
# %%RUBYGEMS_SETUP_END%%
|
52
|
-
# rubocop: enable all
|
53
40
|
|
54
41
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
55
42
|
|
data/lib/nsx_driver.rb
CHANGED
@@ -36,27 +36,14 @@ end
|
|
36
36
|
|
37
37
|
ENV['LANG'] = 'C'
|
38
38
|
|
39
|
-
# rubocop: disable all
|
40
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
41
39
|
if File.directory?(GEMS_LOCATION)
|
42
40
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
43
41
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
44
42
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
45
|
-
|
46
|
-
|
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
|
43
|
+
require 'rubygems'
|
44
|
+
Gem.use_paths(real_gems_path)
|
56
45
|
end
|
57
46
|
end
|
58
|
-
# %%RUBYGEMS_SETUP_END%%
|
59
|
-
# rubocop: enable all
|
60
47
|
|
61
48
|
$LOAD_PATH << LIB_LOCATION + '/ruby'
|
62
49
|
$LOAD_PATH << LIB_LOCATION + '/ruby/nsx_driver'
|
data/lib/nsx_rule.rb
CHANGED
@@ -33,27 +33,14 @@ module NSXDriver
|
|
33
33
|
unless defined?(GEMS_LOCATION)
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
if
|
39
|
-
|
40
|
-
if !defined?(Gem) || Gem.path != [real_gems_path]
|
41
|
-
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
42
|
-
|
43
|
-
# Suppress warnings from Rubygems
|
44
|
-
# https://github.com/OpenNebula/one/issues/5379
|
45
|
-
begin
|
46
|
-
verb = $VERBOSE
|
47
|
-
$VERBOSE = nil
|
36
|
+
if File.directory?(GEMS_LOCATION)
|
37
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
38
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
39
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
48
40
|
require 'rubygems'
|
49
41
|
Gem.use_paths(real_gems_path)
|
50
|
-
ensure
|
51
|
-
$VERBOSE = verb
|
52
42
|
end
|
53
43
|
end
|
54
|
-
end
|
55
|
-
# %%RUBYGEMS_SETUP_END%%
|
56
|
-
# rubocop: enable all
|
57
44
|
|
58
45
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
59
46
|
|
data/lib/nsxt_client.rb
CHANGED
@@ -29,27 +29,14 @@ module NSXDriver
|
|
29
29
|
unless defined?(GEMS_LOCATION)
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
if
|
35
|
-
|
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
|
32
|
+
if File.directory?(GEMS_LOCATION)
|
33
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
34
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
35
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
44
36
|
require 'rubygems'
|
45
37
|
Gem.use_paths(real_gems_path)
|
46
|
-
ensure
|
47
|
-
$VERBOSE = verb
|
48
38
|
end
|
49
39
|
end
|
50
|
-
end
|
51
|
-
# %%RUBYGEMS_SETUP_END%%
|
52
|
-
# rubocop: enable all
|
53
40
|
|
54
41
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
55
42
|
|
data/lib/nsxv_client.rb
CHANGED
@@ -29,27 +29,14 @@ module NSXDriver
|
|
29
29
|
unless defined?(GEMS_LOCATION)
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
if
|
35
|
-
|
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
|
32
|
+
if File.directory?(GEMS_LOCATION)
|
33
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
34
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
35
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
44
36
|
require 'rubygems'
|
45
37
|
Gem.use_paths(real_gems_path)
|
46
|
-
ensure
|
47
|
-
$VERBOSE = verb
|
48
38
|
end
|
49
39
|
end
|
50
|
-
end
|
51
|
-
# %%RUBYGEMS_SETUP_END%%
|
52
|
-
# rubocop: enable all
|
53
40
|
|
54
41
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
55
42
|
|
@@ -361,8 +361,8 @@ module OpenNebula
|
|
361
361
|
# exceeds the limit
|
362
362
|
new_name = "#{template.name}-#{name}"
|
363
363
|
|
364
|
-
if new_name.size >
|
365
|
-
new_name = "#{template.name[0..(
|
364
|
+
if new_name.size > 128
|
365
|
+
new_name = "#{template.name[0..(126 - name.size)]}-#{name}"
|
366
366
|
end
|
367
367
|
|
368
368
|
rc = template.clone(new_name, recursive)
|
@@ -267,20 +267,17 @@ module OpenNebula::VirtualMachineExt
|
|
267
267
|
# --------------------------------------------------------------
|
268
268
|
# Check backup consistency
|
269
269
|
# --------------------------------------------------------------
|
270
|
-
|
271
|
-
|
272
|
-
|
270
|
+
unless binfo
|
271
|
+
rc = info
|
272
|
+
raise rc.message if OpenNebula.is_error?(rc)
|
273
273
|
|
274
|
-
|
275
|
-
new_val.nil? ? old_val : new_val
|
274
|
+
binfo = backup_info
|
276
275
|
end
|
277
276
|
|
278
277
|
raise 'No backup information' if binfo.nil?
|
279
278
|
|
280
279
|
raise 'No frequency defined' unless valid?(binfo[:freq])
|
281
280
|
|
282
|
-
raise 'No marketplace defined' unless valid?(binfo[:market])
|
283
|
-
|
284
281
|
return if Time.now.to_i - binfo[:last].to_i < binfo[:freq].to_i
|
285
282
|
|
286
283
|
# --------------------------------------------------------------
|
@@ -322,12 +319,19 @@ module OpenNebula::VirtualMachineExt
|
|
322
319
|
# --------------------------------------------------------------
|
323
320
|
# Cleanup
|
324
321
|
# --------------------------------------------------------------
|
325
|
-
|
326
|
-
rescue Error, StandardError => e
|
327
|
-
backup_cleanup(keep, logger, binfo, tmp)
|
322
|
+
logger.info "Deleting template #{tmp.id}" if logger
|
328
323
|
|
329
|
-
|
324
|
+
tmp.delete(true)
|
330
325
|
|
326
|
+
binfo[:apps].each do |id|
|
327
|
+
logger.info "Deleting applicance #{id}" if logger
|
328
|
+
|
329
|
+
papp = OpenNebula::MarketPlaceApp.new_with_id(id, @client)
|
330
|
+
|
331
|
+
papp.delete
|
332
|
+
end if !keep && binfo[:apps]
|
333
|
+
rescue Error, StandardError => e
|
334
|
+
logger.fatal(e.inspect) if logger
|
331
335
|
raise
|
332
336
|
end
|
333
337
|
|
@@ -417,9 +421,9 @@ module OpenNebula::VirtualMachineExt
|
|
417
421
|
|
418
422
|
private
|
419
423
|
|
420
|
-
|
424
|
+
# --------------------------------------------------------------
|
421
425
|
# Check an attribute is defined and valid
|
422
|
-
|
426
|
+
# --------------------------------------------------------------
|
423
427
|
def valid?(att)
|
424
428
|
return false if att.nil?
|
425
429
|
|
@@ -450,9 +454,6 @@ module OpenNebula::VirtualMachineExt
|
|
450
454
|
binfo
|
451
455
|
end
|
452
456
|
|
453
|
-
#-------------------------------------------------------------------
|
454
|
-
# Generate backup information string
|
455
|
-
#-------------------------------------------------------------------
|
456
457
|
def backup_attr(binfo, ids)
|
457
458
|
'BACKUP=[' \
|
458
459
|
" MARKETPLACE_APP_IDS = \"#{ids.join(',')}\"," \
|
@@ -461,25 +462,6 @@ module OpenNebula::VirtualMachineExt
|
|
461
462
|
" MARKETPLACE_ID = \"#{binfo[:market]}\" ]"
|
462
463
|
end
|
463
464
|
|
464
|
-
#-------------------------------------------------------------------
|
465
|
-
# Cleanup backup leftovers in case of failure
|
466
|
-
#-------------------------------------------------------------------
|
467
|
-
def backup_cleanup(keep, logger, binfo, template)
|
468
|
-
if template
|
469
|
-
logger.info "Deleting template #{template.id}" if logger
|
470
|
-
|
471
|
-
template.delete(true)
|
472
|
-
end
|
473
|
-
|
474
|
-
binfo[:apps].each do |id|
|
475
|
-
logger.info "Deleting applicance #{id}" if logger
|
476
|
-
|
477
|
-
papp = OpenNebula::MarketPlaceApp.new_with_id(id, @client)
|
478
|
-
|
479
|
-
papp.delete
|
480
|
-
end if !keep && binfo[:apps]
|
481
|
-
end
|
482
|
-
|
483
465
|
end
|
484
466
|
end
|
485
467
|
|
data/lib/opennebula.rb
CHANGED
data/lib/vcenter_driver.rb
CHANGED
@@ -36,25 +36,14 @@ end
|
|
36
36
|
|
37
37
|
ENV['LANG'] = 'C'
|
38
38
|
|
39
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
40
39
|
if File.directory?(GEMS_LOCATION)
|
41
40
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
42
41
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
43
42
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
44
|
-
|
45
|
-
|
46
|
-
# https://github.com/OpenNebula/one/issues/5379
|
47
|
-
begin
|
48
|
-
verb = $VERBOSE
|
49
|
-
$VERBOSE = nil
|
50
|
-
require 'rubygems'
|
51
|
-
Gem.use_paths(real_gems_path)
|
52
|
-
ensure
|
53
|
-
$VERBOSE = verb
|
54
|
-
end
|
43
|
+
require 'rubygems'
|
44
|
+
Gem.use_paths(real_gems_path)
|
55
45
|
end
|
56
46
|
end
|
57
|
-
# %%RUBYGEMS_SETUP_END%%
|
58
47
|
|
59
48
|
$LOAD_PATH << LIB_LOCATION + '/ruby/vendors/rbvmomi/lib'
|
60
49
|
$LOAD_PATH << LIB_LOCATION + '/ruby'
|
data/lib/vcenter_importer.rb
CHANGED
@@ -496,9 +496,9 @@ module VCenterDriver
|
|
496
496
|
end
|
497
497
|
|
498
498
|
#
|
499
|
-
# Create and allocate a
|
499
|
+
# Create and allocate a Opennebula Object.
|
500
500
|
#
|
501
|
-
# @param info [String] Info passed to
|
501
|
+
# @param info [String] Info passed to opennebula Core.
|
502
502
|
#
|
503
503
|
# @return [&block] the allocated object through a block.
|
504
504
|
#
|
data/lib/virtual_machine.rb
CHANGED
@@ -33,27 +33,14 @@ module VCenterDriver
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
if
|
39
|
-
|
40
|
-
if !defined?(Gem) || Gem.path != [real_gems_path]
|
41
|
-
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
42
|
-
|
43
|
-
# Suppress warnings from Rubygems
|
44
|
-
# https://github.com/OpenNebula/one/issues/5379
|
45
|
-
begin
|
46
|
-
verb = $VERBOSE
|
47
|
-
$VERBOSE = nil
|
36
|
+
if File.directory?(GEMS_LOCATION)
|
37
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
38
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
39
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
48
40
|
require 'rubygems'
|
49
41
|
Gem.use_paths(real_gems_path)
|
50
|
-
ensure
|
51
|
-
$VERBOSE = verb
|
52
42
|
end
|
53
43
|
end
|
54
|
-
end
|
55
|
-
# %%RUBYGEMS_SETUP_END%%
|
56
|
-
# rubocop: enable all
|
57
44
|
|
58
45
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
59
46
|
|
@@ -1054,8 +1041,7 @@ end
|
|
1054
1041
|
else
|
1055
1042
|
if snapshots?
|
1056
1043
|
error = 'Disk metadata not present and snapshots exist. ' \
|
1057
|
-
'
|
1058
|
-
'--delete-db".'
|
1044
|
+
'OpenNebula cannot manage this VM.'
|
1059
1045
|
raise error
|
1060
1046
|
end
|
1061
1047
|
|
@@ -2415,15 +2401,6 @@ end
|
|
2415
2401
|
|
2416
2402
|
# Attach DISK to VM (hotplug)
|
2417
2403
|
def attach_disk(disk)
|
2418
|
-
# Adding a new disk in newer vSphere versions
|
2419
|
-
# automatically cleans all system snapshots
|
2420
|
-
# https://github.com/OpenNebula/one/issues/5409
|
2421
|
-
if snapshots? or one_snapshots?
|
2422
|
-
error_message = 'Existing sytem snapshots, cannot change disks. '
|
2423
|
-
error_message << 'Please remove all snapshots and try again.'
|
2424
|
-
raise error_message
|
2425
|
-
end
|
2426
|
-
|
2427
2404
|
spec_hash = {}
|
2428
2405
|
device_change = []
|
2429
2406
|
|
@@ -2605,12 +2582,6 @@ end
|
|
2605
2582
|
def detach_disk(disk)
|
2606
2583
|
return unless disk.exists?
|
2607
2584
|
|
2608
|
-
if snapshots? or one_snapshots?
|
2609
|
-
error_message = 'Existing sytem snapshots, cannot change disks. '
|
2610
|
-
error_message << 'Please remove all snapshots and try again.'
|
2611
|
-
raise error_message
|
2612
|
-
end
|
2613
|
-
|
2614
2585
|
spec_hash = {}
|
2615
2586
|
spec_hash[:extraConfig] = [disk.config(:delete)]
|
2616
2587
|
spec_hash[:deviceChange] = [{
|
@@ -2640,15 +2611,15 @@ end
|
|
2640
2611
|
# - The disk is managed by OpenNebula
|
2641
2612
|
detachable= !(one_vm['LCM_STATE'].to_i == 11 && !disk.managed?)
|
2642
2613
|
detachable &&= disk.exists?
|
2643
|
-
|
2614
|
+
|
2644
2615
|
return unless detachable
|
2645
2616
|
|
2646
2617
|
detach_disk(disk)
|
2647
2618
|
|
2648
2619
|
# Check if we want to keep the non persistent disk
|
2649
2620
|
keep_non_persistent_disks =
|
2650
|
-
VCenterDriver::CONFIG[:keep_non_persistent_disks]
|
2651
|
-
|
2621
|
+
VCenterDriver::CONFIG[:keep_non_persistent_disks]
|
2622
|
+
|
2652
2623
|
return if keep_non_persistent_disks == true
|
2653
2624
|
|
2654
2625
|
disk.destroy
|
@@ -2845,7 +2816,7 @@ end
|
|
2845
2816
|
# Convert VM to template in vCenter
|
2846
2817
|
mark_as_template
|
2847
2818
|
|
2848
|
-
# Edit the
|
2819
|
+
# Edit the Opennebula template
|
2849
2820
|
one_client = OpenNebula::Client.new
|
2850
2821
|
template_id = one_item['TEMPLATE/TEMPLATE_ID']
|
2851
2822
|
new_template = OpenNebula::Template.new_with_id(template_id,
|
@@ -2896,15 +2867,6 @@ end
|
|
2896
2867
|
self['rootSnapshot'] && !self['rootSnapshot'].empty?
|
2897
2868
|
end
|
2898
2869
|
|
2899
|
-
def one_snapshots?
|
2900
|
-
begin
|
2901
|
-
!one_item['TEMPLATE/SNAPSHOT'].nil?
|
2902
|
-
rescue StandardError
|
2903
|
-
# one_item may not be retrieved if deploy_id hasn't been set
|
2904
|
-
false
|
2905
|
-
end
|
2906
|
-
end
|
2907
|
-
|
2908
2870
|
def instantiated_as_persistent?
|
2909
2871
|
begin
|
2910
2872
|
!one_item['TEMPLATE/CLONING_TEMPLATE_ID'].nil?
|
data/lib/vm_template.rb
CHANGED
@@ -1573,8 +1573,9 @@ module VCenterDriver
|
|
1573
1573
|
str << "]\n"
|
1574
1574
|
|
1575
1575
|
if annotation.nil? || annotation.empty?
|
1576
|
-
str << 'DESCRIPTION = "vCenter Template
|
1577
|
-
|
1576
|
+
str << 'DESCRIPTION = "vCenter Template \
|
1577
|
+
imported by OpenNebula' \
|
1578
|
+
" from Cluster #{ccr_name}\"\n"
|
1578
1579
|
else
|
1579
1580
|
notes = annotation.gsub('\\', '\\\\').gsub('"', '\\"')
|
1580
1581
|
str << "DESCRIPTION = \"#{notes}\"\n"
|
data/lib/vmm_importer.rb
CHANGED
@@ -54,14 +54,6 @@ module VCenterDriver
|
|
54
54
|
|
55
55
|
vc_vm = VCenterDriver::VirtualMachine.new_without_id(@vi_client,
|
56
56
|
vm_ref)
|
57
|
-
|
58
|
-
# Importing Wild VMs with snapshots is not supported
|
59
|
-
# https://github.com/OpenNebula/one/issues/1268
|
60
|
-
if vc_vm.snapshots? && vc_vm.disk_keys.empty?
|
61
|
-
raise 'Disk metadata not present and snapshots exist, '\
|
62
|
-
'cannot import this VM'
|
63
|
-
end
|
64
|
-
|
65
57
|
vname = vc_vm['name']
|
66
58
|
|
67
59
|
type = { :object => 'VM', :id => vname }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opennebula
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.
|
4
|
+
version: 6.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenNebula
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -117,24 +117,24 @@ files:
|
|
117
117
|
- lib/opennebula.rb
|
118
118
|
- lib/vcenter_driver.rb
|
119
119
|
- lib/datacenter.rb
|
120
|
+
- lib/datastore.rb
|
121
|
+
- lib/file_helper.rb
|
122
|
+
- lib/host.rb
|
120
123
|
- lib/memoize.rb
|
121
124
|
- lib/network.rb
|
122
125
|
- lib/rest_client.rb
|
126
|
+
- lib/vcenter_importer.rb
|
123
127
|
- lib/vi_client.rb
|
124
128
|
- lib/vi_helper.rb
|
129
|
+
- lib/virtual_machine.rb
|
125
130
|
- lib/vm_device.rb
|
126
131
|
- lib/vm_disk.rb
|
127
132
|
- lib/vm_nic.rb
|
128
133
|
- lib/vm_helper.rb
|
129
134
|
- lib/vm_monitor.rb
|
130
135
|
- lib/vm_folder.rb
|
131
|
-
- lib/vmm_importer.rb
|
132
|
-
- lib/datastore.rb
|
133
|
-
- lib/file_helper.rb
|
134
|
-
- lib/host.rb
|
135
|
-
- lib/vcenter_importer.rb
|
136
|
-
- lib/virtual_machine.rb
|
137
136
|
- lib/vm_template.rb
|
137
|
+
- lib/vmm_importer.rb
|
138
138
|
- lib/nsx_driver.rb
|
139
139
|
- lib/distributed_firewall.rb
|
140
140
|
- lib/logical_port.rb
|
@@ -189,11 +189,13 @@ files:
|
|
189
189
|
- lib/opennebula/image.rb
|
190
190
|
- lib/opennebula/image_pool.rb
|
191
191
|
- lib/opennebula/lockable_ext.rb
|
192
|
+
- lib/opennebula/marketplace.rb
|
192
193
|
- lib/opennebula/marketplace_pool.rb
|
193
194
|
- lib/opennebula/marketplaceapp.rb
|
194
195
|
- lib/opennebula/marketplaceapp_ext.rb
|
195
196
|
- lib/opennebula/marketplaceapp_pool.rb
|
196
197
|
- lib/opennebula/oneflow_client.rb
|
198
|
+
- lib/opennebula/pool.rb
|
197
199
|
- lib/opennebula/pool_element.rb
|
198
200
|
- lib/opennebula/security_group.rb
|
199
201
|
- lib/opennebula/security_group_pool.rb
|
@@ -201,11 +203,14 @@ files:
|
|
201
203
|
- lib/opennebula/template.rb
|
202
204
|
- lib/opennebula/template_ext.rb
|
203
205
|
- lib/opennebula/template_pool.rb
|
206
|
+
- lib/opennebula/user.rb
|
204
207
|
- lib/opennebula/user_pool.rb
|
205
208
|
- lib/opennebula/utils.rb
|
206
209
|
- lib/opennebula/vdc.rb
|
207
210
|
- lib/opennebula/vdc_pool.rb
|
211
|
+
- lib/opennebula/virtual_machine.rb
|
208
212
|
- lib/opennebula/virtual_machine_ext.rb
|
213
|
+
- lib/opennebula/virtual_machine_pool.rb
|
209
214
|
- lib/opennebula/virtual_network.rb
|
210
215
|
- lib/opennebula/virtual_network_pool.rb
|
211
216
|
- lib/opennebula/virtual_router.rb
|
@@ -214,25 +219,20 @@ files:
|
|
214
219
|
- lib/opennebula/vm_group_pool.rb
|
215
220
|
- lib/opennebula/vntemplate.rb
|
216
221
|
- lib/opennebula/vntemplate_pool.rb
|
222
|
+
- lib/opennebula/wait_ext.rb
|
217
223
|
- lib/opennebula/xml_element.rb
|
218
224
|
- lib/opennebula/xml_pool.rb
|
219
225
|
- lib/opennebula/xml_utils.rb
|
220
226
|
- lib/opennebula/zone_pool.rb
|
221
|
-
- lib/opennebula/marketplace.rb
|
222
|
-
- lib/opennebula/pool.rb
|
223
|
-
- lib/opennebula/user.rb
|
224
|
-
- lib/opennebula/virtual_machine.rb
|
225
|
-
- lib/opennebula/virtual_machine_pool.rb
|
226
|
-
- lib/opennebula/wait_ext.rb
|
227
227
|
- lib/opennebula/zone.rb
|
228
228
|
- lib/opennebula/flow/grammar.rb
|
229
229
|
- lib/opennebula/flow/service_pool.rb
|
230
|
+
- lib/opennebula/flow/service_template.rb
|
230
231
|
- lib/opennebula/flow/service_template_ext.rb
|
231
232
|
- lib/opennebula/flow/service_template_pool.rb
|
232
233
|
- lib/opennebula/flow/validator.rb
|
233
|
-
- lib/opennebula/flow/service_template.rb
|
234
|
-
- lib/opennebula/ldap_auth_spec.rb
|
235
234
|
- lib/opennebula/ldap_auth.rb
|
235
|
+
- lib/opennebula/ldap_auth_spec.rb
|
236
236
|
- lib/opennebula/server_cipher_auth.rb
|
237
237
|
- lib/opennebula/server_x509_auth.rb
|
238
238
|
- lib/opennebula/ssh_auth.rb
|