opennebula 5.13.90.pre → 6.0.0.3
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 +71 -37
- data/lib/distributed_firewall.rb +17 -4
- data/lib/network.rb +13 -16
- 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/flow/service_template.rb +37 -1
- data/lib/opennebula/marketplaceapp_ext.rb +77 -13
- data/lib/opennebula/virtual_machine_ext.rb +35 -17
- data/lib/opennebula.rb +1 -1
- 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 +48 -10
- data/lib/vm_template.rb +9 -8
- data/lib/vmm_importer.rb +8 -0
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a444d034775d99b9c676a7718063ff71798eb2ee
|
4
|
+
data.tar.gz: aba015a7d6e223011bb9f33fd1a610dcc01b1379
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dad15a530bfa73ffce417c4dc66f8f2118239de7396c7aa1cdae928869f69b994e1dc61a93ab410de9b74511d4a770eac922b07db1d29391758d91fb11b54e6
|
7
|
+
data.tar.gz: e00ba49630acf67ae3fbcc1c715a7164ede4b6aec81fa059ecbe6536f8d90c7477ece5c3e73a9e5a1aafc26508729e9fb390ecfef43815e93f1042f6594a1ca9
|
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,26 +570,32 @@ module VCenterDriver
|
|
576
570
|
# Initialize opts hash used to inject data into one template
|
577
571
|
opts = {}
|
578
572
|
|
579
|
-
# if full_process
|
580
573
|
# Add network type to network hash
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
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 =
|
578
|
+
VCenterDriver::Network.get_network_type(
|
579
|
+
vc_network,
|
580
|
+
vc_network_name
|
581
|
+
)
|
582
|
+
networks_type[vc_network_hash[:vc_network_ref]] = network_type
|
583
|
+
end
|
584
|
+
|
586
585
|
network[vc_network_ref][:network_type] = network_type
|
587
586
|
network[vc_network_ref][:type] = network_type
|
588
|
-
# end
|
589
587
|
|
590
588
|
# Determine if the network must be excluded
|
591
589
|
network[vc_network_ref][:excluded] = exclude_network?(
|
592
|
-
vc_network,
|
593
590
|
one_host,
|
594
591
|
args,
|
595
|
-
vc_network_hash
|
592
|
+
vc_network_hash,
|
593
|
+
network_type
|
596
594
|
)
|
597
595
|
|
598
|
-
|
596
|
+
if network[vc_network_ref][:excluded] == true
|
597
|
+
return [nil, networks_type, hosts_list, host_list_object]
|
598
|
+
end
|
599
599
|
|
600
600
|
if full_process
|
601
601
|
case network[vc_network_ref][:network_type]
|
@@ -653,31 +653,50 @@ module VCenterDriver
|
|
653
653
|
vc_hosts = vc_network.host
|
654
654
|
vc_hosts.each do |vc_host|
|
655
655
|
# Get vCenter Cluster
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
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
|
665
679
|
# Check if network is excluded from each host
|
666
680
|
next if exclude_network?(
|
667
|
-
vc_network,
|
668
681
|
one_host,
|
669
682
|
args,
|
670
|
-
vc_network_hash
|
683
|
+
vc_network_hash,
|
684
|
+
network_type
|
671
685
|
)
|
672
686
|
|
673
687
|
# Insert vCenter cluster ref
|
674
|
-
network[vc_network_ref][:clusters][:refs] <<
|
688
|
+
network[vc_network_ref][:clusters][:refs] <<
|
689
|
+
vc_cluster[:vc_cluster_ref]
|
690
|
+
|
675
691
|
# Insert OpenNebula cluster id
|
676
692
|
cluster_id = one_cluster_id(one_host)
|
677
|
-
network[vc_network_ref][:clusters][:one_ids] <<
|
693
|
+
network[vc_network_ref][:clusters][:one_ids] <<
|
694
|
+
cluster_id
|
695
|
+
|
678
696
|
# Insert vCenter cluster name
|
679
|
-
network[vc_network_ref][:clusters][:names] <<
|
680
|
-
|
697
|
+
network[vc_network_ref][:clusters][:names] <<
|
698
|
+
vc_cluster[:vc_cluster_name]
|
699
|
+
opts[:dc_name] = vc_cluster[:vc_cluster_name]
|
681
700
|
end
|
682
701
|
|
683
702
|
# Remove duplicate entries
|
@@ -708,7 +727,7 @@ module VCenterDriver
|
|
708
727
|
network[vc_network_ref]['name']
|
709
728
|
end
|
710
729
|
|
711
|
-
network
|
730
|
+
[network, networks_type, hosts_list, host_list_object]
|
712
731
|
end
|
713
732
|
|
714
733
|
# rubocop:disable Style/GlobalVars
|
@@ -725,13 +744,15 @@ module VCenterDriver
|
|
725
744
|
$conf[:one_xmlrpc]
|
726
745
|
)
|
727
746
|
end
|
728
|
-
|
729
747
|
one_host = OpenNebula::Host.new_with_id(args[:host], one_client)
|
730
748
|
rc = one_host.info
|
731
749
|
raise rc.message if OpenNebula.is_error? rc
|
732
750
|
|
733
751
|
# Get all networks in vcenter cluster (one_host)
|
734
752
|
vc_cluster_networks = cluster_networks(one_host)
|
753
|
+
networks_type = {}
|
754
|
+
hosts_list = {}
|
755
|
+
host_list_object = {}
|
735
756
|
|
736
757
|
# Iterate over vcenter networks
|
737
758
|
vc_cluster_networks.each do |vc_cluster_network|
|
@@ -753,7 +774,20 @@ module VCenterDriver
|
|
753
774
|
params[:one_host]= one_host
|
754
775
|
params[:args] = args
|
755
776
|
|
756
|
-
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
|
757
791
|
|
758
792
|
networks.merge!(network) unless network.nil?
|
759
793
|
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,7 +486,7 @@ module VCenterDriver
|
|
486
486
|
@defaults = { :size => '255', :type => 'ether' }
|
487
487
|
end
|
488
488
|
|
489
|
-
def process_import(indexes, opts = {}, &
|
489
|
+
def process_import(indexes, opts = {}, &_block)
|
490
490
|
indexes = indexes.gsub(/\s*\,\s*/, ',').strip.split(',')
|
491
491
|
|
492
492
|
dc_folder = VCenterDriver::DatacenterFolder.new(@vi_client)
|
@@ -526,30 +526,27 @@ module VCenterDriver
|
|
526
526
|
"#{hpool.message}"
|
527
527
|
end
|
528
528
|
|
529
|
-
opts = {}
|
530
|
-
|
531
529
|
params = {}
|
532
530
|
params[:vc_network] = vc_cluster_network
|
533
531
|
params[:vcenter_instance_name] = vcenter_instance_name
|
534
532
|
params[:vcenter_uuid] = vcenter_uuid
|
535
533
|
params[:_hpool] = hpool
|
536
534
|
params[:one_host] = one_host
|
537
|
-
params[:args] =
|
535
|
+
params[:args] = {}
|
538
536
|
|
539
|
-
selected =
|
537
|
+
selected, _networks_type, _hosts_list, _clusters_list =
|
538
|
+
dc_folder.process_network(
|
539
|
+
params,
|
540
|
+
{},
|
541
|
+
{},
|
542
|
+
{}
|
543
|
+
)
|
540
544
|
|
541
545
|
selected = selected[index]
|
542
546
|
|
543
|
-
if block_given?
|
544
|
-
@info[index][:opts] = block.call(selected)
|
545
|
-
elsif opts[index]
|
546
|
-
@info[index][:opts] = opts[index]
|
547
|
-
else
|
548
|
-
@info[index][:opts] = defaults
|
549
|
-
end
|
550
|
-
|
551
547
|
# import the object
|
552
|
-
|
548
|
+
opts[index] ||= @defaults
|
549
|
+
@info[:success] << import(selected, opts[index])
|
553
550
|
rescue StandardError => e
|
554
551
|
@info[:error] << { index => e.message }
|
555
552
|
@info[index][:e] = e
|
@@ -645,8 +642,8 @@ module VCenterDriver
|
|
645
642
|
str
|
646
643
|
end
|
647
644
|
|
648
|
-
def import(selected)
|
649
|
-
opts = @info[selected[:ref]][:opts]
|
645
|
+
def import(selected, opts = nil)
|
646
|
+
opts = @info[selected[:ref]][:opts] if opts.nil?
|
650
647
|
|
651
648
|
net = VCenterDriver::Network
|
652
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'
|
data/lib/nsx_rule.rb
CHANGED
@@ -33,14 +33,27 @@ module NSXDriver
|
|
33
33
|
unless defined?(GEMS_LOCATION)
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
# rubocop: disable all
|
37
|
+
# %%RUBYGEMS_SETUP_BEGIN%%
|
38
|
+
if File.directory?(GEMS_LOCATION)
|
39
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
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
|
40
48
|
require 'rubygems'
|
41
49
|
Gem.use_paths(real_gems_path)
|
50
|
+
ensure
|
51
|
+
$VERBOSE = verb
|
42
52
|
end
|
43
53
|
end
|
54
|
+
end
|
55
|
+
# %%RUBYGEMS_SETUP_END%%
|
56
|
+
# rubocop: enable all
|
44
57
|
|
45
58
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
46
59
|
|
data/lib/nsxt_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/nsxv_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
|
|
@@ -357,7 +357,15 @@ module OpenNebula
|
|
357
357
|
|
358
358
|
break rc if OpenNebula.is_error?(rc)
|
359
359
|
|
360
|
-
|
360
|
+
# The maximum size is 128, so crop the template name if it
|
361
|
+
# exceeds the limit
|
362
|
+
new_name = "#{template.name}-#{name}"
|
363
|
+
|
364
|
+
if new_name.size > 119
|
365
|
+
new_name = "#{template.name[0..(119 - name.size)]}-#{name}"
|
366
|
+
end
|
367
|
+
|
368
|
+
rc = template.clone(new_name, recursive)
|
361
369
|
|
362
370
|
break rc if OpenNebula.is_error?(rc)
|
363
371
|
|
@@ -384,6 +392,9 @@ module OpenNebula
|
|
384
392
|
return rc
|
385
393
|
end
|
386
394
|
|
395
|
+
# add registration time, as the template is new
|
396
|
+
body['registration_time'] = Integer(Time.now)
|
397
|
+
|
387
398
|
# update the template with the new body
|
388
399
|
doc.update(body.to_json)
|
389
400
|
|
@@ -391,6 +402,31 @@ module OpenNebula
|
|
391
402
|
new_id
|
392
403
|
end
|
393
404
|
|
405
|
+
# Clones a service template
|
406
|
+
#
|
407
|
+
# @param name [Stirng] New name
|
408
|
+
#
|
409
|
+
# @return [Integer] New template ID
|
410
|
+
def clone(name)
|
411
|
+
new_id = super
|
412
|
+
|
413
|
+
doc = OpenNebula::ServiceTemplate.new_with_id(new_id, @client)
|
414
|
+
rc = doc.info
|
415
|
+
|
416
|
+
return rc if OpenNebula.is_error?(rc)
|
417
|
+
|
418
|
+
body = JSON.parse(doc["TEMPLATE/#{TEMPLATE_TAG}"])
|
419
|
+
|
420
|
+
# add registration time, as the template is new
|
421
|
+
body['registration_time'] = Integer(Time.now)
|
422
|
+
|
423
|
+
# update the template with the new body
|
424
|
+
DocumentJSON.instance_method(:update).bind(doc).call(body.to_json)
|
425
|
+
|
426
|
+
# return the new document ID
|
427
|
+
new_id
|
428
|
+
end
|
429
|
+
|
394
430
|
# Replaces the raw template contents
|
395
431
|
#
|
396
432
|
# @param template [String] New template contents, in the form KEY = VAL
|
@@ -155,6 +155,10 @@ module OpenNebula::MarketPlaceAppExt
|
|
155
155
|
is_vcenter = !OpenNebula.is_error?(rc) &&
|
156
156
|
(ds['TEMPLATE/DRIVER'] == 'vcenter')
|
157
157
|
|
158
|
+
if is_vcenter && options[:template].nil?
|
159
|
+
options = update_options_with_template(options)
|
160
|
+
end
|
161
|
+
|
158
162
|
#---------------------------------------------------------------
|
159
163
|
# Allocate the image in OpenNebula
|
160
164
|
#---------------------------------------------------------------
|
@@ -181,15 +185,17 @@ module OpenNebula::MarketPlaceAppExt
|
|
181
185
|
#---------------------------------------------------------------
|
182
186
|
# Created an associated VMTemplate if needed
|
183
187
|
#---------------------------------------------------------------
|
184
|
-
if self['TEMPLATE/VMTEMPLATE64'].nil? ||
|
188
|
+
if (self['TEMPLATE/VMTEMPLATE64'].nil? && !is_vcenter) ||
|
189
|
+
options[:notemplate] ||
|
190
|
+
options[:template] == -1
|
185
191
|
return rc_info
|
186
192
|
end
|
187
193
|
|
188
194
|
if !options[:template].nil?
|
189
195
|
template_id = options[:template]
|
190
196
|
|
191
|
-
if template_id
|
192
|
-
template_id
|
197
|
+
if template_id < 0
|
198
|
+
raise 'Invalid option, template_id must be a valid ID'
|
193
199
|
end
|
194
200
|
|
195
201
|
template = Template.new_with_id(template_id, @client)
|
@@ -280,6 +286,33 @@ module OpenNebula::MarketPlaceAppExt
|
|
280
286
|
rc
|
281
287
|
end
|
282
288
|
|
289
|
+
def update_options_with_template(options, _validate = false)
|
290
|
+
vcenterrc_path =
|
291
|
+
"#{VAR_LOCATION}/remotes/etc/vmm/vcenter/vcenterrc"
|
292
|
+
|
293
|
+
if File.file?(vcenterrc_path)
|
294
|
+
config_vcenter = YAML.load_file(vcenterrc_path)
|
295
|
+
|
296
|
+
if config_vcenter.key?(:default_template)
|
297
|
+
options[:template] =
|
298
|
+
config_vcenter[:default_template]
|
299
|
+
|
300
|
+
options
|
301
|
+
else
|
302
|
+
raise "Couldn't find default_template " \
|
303
|
+
'configuration in vcenterrc conf ' \
|
304
|
+
'file. Please use the --template ' \
|
305
|
+
'file to define a VM Template ID if ' \
|
306
|
+
'needed or add default_template to' \
|
307
|
+
' vcenterrc conf file'
|
308
|
+
end
|
309
|
+
else
|
310
|
+
raise "Couldn't find vcenterrc conf file. " \
|
311
|
+
' Please use the --template file to define' \
|
312
|
+
' a VM Template ID if needed.'
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
283
316
|
# Creates a VM template based on the APPTEMPLATE64 attribute
|
284
317
|
# @param [Hash] options
|
285
318
|
# :export_name [String] name of the vm template
|
@@ -288,19 +321,50 @@ module OpenNebula::MarketPlaceAppExt
|
|
288
321
|
#
|
289
322
|
# @return [Integer, OpenNebula::Error] template id or error
|
290
323
|
def create_vm_template(options, disks)
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
if self['TEMPLATE/APPTEMPLATE64'].nil?
|
295
|
-
return Error.new("Missing APPTEMPLATE64 for App #{id}")
|
296
|
-
end
|
324
|
+
dsid = options[:dsid]
|
325
|
+
ds = OpenNebula::Datastore.new_with_id(dsid, @client)
|
326
|
+
rc = ds.info
|
297
327
|
|
298
|
-
|
328
|
+
is_vcenter =
|
329
|
+
!OpenNebula.is_error?(rc) &&
|
330
|
+
(ds['TEMPLATE/DRIVER'] == 'vcenter')
|
331
|
+
|
332
|
+
if is_vcenter
|
333
|
+
if options[:template].nil?
|
334
|
+
options = update_options_with_template(options)
|
335
|
+
end
|
336
|
+
|
337
|
+
template_id = options[:template]
|
338
|
+
|
339
|
+
if template_id < 0
|
340
|
+
return
|
341
|
+
end
|
342
|
+
|
343
|
+
template = Template.new_with_id(template_id, @client)
|
344
|
+
|
345
|
+
vmtpl_id = template.clone(
|
346
|
+
options[:vmtemplate_name] || options[:name]
|
347
|
+
)
|
348
|
+
|
349
|
+
vmtpl = Template.new_with_id(vmtpl_id, @client)
|
350
|
+
rc = vmtpl.info
|
351
|
+
else
|
352
|
+
# ----------------------------------------------------------
|
353
|
+
# Allocate Template
|
354
|
+
# ----------------------------------------------------------
|
355
|
+
if self['TEMPLATE/APPTEMPLATE64'].nil?
|
356
|
+
return Error.new(
|
357
|
+
"Missing APPTEMPLATE64 for App #{id}"
|
358
|
+
)
|
359
|
+
end
|
360
|
+
|
361
|
+
tmpl = Base64.decode64(self['TEMPLATE/APPTEMPLATE64'])
|
299
362
|
|
300
|
-
|
363
|
+
tmpl << "\nNAME=\"#{options[:name]}\"\n"
|
301
364
|
|
302
|
-
|
303
|
-
|
365
|
+
vmtpl = Template.new(Template.build_xml, @client)
|
366
|
+
rc = vmtpl.allocate(tmpl)
|
367
|
+
end
|
304
368
|
|
305
369
|
return rc if OpenNebula.is_error?(rc)
|
306
370
|
|
@@ -267,17 +267,20 @@ module OpenNebula::VirtualMachineExt
|
|
267
267
|
# --------------------------------------------------------------
|
268
268
|
# Check backup consistency
|
269
269
|
# --------------------------------------------------------------
|
270
|
-
|
271
|
-
rc = info
|
272
|
-
raise rc.message if OpenNebula.is_error?(rc)
|
270
|
+
rc = info
|
273
271
|
|
274
|
-
|
272
|
+
raise rc.message if OpenNebula.is_error?(rc)
|
273
|
+
|
274
|
+
binfo.merge!(backup_info) do |key, old_val, new_val|
|
275
|
+
new_val.nil? ? old_val : new_val
|
275
276
|
end
|
276
277
|
|
277
278
|
raise 'No backup information' if binfo.nil?
|
278
279
|
|
279
280
|
raise 'No frequency defined' unless valid?(binfo[:freq])
|
280
281
|
|
282
|
+
raise 'No marketplace defined' unless valid?(binfo[:market])
|
283
|
+
|
281
284
|
return if Time.now.to_i - binfo[:last].to_i < binfo[:freq].to_i
|
282
285
|
|
283
286
|
# --------------------------------------------------------------
|
@@ -319,19 +322,12 @@ module OpenNebula::VirtualMachineExt
|
|
319
322
|
# --------------------------------------------------------------
|
320
323
|
# Cleanup
|
321
324
|
# --------------------------------------------------------------
|
322
|
-
logger
|
323
|
-
|
324
|
-
tmp.delete(true)
|
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]
|
325
|
+
backup_cleanup(keep, logger, binfo, tmp)
|
333
326
|
rescue Error, StandardError => e
|
327
|
+
backup_cleanup(keep, logger, binfo, tmp)
|
328
|
+
|
334
329
|
logger.fatal(e.inspect) if logger
|
330
|
+
|
335
331
|
raise
|
336
332
|
end
|
337
333
|
|
@@ -421,9 +417,9 @@ module OpenNebula::VirtualMachineExt
|
|
421
417
|
|
422
418
|
private
|
423
419
|
|
424
|
-
|
420
|
+
#-------------------------------------------------------------------
|
425
421
|
# Check an attribute is defined and valid
|
426
|
-
|
422
|
+
#-------------------------------------------------------------------
|
427
423
|
def valid?(att)
|
428
424
|
return false if att.nil?
|
429
425
|
|
@@ -454,6 +450,9 @@ module OpenNebula::VirtualMachineExt
|
|
454
450
|
binfo
|
455
451
|
end
|
456
452
|
|
453
|
+
#-------------------------------------------------------------------
|
454
|
+
# Generate backup information string
|
455
|
+
#-------------------------------------------------------------------
|
457
456
|
def backup_attr(binfo, ids)
|
458
457
|
'BACKUP=[' \
|
459
458
|
" MARKETPLACE_APP_IDS = \"#{ids.join(',')}\"," \
|
@@ -462,6 +461,25 @@ module OpenNebula::VirtualMachineExt
|
|
462
461
|
" MARKETPLACE_ID = \"#{binfo[:market]}\" ]"
|
463
462
|
end
|
464
463
|
|
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
|
+
|
465
483
|
end
|
466
484
|
end
|
467
485
|
|
data/lib/opennebula.rb
CHANGED
data/lib/scripts_common.rb
CHANGED
@@ -14,6 +14,8 @@
|
|
14
14
|
# limitations under the License. #
|
15
15
|
#--------------------------------------------------------------------------- #
|
16
16
|
|
17
|
+
require 'shellwords'
|
18
|
+
|
17
19
|
module OpenNebula
|
18
20
|
|
19
21
|
# Generic log function
|
@@ -76,6 +78,7 @@ module OpenNebula
|
|
76
78
|
# If a second parameter is present it is used as the error message when
|
77
79
|
# the command fails
|
78
80
|
def self.exec_and_log(command, message=nil, allowed_return_code=0)
|
81
|
+
command = command.shellsplit.shelljoin # escape
|
79
82
|
output=`#{command} 2>&1 1>/dev/null`
|
80
83
|
code=$?.exitstatus
|
81
84
|
|
data/lib/vcenter_driver.rb
CHANGED
@@ -36,14 +36,25 @@ end
|
|
36
36
|
|
37
37
|
ENV['LANG'] = 'C'
|
38
38
|
|
39
|
+
# %%RUBYGEMS_SETUP_BEGIN%%
|
39
40
|
if File.directory?(GEMS_LOCATION)
|
40
41
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
41
42
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
42
43
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
43
|
-
|
44
|
-
|
44
|
+
|
45
|
+
# Suppress warnings from Rubygems
|
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
|
45
55
|
end
|
46
56
|
end
|
57
|
+
# %%RUBYGEMS_SETUP_END%%
|
47
58
|
|
48
59
|
$LOAD_PATH << LIB_LOCATION + '/ruby/vendors/rbvmomi/lib'
|
49
60
|
$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/vi_helper.rb
CHANGED
@@ -231,10 +231,11 @@ module VCenterDriver
|
|
231
231
|
@ref_hash[attribute][refkey]
|
232
232
|
end
|
233
233
|
|
234
|
+
require 'addressable'
|
234
235
|
def self.find_image_by(att, the_class, path, ds_id, pool = nil)
|
235
236
|
pool = one_pool(the_class, false) if pool.nil?
|
236
237
|
pool.find do |e|
|
237
|
-
e[att] == path &&
|
238
|
+
e[att] == Addressable::URI.escape(path) &&
|
238
239
|
e['DATASTORE_ID'] == ds_id
|
239
240
|
end
|
240
241
|
end
|
data/lib/virtual_machine.rb
CHANGED
@@ -33,14 +33,27 @@ module VCenterDriver
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
# rubocop: disable all
|
37
|
+
# %%RUBYGEMS_SETUP_BEGIN%%
|
38
|
+
if File.directory?(GEMS_LOCATION)
|
39
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
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
|
40
48
|
require 'rubygems'
|
41
49
|
Gem.use_paths(real_gems_path)
|
50
|
+
ensure
|
51
|
+
$VERBOSE = verb
|
42
52
|
end
|
43
53
|
end
|
54
|
+
end
|
55
|
+
# %%RUBYGEMS_SETUP_END%%
|
56
|
+
# rubocop: enable all
|
44
57
|
|
45
58
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
46
59
|
|
@@ -1041,7 +1054,8 @@ module VCenterDriver
|
|
1041
1054
|
else
|
1042
1055
|
if snapshots?
|
1043
1056
|
error = 'Disk metadata not present and snapshots exist. ' \
|
1044
|
-
'
|
1057
|
+
'Please remove imported VM with "onevm recover ' \
|
1058
|
+
'--delete-db".'
|
1045
1059
|
raise error
|
1046
1060
|
end
|
1047
1061
|
|
@@ -2401,6 +2415,15 @@ module VCenterDriver
|
|
2401
2415
|
|
2402
2416
|
# Attach DISK to VM (hotplug)
|
2403
2417
|
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
|
+
|
2404
2427
|
spec_hash = {}
|
2405
2428
|
device_change = []
|
2406
2429
|
|
@@ -2582,6 +2605,12 @@ module VCenterDriver
|
|
2582
2605
|
def detach_disk(disk)
|
2583
2606
|
return unless disk.exists?
|
2584
2607
|
|
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
|
+
|
2585
2614
|
spec_hash = {}
|
2586
2615
|
spec_hash[:extraConfig] = [disk.config(:delete)]
|
2587
2616
|
spec_hash[:deviceChange] = [{
|
@@ -2611,15 +2640,15 @@ module VCenterDriver
|
|
2611
2640
|
# - The disk is managed by OpenNebula
|
2612
2641
|
detachable= !(one_vm['LCM_STATE'].to_i == 11 && !disk.managed?)
|
2613
2642
|
detachable &&= disk.exists?
|
2614
|
-
|
2643
|
+
|
2615
2644
|
return unless detachable
|
2616
2645
|
|
2617
2646
|
detach_disk(disk)
|
2618
2647
|
|
2619
2648
|
# Check if we want to keep the non persistent disk
|
2620
2649
|
keep_non_persistent_disks =
|
2621
|
-
VCenterDriver::CONFIG[:keep_non_persistent_disks]
|
2622
|
-
|
2650
|
+
VCenterDriver::CONFIG[:keep_non_persistent_disks]
|
2651
|
+
|
2623
2652
|
return if keep_non_persistent_disks == true
|
2624
2653
|
|
2625
2654
|
disk.destroy
|
@@ -2816,7 +2845,7 @@ module VCenterDriver
|
|
2816
2845
|
# Convert VM to template in vCenter
|
2817
2846
|
mark_as_template
|
2818
2847
|
|
2819
|
-
# Edit the
|
2848
|
+
# Edit the OpenNebula template
|
2820
2849
|
one_client = OpenNebula::Client.new
|
2821
2850
|
template_id = one_item['TEMPLATE/TEMPLATE_ID']
|
2822
2851
|
new_template = OpenNebula::Template.new_with_id(template_id,
|
@@ -2867,6 +2896,15 @@ module VCenterDriver
|
|
2867
2896
|
self['rootSnapshot'] && !self['rootSnapshot'].empty?
|
2868
2897
|
end
|
2869
2898
|
|
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
|
+
|
2870
2908
|
def instantiated_as_persistent?
|
2871
2909
|
begin
|
2872
2910
|
!one_item['TEMPLATE/CLONING_TEMPLATE_ID'].nil?
|
@@ -3032,7 +3070,7 @@ module VCenterDriver
|
|
3032
3070
|
# Create a snapshot for the VM
|
3033
3071
|
def create_snapshot(snap_id, snap_name)
|
3034
3072
|
memory_dumps = true
|
3035
|
-
memory_dumps = CONFIG[:memory_dumps]
|
3073
|
+
memory_dumps = CONFIG[:memory_dumps] unless CONFIG[:memory_dumps].nil?
|
3036
3074
|
|
3037
3075
|
snapshot_hash = {
|
3038
3076
|
:name => snap_id,
|
data/lib/vm_template.rb
CHANGED
@@ -1573,9 +1573,8 @@ module VCenterDriver
|
|
1573
1573
|
str << "]\n"
|
1574
1574
|
|
1575
1575
|
if annotation.nil? || annotation.empty?
|
1576
|
-
str << 'DESCRIPTION = "vCenter Template \
|
1577
|
-
|
1578
|
-
" from Cluster #{ccr_name}\"\n"
|
1576
|
+
str << 'DESCRIPTION = "vCenter Template imported by OpenNebula'\
|
1577
|
+
" from Cluster #{ccr_name}\"\n"
|
1579
1578
|
else
|
1580
1579
|
notes = annotation.gsub('\\', '\\\\').gsub('"', '\\"')
|
1581
1580
|
str << "DESCRIPTION = \"#{notes}\"\n"
|
@@ -1659,10 +1658,12 @@ module VCenterDriver
|
|
1659
1658
|
folders = []
|
1660
1659
|
until item.instance_of? RbVmomi::VIM::Datacenter
|
1661
1660
|
item = item.parent
|
1662
|
-
first_condition =
|
1663
|
-
|
1661
|
+
first_condition =
|
1662
|
+
!(item.instance_of? RbVmomi::VIM::Datacenter)
|
1663
|
+
second_condition =
|
1664
|
+
item.name != 'vm'
|
1664
1665
|
|
1665
|
-
|
1666
|
+
if first_condition && second_condition
|
1666
1667
|
folders << item.name
|
1667
1668
|
end
|
1668
1669
|
if item.nil?
|
@@ -1693,8 +1694,8 @@ module VCenterDriver
|
|
1693
1694
|
one_tmp[:dc_name] = dc_name
|
1694
1695
|
one_tmp[:template_name] = template_name
|
1695
1696
|
one_tmp[:sunstone_template_name]=
|
1696
|
-
"#{template_name} [ Cluster: #{template_ccr_name} \
|
1697
|
-
- Template location: #{location} ]"
|
1697
|
+
"#{template_name} [ Cluster: #{template_ccr_name}" \
|
1698
|
+
" - Template location: #{location} ]"
|
1698
1699
|
one_tmp[:template_location] = location
|
1699
1700
|
one_tmp[:vcenter_ccr_ref] = template_ccr_ref
|
1700
1701
|
one_tmp[:vcenter_ref] = template_ref
|
data/lib/vmm_importer.rb
CHANGED
@@ -54,6 +54,14 @@ 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
|
+
|
57
65
|
vname = vc_vm['name']
|
58
66
|
|
59
67
|
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:
|
4
|
+
version: 6.0.0.3
|
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-11-29 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
|
123
120
|
- lib/memoize.rb
|
124
121
|
- lib/network.rb
|
125
122
|
- lib/rest_client.rb
|
126
|
-
- lib/vcenter_importer.rb
|
127
123
|
- lib/vi_client.rb
|
128
124
|
- lib/vi_helper.rb
|
129
|
-
- lib/virtual_machine.rb
|
130
125
|
- lib/vm_device.rb
|
131
126
|
- lib/vm_disk.rb
|
132
127
|
- lib/vm_nic.rb
|
133
128
|
- lib/vm_helper.rb
|
134
129
|
- lib/vm_monitor.rb
|
135
130
|
- lib/vm_folder.rb
|
136
|
-
- lib/vm_template.rb
|
137
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
|
+
- lib/vm_template.rb
|
138
138
|
- lib/nsx_driver.rb
|
139
139
|
- lib/distributed_firewall.rb
|
140
140
|
- lib/logical_port.rb
|
@@ -189,13 +189,11 @@ 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
|
193
192
|
- lib/opennebula/marketplace_pool.rb
|
194
193
|
- lib/opennebula/marketplaceapp.rb
|
195
194
|
- lib/opennebula/marketplaceapp_ext.rb
|
196
195
|
- lib/opennebula/marketplaceapp_pool.rb
|
197
196
|
- lib/opennebula/oneflow_client.rb
|
198
|
-
- lib/opennebula/pool.rb
|
199
197
|
- lib/opennebula/pool_element.rb
|
200
198
|
- lib/opennebula/security_group.rb
|
201
199
|
- lib/opennebula/security_group_pool.rb
|
@@ -203,14 +201,11 @@ files:
|
|
203
201
|
- lib/opennebula/template.rb
|
204
202
|
- lib/opennebula/template_ext.rb
|
205
203
|
- lib/opennebula/template_pool.rb
|
206
|
-
- lib/opennebula/user.rb
|
207
204
|
- lib/opennebula/user_pool.rb
|
208
205
|
- lib/opennebula/utils.rb
|
209
206
|
- lib/opennebula/vdc.rb
|
210
207
|
- lib/opennebula/vdc_pool.rb
|
211
|
-
- lib/opennebula/virtual_machine.rb
|
212
208
|
- lib/opennebula/virtual_machine_ext.rb
|
213
|
-
- lib/opennebula/virtual_machine_pool.rb
|
214
209
|
- lib/opennebula/virtual_network.rb
|
215
210
|
- lib/opennebula/virtual_network_pool.rb
|
216
211
|
- lib/opennebula/virtual_router.rb
|
@@ -219,20 +214,25 @@ files:
|
|
219
214
|
- lib/opennebula/vm_group_pool.rb
|
220
215
|
- lib/opennebula/vntemplate.rb
|
221
216
|
- lib/opennebula/vntemplate_pool.rb
|
222
|
-
- lib/opennebula/wait_ext.rb
|
223
217
|
- lib/opennebula/xml_element.rb
|
224
218
|
- lib/opennebula/xml_pool.rb
|
225
219
|
- lib/opennebula/xml_utils.rb
|
226
|
-
- lib/opennebula/zone.rb
|
227
220
|
- 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
|
+
- 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
|
231
230
|
- lib/opennebula/flow/service_template_ext.rb
|
232
231
|
- lib/opennebula/flow/service_template_pool.rb
|
233
232
|
- lib/opennebula/flow/validator.rb
|
234
|
-
- lib/opennebula/
|
233
|
+
- lib/opennebula/flow/service_template.rb
|
235
234
|
- lib/opennebula/ldap_auth_spec.rb
|
235
|
+
- lib/opennebula/ldap_auth.rb
|
236
236
|
- lib/opennebula/server_cipher_auth.rb
|
237
237
|
- lib/opennebula/server_x509_auth.rb
|
238
238
|
- lib/opennebula/ssh_auth.rb
|
@@ -255,9 +255,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
255
255
|
version: '0'
|
256
256
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
257
257
|
requirements:
|
258
|
-
- - '
|
258
|
+
- - '>='
|
259
259
|
- !ruby/object:Gem::Version
|
260
|
-
version:
|
260
|
+
version: '0'
|
261
261
|
requirements: []
|
262
262
|
rubyforge_project:
|
263
263
|
rubygems_version: 2.0.14.1
|