Skip to content

Commit f5e6136

Browse files
author
Sudhansu
committed
CLOUDSTACK-9630: Cannot use listNics API as advertised
added "type" details for listNics API response.
1 parent 5811d33 commit f5e6136

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3433,6 +3433,7 @@ public NicResponse createNicResponse(Nic result) {
34333433
NicResponse response = new NicResponse();
34343434
NetworkVO network = _entityMgr.findById(NetworkVO.class, result.getNetworkId());
34353435
VMInstanceVO vm = _entityMgr.findById(VMInstanceVO.class, result.getInstanceId());
3436+
UserVmJoinVO userVm = _entityMgr.findById(UserVmJoinVO.class, result.getInstanceId());
34363437

34373438
response.setId(result.getUuid());
34383439
response.setNetworkid(network.getUuid());
@@ -3441,6 +3442,14 @@ public NicResponse createNicResponse(Nic result) {
34413442
response.setVmId(vm.getUuid());
34423443
}
34433444

3445+
if (userVm != null){
3446+
if (userVm.getTrafficType() != null) {
3447+
response.setTrafficType(userVm.getTrafficType().toString());
3448+
}
3449+
if (userVm.getGuestType() != null) {
3450+
response.setType(userVm.getGuestType().toString());
3451+
}
3452+
}
34443453
response.setIpaddress(result.getIPv4Address());
34453454

34463455
if (result.getSecondaryIp()) {
@@ -3461,10 +3470,21 @@ public NicResponse createNicResponse(Nic result) {
34613470
response.setNetmask(result.getIPv4Netmask());
34623471
response.setMacAddress(result.getMacAddress());
34633472

3473+
if (result.getBroadcastUri() != null) {
3474+
response.setBroadcastUri(result.getBroadcastUri().toString());
3475+
}
3476+
if (result.getIsolationUri() != null) {
3477+
response.setIsolationUri(result.getIsolationUri().toString());
3478+
}
3479+
34643480
if (result.getIPv6Address() != null) {
34653481
response.setIp6Address(result.getIPv6Address());
34663482
}
34673483

3484+
if (result.getIPv6Cidr() != null) {
3485+
response.setIp6Cidr(result.getIPv6Cidr());
3486+
}
3487+
34683488
response.setDeviceId(String.valueOf(result.getDeviceId()));
34693489

34703490
response.setIsDefault(result.isDefaultNic());

0 commit comments

Comments
 (0)