cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From muralire...@apache.org
Subject git commit: updated refs/heads/master to 899e9f0
Date Thu, 21 Nov 2013 09:50:36 GMT
Updated Branches:
  refs/heads/master 8c6840e48 -> 899e9f0d6


CS-16962: [API] [EIP/ELB enabled Zone] Need to display EIP address as
"Public IP Address" for system VMs

In system VM response object return EIP as public IP in case of basic
zone with EIP service.

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


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/899e9f0d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/899e9f0d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/899e9f0d

Branch: refs/heads/master
Commit: 899e9f0d6014f1e67788fa9fcb0bc8d3f639bd98
Parents: 8c6840e
Author: Murali Reddy <murali.reddy@citrix.com>
Authored: Tue Dec 4 14:56:58 2012 +0530
Committer: Murali Reddy <muralimmreddy@gmail.com>
Committed: Thu Nov 21 15:20:28 2013 +0530

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiResponseHelper.java | 21 ++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/899e9f0d/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 b74ebf1..98feb29 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -1186,12 +1186,29 @@ public class ApiResponseHelper implements ResponseGenerator {
                         vmResponse.setLinkLocalIp(singleNicProfile.getIp4Address());
                         vmResponse.setLinkLocalMacAddress(singleNicProfile.getMacAddress());
                         vmResponse.setLinkLocalNetmask(singleNicProfile.getNetmask());
-                    } else if (network.getTrafficType() == TrafficType.Public || network.getTrafficType()
== TrafficType.Guest) {
-                        /*In basic zone, public ip has TrafficType.Guest*/
+                    } else if (network.getTrafficType() == TrafficType.Public) {
                         vmResponse.setPublicIp(singleNicProfile.getIp4Address());
                         vmResponse.setPublicMacAddress(singleNicProfile.getMacAddress());
                         vmResponse.setPublicNetmask(singleNicProfile.getNetmask());
                         vmResponse.setGateway(singleNicProfile.getGateway());
+                    } else if (network.getTrafficType() == TrafficType.Guest) {
+                        /*
+                          * In basic zone, public ip has TrafficType.Guest in case EIP service
is not enabled.
+                          * When EIP service is enabled in the basic zone, system VM by default
get the public
+                          * IP allocated for EIP. So return the guest/public IP accordingly.
+                          * */
+                        NetworkOffering networkOffering = ApiDBUtils.findNetworkOfferingById(network.getNetworkOfferingId());
+                        if (networkOffering.getElasticIp()) {
+                            IpAddress ip = ApiDBUtils.findIpByAssociatedVmId(vm.getId());
+                            if (ip != null) {
+                                vmResponse.setPublicIp(ip.getAddress().addr());
+                            }
+                        } else {
+                            vmResponse.setPublicIp(singleNicProfile.getIp4Address());
+                            vmResponse.setPublicMacAddress(singleNicProfile.getMacAddress());
+                            vmResponse.setPublicNetmask(singleNicProfile.getNetmask());
+                            vmResponse.setGateway(singleNicProfile.getGateway());
+                        }
                     }
                 }
             }


Mime
View raw message