Revision a39d1529

View differences:

src/sunstone/routes/vcenter.rb
379 379
            error 404, error.to_json
380 380
        end
381 381

  
382
        # clean vcenterDriver cache
383
        VCenterDriver::VIHelper.clean_ref_hash("TEMPLATE/VCENTER_CCR_REF")
382 384
        networks = dc_folder.get_unimported_networks(npool,vcenter_client.vim.host,hpool)
383 385

  
384 386
        if networks.nil?
......
453 455
            error 404, error.to_json
454 456
        end
455 457

  
458
        # clean vcenterDriver cache
459
        VCenterDriver::VIHelper.clean_ref_hash("TEMPLATE/VCENTER_CCR_REF")
456 460
        datastores = dc_folder.get_unimported_datastores(dpool, vcenter_client.vim.host, hpool)
457 461
        if datastores.nil?
458 462
            msg = "No datacenter found"
src/vmm_mad/remotes/lib/vcenter_driver/importer.rb
644 644
                                 "      - Cluster               : \e[96m#{n[:cluster]}\e[39m\n"\
645 645
                                 "      - Cluster location      : #{n[:cluster_location]}\n"\
646 646
                                 "      - OpenNebula Cluster ID : #{n[:one_cluster_id]}\n"
647
                    print_str << "    Import this Network (y/[n])? "
647

  
648
                    if n[:one_cluster_id] == -1
649
                        print_str << "You need to import the associated vcenter cluster as one host first!"
650
                    else
651
                        print_str << "    Import this Network (y/[n])? "
652
                    end
648 653

  
649 654
                    STDOUT.print print_str
650 655

  
651
                    next if STDIN.gets.strip.downcase != 'y'
656
                    next if STDIN.gets.strip.downcase != 'y' || n[:one_cluster_id] == -1
652 657
                end
653 658

  
654 659
                # we try to retrieve once we know the desired net
......
845 850

  
846 851
            tmps.each{ |d|
847 852
                if !use_defaults
848
                    STDOUT.print "\n  * Datastore found:\n"\
853
                    datastore_str = "\n  * Datastore found:\n"\
849 854
                                    "      - Name                  : \e[92m#{d[:simple_name]}\e[39m\n"\
850 855
                                    "      - Total MB              : #{d[:total_mb]}\n"\
851 856
                                    "      - Free  MB              : #{d[:free_mb]}\n"\
852
                                    "      - OpenNebula Cluster IDs: #{d[:cluster].join(',')}\n"\
853
                                    "   Import this datastore [y/n]? "
857
                                    "      - OpenNebula Cluster IDs: #{d[:cluster].join(',')}\n"
858
                    if d[:cluster].empty?
859
                        datastore_str << "You need to import the associated vcenter cluster as one host first!"
860
                    else
861
                        datastore_str << "   Import this datastore [y/n]? "
862
                    end
863
                    STDOUT.print datastore_str
864

  
865
                    next if STDIN.gets.strip.downcase != 'y' || d[:cluster].empty?
854 866

  
855
                    next if STDIN.gets.strip.downcase != 'y'
856 867

  
857 868
                    STDOUT.print "\n    NOTE: For each vCenter datastore a SYSTEM and IMAGE datastore\n"\
858 869
                                 "    will be created in OpenNebula except for a StorageDRS which is \n"\
src/vmm_mad/remotes/lib/vcenter_driver/vi_helper.rb
75 75
        if attr.nil?
76 76
            @ref_hash = {}
77 77
        else
78
            @ref_hash[attr] = {}
78
            @ref_hash[attr] = {} unless @ref_hash.nil?
79 79
        end
80 80
    end
81 81

  

Also available in: Unified diff