Skip to content

Commit 025b654

Browse files
authored
server: use network details from nic network (#4772)
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent 7a9d43e commit 025b654

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

server/src/main/java/com/cloud/api/ApiResponseHelper.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3922,7 +3922,6 @@ public NicResponse createNicResponse(Nic result) {
39223922
NicResponse response = new NicResponse();
39233923
NetworkVO network = _entityMgr.findById(NetworkVO.class, result.getNetworkId());
39243924
VMInstanceVO vm = _entityMgr.findById(VMInstanceVO.class, result.getInstanceId());
3925-
UserVmJoinVO userVm = _entityMgr.findById(UserVmJoinVO.class, result.getInstanceId());
39263925
List<NicExtraDhcpOptionVO> nicExtraDhcpOptionVOs = _nicExtraDhcpOptionDao.listByNicId(result.getId());
39273926

39283927
// The numbered comments are to keep track of the data returned from here and UserVmJoinDaoImpl.setUserVmResponse()
@@ -3936,15 +3935,13 @@ public NicResponse createNicResponse(Nic result) {
39363935
response.setVmId(vm.getUuid());
39373936
}
39383937

3939-
if (userVm != null){
3940-
if (userVm.getTrafficType() != null) {
3941-
/*4: trafficType*/
3942-
response.setTrafficType(userVm.getTrafficType().toString());
3943-
}
3944-
if (userVm.getGuestType() != null) {
3945-
/*5: guestType*/
3946-
response.setType(userVm.getGuestType().toString());
3947-
}
3938+
if (network.getTrafficType() != null) {
3939+
/*4: trafficType*/
3940+
response.setTrafficType(network.getTrafficType().toString());
3941+
}
3942+
if (network.getGuestType() != null) {
3943+
/*5: guestType*/
3944+
response.setType(network.getGuestType().toString());
39483945
}
39493946
/*6: ipAddress*/
39503947
response.setIpaddress(result.getIPv4Address());
@@ -3953,9 +3950,7 @@ public NicResponse createNicResponse(Nic result) {
39533950
/*8: netmask*/
39543951
response.setNetmask(result.getIPv4Netmask());
39553952
/*9: networkName*/
3956-
if(userVm != null && userVm.getNetworkName() != null) {
3957-
response.setNetworkName(userVm.getNetworkName());
3958-
}
3953+
response.setNetworkName(network.getName());
39593954
/*10: macAddress*/
39603955
response.setMacAddress(result.getMacAddress());
39613956
/*11: IPv6Address*/

0 commit comments

Comments
 (0)