CLOUDSTACK-6899: Added vmId in listnics response

This commit is contained in:
Jayapal 2014-06-12 16:50:17 +05:30
parent 93c75c73a4
commit 923c0cd89f
2 changed files with 14 additions and 0 deletions

View File

@ -98,6 +98,14 @@ public class NicResponse extends BaseResponse {
@Param(description = "device id for the network when plugged into the virtual machine", since = "4.4")
private String deviceId;
@SerializedName(ApiConstants.VIRTUAL_MACHINE_ID)
@Param(description = "Id of the vm to which the nic belongs")
private String vmId;
public void setVmId(String vmId) {
this.vmId = vmId;
}
public String getId() {
return id;
}

View File

@ -3302,9 +3302,15 @@ public class ApiResponseHelper implements ResponseGenerator {
public NicResponse createNicResponse(Nic result) {
NicResponse response = new NicResponse();
NetworkVO network = _entityMgr.findById(NetworkVO.class, result.getNetworkId());
VMInstanceVO vm = _entityMgr.findById(VMInstanceVO.class, result.getInstanceId());
response.setId(result.getUuid());
response.setNetworkid(network.getUuid());
if (vm != null) {
response.setVmId(vm.getUuid());
}
response.setIpaddress(result.getIp4Address());
if (result.getSecondaryIp()) {