Repository: cloudstack Updated Branches: refs/heads/master 93c75c73a -> 923c0cd89
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/923c0cd8 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/923c0cd8 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/923c0cd8 Branch: refs/heads/master Commit: 923c0cd89f9ba35a1cdbc1c4502a04620e9eff79 Parents: 93c75c7 Author: Jayapal <[email protected]> Authored: Thu Jun 12 16:50:17 2014 +0530 Committer: Jayapal <[email protected]> Committed: Thu Jun 12 17:18:08 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/923c0cd8/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/923c0cd8/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 682b617..f1f0d2c 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -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()) {
