Repository: cloudstack Updated Branches: refs/heads/4.4-forward 62cc238e1 -> e9f60ee29
CLOUDSTACK-6899: Added vmId in listnics response Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e9f60ee2 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e9f60ee2 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e9f60ee2 Branch: refs/heads/4.4-forward Commit: e9f60ee292109633ae538694107f3450693716d2 Parents: 62cc238 Author: Jayapal <[email protected]> Authored: Thu Jun 12 16:50:17 2014 +0530 Committer: Jayapal <[email protected]> Committed: Thu Jun 12 17:16:02 2014 +0530 ---------------------------------------------------------------------- api/src/org/apache/cloudstack/api/response/NicResponse.java | 8 ++++++++ server/src/com/cloud/api/ApiResponseHelper.java | 6 ++++++ 2 files changed, 14 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e9f60ee2/api/src/org/apache/cloudstack/api/response/NicResponse.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/response/NicResponse.java b/api/src/org/apache/cloudstack/api/response/NicResponse.java index 3dd8b29..2f79d7f 100644 --- a/api/src/org/apache/cloudstack/api/response/NicResponse.java +++ b/api/src/org/apache/cloudstack/api/response/NicResponse.java @@ -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; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e9f60ee2/server/src/com/cloud/api/ApiResponseHelper.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index a47f62d..c4d5ae6 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -3573,9 +3573,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()) {
