@@ -698,8 +698,8 @@ private Pair<DiskProfile, StoragePool> importDisk(UnmanagedInstanceTO.Disk disk,
698698 return new Pair <DiskProfile , StoragePool >(profile , storagePool );
699699 }
700700
701- private NicProfile importNic (UnmanagedInstanceTO .Nic nic , VirtualMachine vm , Network network , Network .IpAddresses ipAddresses , boolean isDefaultNic , boolean forced ) throws InsufficientVirtualNetworkCapacityException , InsufficientAddressCapacityException {
702- Pair <NicProfile , Integer > result = networkOrchestrationService .importNic (nic .getMacAddress (), 0 , network , isDefaultNic , vm , ipAddresses , forced );
701+ private NicProfile importNic (UnmanagedInstanceTO .Nic nic , VirtualMachine vm , Network network , Network .IpAddresses ipAddresses , int deviceId , boolean isDefaultNic , boolean forced ) throws InsufficientVirtualNetworkCapacityException , InsufficientAddressCapacityException {
702+ Pair <NicProfile , Integer > result = networkOrchestrationService .importNic (nic .getMacAddress (), deviceId , network , isDefaultNic , vm , ipAddresses , forced );
703703 if (result == null ) {
704704 throw new ServerApiException (ApiErrorCode .INTERNAL_ERROR , String .format ("NIC ID: %s import failed" , nic .getNicId ()));
705705 }
@@ -1016,12 +1016,12 @@ private UserVm importVirtualMachineInternal(final UnmanagedInstanceTO unmanagedI
10161016 throw new ServerApiException (ApiErrorCode .INTERNAL_ERROR , String .format ("Failed to import volumes while importing vm: %s. %s" , instanceName , StringUtils .defaultString (e .getMessage ())));
10171017 }
10181018 try {
1019- boolean firstNic = true ;
1019+ int nicIndex = 0 ;
10201020 for (UnmanagedInstanceTO .Nic nic : unmanagedInstance .getNics ()) {
10211021 Network network = networkDao .findById (allNicNetworkMap .get (nic .getNicId ()));
10221022 Network .IpAddresses ipAddresses = nicIpAddressMap .get (nic .getNicId ());
1023- importNic (nic , userVm , network , ipAddresses , firstNic , forced );
1024- firstNic = false ;
1023+ importNic (nic , userVm , network , ipAddresses , nicIndex , nicIndex == 0 , forced );
1024+ nicIndex ++ ;
10251025 }
10261026 } catch (Exception e ) {
10271027 LOGGER .error (String .format ("Failed to import NICs while importing vm: %s" , instanceName ), e );
0 commit comments