Revision 42e84185 src/vmm_mad/remotes/lib/vcenter_driver/importer.rb

View differences:

src/vmm_mad/remotes/lib/vcenter_driver/importer.rb
666 666
            end
667 667

  
668 668
            tmps.each{ |d|
669
                one_cluster_id = nil
670 669
                if !use_defaults
671 670
                    STDOUT.print "\n  * Datastore found:\n"\
672 671
                                    "      - Name      : #{d[:name]}\n"\
......
676 675
                                    "    Import this as Datastore [y/n]? "
677 676

  
678 677
                    next if STDIN.gets.strip.downcase != 'y'
679
                end
680 678

  
681
                one_d = VCenterDriver::VIHelper.new_one_item(OpenNebula::Datastore)
679
                    STDOUT.print "\n    NOTE: For each vcenter datastore a SYSTEM and IMAGE datastore\n"\
680
                                 "    will be created in OpenNebula except for a StorageDRS which is \n"\
681
                                 "    represented as a SYSTEM datastore only.\n"
682 682

  
683
                if one_cluster_id
684
                    rc = one_d.allocate(d[:one], one_cluster_id.to_i)
685
                else
686
                    rc = one_d.allocate(d[:one])
687 683
                end
688 684

  
689
                if ::OpenNebula.is_error?(rc)
690
                    STDOUT.puts "    \nError creating datastore: #{rc.message}\n"\
691
                                "    One datastore can exist only once, and "\
692
                                "can be used in any vCenter Cluster that "\
693
                                "has access to it. Also, no spaces allowed "\
694
                                "in datastore name (rename it in vCenter "\
695
                                "and try again)"
696
                else
697
                    STDOUT.puts "    \nOpenNebula datastore #{one_d.id} created!\n"
685
                ds_allocate_error = false
686
                d[:ds].each do |ds|
687
                    one_d = VCenterDriver::VIHelper.new_one_item(OpenNebula::Datastore)
688
                    rc = one_d.allocate(ds[:one])
689
                    if ::OpenNebula.is_error?(rc)
690
                        STDOUT.puts "    \n    Error creating datastore: #{rc.message}"
691
                        ds_allocate_error = true
692
                    else
693
                        STDOUT.puts "    \n    OpenNebula datastore #{one_d.id} created!\n"
694
                    end
698 695
                end
699 696
            }
700 697
        }

Also available in: Unified diff