server: use network details from nic network (#4772)

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
Abhishek Kumar 2021-03-11 13:06:44 +05:30 committed by GitHub
parent 7a9d43e959
commit 025b654b5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3922,7 +3922,6 @@ public class ApiResponseHelper implements ResponseGenerator {
NicResponse response = new NicResponse(); NicResponse response = new NicResponse();
NetworkVO network = _entityMgr.findById(NetworkVO.class, result.getNetworkId()); NetworkVO network = _entityMgr.findById(NetworkVO.class, result.getNetworkId());
VMInstanceVO vm = _entityMgr.findById(VMInstanceVO.class, result.getInstanceId()); VMInstanceVO vm = _entityMgr.findById(VMInstanceVO.class, result.getInstanceId());
UserVmJoinVO userVm = _entityMgr.findById(UserVmJoinVO.class, result.getInstanceId());
List<NicExtraDhcpOptionVO> nicExtraDhcpOptionVOs = _nicExtraDhcpOptionDao.listByNicId(result.getId()); List<NicExtraDhcpOptionVO> nicExtraDhcpOptionVOs = _nicExtraDhcpOptionDao.listByNicId(result.getId());
// The numbered comments are to keep track of the data returned from here and UserVmJoinDaoImpl.setUserVmResponse() // The numbered comments are to keep track of the data returned from here and UserVmJoinDaoImpl.setUserVmResponse()
@ -3936,15 +3935,13 @@ public class ApiResponseHelper implements ResponseGenerator {
response.setVmId(vm.getUuid()); response.setVmId(vm.getUuid());
} }
if (userVm != null){ if (network.getTrafficType() != null) {
if (userVm.getTrafficType() != null) { /*4: trafficType*/
/*4: trafficType*/ response.setTrafficType(network.getTrafficType().toString());
response.setTrafficType(userVm.getTrafficType().toString()); }
} if (network.getGuestType() != null) {
if (userVm.getGuestType() != null) { /*5: guestType*/
/*5: guestType*/ response.setType(network.getGuestType().toString());
response.setType(userVm.getGuestType().toString());
}
} }
/*6: ipAddress*/ /*6: ipAddress*/
response.setIpaddress(result.getIPv4Address()); response.setIpaddress(result.getIPv4Address());
@ -3953,9 +3950,7 @@ public class ApiResponseHelper implements ResponseGenerator {
/*8: netmask*/ /*8: netmask*/
response.setNetmask(result.getIPv4Netmask()); response.setNetmask(result.getIPv4Netmask());
/*9: networkName*/ /*9: networkName*/
if(userVm != null && userVm.getNetworkName() != null) { response.setNetworkName(network.getName());
response.setNetworkName(userVm.getNetworkName());
}
/*10: macAddress*/ /*10: macAddress*/
response.setMacAddress(result.getMacAddress()); response.setMacAddress(result.getMacAddress());
/*11: IPv6Address*/ /*11: IPv6Address*/