Revision d923ef36 src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb

View differences:

src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb
295 295
                        one_i.info
296 296
                        disk_info << "DISK=[\n"
297 297
                        disk_info << "IMAGE_ID=\"#{one_i["ID"]}\",\n"
298
                        disk_info << "IMAGE_UNAME=\"#{one_i["UNAME"]}\",\n"
299 298
                        disk_info << "OPENNEBULA_MANAGED=\"NO\"\n"
300 299
                        disk_info << "]\n"
301 300
                    end
......
344 343
            # Track allocated networks for rollback
345 344
            allocated_networks = []
346 345

  
346
            # Track port groups duplicated in this VM
347
            duplicated_networks = []
348

  
347 349
            vc_nics.each do |nic|
348 350
                # Check if the network already exists
349 351
                network_found = VCenterDriver::Network.get_unmanaged_vnet_by_ref(nic[:net_ref],
......
423 425
                    one_vnet[:one] << ar_str
424 426

  
425 427
                    if sunstone
426
                        sunstone_nic = {}
427
                        sunstone_nic[:type] = "NEW_NIC"
428
                        sunstone_nic[:network_tmpl] = one_vnet[:one]
429
                        sunstone_nic[:one_cluster_id] = cluster_id.to_i
430
                        sunstone_nic_info << sunstone_nic
428
                        if !duplicated_networks.include?(nic[:net_name])
429
                            sunstone_nic = {}
430
                            sunstone_nic[:type] = "NEW_NIC"
431
                            sunstone_nic[:network_name] = nic[:net_name]
432
                            sunstone_nic[:network_tmpl] = one_vnet[:one]
433
                            sunstone_nic[:one_cluster_id] = cluster_id.to_i
434
                            sunstone_nic_info << sunstone_nic
435
                            duplicated_networks << nic[:net_name]
436
                        else
437
                            sunstone_nic = {}
438
                            sunstone_nic[:type] = "DUPLICATED_NIC"
439
                            sunstone_nic[:network_name] = nic[:net_name]
440
                            sunstone_nic_info << sunstone_nic
441
                        end
431 442
                    else
432 443
                        # Allocate the Virtual Network
433 444
                        allocated_networks << one_vn
......
444 455
                        nic_info << "NETWORK_ID=\"#{one_vn["ID"]}\",\n"
445 456
                        nic_info << "OPENNEBULA_MANAGED=\"NO\"\n"
446 457
                        nic_info << "]\n"
458

  
459
                        # Refresh npool
460
                        npool.info_all
447 461
                    end
448 462
                end
449 463
            end

Also available in: Unified diff