Revision 929f01eb

View differences:

src/onedb/vcenter_one54_pre.rb
2156 2156

  
2157 2157
            # Get OpenNebulas's template
2158 2158
            one_template = OpenNebula::Template.new_with_id(template["ID"], one_client)
2159

  
2159 2160
            STDOUT.puts
2160 2161

  
2161 2162
            if !template_ref
......
2249 2250
            dc_ref  = dc._ref
2250 2251
            vcenter_name = vi_client.host
2251 2252
            STDOUT.puts "--- Discovering disks and network interfaces inside the template (please be patient)"
2252
            unmanaged = template_unmanaged_discover(vc_template["config.hardware.device"],
2253

  
2254
            devices = vc_template["config.hardware.device"]
2255

  
2256
            has_spaces = false
2257
            devices.each do |device|
2258
                if !(device.class.ancestors.index(RbVmomi::VIM::VirtualDisk)).nil?
2259
                    image_path = device.backing.fileName.sub(/^\[(.*?)\] /, "")
2260
                    if image_path.include?(" ")
2261
                        has_spaces = true
2262
                        break
2263
                    end
2264
                end
2265
            end
2266

  
2267
            if has_spaces
2268
                STDOUT.puts
2269
                STDOUT.puts("\n\e[93mWARNING: Manual intervention required!\e[39m")
2270
                STDOUT.puts "Template #{one_template["ID"]}: '#{one_template["NAME"]}' is not compatible."
2271
                STDOUT.puts
2272
                STDOUT.puts "Images in this template contain spaces, which is not supported."
2273
                STDOUT.puts "You need to remove the spaces from the paths and import it again"
2274
                STDOUT.puts "in OpenNebula 5.4."
2275
                STDOUT.puts
2276
                STDOUT.puts "Press 'y' to delete the template from OpenNebula."
2277
                STDOUT.puts "Alternatively press 'q' to quit the premigrator"
2278
                STDOUT.puts "in order to fix the path before running the premigrator again."
2279
                STDOUT.puts "(y/q)"
2280
                STDOUT.puts
2281

  
2282
                loop do
2283
                    option = STDIN.gets.strip
2284
                    case option
2285
                    when "y"
2286
                        rc = one_template.delete
2287
                        raise "Template #{one_template["ID"]}: '#{one_template["NAME"]}' could not be deleted. Reason #{rc.message}" if OpenNebula.is_error?(rc)
2288
                        break
2289
                    when "q"
2290
                        exit 0
2291
                    end
2292
                end
2293
                next
2294
            end
2295

  
2296
            unmanaged = template_unmanaged_discover(devices,
2253 2297
                                                    template_cluster,
2254 2298
                                                    ccr_ref,
2255 2299
                                                    vcenter_name,
......
2425 2469
                STDOUT.puts "VM \e[96m#{vm_name}\e[39m could not be migrated, \e[91mcannot find this VM in objects retrieved\e[39m,\n"\
2426 2470
                            "maybe it was deleted in vCenter but not in OpenNebula?"
2427 2471
                STDOUT.puts
2472
                STDOUT.puts "Press any key to continue."
2473
                STDIN.gets
2474
                STDOUT.puts
2428 2475
                STDOUT.puts "-" * 80
2429 2476
                STDOUT.puts
2430 2477
                next
......
2505 2552
                    end
2506 2553
                end
2507 2554

  
2508
                # Try to get moref using the templates uuid note that that uuid
2555
                # Try to get moref using the templates uuid. Note that that uuid
2509 2556
                # is not unique
2510 2557
                templates_same_uuid = {}
2511 2558
                if !template_ref && template_uuid
......
2568 2615
                    STDOUT.puts("#{template_refs.size+1}: None of the above.")
2569 2616

  
2570 2617
                    loop do
2571
                        STDOUT.print("\nFrom the list above, please \e[95mpick up one number\e[39m in order to specify the venter template that this VM was based on: ")
2618
                        STDOUT.print("\nFrom the list above, please \e[95mpick a number\e[39m in order to specify the venter template that this VM was based on: ")
2572 2619
                        template_index = STDIN.gets.strip.to_i
2573 2620
                        next if template_index == 0 || template_index - 1 < 0 || template_index > template_refs.size + 1
2574 2621
                        template_ref  = template_refs[template_index-1] rescue nil
......
2581 2628
                STDOUT.puts
2582 2629
            end
2583 2630

  
2631
            if !template_ref
2632
                # This VM doesn't have an associated template any more. Let's
2633
                # treat it as a wild VM
2634
                vm_wild = true
2635
                template_ref = vm_ref
2636
            end
2637

  
2584 2638
            # Get VM's datacenter name
2585 2639
            dc = get_dc(vc_vmachine_object)
2586 2640
            dc_name = dc.name

Also available in: Unified diff